From aadb5115040cfe0199e79a3e32dada6aa4b99fda Mon Sep 17 00:00:00 2001 From: dtentiion Date: Thu, 5 Mar 2026 20:57:37 +0000 Subject: Fix save list, delete save, exit without saving, and blank username on Windows64 (#539) * Fix world save rename not applying new name KeyboardCompleteWorldNameCallback had no _WINDOWS64 branch, so the typed name was validated then silently discarded on every rename attempt. Write the new name to a worldname.txt sidecar file next to the save (Windows64\GameHDD\{folder}\worldname.txt) and update the in-memory display name immediately. ReadLevelNameFromSaveFile now checks for this sidecar first so renamed saves persist correctly across restarts. * Fixed gamertag being blank upon renaming and re-joining a save * Save deletion fix, exiting without saving fix * Add native in-game keyboard UI for world naming and renaming --- Minecraft.Client/Common/UI/UIStructs.h | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'Minecraft.Client/Common/UI/UIStructs.h') diff --git a/Minecraft.Client/Common/UI/UIStructs.h b/Minecraft.Client/Common/UI/UIStructs.h index c41f2276..ac83458f 100644 --- a/Minecraft.Client/Common/UI/UIStructs.h +++ b/Minecraft.Client/Common/UI/UIStructs.h @@ -282,6 +282,44 @@ typedef struct _JoinMenuInitData int iPad; } JoinMenuInitData; +// Native keyboard (Windows64 replacement for InputManager.RequestKeyboard WinAPI dialog) +#ifdef _WINDOWS64 +typedef struct _UIKeyboardInitData +{ + const wchar_t* title; + const wchar_t* defaultText; + int maxChars; + int(*callback)(LPVOID, const bool); + LPVOID lpParam; + bool pcMode; // When true, disables on-screen keyboard buttons (PC keyboard users only need the text field) + + _UIKeyboardInitData() : title(nullptr), defaultText(nullptr), maxChars(25), callback(nullptr), lpParam(nullptr), pcMode(false) {} +} UIKeyboardInitData; + +// Stores the text typed in UIScene_Keyboard so callbacks can retrieve it +// without calling InputManager.GetText (which shows the WinAPI dialog result). +extern wchar_t g_Win64KeyboardResult[256]; +inline void Win64_GetKeyboardText(uint16_t* outBuf, int maxChars) +{ + wcsncpy_s((wchar_t*)outBuf, maxChars, g_Win64KeyboardResult, _TRUNCATE); +} + +// Returns true if any XInput controller is currently connected. +// Used to decide whether to show the in-game keyboard UI or fall back to PC input. +#include +inline bool Win64_IsControllerConnected() +{ + XINPUT_STATE state; + for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) + { + memset(&state, 0, sizeof(state)); + if (XInputGetState(i, &state) == ERROR_SUCCESS) + return true; + } + return false; +} +#endif // _WINDOWS64 + // More Options typedef struct _LaunchMoreOptionsMenuInitData { -- cgit v1.2.3