[Code] Fix custom asset loading for client
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
I noticed that custom menu and weapon files are not loaded when you join a modded server, for example with the promod_v3.3. So I said to myself why not fix this and came quickly up with this solution.
Index: PatchMW2DownloadCL.cpp =================================================================== --- PatchMW2DownloadCL.cpp (revision 122) +++ PatchMW2DownloadCL.cpp (working copy) @@ -486,6 +486,8 @@ dls.isDownloading = false; CL_DownloadsComplete(0); + //afaik iw3 also reconnects after download, cl_modVidRestart dvar should probably be changed but I'll let NTA do this + Cmd_ExecuteSingleCommand(0, 0, "reconnect"); } } } @@ -564,6 +566,59 @@ } } +void GetFS_Game() +{ + char* msg = (char *)0x1CB7EB9;//it actually starts at 0x1CB7EB8 + + while(true) + { + if(msg[0]==0) + return; //this should never happen + if(memcmp("fs_game", msg, sizeof("fs_game") - 1) == 0) + break; + msg++; + } + + msg += 8; //old value + sizeof("fs_game\\") + int length = 0; + do + { + length++; + } + while(msg[length]!='\\'); + + if(length==0) + Dvar_SetCommand("fs_game", ""); + else + { + char* buffer = (char*)malloc(length + 1); + buffer[length] = 0; //terminate string + memcpy(buffer, msg, length); + Dvar_SetCommand("fs_game", buffer); + free(buffer); + } +} + +void __declspec(naked) clParseGamestateHookStub() +{ + __asm + { + mov ebx,[esp] + mov [esp+4],ebx + //code we've overwritten + add esp,4 + mov ebx,eax + + test edi,edi //some kind of ID + jne back + pushad + call GetFS_Game + popad +back: + ret + } +} + // hook definitions CallHook clInitDownloadsHook; // from CL_ParseGamestate, currently calls CL_DownloadsComplete DWORD clInitDownloadsHookLoc = 0x5AC6E9; @@ -574,6 +629,9 @@ CallHook connStatusDisplayHook; DWORD connStatusDisplayHookLoc = 0x49FA39; +DWORD clParseGamestateHookLoc = 0x5AC4B0; + + #include "ExtDLL.h" extern IExtDLL* g_extDLL; @@ -625,6 +683,11 @@ connStatusDisplayHook.initialize(connStatusDisplayHookLoc, DisplayConnectionStatusHookStub); connStatusDisplayHook.installHook(); + if(!GAME_FLAG(GAME_FLAG_DEDICATED)) + { + call(clParseGamestateHookLoc, clParseGamestateHookStub, eCallPatcher::PATCH_CALL); + } + // switch table in CL_ParseServerMessage *(DWORD*)0x4A9FD8 = (DWORD)CL_ParseServerMessageHookStub - (0x4A9FD6 + 6);Requires the reconnect patch I posted here: viewtopic.php?f=17&t=26688#p225039
Greetings to banz, this is for you. I want to thank you for all your contributions.