Merge pull request #11 from Werseter/mp_init

Shift LoadInventory and autoexec to CG_MainMP_Init
This commit is contained in:
MatrixMMOfficial 2023-11-01 11:51:13 -04:00 committed by GitHub
commit c0de806f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 24 deletions

View File

@ -12,7 +12,7 @@
#include "dvar.h" #include "dvar.h"
#include "stringed.h" #include "stringed.h"
#include "fastfile.h" #include "fastfile.h"
#include "party.h" #include "mp_init.h"
#include "ddl.h" #include "ddl.h"
#include "gamemode.h" #include "gamemode.h"
#include "sv_main.h" #include "sv_main.h"

View File

@ -176,7 +176,7 @@
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="net_chan.cpp" /> <ClCompile Include="net_chan.cpp" />
<ClCompile Include="omnvars.cpp" /> <ClCompile Include="omnvars.cpp" />
<ClCompile Include="party.cpp" /> <ClCompile Include="mp_init.cpp" />
<ClCompile Include="patch.cpp" /> <ClCompile Include="patch.cpp" />
<ClCompile Include="screen.cpp" /> <ClCompile Include="screen.cpp" />
<ClCompile Include="script.cpp" /> <ClCompile Include="script.cpp" />
@ -222,7 +222,7 @@
<ClInclude Include="MinHook.hpp" /> <ClInclude Include="MinHook.hpp" />
<ClInclude Include="net_chan.h" /> <ClInclude Include="net_chan.h" />
<ClInclude Include="omnvars.h" /> <ClInclude Include="omnvars.h" />
<ClInclude Include="party.h" /> <ClInclude Include="mp_init.h" />
<ClInclude Include="patch.h" /> <ClInclude Include="patch.h" />
<ClInclude Include="screen.h" /> <ClInclude Include="screen.h" />
<ClInclude Include="script.h" /> <ClInclude Include="script.h" />

View File

@ -109,7 +109,7 @@
<ClCompile Include="omnvars.cpp"> <ClCompile Include="omnvars.cpp">
<Filter>hook_lib\game</Filter> <Filter>hook_lib\game</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="party.cpp"> <ClCompile Include="mp_init.cpp">
<Filter>hook_lib\game</Filter> <Filter>hook_lib\game</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="patch.cpp"> <ClCompile Include="patch.cpp">
@ -240,7 +240,7 @@
<ClInclude Include="omnvars.h"> <ClInclude Include="omnvars.h">
<Filter>hook_lib\game</Filter> <Filter>hook_lib\game</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="party.h"> <ClInclude Include="mp_init.h">
<Filter>hook_lib\game</Filter> <Filter>hook_lib\game</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="patch.h"> <ClInclude Include="patch.h">

13
hook_lib/mp_init.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "mp_init.h"
#include "game_inc.h"
void CG_MainMP_Init_Detour(int localClientNum, int serverMessageNum, int serverCommandSequence, int clientNum, void* hunkUser)
{
cg_mainmp_init.stub<void>(localClientNum, serverMessageNum, serverCommandSequence, clientNum, hunkUser);
Cbuf_AddText("exec autoexec.cfg");
LoadInventory();
Cbuf_AddText("set cl_textChatEnabled 1");
}

5
hook_lib/mp_init.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
#include "Main.hpp"
inline utils::hook::detour cg_mainmp_init;
void CG_MainMP_Init_Detour(int localClientNum, int serverMessageNum, int serverCommandSequence, int clientNum, void* hunkUser);

View File

@ -1,13 +0,0 @@
#include "party.h"
#include "game_inc.h"
void PartyHost_StartPrivateParty_Detour(int localClientNum, int localControllerIndex, bool currentlyActive, int hostType)
{
Cbuf_AddText("exec autoexec.cfg");
partyhost_startprivateparty.stub<void>(localClientNum, localControllerIndex, currentlyActive, hostType);
LoadInventory();
Cbuf_AddText("set cl_textChatEnabled 1");
}

View File

@ -1,5 +0,0 @@
#pragma once
#include "Main.hpp"
inline utils::hook::detour partyhost_startprivateparty;
void PartyHost_StartPrivateParty_Detour(int localClientNum, int localControllerIndex, bool currentlyActive, int hostType);

View File

@ -137,7 +137,7 @@ void hooks()
seh_stringed_getstring.create(0x1413CC2A0_g, SEH_StringEd_GetString_Detour); seh_stringed_getstring.create(0x1413CC2A0_g, SEH_StringEd_GetString_Detour);
cl_createdevgui.create(0x1415B2080_g, CL_CreateDevGui_Detour); cl_createdevgui.create(0x1415B2080_g, CL_CreateDevGui_Detour);
partyhost_startprivateparty.create(0x14119F0D0_g, PartyHost_StartPrivateParty_Detour); cg_mainmp_init.create(0x141792E60_g, CG_MainMP_Init_Detour);
PM_WeaponUseAmmo.create(0x141155AF0_g, PM_WeaponUseAmmo_Detour); PM_WeaponUseAmmo.create(0x141155AF0_g, PM_WeaponUseAmmo_Detour);