diff --git a/docs/progress.svg b/docs/progress.svg index b2bc869..b6926cb 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -40.97% (499) · 56.57% (689) · 0% (0) · 2.46% (30) +41.05% (500) · 56.49% (688) · 0% (0) · 2.46% (30) - - + + @@ -899,7 +899,7 @@ bool __cdecl DDrawCreate(LPGUID lpGUID); void __cdecl DDrawRelease(void); void __cdecl GameWindowCalculateSizeFromClient(int32_t *width, int32_t *height); -void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); +void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); void __cdecl WinVidSetMinWindowSize(int32_t width, int32_t height); void __cdecl WinVidClearMinWindowSize(void); void __cdecl WinVidSetMaxWindowSize(int32_t width, int32_t height); @@ -1298,10 +1298,10 @@ Tomb2.exe progress according to the function sizes: -38.02% · 61.65% · 0% · 0.33% +38.05% · 61.62% · 0% · 0.33% - - + + @@ -1997,7 +1997,7 @@ void __cdecl DrawUnclippedItem(ITEM_INFO *item); bool __cdecl PlayFMV(const char *file_name); void __cdecl Direct3DRelease(void); -void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); +void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); bool __cdecl WinVidRegisterGameWindowClass(void); int32_t __cdecl CreateTexturePage(int32_t width, int32_t height, bool alpha); void __cdecl Lara_Col_SwanDive(ITEM_INFO *item, COLL_INFO *coll); diff --git a/docs/progress.txt b/docs/progress.txt index b98ddef..ab91eb4 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -3011,7 +3011,7 @@ typedef struct { 0x00444BD0 0x0054 +R bool __cdecl DDrawCreate(LPGUID lpGUID); 0x00444C30 0x0033 +R void __cdecl DDrawRelease(void); 0x00444C70 0x0073 +R void __cdecl GameWindowCalculateSizeFromClient(int32_t *width, int32_t *height); -0x00444CF0 0x006A -R void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); +0x00444CF0 0x006A +R void __cdecl GameWindowCalculateSizeFromClientByZero(int32_t *width, int32_t *height); 0x00444D60 0x0041 +R void __cdecl WinVidSetMinWindowSize(int32_t width, int32_t height); 0x00444DB0 0x0008 +R void __cdecl WinVidClearMinWindowSize(void); 0x00444DC0 0x0041 +R void __cdecl WinVidSetMaxWindowSize(int32_t width, int32_t height); diff --git a/src/decomp/decomp.c b/src/decomp/decomp.c index 035c279..c7a2276 100644 --- a/src/decomp/decomp.c +++ b/src/decomp/decomp.c @@ -2162,3 +2162,14 @@ void __cdecl GameWindowCalculateSizeFromClient( *width = rect.right - rect.left; *height = rect.bottom - rect.top; } + +void __cdecl GameWindowCalculateSizeFromClientByZero( + int *const width, int *const height) +{ + RECT rect = { 0, 0, 0, 0 }; + const DWORD style = GetWindowLong(g_GameWindowHandle, GWL_STYLE); + const DWORD styleEx = GetWindowLong(g_GameWindowHandle, GWL_EXSTYLE); + AdjustWindowRectEx(&rect, style, FALSE, styleEx); + *width += rect.left - rect.right; + *height += rect.top - rect.bottom; +} diff --git a/src/decomp/decomp.h b/src/decomp/decomp.h index fabfecb..ff3fe85 100644 --- a/src/decomp/decomp.h +++ b/src/decomp/decomp.h @@ -103,3 +103,4 @@ bool __cdecl Direct3DInit(void); bool __cdecl DDrawCreate(LPGUID lpGUID); void __cdecl DDrawRelease(void); void __cdecl GameWindowCalculateSizeFromClient(int *width, int *height); +void __cdecl GameWindowCalculateSizeFromClientByZero(int *width, int *height); diff --git a/src/global/funcs.h b/src/global/funcs.h index 30c2637..9e8416f 100644 --- a/src/global/funcs.h +++ b/src/global/funcs.h @@ -443,7 +443,6 @@ #define ControlLavaBlob ((void __cdecl (*)(int16_t fx_num))0x00442F40) #define GiantYetiControl ((void __cdecl (*)(int16_t item_num))0x00443050) #define YetiControl ((void __cdecl (*)(int16_t item_num))0x00443350) -#define GameWindowCalculateSizeFromClientByZero ((void __cdecl (*)(int32_t *width, int32_t *height))0x00444CF0) #define CompareVideoModes ((bool __thiscall (*)(const DISPLAY_MODE *mode1, const DISPLAY_MODE *mode2))0x004459A0) #define WinVidGetDisplayModes ((bool __cdecl (*)(void))0x004459F0) #define EnumDisplayModesCallback ((HRESULT __stdcall (*)(LPDDSDESC lpDDSurfaceDesc, LPVOID lpContext))0x00445A50) diff --git a/src/inject_exec.c b/src/inject_exec.c index 9136af9..96f2704 100644 --- a/src/inject_exec.c +++ b/src/inject_exec.c @@ -148,6 +148,7 @@ static void Inject_Decomp(const bool enable) INJECT(enable, 0x00444BD0, DDrawCreate); INJECT(enable, 0x00444C30, DDrawRelease); INJECT(enable, 0x00444C70, GameWindowCalculateSizeFromClient); + INJECT(enable, 0x00444CF0, GameWindowCalculateSizeFromClientByZero); } static void Inject_Background(const bool enable)