When the game is loading the Client or Server
| 599 | |
| 600 | // When the game is loading the Client or Server |
| 601 | static intptr_t __cdecl LoadGameDLL_Hook(char* FileName, char a2, DWORD* a3) |
| 602 | { |
| 603 | intptr_t result = LoadGameDLL(FileName, a2, a3); |
| 604 | |
| 605 | // Convert FileName to wide string |
| 606 | wchar_t wFileName[MAX_PATH]; |
| 607 | MultiByteToWideChar(CP_ACP, 0, FileName, -1, wFileName, MAX_PATH); |
| 608 | |
| 609 | // Use FileName to get the module handle |
| 610 | HMODULE ApiDLL = GetModuleHandleW(wFileName); |
| 611 | if (ApiDLL) |
| 612 | { |
| 613 | if (!g_State.isClientLoaded) // First time is client |
| 614 | { |
| 615 | g_State.GameClient = ApiDLL; |
| 616 | g_State.isClientLoaded = true; |
| 617 | ApplyClientPatch(); |
| 618 | } |
| 619 | else // Otherwise server |
| 620 | { |
| 621 | g_State.GameServer = ApiDLL; |
| 622 | ApplyServerPatch(); |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | return result; |
| 627 | } |
| 628 | |
| 629 | static int __stdcall SetConsoleVariableFloat_Hook(const char* pszVarName, float fValue) |
| 630 | { |
nothing calls this directly
no test coverage detected