@@ -35,6 +35,9 @@ DownloadCache_PersistToDiskFn oDownloadCache_PersistToDisk;
3535DecompressBZipToDiskFn oDecompressBZipToDisk;
3636BZ2_bzreadFn oBZ2_bzread;
3737
38+ typedef void (__thiscall* CHostState_OnClientConnectedFn)(void *);
39+ CHostState_OnClientConnectedFn oCHostState_OnClientConnected;
40+
3841// NOTE: __thiscall for the typedefs so the original function is called correctly.
3942// __fastcall for the hook function because... reasons?
4043// TODO check if we can just thiscall those...
@@ -310,6 +313,12 @@ int __stdcall Hooked_BZ2_bzread(int a, int b, int c)
310313 return x;
311314}
312315
316+ void __fastcall Hooked_CHostState_OnClientConnected (void * thisptr)
317+ {
318+ oCHostState_OnClientConnected (thisptr);
319+ FlashWindow (FindWindowA (" Valve001" , NULL ), TRUE );
320+ }
321+
313322BOOL IsProcessRunning (DWORD processID)
314323{
315324 HANDLE process = OpenProcess (SYNCHRONIZE, FALSE , processID);
@@ -360,6 +369,8 @@ DWORD InjectionEntryPoint(DWORD processID)
360369 oDecompressBZipToDisk = (DecompressBZipToDiskFn)(FindPattern (" engine.dll" , " 55 8B EC B8 14 03 01 00" ));
361370 oBZ2_bzread = (BZ2_bzreadFn)(FindPattern (" engine.dll" , " 55 8B EC 8B 45 ? 83 B8 ? ? ? ? 04" ));
362371
372+ oCHostState_OnClientConnected = (CHostState_OnClientConnectedFn)(FindPattern (" engine.dll" , " 55 8B EC 83 EC 0C 56 8B F1 80 BE ? ? ? ? 00 0F 84" ));
373+
363374 uintptr_t tier = (uintptr_t )GetModuleHandleA (" tier0.dll" );
364375 ConMsg = (ConMsgFn)(uintptr_t )GetProcAddress ((HMODULE)tier, " ?ConMsg@@YAXPBDZZ" );
365376 Plat_FloatTime = (Plat_FloatTimeFn)(uintptr_t )GetProcAddress ((HMODULE)tier, " Plat_FloatTime" );
@@ -403,6 +414,7 @@ DWORD InjectionEntryPoint(DWORD processID)
403414 DetourAttach (&(PVOID&)oDownloadCache_PersistToDisk, Hooked_DownloadCache_PersistToDisk);
404415 DetourAttach (&(PVOID&)oDecompressBZipToDisk, Hooked_DecompressBZipToDisk);
405416 DetourAttach (&(PVOID&)oBZ2_bzread, Hooked_BZ2_bzread);
417+ DetourAttach (&(PVOID&)oCHostState_OnClientConnected, Hooked_CHostState_OnClientConnected);
406418 DetourTransactionCommit ();
407419
408420 bool jumpPredPatched = true ;
@@ -480,6 +492,7 @@ DWORD InjectionEntryPoint(DWORD processID)
480492 DetourDetach (&(PVOID&)oDownloadCache_PersistToDisk, Hooked_DownloadCache_PersistToDisk);
481493 DetourDetach (&(PVOID&)oDecompressBZipToDisk, Hooked_DecompressBZipToDisk);
482494 DetourDetach (&(PVOID&)oBZ2_bzread, Hooked_BZ2_bzread);
495+ DetourDetach (&(PVOID&)oCHostState_OnClientConnected, Hooked_CHostState_OnClientConnected);
483496 DetourTransactionCommit ();
484497
485498 ExitThread (0 );
0 commit comments