Initial CSGO GetWeaponPrice fixes
This commit is contained in:
@@ -58,6 +58,23 @@ CDetour *CDetourManager::CreateDetour(void *callbackfunction, void **trampoline,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CDetour *CDetourManager::CreateDetour(void *callbackfunction, void **trampoline, void *pAddress)
|
||||
{
|
||||
CDetour *detour = new CDetour(callbackfunction, trampoline, pAddress);
|
||||
if (detour)
|
||||
{
|
||||
if (!detour->Init(spengine, gameconf))
|
||||
{
|
||||
delete detour;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return detour;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CDetour::CDetour(void *callbackfunction, void **trampoline, const char *signame)
|
||||
{
|
||||
enabled = false;
|
||||
@@ -71,6 +88,19 @@ CDetour::CDetour(void *callbackfunction, void **trampoline, const char *signame)
|
||||
this->trampoline = trampoline;
|
||||
}
|
||||
|
||||
CDetour::CDetour(void*callbackfunction, void **trampoline, void *pAddress)
|
||||
{
|
||||
enabled = false;
|
||||
detoured = false;
|
||||
detour_address = pAddress;
|
||||
detour_trampoline = NULL;
|
||||
this->signame = NULL;
|
||||
this->detour_callback = callbackfunction;
|
||||
spengine = NULL;
|
||||
gameconf = NULL;
|
||||
this->trampoline = trampoline;
|
||||
}
|
||||
|
||||
bool CDetour::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
||||
{
|
||||
this->spengine = spengine;
|
||||
@@ -100,11 +130,16 @@ bool CDetour::IsEnabled()
|
||||
|
||||
bool CDetour::CreateDetour()
|
||||
{
|
||||
if (!gameconf->GetMemSig(signame, &detour_address))
|
||||
if (signame && !gameconf->GetMemSig(signame, &detour_address))
|
||||
{
|
||||
g_pSM->LogError(myself, "Could not locate %s - Disabling detour", signame);
|
||||
return false;
|
||||
}
|
||||
else if(!detour_address)
|
||||
{
|
||||
g_pSM->LogError(myself, "Invalid detour address passed - Disabling detour to prevent crashes");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!detour_address)
|
||||
{
|
||||
|
||||
@@ -167,6 +167,7 @@ public:
|
||||
|
||||
protected:
|
||||
CDetour(void *callbackfunction, void **trampoline, const char *signame);
|
||||
CDetour(void*callbackfunction, void **trampoline, void *pAddress);
|
||||
|
||||
bool Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
||||
private:
|
||||
@@ -239,6 +240,7 @@ public:
|
||||
* Note we changed the netadr_s reference into a void* to avoid needing to define the type
|
||||
*/
|
||||
static CDetour *CreateDetour(void *callbackfunction, void **trampoline, const char *signame);
|
||||
static CDetour *CreateDetour(void *callbackfunction, void **trampoline, void *pAddress);
|
||||
|
||||
friend class CBlocker;
|
||||
friend class CDetour;
|
||||
|
||||
Reference in New Issue
Block a user