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

@@ -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)) {