Medieval Songbook

homeblogmastodonblueskythingiverse



Xhook Crossfire Better -

Here are a few different types of content depending on what exactly you are looking for.

4.2. Fixing the "Flicker" Bug

Standard Crossfire flickers because the front buffer is rendered on GPU0 but presented on GPU1. Use XHook to intercept Present: xhook crossfire better

5. No malloc in Signal Handler

Original XHook may call dladdr/malloc inside hook stub → unsafe.
Improved version pre-allocates stack-safe buffers. Here are a few different types of content

3.2. Implement a "Sleep-Bypass" for Input Hooking

Most recoil scripts using GetCursorPos hooking cause input lag. To make XHook better: Calculate the frame ID

3.1. Move from Inline Hooking to VTable Hooking

Standard XHook uses mprotect (Linux) or VirtualProtect (Windows) to change page permissions. This is slow and triggers anti-cheat. The "Better" Way: Hook the VTable of the DirectX device instead.

// Instead of hooking EndScene directly via trampoline:
// Better: Swap the VTable entry.
DWORD* vTable = (DWORD*)pDevice;
vTable[42] = (DWORD)MyEndScene; // VTable hook - faster, fewer page faults.

This reduces overhead by ~40% because you aren't detouring every single call.

2. Safe Trampoline Generation




[æ]