Thread: Module: Okapi
View Single Post
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 02-08-2014 , 06:48   Re: Module: Okapi
Reply With Quote #5

Quote:
Originally Posted by yokomo View Post

//new const SignA[] = {0x3D,0x1C,0xDEF,0xDEF,0xDEF,0x7E,0x1C,0x68}
//new const SignB[] = {0x68,0xDEF,0xDEF,0xDEF,0x41,0x68,0x84,0xE9}
//new const SignC[] = {0xC7,0x46,0x3C,0x1C,0xDEF,0xDEF,0xDEF,0xEB}

public plugin_init()
{
register_plugin("Okapi Test", "0.0.1", "wbyokomo")

//Just testing searching signature, found and no crash.
//server_print("SignA: %s", okapi_mod_find_sig(SignA, ? "Found":"Not Found")
//server_print("SignB: %s", okapi_mod_find_sig(SignB, ? "Found":"Not Found")
//server_print("SignC: %s", okapi_mod_find_sig(SignC, ? "Found":"Not Found")

//Patch roundtime, game crash here.
okapi_set_ptr_int(RoundtimeMaxCheck, 32400) //max check 0x94163
okapi_set_ptr_int(RoundtimeMaxCvarSet, 540) //max cvar set 0x9416A
okapi_set_ptr_int(RoundtimeMaxSet, 32400) //max set 0x9417D
}
[/PHP]
This step is incorrect

PHP Code:
okapi_set_ptr_int(RoundtimeMaxCheck32400//max check 0x94163 
That's because you are passing an offset, not the actual address you want.
You would do

PHP Code:
okapi_set_ptr_int(okapi_mod_get_offset_ptr(RoundtimeMaxCheck), 32400
To check if the signature is being searched correctly do:

PHP Code:
new offset okapi_mod_get_ptr_offset(okapi_mod_find_sig(SignA,8))
server_print("offset %x^n",offset
(Notice the name of this function is "the inverse" of the one used before)

After you patch the value by using a signature, remember that after map restart, the signature will be searched again, but now will not be found in the same memory location since it was altered. So be sure to check if the result from okapi_mod_find sig is not null, and be sure to confirm that your signature is unique.
__________________

Last edited by joaquimandrade; 02-08-2014 at 06:59.
joaquimandrade is offline