diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-02 02:24:29 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-02 02:24:29 +0700 |
| commit | d76650f33346e9fc31cd1f061c37b35dd22b9b9b (patch) | |
| tree | f76e545e7b8c9d7c79649a7522bb4064933ae8ca /Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp | |
| parent | 38b442b1e33726f011fd6a28824fb8e6e99ccb5a (diff) | |
| parent | a2bcce6426f6179ec8fbdda7086a16db2f69ae67 (diff) | |
Merge pull request #42 from simulpingus/main
fix my cast and put it into a separate function
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index bce5e34e..33f41994 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1242,6 +1242,15 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() updatePackDisplay(); } +std::wstring fakeWideToRealWide(const wchar_t* original) +{ + const char* name = reinterpret_cast<const char*>(original); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + std::wstring wName(len, 0); + MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); + return wName.c_str(); +} + void UIScene_SkinSelectMenu::updatePackDisplay() { m_currentPackCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; @@ -1250,11 +1259,7 @@ void UIScene_SkinSelectMenu::updatePackDisplay() { DLCPack *thisPack = app.m_dlcManager.getPack(m_packIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); // Fix the incorrect string type on title to display correctly - const char* name = static_cast<const char*>(thisPack->getName().c_str()); - int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); - std::wstring wName(len, 0); - MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); - setCentreLabel(wName.c_str()); + setCentreLabel(fakeWideToRealWide(thisPack->getName().c_str())); //setCentreLabel(thisPack->getName().c_str()); } else @@ -1275,11 +1280,7 @@ void UIScene_SkinSelectMenu::updatePackDisplay() { DLCPack *thisPack = app.m_dlcManager.getPack(nextPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); // Fix the incorrect string type on title to display correctly - const char* name = static_cast<const char*>(thisPack->getName().c_str()); - int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); - std::wstring wName(len, 0); - MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); - setRightLabel(wName.c_str()); + setRightLabel(fakeWideToRealWide(thisPack->getName().c_str())); //setRightLabel(thisPack->getName().c_str()); } else @@ -1300,11 +1301,7 @@ void UIScene_SkinSelectMenu::updatePackDisplay() { DLCPack *thisPack = app.m_dlcManager.getPack(previousPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); // Fix the incorrect string type on title to display correctly - const char* name = static_cast<const char*>(thisPack->getName().c_str()); - int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); - std::wstring wName(len, 0); - MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); - setLeftLabel(wName.c_str()); + setLeftLabel(fakeWideToRealWide(thisPack->getName().c_str())); //setLeftLabel(thisPack->getName().c_str()); } else |
