Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HandleChange function symbols #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions helpers_extended/include/GarrysMod/FunctionPointers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
#if defined ARCHITECTURE_X86_64

#define GMCOMMON_CALLING_CONVENTION __fastcall
#define GMCOMMON_CALLING_CONVENTION_STD __fastcall

#else

#define GMCOMMON_CALLING_CONVENTION __thiscall
#define GMCOMMON_CALLING_CONVENTION_STD __stdcall

#endif

#else

#define GMCOMMON_CALLING_CONVENTION
#define GMCOMMON_CALLING_CONVENTION_STD

#endif

Expand Down Expand Up @@ -97,4 +100,7 @@ typedef INetChannel *( *NET_CreateNetChannel_t )(
);
NET_CreateNetChannel_t NET_CreateNetChannel( );

typedef void ( GMCOMMON_CALLING_CONVENTION_STD *HandleChange_t )( const std::string& path );
HandleChange_t HandleChange( );

}
1 change: 1 addition & 0 deletions helpers_extended/include/GarrysMod/Symbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ extern const std::vector<Symbol> GlobalVars;
extern const std::vector<Symbol> AdvancedLuaErrorReporter;
extern const std::vector<Symbol> NET_ProcessSocket;
extern const std::vector<Symbol> NET_CreateNetChannel;
extern const std::vector<Symbol> HandleChange;

}
14 changes: 14 additions & 0 deletions helpers_extended/source/FunctionPointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@ namespace FunctionPointers
);
}

return func_pointer;
}

HandleChange_t HandleChange( )
{
static HandleChange_t func_pointer = nullptr;
if( func_pointer == nullptr )
{
SourceSDK::FactoryLoader server_loader( "server" );
func_pointer = ResolveSymbols<HandleChange_t>(
server_loader, Symbols::HandleChange
);
}

return func_pointer;
}
}
24 changes: 24 additions & 0 deletions helpers_extended/source/Symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ namespace Symbols
Symbol::FromSignature( "\x48\x89\x6C\x24\x2A\x48\x89\x7C\x24\x2A\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x30\x80\x7C\x24\x2A\x00" )
};

const std::vector<Symbol> HandleChange = {
Symbol::FromSignature( "\x48\x89\x5c\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7c\x24\x20\x55\x48\x8d\x6c\x24\xa9\x48\x81\xec\xb0\x00\x00\x00\x48\x8b\x05\x2A" )
}

#elif defined ARCHITECTURE_X86

const std::vector<Symbol> CBasePlayer_HandleClientLuaError = {
Expand Down Expand Up @@ -199,6 +203,10 @@ namespace Symbols
Symbol::FromSignature( "\x55\x8B\xEC\x80\x7D\x2A\x00\x53\x8B\x5D" )
};

const std::vector<Symbol> HandleChange = {
Symbol::FromSignature( "\x55\x8b\xec\x83\xec\x60\x56\x8b\x75\x08\x8d\x45\xd0\x57\x56\x50\xe8\x2a\x2a\x2a\x00\x83\xc4\x08\x83\x7d\xe0\x00\x0f\x84\x60\x02" )
}

#endif

#elif defined SYSTEM_LINUX
Expand Down Expand Up @@ -448,6 +456,20 @@ namespace Symbols

};

const std::vector<Symbol> HandleChange = {

#if defined ARCHITECTURE_X86

Symbol::FromSignature( "\x55\x89\xe5\x57\x56\x53\x8d\x5d\x98\x83\xec\x7c\x8b\x75\x08\x89\x1c\x24\x89\x74\x24\x04\xe8\x44\x4d\x94\x00\x8b\x45\x98\x83\xec\x04\x8b\x50\xf4\x85\xd2\x0f\x84\x86\x00\x00\x00\x8d\x45\xb8\x89" )

#elif ARCHITECTURE_X86_64

Symbol::FromSignature( "\x55\x48\x89\xfe\x48\x89\xe5\x41\x57\x41\x56\x41\x55\x41\x54\x4c\x8d\x65\x80\x53\x48\x89\xfb\x4c\x89\xe7\x48\x83\xec\x68\xe8\x2d\x23\x1c\x00\x48\x8b\x45\x80\x48\x83\x78\xe8\x00\x75\x2a\x48\x8b" )

#endif

}

#elif defined SYSTEM_MACOSX

const std::vector<Symbol> CBasePlayer_HandleClientLuaError = {
Expand Down Expand Up @@ -548,6 +570,8 @@ namespace Symbols

const std::vector<Symbol> NET_CreateNetChannel;

const std::vector<Symbol> HandleChange = { Symbol::FromSignature( "\x55\x48\x89\xe5\x53\x48\x81\xec\x88\x00\x00\x00\x48\x89\xfb\x48\x8d\x7d\xc8\x48\x89\xde\xe8\x2A\x21\x11\x00\x8a\x4d\xc8\x89\xc8" ) }

#endif

}