server names load properly hooray

This commit is contained in:
Siepert123 2026-03-04 21:01:31 +01:00
parent 47e427e844
commit f652f1f5b0

View file

@ -736,12 +736,15 @@ void CPlatformNetworkManagerStub::SearchForGames()
#ifdef _WINDOWS64 //Should we have this windows64 only? idk i havent tested so... #ifdef _WINDOWS64 //Should we have this windows64 only? idk i havent tested so...
ifstream ServersTxt("servers.txt"); ifstream ServersTxt("servers.txt");
if (ServersTxt) { if (ServersTxt) {
string line; string line;
wstring wline; wstring wline;
int phase = 0; int phase = 0;
string ip; string ip;
wstring port; wstring port;
wstring name; wstring name;
while (getline(ServersTxt, line)) { while (getline(ServersTxt, line)) {
app.DebugPrintf("Read line %s in phase %i\n", line, phase); app.DebugPrintf("Read line %s in phase %i\n", line, phase);
wline = convStringToWstring(line); wline = convStringToWstring(line);
@ -761,7 +764,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
//Add server to the list! //Add server to the list!
FriendSessionInfo* info = new FriendSessionInfo(); FriendSessionInfo* info = new FriendSessionInfo();
wchar_t label[128]; wchar_t label[128];
swprintf(label, L"%S", name); wcsncpy_s(label, _countof(label), name.c_str(), _TRUNCATE);
size_t nameLen = wcslen(label); size_t nameLen = wcslen(label);
info->displayLabel = new wchar_t[nameLen+1]; info->displayLabel = new wchar_t[nameLen+1];
wcscpy_s(info->displayLabel, nameLen + 1, label); wcscpy_s(info->displayLabel, nameLen + 1, label);