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
This commit is contained in:
MatthewBeshay
2026-03-30 12:46:50 +11:00
parent dcc937da5e
commit 1ead072c45
8 changed files with 39 additions and 17 deletions

View File

@@ -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<int>(value);
switch (pClass->m_keyboardCallbackControl) {