diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 7e8d6910..6b0d9b97 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -13,6 +13,9 @@ #include #endif +#include +#include + CPlatformNetworkManagerStub *g_pPlatformNetworkManager; @@ -910,14 +913,13 @@ void CPlatformNetworkManagerStub::SearchForGames() if (std::fread(&nameLen, sizeof(uint16_t), 1, file) != 1) break; if (nameLen > 256) break; - char nameBuf[257] = {}; - if (nameLen > 0) - { - if (std::fread(nameBuf, 1, nameLen, file) != nameLen) break; + wstring wName = L""; + for (int l = 0; l < nameLen; l++) { + uint16_t _char = 0; + if (std::fread(&_char, 1, 1, file) != 1) break; + wName += _char; } - wstring wName = convStringToWstring(nameBuf); - FriendSessionInfo* info = new FriendSessionInfo(); size_t nLen = wName.length(); info->displayLabel = new wchar_t[nLen + 1]; diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp index b38fa9ce..3ab3ba99 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp @@ -4675,7 +4675,7 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) m_buttonListGames.getItemCount() - 1, L"lceheadwer.png", L"lceheadwer"); - + RefreshServerListHtmlPatch(); #endif if (m_currentSessions == nullptr || m_currentSessions->empty()) @@ -4756,7 +4756,10 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) } } - m_buttonListGames.addItem(sessionInfo->displayLabel, modeIconName, tpIconName); + wstring htmlLabel = app.EscapeHTMLString(sessionInfo->displayLabel); + htmlLabel = app.FormatColoredString(htmlLabel); + + m_buttonListGames.addItem(htmlLabel, modeIconName, tpIconName); if (memcmp(&selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID)) == 0) @@ -4778,6 +4781,8 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) } + RefreshServerListHtmlPatch(); + if(syncFocus) m_buttonListGames.updateChildFocus(m_buttonListGames.getCurrentSelection()); @@ -9208,6 +9213,21 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b } +void UIScene_LoadCreateJoinMenu::RefreshServerListHtmlPatch() { + S32 arrayItems = 0; + IggyValueGetArrayLengthRS(m_buttonListGames.getIggyValuePath(), 0, "m_aItems", &arrayItems); + + IggyValuePath listPath; + IggyValuePathMakeNameRef(&listPath, m_buttonListGames.getIggyValuePath(), "m_aItems"); + + for (int i = 0; i < arrayItems; i++) { + IggyValuePath listItem; + IggyValuePathMakeArrayRef(&listItem, &listPath, i); + + IggyValueSetBooleanRS(&listItem, 0, "m_bUseHtmlText", true); + } +} + void UIScene_LoadCreateJoinMenu::AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name) diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h index dd12816e..721c298a 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h @@ -270,6 +270,8 @@ private: void BeginAddServer(); void AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name); static int AddServerKeyboardCallback(LPVOID lpParam, bool bRes); + + void RefreshServerListHtmlPatch(); #endif #if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__)