From 90504b14794c912decbee51cb23cd966539cc354 Mon Sep 17 00:00:00 2001 From: Slenderman Date: Sun, 1 Mar 2026 13:38:11 -0500 Subject: fix various things --- .../Common/UI/UIScene_SkinSelectMenu.cpp | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 6910dd65..e40dc37a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1249,7 +1249,13 @@ void UIScene_SkinSelectMenu::updatePackDisplay() if(m_packIndex >= SKIN_SELECT_MAX_DEFAULTS) { DLCPack *thisPack = app.m_dlcManager.getPack(m_packIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setCentreLabel(thisPack->getName().c_str()); + // Fix the incorrect string type on title to display correctly + const char* name = (LPCSTR)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(thisPack->getName().c_str()); } else { @@ -1268,7 +1274,13 @@ void UIScene_SkinSelectMenu::updatePackDisplay() if(nextPackIndex >= SKIN_SELECT_MAX_DEFAULTS) { DLCPack *thisPack = app.m_dlcManager.getPack(nextPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setRightLabel(thisPack->getName().c_str()); + // Fix the incorrect string type on title to display correctly + const char* name = (LPCSTR)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(thisPack->getName().c_str()); } else { @@ -1287,7 +1299,13 @@ void UIScene_SkinSelectMenu::updatePackDisplay() if(previousPackIndex >= SKIN_SELECT_MAX_DEFAULTS) { DLCPack *thisPack = app.m_dlcManager.getPack(previousPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setLeftLabel(thisPack->getName().c_str()); + // Fix the incorrect string type on title to display correctly + const char* name = (LPCSTR)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(thisPack->getName().c_str()); } else { -- cgit v1.2.3 From 6080c4ceac7a0968db06deac0853209f69aba2ab Mon Sep 17 00:00:00 2001 From: Slenderman Date: Sun, 1 Mar 2026 14:12:39 -0500 Subject: use C++ style cast instead of C-style cast --- Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index e40dc37a..bce5e34e 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1250,7 +1250,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 = (LPCSTR)thisPack->getName().c_str(); + const char* name = static_cast(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); @@ -1275,7 +1275,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 = (LPCSTR)thisPack->getName().c_str(); + const char* name = static_cast(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); @@ -1300,7 +1300,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 = (LPCSTR)thisPack->getName().c_str(); + const char* name = static_cast(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); -- cgit v1.2.3 From a2bcce6426f6179ec8fbdda7086a16db2f69ae67 Mon Sep 17 00:00:00 2001 From: Slenderman Date: Sun, 1 Mar 2026 14:22:01 -0500 Subject: fix my cast and put it into a separate function --- .gitignore | 3 +++ .../Common/UI/UIScene_SkinSelectMenu.cpp | 27 ++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp') diff --git a/.gitignore b/.gitignore index 86c4ba55..788c5390 100644 --- a/.gitignore +++ b/.gitignore @@ -418,3 +418,6 @@ Minecraft.World/x64/ Minecraft.World/x64_Debug/ Minecraft.World/Debug/ Minecraft.World/Release/ +Minecraft.World/x64_Release/Minecraft.World.vcxproj.FileListAbsolute.txt +Minecraft.World/x64_Release/Minecraft.World.lib +Minecraft.World/x64_Release/Minecraft.World.lib.recipe 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(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(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(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(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 -- cgit v1.2.3