Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import binutils
- from binutils import Convention
- from custom_types import ICvar
- # Get the server binary
- server = binutils.find_binary('cstrike/bin/server')
- # Get the ICvar interface
- cvar = ICvar(server['cvar'].get_ptr())
- # Create a global change callback
- # typedef void ( *FnChangeCallback_t )( IConVar *var, const char *pOldValue, float flOldValue );
- @binutils.callback(Convention.CDECL, 'pZf)v')
- def cpp_change_callback(var, str_old_value, float_old_value, ebp):
- print (var, str_old_value, float_old_value)
- # Install the callback
- cvar.InstallGlobalChangeCallback(cpp_change_callback)
- def unload():
- # Remove the callback
- cvar.RemoveGlobalChangeCallback(cpp_change_callback)
- # Free the memory
- cpp_change_callback.free()
Advertisement
Add Comment
Please, Sign In to add comment