From 392f84c1b18201f48a55ee7cd04bcd0a19b7b843 Mon Sep 17 00:00:00 2001 From: Inori Date: Tue, 27 Aug 2019 10:43:30 -0400 Subject: [PATCH] Use native SetWindowLong on Windows --- README.md | 2 +- src/fake-api.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e133179f..93dba973 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ mkxp-z provides limited support for some WinAPI functions that would normally br * `SetWindowTextA`: Sets the window title. * `GetWindowRect`: Returns the screen coordinates of the game window's corners. * `RegisterHotKey`: No-op. pls no disabling SDL's precious fullscreen. -* `SetWindowLong`: Only supports switching between fullscreen/windowed modes. Always returns `571`. +* `SetWindowLong`: Native SetWindowLong on Windows. Everywhere else, only supports switching between fullscreen/windowed modes and always returns `571`. * `GetKeyboardState`: On Windows, adds states for Shift based on SDL's keystates. Emulated everywhere else. #### macOS/Linux diff --git a/src/fake-api.cpp b/src/fake-api.cpp index fa9d654b..6182129c 100644 --- a/src/fake-api.cpp +++ b/src/fake-api.cpp @@ -337,6 +337,9 @@ NOP_VAL(true) PREFABI LONG MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) { +#ifdef __WIN32__ + return SetWindowLong(hWnd, nIndex, dwNewLong); +#else if (nIndex == -16) { if (dwNewLong == 0) @@ -349,6 +352,7 @@ MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) } } return DUMMY_VAL; +#endif }; // Shift key with GetKeyboardState doesn't work for whatever reason,