Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
port HideDDrawGameWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 20, 2024
1 parent 5796d80 commit 474af97
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ typedef enum GAME_OBJECT_ID {
00445110 0000003A +R void __cdecl WinVidHideGameWindow(void);
00445150 00000035 +R void __cdecl WinVidSetGameWindowSize(int32_t width, int32_t height);
00445190 000000A7 +R bool __cdecl ShowDDrawGameWindow(bool active);
00445240 00000087 -R bool __cdecl HideDDrawGameWindow(void);
00445240 00000087 +R bool __cdecl HideDDrawGameWindow(void);
004452D0 00000044 -R HRESULT __cdecl DDrawSurfaceCreate(LPDDSDESC dsp, LPDDS *surface);
00445320 00000046 -R HRESULT __cdecl DDrawSurfaceRestoreLost(LPDDS surface1, LPDDS surface2, bool blank);
00445370 0000004D -R bool __cdecl WinVidClearBuffer(LPDDS surface, LPRECT rect, DWORD fillColor);
Expand Down
24 changes: 24 additions & 0 deletions src/decomp/decomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,27 @@ bool __cdecl ShowDDrawGameWindow(bool active)
g_IsDDrawGameWindowShow = true;
return true;
}

bool __cdecl HideDDrawGameWindow(void)
{
if (!g_GameWindowHandle || !g_DDraw) {
return false;
}
if (!g_IsDDrawGameWindowShow) {
return true;
}

WinVidHideGameWindow();
g_IsGameWindowUpdating = true;
const HRESULT result = IDirectDraw_SetCooperativeLevel(
g_DDraw, g_GameWindowHandle, DDSCL_NORMAL);
if (SUCCEEDED(result)) {
g_IsDDrawGameWindowShow = false;
SetWindowPos(
g_GameWindowHandle, NULL, g_GameWindowX, g_GameWindowY, 0, 0,
SWP_NOCOPYBITS | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
}

g_IsGameWindowUpdating = false;
return SUCCEEDED(result);
}
1 change: 1 addition & 0 deletions src/decomp/decomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ void __cdecl WinVidShowGameWindow(int32_t cmd_show);
void __cdecl WinVidHideGameWindow(void);
void __cdecl WinVidSetGameWindowSize(int32_t width, int32_t height);
bool __cdecl ShowDDrawGameWindow(bool active);
bool __cdecl HideDDrawGameWindow(void);
1 change: 0 additions & 1 deletion src/global/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@
#define DDrawRelease ((void __cdecl (*)(void))0x00444C30)
#define GameWindowCalculateSizeFromClient ((void __cdecl (*)(int32_t *width, int32_t *height))0x00444C70)
#define GameWindowCalculateSizeFromClientByZero ((void __cdecl (*)(int32_t *width, int32_t *height))0x00444CF0)
#define HideDDrawGameWindow ((bool __cdecl (*)(void))0x00445240)
#define DDrawSurfaceCreate ((HRESULT __cdecl (*)(LPDDSDESC dsp, LPDDS *surface))0x004452D0)
#define DDrawSurfaceRestoreLost ((HRESULT __cdecl (*)(LPDDS surface1, LPDDS surface2, bool blank))0x00445320)
#define WinVidClearBuffer ((bool __cdecl (*)(LPDDS surface, LPRECT rect, DWORD fillColor))0x00445370)
Expand Down
1 change: 1 addition & 0 deletions src/inject_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static void Inject_Decomp(void)
INJECT(1, 0x00445110, WinVidHideGameWindow);
INJECT(1, 0x00445150, WinVidSetGameWindowSize);
INJECT(1, 0x00445190, ShowDDrawGameWindow);
INJECT(1, 0x00445240, HideDDrawGameWindow);
INJECT(1, 0x004471F0, DInputCreate);
INJECT(1, 0x00447220, DInputRelease);
INJECT(1, 0x00447240, WinInReadKeyboard);
Expand Down

0 comments on commit 474af97

Please sign in to comment.