Hi, i want to patch csbot in linux cs_i386.so, i view cs16 code in IDA and i found that "UTIL_IsGame" is playing the main role to enable all CZ stuff.
Here is Linux Pseudocode:
Код:
char __cdecl UTIL_IsGame(const char *s1)
{
char s2; // [sp+18h] [bp-1000h]@1
(*(void (__cdecl **)(char *))&g_engfuncs[396])(&s2);
return s1 && !strcasecmp(s1, &s2);
}
So it return int right? all i want is to patch it return to 1.
I tried with Orpheu module, it works but some commands is not available. We need a forward before plugin_precache. So the best is to patch via metamod module.
Orpheu code:
Код:
#include <amxmodx>
#include <orpheu>
public plugin_precache()
{
OrpheuRegisterHook(OrpheuGetFunction("UTIL_IsGame"), "OnUTIL_IsGame") //too late to hook on plugin_precache
register_plugin("Patch UTIL_IsGame", "0.0.1", "wbyokomo")
}
public OrpheuHookReturn:OnUTIL_IsGame()
{
//log_amx("Hook: OnUTIL_IsGame()")
OrpheuSetReturn(1) //set 1 to enable cz stuff
return OrpheuSupercede;
}