From 1ead072c458ad4f7ab3f222f92b945525d08ac3b Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:46:50 +1100 Subject: [PATCH 1/5] Add text input support: safe uint16_t* to wstring conversion Replace unsafe (wchar_t*)pchText casts with uint16_to_wstring() in all keyboard callbacks. The direct cast is incorrect on platforms where wchar_t is 4 bytes (Linux/macOS). New helpers in StringHelpers route through u16string for proper UTF-16 to wchar_t conversion. - Add uint16_len, uint16_to_u16string, uint16_to_wstring to StringHelpers - Fix casts in AnvilMenu, CreateWorldMenu, DebugCreateSchematic, DebugSetCamera, LaunchMoreOptionsMenu, SignEntryMenu - Truncate sign text to 15 chars in SignEntryMenu - Move m_bIgnoreInput reset after if-block in LaunchMoreOptionsMenu --- .../Platform/Common/UI/UIScene_AnvilMenu.cpp | 5 +++-- .../Common/UI/UIScene_CreateWorldMenu.cpp | 16 ++++++++-------- .../Common/UI/UIScene_DebugCreateSchematic.cpp | 2 +- .../Common/UI/UIScene_DebugSetCamera.cpp | 2 +- .../Common/UI/UIScene_LaunchMoreOptionsMenu.cpp | 8 +++++--- .../Platform/Common/UI/UIScene_SignEntryMenu.cpp | 6 ++++-- Minecraft.World/Util/StringHelpers.cpp | 13 +++++++++++++ Minecraft.World/Util/StringHelpers.h | 4 ++++ 8 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index 5b4692fe8..c00466165 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -4,6 +4,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h" #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.Client/Minecraft.h" +#include "../../Minecraft.World/Util/StringHelpers.h" #include "UIScene_AnvilMenu.h" UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData, @@ -300,8 +301,8 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); InputManager.GetText(pchText); - pClass->setEditNameValue((wchar_t*)pchText); - pClass->m_itemName = (wchar_t*)pchText; + pClass->setEditNameValue(uint16_to_wstring(pchText)); + pClass->m_itemName = uint16_to_wstring(pchText); pClass->updateItemName(); } return 0; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 43dbade82..76beb132a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -723,8 +723,8 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(void* lpParam, InputManager.GetText(pchText); if (pchText[0] != 0) { - pClass->m_editWorldName.setLabel((wchar_t*)pchText); - pClass->m_worldName = (wchar_t*)pchText; + pClass->m_editWorldName.setLabel(uint16_to_wstring(pchText)); + pClass->m_worldName = uint16_to_wstring(pchText); } pClass->m_buttonCreateWorld.setEnable(!pClass->m_worldName.empty()); @@ -901,9 +901,9 @@ IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); return; bool pccFriendsAllowed = true; bool bContentRestricted = false; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, - &pccFriendsAllowed); + GetAllowedPlayerCreatedContentFlags(ProfileManager.GetPrimaryPad(), + false, &pccAllowed, + &pccFriendsAllowed); #if defined(__PS3__) || defined(__PSVITA__) if (isOnlineGame && isSignedInLive) { ProfileManager.GetChatAndContentRestrictions( @@ -1346,9 +1346,9 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, - &pccFriendsAllowed); + GetAllowedPlayerCreatedContentFlags(ProfileManager.GetPrimaryPad(), + false, &pccAllowed, + &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (isOnlineGame && (noPrivileges || noUGC)) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp index 3e2d56504..00b175887 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -146,7 +146,7 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(void* lpParam, InputManager.GetText(pchText); if (pchText[0] != 0) { - std::wstring value = (wchar_t*)pchText; + std::wstring value = uint16_to_wstring(pchText); int iVal = 0; if (!value.empty()) iVal = _fromString(value); switch (pClass->m_keyboardCallbackControl) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp index af850cb67..1472864e3 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp @@ -124,7 +124,7 @@ int UIScene_DebugSetCamera::KeyboardCompleteCallback(void* lpParam, bool bRes) { InputManager.GetText(pchText); if (pchText[0] != 0) { - std::wstring value = (wchar_t*)pchText; + std::wstring value = uint16_to_wstring(pchText); double val = 0; if (!value.empty()) val = _fromString(value); switch (pClass->m_keyboardCallbackControl) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 448acff95..8a7e7efda 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -1,5 +1,6 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "UI.h" +#include "../../Minecraft.World/Util/StringHelpers.h" #include "UIScene_LaunchMoreOptionsMenu.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 @@ -589,7 +590,6 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(void* lpParam, bool bRes) { UIScene_LaunchMoreOptionsMenu* pClass = (UIScene_LaunchMoreOptionsMenu*)lpParam; - pClass->m_bIgnoreInput = false; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { #ifdef __PSVITA__ @@ -601,9 +601,10 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(void* lpParam, ZeroMemory(pchText, 128 * sizeof(uint16_t)); #endif InputManager.GetText(pchText); - pClass->m_editSeed.setLabel((wchar_t*)pchText); - pClass->m_params->seed = (wchar_t*)pchText; + pClass->m_editSeed.setLabel(uint16_to_wstring(pchText)); + pClass->m_params->seed = uint16_to_wstring(pchText); } + pClass->m_bIgnoreInput = false; return 0; } @@ -643,6 +644,7 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) { 0, 60, &UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback, this, C_4JInput::EKeyboardMode_Default); + KeyboardCompleteSeedCallback(this, true); #endif } break; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index ad927a1dc..70288fb1f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -1,5 +1,6 @@ #include "../../Minecraft.World/Platform/stdafx.h" #include "UI.h" +#include "../../Minecraft.World/Util/StringHelpers.h" #include "UIScene_SignEntryMenu.h" #include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" @@ -144,8 +145,9 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); InputManager.GetText(pchText); - pClass->m_textInputLines[pClass->m_iEditingLine].setLabel( - (wchar_t*)pchText); + std::wstring str = uint16_to_wstring(pchText); + str.resize(15); + pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(str); } return 0; } diff --git a/Minecraft.World/Util/StringHelpers.cpp b/Minecraft.World/Util/StringHelpers.cpp index 9f47f92b8..43cfb171a 100644 --- a/Minecraft.World/Util/StringHelpers.cpp +++ b/Minecraft.World/Util/StringHelpers.cpp @@ -36,6 +36,19 @@ bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b) { return out; } +size_t uint16_len(const uint16_t* str) { + return std::char_traits::length( + reinterpret_cast(str)); +} + +std::u16string uint16_to_u16string(const uint16_t* str) { + return std::u16string(reinterpret_cast(str), uint16_len(str)); +} + +std::wstring uint16_to_wstring(const uint16_t* str) { + return u16string_to_wstring(uint16_to_u16string(str)); +} + std::wstring convStringToWstring(const std::string& converting) { std::wstring converted(converting.length(), L' '); copy(converting.begin(), converting.end(), converted.begin()); diff --git a/Minecraft.World/Util/StringHelpers.h b/Minecraft.World/Util/StringHelpers.h index 871e46d87..4f41be369 100644 --- a/Minecraft.World/Util/StringHelpers.h +++ b/Minecraft.World/Util/StringHelpers.h @@ -29,6 +29,10 @@ T _fromHEXString(const std::wstring& s) { return t; } +size_t uint16_len(const uint16_t* str); +std::u16string uint16_to_u16string(const uint16_t* str); +std::wstring uint16_to_wstring(const uint16_t* str); + std::wstring convStringToWstring(const std::string& converting); std::wstring u16string_to_wstring(const std::u16string& converting); std::u16string wstring_to_u16string(const std::wstring& converting); From e89198f56cd96520f26c89b659a4b78facd9f503 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:38:50 +1100 Subject: [PATCH 2/5] fix: sign entry crash and remove blocking callback workaround - Initialize m_iEditingLine to 0 in SignEntryMenu constructor (was uninitialized, causing out-of-bounds array access) - Add bounds check on m_iEditingLine before array access in callback - Only truncate sign text if longer than 15 chars (avoid padding) - Remove manual KeyboardCompleteSeedCallback call in LaunchMoreOptionsMenu (no longer needed since RequestKeyboard now fires callbacks asynchronously from Tick) --- .../Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp | 1 - .../Platform/Common/UI/UIScene_SignEntryMenu.cpp | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 8a7e7efda..fdd814ab7 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -644,7 +644,6 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) { 0, 60, &UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback, this, C_4JInput::EKeyboardMode_Default); - KeyboardCompleteSeedCallback(this, true); #endif } break; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index 70288fb1f..ad79dc97a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -18,6 +18,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, SignEntryScreenInput* initData = (SignEntryScreenInput*)_initData; m_sign = initData->sign; + m_iEditingLine = 0; m_bConfirmed = false; m_bIgnoreInput = false; @@ -141,12 +142,12 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled UIScene_SignEntryMenu* pClass = (UIScene_SignEntryMenu*)lpParam; pClass->m_bIgnoreInput = false; - if (bRes) { + if (bRes && pClass->m_iEditingLine >= 0 && pClass->m_iEditingLine < 4) { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); InputManager.GetText(pchText); std::wstring str = uint16_to_wstring(pchText); - str.resize(15); + if (str.size() > 15) str.resize(15); pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(str); } return 0; From 95e0a14b363667f8b902e19aa5ec0a33a5fd4a0b Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 14:10:14 +1100 Subject: [PATCH 3/5] refactor: use convStringToWstring for text input instead of uint16 helpers GetText now returns UTF-8 directly so callers go through simdutf via convStringToWstring(). Remove dead uint16_to_wstring helpers. --- .../Platform/Common/UI/UIScene_AnvilMenu.cpp | 8 +++----- .../Platform/Common/UI/UIScene_CreateWorldMenu.cpp | 11 ++++------- .../Common/UI/UIScene_DebugCreateSchematic.cpp | 9 +++------ .../Platform/Common/UI/UIScene_DebugSetCamera.cpp | 9 +++------ .../Common/UI/UIScene_LaunchMoreOptionsMenu.cpp | 14 +++----------- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 7 ++----- .../Platform/Common/UI/UIScene_SignEntryMenu.cpp | 5 +---- Minecraft.World/Util/StringHelpers.cpp | 12 ------------ Minecraft.World/Util/StringHelpers.h | 3 --- 9 files changed, 19 insertions(+), 59 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index c00466165..f3296c5a9 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -298,11 +298,9 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) { pClass->setIgnoreInput(false); if (bRes) { - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t)); - InputManager.GetText(pchText); - pClass->setEditNameValue(uint16_to_wstring(pchText)); - pClass->m_itemName = uint16_to_wstring(pchText); + std::wstring str = convStringToWstring(InputManager.GetText()); + pClass->setEditNameValue(str); + pClass->m_itemName = std::move(str); pClass->updateItemName(); } return 0; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 76beb132a..4a3c44c61 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -718,13 +718,10 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(void* lpParam, pClass->m_bIgnoreInput = false; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t)); - InputManager.GetText(pchText); - - if (pchText[0] != 0) { - pClass->m_editWorldName.setLabel(uint16_to_wstring(pchText)); - pClass->m_worldName = uint16_to_wstring(pchText); + std::wstring str = convStringToWstring(InputManager.GetText()); + if (!str.empty()) { + pClass->m_editWorldName.setLabel(str); + pClass->m_worldName = std::move(str); } pClass->m_buttonCreateWorld.setEnable(!pClass->m_worldName.empty()); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp index 00b175887..6eb2c7bb4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -141,12 +141,9 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(void* lpParam, UIScene_DebugCreateSchematic* pClass = (UIScene_DebugCreateSchematic*)lpParam; - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t)); - InputManager.GetText(pchText); - - if (pchText[0] != 0) { - std::wstring value = uint16_to_wstring(pchText); + const char* text = InputManager.GetText(); + if (text[0] != '\0') { + std::wstring value = convStringToWstring(text); int iVal = 0; if (!value.empty()) iVal = _fromString(value); switch (pClass->m_keyboardCallbackControl) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp index 1472864e3..74787f726 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugSetCamera.cpp @@ -119,12 +119,9 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, int UIScene_DebugSetCamera::KeyboardCompleteCallback(void* lpParam, bool bRes) { UIScene_DebugSetCamera* pClass = (UIScene_DebugSetCamera*)lpParam; - uint16_t pchText[2048]; //[128]; - ZeroMemory(pchText, 2048 /*128*/ * sizeof(uint16_t)); - InputManager.GetText(pchText); - - if (pchText[0] != 0) { - std::wstring value = uint16_to_wstring(pchText); + const char* text = InputManager.GetText(); + if (text[0] != '\0') { + std::wstring value = convStringToWstring(text); double val = 0; if (!value.empty()) val = _fromString(value); switch (pClass->m_keyboardCallbackControl) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index fdd814ab7..3aa26be48 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -592,17 +592,9 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(void* lpParam, (UIScene_LaunchMoreOptionsMenu*)lpParam; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { -#ifdef __PSVITA__ - // CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH] - uint16_t pchText[2048]; - ZeroMemory(pchText, 2048 * sizeof(uint16_t)); -#else - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t)); -#endif - InputManager.GetText(pchText); - pClass->m_editSeed.setLabel(uint16_to_wstring(pchText)); - pClass->m_params->seed = uint16_to_wstring(pchText); + std::wstring str = convStringToWstring(InputManager.GetText()); + pClass->m_editSeed.setLabel(str); + pClass->m_params->seed = std::move(str); } pClass->m_bIgnoreInput = false; return 0; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 31e09f0fb..73a87a38d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1177,12 +1177,9 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(void* lpParam, UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)lpParam; pClass->m_bIgnoreInput = false; if (bRes) { - std::uint16_t ui16Text[128]; - ZeroMemory(ui16Text, 128 * sizeof(std::uint16_t)); - InputManager.GetText(ui16Text); - + const char* text = InputManager.GetText(); // check the name is valid - if (ui16Text[0] != 0) { + if (text[0] != '\0') { #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || \ defined(__PSVITA__)) // open the save and overwrite the metadata diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index ad79dc97a..e8a8cd848 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -143,10 +143,7 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) { UIScene_SignEntryMenu* pClass = (UIScene_SignEntryMenu*)lpParam; pClass->m_bIgnoreInput = false; if (bRes && pClass->m_iEditingLine >= 0 && pClass->m_iEditingLine < 4) { - uint16_t pchText[128]; - ZeroMemory(pchText, 128 * sizeof(uint16_t)); - InputManager.GetText(pchText); - std::wstring str = uint16_to_wstring(pchText); + std::wstring str = convStringToWstring(InputManager.GetText()); if (str.size() > 15) str.resize(15); pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(str); } diff --git a/Minecraft.World/Util/StringHelpers.cpp b/Minecraft.World/Util/StringHelpers.cpp index 43cfb171a..da690b354 100644 --- a/Minecraft.World/Util/StringHelpers.cpp +++ b/Minecraft.World/Util/StringHelpers.cpp @@ -36,18 +36,6 @@ bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b) { return out; } -size_t uint16_len(const uint16_t* str) { - return std::char_traits::length( - reinterpret_cast(str)); -} - -std::u16string uint16_to_u16string(const uint16_t* str) { - return std::u16string(reinterpret_cast(str), uint16_len(str)); -} - -std::wstring uint16_to_wstring(const uint16_t* str) { - return u16string_to_wstring(uint16_to_u16string(str)); -} std::wstring convStringToWstring(const std::string& converting) { std::wstring converted(converting.length(), L' '); diff --git a/Minecraft.World/Util/StringHelpers.h b/Minecraft.World/Util/StringHelpers.h index 4f41be369..8ed4bc987 100644 --- a/Minecraft.World/Util/StringHelpers.h +++ b/Minecraft.World/Util/StringHelpers.h @@ -29,9 +29,6 @@ T _fromHEXString(const std::wstring& s) { return t; } -size_t uint16_len(const uint16_t* str); -std::u16string uint16_to_u16string(const uint16_t* str); -std::wstring uint16_to_wstring(const uint16_t* str); std::wstring convStringToWstring(const std::string& converting); std::wstring u16string_to_wstring(const std::u16string& converting); From 7545b7dd87aabd16f9ed93c52a8acaf57f2f582e Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 14:41:27 +1100 Subject: [PATCH 4/5] fix: remove extra blank lines to pass clang-format check --- Minecraft.World/Util/StringHelpers.cpp | 1 - Minecraft.World/Util/StringHelpers.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Minecraft.World/Util/StringHelpers.cpp b/Minecraft.World/Util/StringHelpers.cpp index da690b354..9f47f92b8 100644 --- a/Minecraft.World/Util/StringHelpers.cpp +++ b/Minecraft.World/Util/StringHelpers.cpp @@ -36,7 +36,6 @@ bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b) { return out; } - std::wstring convStringToWstring(const std::string& converting) { std::wstring converted(converting.length(), L' '); copy(converting.begin(), converting.end(), converted.begin()); diff --git a/Minecraft.World/Util/StringHelpers.h b/Minecraft.World/Util/StringHelpers.h index 8ed4bc987..871e46d87 100644 --- a/Minecraft.World/Util/StringHelpers.h +++ b/Minecraft.World/Util/StringHelpers.h @@ -29,7 +29,6 @@ T _fromHEXString(const std::wstring& s) { return t; } - std::wstring convStringToWstring(const std::string& converting); std::wstring u16string_to_wstring(const std::u16string& converting); std::u16string wstring_to_u16string(const std::wstring& converting); From 8f61c9b01abd06f60ef5062c6ad81dd4f01f8315 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 14:57:56 +1100 Subject: [PATCH 5/5] fix: update 4jlibs flake input to latest main Resolves build failure caused by 4jlibs:gles being an unknown option. --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 5a5335f73..f2128808e 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "4jlibs": { "flake": false, "locked": { - "lastModified": 1774012501, - "narHash": "sha256-NoM5LtKcU+3LFPVZUtep1L+hfZS6YSQ4P/xkJU/2NY4=", + "lastModified": 1774836469, + "narHash": "sha256-ukp6tLThQugPlREYFDDB6IaunjGte08f0Ler/c8cvaY=", "owner": "4jcraft", "repo": "4jlibs", - "rev": "df5f4a1fc3288fdc021b3d8ee2abaed3083de460", + "rev": "ab37891dabba90cf1e568660f750cebf46ba83f6", "type": "github" }, "original": {