mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-04 22:15:33 +02:00
Use MKXP_SetWindowLong for Windows
This commit is contained in:
parent
e093e3eb8f
commit
db0bb632ed
4 changed files with 22 additions and 23 deletions
|
@ -104,6 +104,7 @@ mkxp-z provides limited support for some WinAPI functions that would normally br
|
||||||
* `SetWindowTextA`: Sets the window title.
|
* `SetWindowTextA`: Sets the window title.
|
||||||
* `GetWindowRect`: Returns the screen coordinates of the game window's corners.
|
* `GetWindowRect`: Returns the screen coordinates of the game window's corners.
|
||||||
* `RegisterHotKey`: No-op. pls no disabling SDL's precious fullscreen.
|
* `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.
|
* `GetKeyboardState`: On Windows, adds states for Shift based on SDL's keystates. Emulated everywhere else.
|
||||||
|
|
||||||
#### macOS/Linux
|
#### 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.
|
* `GetAsyncKeyState`: Emulated based on SDL mouse/key states.
|
||||||
* `GetSystemPowerStatus`: Emulated based on SDL_GetPowerInfo.
|
* `GetSystemPowerStatus`: Emulated based on SDL_GetPowerInfo.
|
||||||
* `ShowWindow`: No-op.
|
* `ShowWindow`: No-op.
|
||||||
* `SetWindowLong`: No-op. Always returns `571`.
|
|
||||||
* `GetSystemMetrics`: Only supports getting screen width/height.
|
* `GetSystemMetrics`: Only supports getting screen width/height.
|
||||||
* `SetCapture`: No-op. Always returns `571`.
|
* `SetCapture`: No-op. Always returns `571`.
|
||||||
* `ReleaseCapture`: No-op.
|
* `ReleaseCapture`: No-op.
|
||||||
|
|
|
@ -58,6 +58,7 @@ MiniFFI_GetFunctionHandle(void *libhandle, const char *func)
|
||||||
CAPTURE(SetWindowTextA);
|
CAPTURE(SetWindowTextA);
|
||||||
CAPTURE(GetWindowRect);
|
CAPTURE(GetWindowRect);
|
||||||
CAPTURE(RegisterHotKey);
|
CAPTURE(RegisterHotKey);
|
||||||
|
CAPTURE(SetWindowLong);
|
||||||
CAPTURE(GetKeyboardState);
|
CAPTURE(GetKeyboardState);
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
// Functions only needed on Linux and macOS go here
|
// Functions only needed on Linux and macOS go here
|
||||||
|
@ -67,7 +68,6 @@ MiniFFI_GetFunctionHandle(void *libhandle, const char *func)
|
||||||
CAPTURE(GetAsyncKeyState);
|
CAPTURE(GetAsyncKeyState);
|
||||||
CAPTURE(GetSystemPowerStatus);
|
CAPTURE(GetSystemPowerStatus);
|
||||||
CAPTURE(ShowWindow);
|
CAPTURE(ShowWindow);
|
||||||
CAPTURE(SetWindowLong);
|
|
||||||
CAPTURE(GetSystemMetrics);
|
CAPTURE(GetSystemMetrics);
|
||||||
CAPTURE(SetCapture);
|
CAPTURE(SetCapture);
|
||||||
CAPTURE(ReleaseCapture);
|
CAPTURE(ReleaseCapture);
|
||||||
|
|
|
@ -334,6 +334,23 @@ MKXP_RegisterHotKey(HWND hWnd,
|
||||||
UINT vk)
|
UINT vk)
|
||||||
NOP_VAL(true)
|
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,
|
// Shift key with GetKeyboardState doesn't work for whatever reason,
|
||||||
// so Windows needs this too
|
// so Windows needs this too
|
||||||
#define ks(sc) shState->eThread().keyStates[SDL_SCANCODE_##sc]
|
#define ks(sc) shState->eThread().keyStates[SDL_SCANCODE_##sc]
|
||||||
|
@ -506,24 +523,6 @@ PREFABI BOOL
|
||||||
MKXP_ShowWindow(HWND hWnd, int nCmdShow)
|
MKXP_ShowWindow(HWND hWnd, int nCmdShow)
|
||||||
NOP_VAL(true);
|
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
|
// This only currently supports getting screen width/height
|
||||||
// Not really motivated to do the other ones when I'll be
|
// Not really motivated to do the other ones when I'll be
|
||||||
|
|
|
@ -102,6 +102,9 @@ MKXP_RegisterHotKey(HWND hWnd,
|
||||||
UINT fsModifiers,
|
UINT fsModifiers,
|
||||||
UINT vk);
|
UINT vk);
|
||||||
|
|
||||||
|
PREFABI LONG
|
||||||
|
MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||||
|
|
||||||
PREFABI BOOL
|
PREFABI BOOL
|
||||||
MKXP_GetKeyboardState(PBYTE lpKeyState);
|
MKXP_GetKeyboardState(PBYTE lpKeyState);
|
||||||
|
|
||||||
|
@ -125,9 +128,6 @@ MKXP_GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus);
|
||||||
PREFABI BOOL
|
PREFABI BOOL
|
||||||
MKXP_ShowWindow(HWND hWnd, int nCmdShow);
|
MKXP_ShowWindow(HWND hWnd, int nCmdShow);
|
||||||
|
|
||||||
PREFABI LONG
|
|
||||||
MKXP_SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
|
|
||||||
|
|
||||||
PREFABI int
|
PREFABI int
|
||||||
MKXP_GetSystemMetrics(int nIndex);
|
MKXP_GetSystemMetrics(int nIndex);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue