extern "C" void GameTickHandler(void* game) { for (DLL* dll: modDLLs) { dll->mod->OnGameTick(game); } } GETTER_VAR(void*, ASMGameTickHandler_jmpback); void ASMGameTickHandler() { asm(".intel_syntax \n" PUSH_ALL "mov rcx, rax \n" // cube::Game* PREPARE_STACK "call GameTickHandler \n" RESTORE_STACK POP_ALL // original code "mov [rsp+0x20], ebx \n" "xor r9d, r9d \n" "xor r8d, r8d \n" "xor edx, edx \n" "lea rcx, [rbp+0xB8] \n" DEREF_JMP(ASMGameTickHandler_jmpback) ); } void SetupGameTickHandler() { WriteFarJMP(Offset(base, 0x136458), (void*)&ASMGameTickHandler); ASMGameTickHandler_jmpback = Offset(base, 0x13646B); }