Skip to content

AlvinHV/KCD2_mac_fix

Repository files navigation

hook.dll

A dynamic library that hooks into the KCD2's cry engine to monitor shader resources, apply fixes for mac in runtime, and provide runtime debugging capabilities.

Overview

This DLL injects into the game process to hooks engine functions, log shader information, and apply memory patches. It includes hotkey-controlled logging to minimize performance overhead during normal gameplay.

Source Files

hook.cpp

Entry point of the DLL. Handles initialization and sets up the hooking system when the library is loaded into the game process.

log_shader_count.cpp

Monitors and logs the shader resource count by printing CShader::s_ShaderResources_known.Num() to the log file. Useful for tracking shader loading and resource usage.

patch_memory.cpp

Applies binary patches to the game engine in memory at runtime. Allows modification of engine behavior without altering game files on disk.

print_stacktrace.cpp

Contains utility functions that print the call stack to the log file. Essential for debugging and understanding code execution flow when hooks are triggered.

load_shader_hook.cpp

Contains the core hooking functions that intercept game engine shader loading functions. Monitors shader operations and provides detailed logging capabilities.

check_key.cpp

Implements keyboard input monitoring to dynamically control logging behavior. Allows enabling/disabling extensive logging on-demand via hotkeys.

Purpose: Prevents performance overhead from excessive logging by keeping detailed logs disabled during normal gameplay and enabling them only when needed for debugging.

Usage

  1. Place hook.dll in the game's binary directory (see Extra folder instructions)
  2. Enable Wine override for DLL injection
  3. Launch the game
  4. Use configured hotkeys to toggle verbose logging when debugging is needed
  5. Check log files for shader information and stack traces:

About

No longer needed since it is fixed in 1.5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published