From fc358a29963799e3505969ae47c6b2e46a0db76b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:30:36 +0800 Subject: [PATCH] [saco] Implement `LaunchMonitor()` * Adds `CGame::StartGame()` stub --- saco/game/game.cpp | 7 +++++++ saco/game/game.h | 1 + saco/main.cpp | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/saco/game/game.cpp b/saco/game/game.cpp index 496610d..f01ef65 100644 --- a/saco/game/game.cpp +++ b/saco/game/game.cpp @@ -76,6 +76,13 @@ void CGame::InitGame() //----------------------------------------------------------- +void CGame::StartGame() +{ + // TODO: CGame::StartGame() .text:100A08E0 +} + +//----------------------------------------------------------- + void CGame::sub_100A0060() { // No indication for __thiscall, maybe not part of CGame diff --git a/saco/game/game.h b/saco/game/game.h index 50a6b1d..5d83869 100644 --- a/saco/game/game.h +++ b/saco/game/game.h @@ -36,6 +36,7 @@ public: HWND GetMainWindowHwnd() { return *(HWND *)ADDR_HWND; }; + void StartGame(); void InitGame(); CGame(); diff --git a/saco/main.cpp b/saco/main.cpp index 8907b7d..f598d99 100644 --- a/saco/main.cpp +++ b/saco/main.cpp @@ -34,6 +34,27 @@ CFileSystem *pFileSystem=NULL; void TheGraphicsLoop(); LONG WINAPI exc_handler(_EXCEPTION_POINTERS* exc_inf); +void sub_1009DD50(); + +// polls the game until it's able to run. +void LaunchMonitor(PVOID v) +{ + if(pGame) + pGame->InitGame(); + + while(1) { + if(*(PDWORD)ADDR_ENTRY == 7) { + sub_1009DD50(); + pGame->StartGame(); + break; + } + else { + Sleep(5); + } + } + + ExitThread(0); +} //---------------------------------------------------- @@ -70,7 +91,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) pGame = new CGame(); - //_beginthread((int)sub_100C3A80, 0, 0); + _beginthread(LaunchMonitor,0,NULL); } } else if(DLL_PROCESS_DETACH==fdwReason)