From 93f29ac51fdbb8bf0afb19010241a8b4b3cf55e6 Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Sat, 25 Oct 2025 21:50:18 +0300 Subject: [PATCH] WM_USER_GET_CURRENT_GAMEID: return 4 u32 values (compatibility with 32 bit builds) --- Windows/MainWindow.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index a6bb9200ac..cd1b2f8775 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -669,9 +669,9 @@ namespace MainWindow case WM_USER_GET_CURRENT_GAMEID: { - // Return game ID packed as u64 - // wParam: 0 = first 8 chars, 1 = next 7 chars - // Returns: packed u64 with 8 bytes of game ID + // Return game ID as four u32 values + // wParam: 0-3 = which u32 to return (chars 0-3, 4-7, 8-11, 12-15) + // Returns: packed u32 with 4 bytes of game ID if (!PSP_IsInited()) { return 0; @@ -681,13 +681,15 @@ namespace MainWindow { return 0; } - u64 packed = 0; - const size_t offset = (wParam == 0) ? 0 : 8; - const size_t maxLen = std::min(gameID.length() - offset, size_t(8)); - for (size_t i = 0; i < maxLen; ++i) + const size_t offset = (wParam & 0x3) * 4; // 0, 4, 8, 12 + u32 packed = 0; + for (size_t i = 0; i < 4; ++i) { - const u8 c = static_cast(gameID[offset + i]); - packed |= ((u64)c << (i * 8)); + if (offset + i < gameID.length()) + { + const u8 c = static_cast(gameID[offset + i]); + packed |= ((u32)c << (i * 8)); + } } return packed; }