diff --git a/README.md b/README.md index 14a2aa10..e133179f 100644 --- a/README.md +++ b/README.md @@ -104,6 +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`. * `GetKeyboardState`: On Windows, adds states for Shift based on SDL's keystates. Emulated everywhere else. #### macOS/Linux @@ -112,7 +113,6 @@ mkxp-z provides limited support for some WinAPI functions that would normally br * `GetAsyncKeyState`: Emulated based on SDL mouse/key states. * `GetSystemPowerStatus`: Emulated based on SDL_GetPowerInfo. * `ShowWindow`: No-op. -* `SetWindowLong`: No-op. Always returns `571`. * `GetSystemMetrics`: Only supports getting screen width/height. * `SetCapture`: No-op. Always returns `571`. * `ReleaseCapture`: No-op. diff --git a/binding/miniffi-binding.cpp b/binding/miniffi-binding.cpp index d3ab2259..9fddfa09 100644 --- a/binding/miniffi-binding.cpp +++ b/binding/miniffi-binding.cpp @@ -58,6 +58,7 @@ MiniFFI_GetFunctionHandle(void *libhandle, const char *func) CAPTURE(SetWindowTextA); CAPTURE(GetWindowRect); CAPTURE(RegisterHotKey); + CAPTURE(SetWindowLong); CAPTURE(GetKeyboardState); #ifndef __WIN32__ // Functions only needed on Linux and macOS go here @@ -67,7 +68,6 @@ MiniFFI_GetFunctionHandle(void *libhandle, const char *func) CAPTURE(GetAsyncKeyState); CAPTURE(GetSystemPowerStatus); CAPTURE(ShowWindow); - CAPTURE(SetWindowLong); CAPTURE(GetSystemMetrics); CAPTURE(SetCapture); CAPTURE(ReleaseCapture); diff --git a/src/fake-api.cpp b/src/fake-api.cpp index ce3aee09..fa9d654b 100644 --- a/src/fake-api.cpp +++ b/src/fake-api.cpp @@ -334,6 +334,23 @@ MKXP_RegisterHotKey(HWND hWnd, UINT vk) NOP_VAL(true) +PREFABI LONG +MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) +{ + if (nIndex == -16) + { + if (dwNewLong == 0) + { + shState->graphics().setFullscreen(true); + } + else if (dwNewLong == 0x14ca0000) + { + shState->graphics().setFullscreen(false); + } + } + return DUMMY_VAL; +}; + // Shift key with GetKeyboardState doesn't work for whatever reason, // so Windows needs this too #define ks(sc) shState->eThread().keyStates[SDL_SCANCODE_##sc] @@ -506,24 +523,6 @@ PREFABI BOOL MKXP_ShowWindow(HWND hWnd, int nCmdShow) NOP_VAL(true); -PREFABI LONG -MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) -{ - - if (nIndex == -16) - { - if (dwNewLong == 0) - { - shState->graphics().setFullscreen(true); - } - else if (dwNewLong == 0x14ca0000) - { - shState->graphics().setFullscreen(false); - } - } - return DUMMY_VAL; -}; - // This only currently supports getting screen width/height // Not really motivated to do the other ones when I'll be diff --git a/src/fake-api.h b/src/fake-api.h index f2dad559..208950b1 100644 --- a/src/fake-api.h +++ b/src/fake-api.h @@ -102,6 +102,9 @@ MKXP_RegisterHotKey(HWND hWnd, UINT fsModifiers, UINT vk); +PREFABI LONG +MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong); + PREFABI BOOL MKXP_GetKeyboardState(PBYTE lpKeyState); @@ -125,9 +128,6 @@ MKXP_GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus); PREFABI BOOL MKXP_ShowWindow(HWND hWnd, int nCmdShow); -PREFABI LONG -MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong); - PREFABI int MKXP_GetSystemMetrics(int nIndex);