KitserverOverlay provides optional on-screen feedback by integrating with Kitserver’s rendering pipeline. All Kitserver APIs are resolved at runtime viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/angelballay/pes6_game_physics_mod/llms.txt
Use this file to discover all available pages before exploring further.
GetProcAddress — the mod compiles and runs without Kitserver being present. If kload.dll is not loaded when InstallKitserverOverlay is called, the overlay is silently disabled and all other mod functionality continues normally.
Dynamic Loading Strategy
At install time,GetModuleHandleA("kload.dll") is called to check whether Kitserver is present in the process. If the handle is NULL, the overlay is skipped entirely. If the module is found, four exports are resolved by name:
Kitserver Function Pointer Typedefs
| Export name | Purpose |
|---|---|
HookFunction | Registers a callback for a Kitserver hook point |
UnhookFunction | Removes a previously registered callback |
KDrawText | Draws text on screen at (x, y) with the given color and font size |
KGetTextExtent | Measures the pixel dimensions of a string for a given font size |
nullptr and the overlay is disabled. No partial state is left behind.
Hook IDs
The overlay uses theKitserverHookId enum to identify the D3D callback slot:
hk_D3D_Present = 3, which fires on every Direct3D Present call — once per rendered frame.
Public API
InstallKitserverOverlay
CRITICAL_SECTION used to protect g_lastEnabled, loads the four Kitserver exports, and calls g_hookFunction(hk_D3D_Present, (DWORD)ABPhysicsPresent) to register the per-frame callback. Returns false if kload.dll is absent or any export is missing. Called from MainThread in dllmain.cpp after the game hooks are installed.
UninstallKitserverOverlay
g_unhookFunction(hk_D3D_Present, (DWORD)ABPhysicsPresent) to deregister the callback, then calls DeleteCriticalSection to release the overlay lock. Called from the DLL_PROCESS_DETACH branch of DllMain.
ShowPhysicsModOverlayMessage
enabled in g_lastEnabled (under the critical section), sets g_messageUntilTick = GetTickCount() + 2200, and sets g_drawMessage = 1 via InterlockedExchange. The message will be visible for 2.2 seconds from the moment this function is called. Called by HotkeyToggle immediately after each toggle.
IsKitserverOverlayAvailable
g_overlayInstalled. Used by MainThread to decide whether to log a warning about the overlay not being available.
Rendering
ABPhysicsPresent is the D3D Present callback registered with Kitserver. Its signature matches the hk_D3D_Present prototype:
DrawPhysicsMessage() and increments a frame counter.
DrawPhysicsMessage runs every frame and checks whether a message is active:
- If
g_drawMessage == 0, returns immediately (nothing to draw). - Compares
GetTickCount()againstg_messageUntilTick. If the timer has expired, clearsg_drawMessageand returns. - Reads
g_lastEnabledunder the critical section to determine the message text and color. - Calls
g_kGetTextExtent(text, 16, &size)to measure the string width. - Centers horizontally against a 640-pixel base width:
x = (640.0f - size.cx) / 2.0f. - Draws at
y = 26.0fwithabsolute = true.
| State | Text | Color |
|---|---|---|
| Enabled | FISICAS ACTIVADAS | 0xff40ff40 (green) |
| Disabled | FISICAS DESACTIVADAS | 0xffff4040 (red) |
(x + 2, y + 2) in solid black (0xff000000), then the colored text is drawn on top.
Even when Kitserver is not present and the overlay is unavailable, the toggle still functions fully.
HotkeyToggle logs the new state via LogFormat("[HOTKEY] Mod de fisicas %s", ...) whenever ENABLED = true in Logger.cpp, and MainThread logs "[WARN] Overlay Kitserver no disponible. El toggle funcionara igual por log." at startup to confirm the degraded-but-functional state.