2025-12-13 18:12:22 +01:00
# define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
# define IMGUI_HAS_DOCK 1
2026-01-05 21:21:39 +01:00
# include "CommonHeaders.h"
2026-01-04 21:39:34 +01:00
# include "HotkeysManager.h"
# include "OSDManager.h"
2025-12-31 14:31:47 +01:00
# include <chrono>
2025-12-13 18:12:22 +01:00
# include <Windows.h>
// Screen informations
static int screenWidth = GetSystemMetrics ( SM_CXSCREEN ) ;
static int screenHeight = GetSystemMetrics ( SM_CYSCREEN ) ;
static float aspectRatio = ( float ) screenWidth / screenHeight ;
// Core game dll functions declarations
typedef void ( * SetBoolFn ) ( bool , bool ) ;
typedef void ( * SetFixesFn ) ( GameFixes , bool ) ;
typedef void ( * SetIntFn ) ( int ) ;
2025-12-21 18:13:22 +01:00
typedef void ( * SetFloatFn ) ( float ) ;
2025-12-13 18:12:22 +01:00
static HMODULE fixLib = nullptr ;
static LONG g_coreInitialized = 0 ;
2026-01-04 21:39:34 +01:00
static LONG g_hotkeysInitialized = 0 ;
static LONG g_uniformReseted = 0 ;
2025-12-13 18:12:22 +01:00
static SetBoolFn SetFixEnabled = nullptr ;
2026-01-04 21:39:34 +01:00
static SetFixesFn SetFixes = nullptr ;
2025-12-13 18:12:22 +01:00
static SetIntFn SetFOV = nullptr ;
static SetIntFn SetHUDScale = nullptr ;
static SetIntFn SetCameraOffset = nullptr ;
2025-12-21 18:13:22 +01:00
static SetFloatFn SetWorldTimeDilation = nullptr ;
2025-12-28 14:51:49 +01:00
static SetFloatFn SetAITimeDilation = nullptr ;
2025-12-26 19:17:24 +01:00
static SetFloatFn SetCameraSmoothness = nullptr ;
2025-12-13 18:12:22 +01:00
static GetGameInfosStruct GetGameInfos = nullptr ;
2026-01-04 21:39:34 +01:00
void SetFixesEnabled ( GameFixes fix , bool value ) {
if ( SetFixes ) SetFixes ( fix , value ) ;
}
2025-12-13 18:12:22 +01:00
// Plugin variables for checkboxes and sliders
static bool fov_fix_enabled = false ;
static bool Camera_fix_enabled = false ;
static bool HUD_fix_enabled = false ;
static bool CA_fix_enabled = false ;
static bool Vignetting_fix_enabled = false ;
static bool Fog_fix_enabled = false ;
2025-12-28 14:51:49 +01:00
static bool Time_Dilation_fix_enabled = false ;
2026-01-04 21:39:34 +01:00
static bool GodMode_fix_enabled = false ;
static bool Ignore_hits_fix_enabled = false ;
2026-01-05 21:21:39 +01:00
static bool Stealth_fix_enabled = false ;
2025-12-13 18:12:22 +01:00
static bool fix_enabled = false ;
static bool console = true ;
static int worldFOVValue = 0 ;
static int HUDScaleValue = 0 ;
static int cameraOffsetValue = 0 ;
2025-12-21 18:13:22 +01:00
static float worldTimeDilationValue = 1.f ;
2025-12-28 14:51:49 +01:00
static float AITimeDilationValue = 1.f ;
2025-12-26 19:17:24 +01:00
static float cameraSmoothnessValue = 3.5f ;
2025-12-31 14:31:47 +01:00
static float OSD_duration = 3.f ;
2025-12-13 18:12:22 +01:00
// Overlays popups
static bool popup_Informations = false ;
static bool show_log_overlay = false ;
static std : : string log_content ;
// Plugin settings
const std : : string SETTINGS_FILE = " ./pluginsettings.ini " ;
2026-01-05 21:21:39 +01:00
const char * FIX_VERSION = " 0.9.7 " ;
2026-01-04 21:39:34 +01:00
const char * FIX_INFORMATIONS = " This fix allows to: \n - Control FOV in game. \n - Control camera distance. \n - Control HUD scaling. \n - Enable cheats. \n - Disable chromatic aberrations. \n - Disable vignetting. \n - Disable fog. \n - Re enable dev console. " ;
2025-12-13 18:12:22 +01:00
const char * DONATION_URL = " https://buymeacoffee.com/k4sh44 " ;
// Scaling factor based on screen resolution
float scale = ( float ) screenHeight / 1200 ;
2025-12-31 14:31:47 +01:00
// Plugin sig
2025-12-13 18:12:22 +01:00
extern " C " __declspec ( dllexport ) const char * NAME = " The Callisto Protocol " ;
2026-01-04 21:39:34 +01:00
extern " C " __declspec ( dllexport ) const char * DESCRIPTION = " Reshade addon to re-enable console, control FOV, camera distance, HUD, some effects and enable cheats. " ;
2026-01-06 09:59:39 +01:00
// Prepare arrays of checkboxes for ImGui
static FixToggle individualFixes [ ] = {
{ " FOV " , & fov_fix_enabled , GameFixes : : FOV } ,
{ " Fog " , & Fog_fix_enabled , GameFixes : : Fog } ,
{ " Vignetting " , & Vignetting_fix_enabled , GameFixes : : Vignetting } ,
{ " Camera distance " , & Camera_fix_enabled , GameFixes : : Camera ,
" Experimental fix. Use at your own risk. " } ,
{ " HUD scaling " , & HUD_fix_enabled , GameFixes : : HUD } ,
{ " Chromatic aberrations " , & CA_fix_enabled , GameFixes : : ChromaticAberrations }
} ;
static FixToggle cheatFixes [ ] = {
{ " Time dilation " , & Time_Dilation_fix_enabled , GameFixes : : TimeDilation , " ALT + 1 (top keyboard row) to toggle " } ,
{ " God mode " , & GodMode_fix_enabled , GameFixes : : GodMode , " ALT + 2 (top keyboard row) to toggle. \n Jacob won't receive any damage. " } ,
{ " Ignore hits " , & Ignore_hits_fix_enabled , GameFixes : : Invulnerable , " ALT + 3 (top keyboard row) to toggle. \n Jacob can't be hit. " } ,
{ " Stealth mode " , & Stealth_fix_enabled , GameFixes : : Stealth , " ALT + 4 (top keyboard row) to toggle. \n Enemies won't attack you " }
} ;
// Prepare array of sliders for ImGui
2026-01-04 21:39:34 +01:00
static SliderFix sliders [ 6 ] ;
2025-12-13 18:12:22 +01:00
// Load and unload game core dll functions /!\ necessary
static void LoadFixDLL ( )
{
// Ensure the Core dll will be called once
if ( InterlockedCompareExchange ( & g_coreInitialized , 1 , 0 ) ! = 0 )
return ;
if ( GetModuleHandleA ( " TheCallistoProtocolCore.dll " ) = = nullptr ) {
fixLib = LoadLibraryA ( " TheCallistoProtocolCore.dll " ) ;
if ( ! fixLib ) {
MessageBoxA ( nullptr , " Impossible to load game core dll " , " Erreur " , MB_OK ) ;
return ;
}
SetFixEnabled = ( SetBoolFn ) GetProcAddress ( fixLib , " SetFixEnabled " ) ;
2026-01-04 21:39:34 +01:00
SetFixes = ( SetFixesFn ) GetProcAddress ( fixLib , " SetFixesEnabled " ) ;
2025-12-13 18:12:22 +01:00
SetFOV = ( SetIntFn ) GetProcAddress ( fixLib , " SetFOV " ) ;
SetHUDScale = ( SetIntFn ) GetProcAddress ( fixLib , " SetHUDScale " ) ;
SetCameraOffset = ( SetIntFn ) GetProcAddress ( fixLib , " SetCameraOffset " ) ;
2025-12-21 18:13:22 +01:00
SetWorldTimeDilation = ( SetFloatFn ) GetProcAddress ( fixLib , " SetWorldTimeDilation " ) ;
2025-12-28 14:51:49 +01:00
SetAITimeDilation = ( SetFloatFn ) GetProcAddress ( fixLib , " SetAITimeDilation " ) ;
2025-12-26 19:17:24 +01:00
SetCameraSmoothness = ( SetFloatFn ) GetProcAddress ( fixLib , " SetCameraSmoothness " ) ;
2025-12-13 18:12:22 +01:00
GetGameInfos = ( GetGameInfosStruct ) GetProcAddress ( fixLib , " GetGameInfos " ) ;
// Apply initial values loaded from settings
if ( SetFOV ) SetFOV ( worldFOVValue ) ;
if ( SetHUDScale ) SetHUDScale ( HUDScaleValue ) ;
if ( SetCameraOffset ) SetCameraOffset ( cameraOffsetValue ) ;
2025-12-21 18:13:22 +01:00
if ( SetWorldTimeDilation ) SetWorldTimeDilation ( worldTimeDilationValue ) ;
2025-12-28 14:51:49 +01:00
if ( SetAITimeDilation ) SetAITimeDilation ( AITimeDilationValue ) ;
2025-12-26 19:17:24 +01:00
if ( SetCameraSmoothness ) SetCameraSmoothness ( cameraSmoothnessValue ) ;
2025-12-13 18:12:22 +01:00
if ( SetFixEnabled ) SetFixEnabled ( fix_enabled , true ) ;
2026-01-04 21:39:34 +01:00
if ( SetFixes ) {
SetFixes ( GameFixes : : FOV , fov_fix_enabled ) ;
SetFixes ( GameFixes : : Camera , Camera_fix_enabled ) ;
SetFixes ( GameFixes : : HUD , HUD_fix_enabled ) ;
SetFixes ( GameFixes : : ChromaticAberrations , CA_fix_enabled ) ;
SetFixes ( GameFixes : : Vignetting , Vignetting_fix_enabled ) ;
SetFixes ( GameFixes : : Fog , Fog_fix_enabled ) ;
SetFixes ( GameFixes : : TimeDilation , Time_Dilation_fix_enabled ) ;
SetFixes ( GameFixes : : GodMode , GodMode_fix_enabled ) ;
SetFixes ( GameFixes : : Invulnerable , Ignore_hits_fix_enabled ) ;
2026-01-05 21:21:39 +01:00
SetFixes ( GameFixes : : Stealth , Stealth_fix_enabled ) ;
2026-01-04 21:39:34 +01:00
SetFixes ( GameFixes : : DevConsole , console ) ;
2025-12-13 18:12:22 +01:00
}
2026-01-04 21:39:34 +01:00
// Declare sliders only when function pointers are initilized (SetFOV ...)
sliders [ 0 ] = { " In game additional FOV " , " ##FOVValue " , SliderType : : Int , & worldFOVValue , - 20 , 50 , SetFOV } ;
sliders [ 1 ] = { " Camera offset (*) " , " ##CameraOffset " , SliderType : : Int , & cameraOffsetValue , 0 , 200 , SetCameraOffset , nullptr , " Value is in cms. " } ;
sliders [ 2 ] = { " HUD scaling " , " ##HUDScale " , SliderType : : Int , & HUDScaleValue , 0 , 40 , SetHUDScale } ;
sliders [ 3 ] = { " Camera smoothness (*) " , " ##CameraSmoothnessValue " , SliderType : : Float , & cameraSmoothnessValue , 2.f , 10.f , SetCameraSmoothness , " %.2f " ,
" The higher the value, the quicker the camera transition is. " } ;
sliders [ 4 ] = { " World time dilation " , " ##WorldTimeDilationValue " , SliderType : : Float , & worldTimeDilationValue , 0.f , 2.f , SetWorldTimeDilation , nullptr ,
" Will affect everything in the world. \n Default value is 1. " } ;
sliders [ 5 ] = { " AI time dilation " , " ##AITimeDilationValue " , SliderType : : Float , & AITimeDilationValue , 0.f , 2.f , SetAITimeDilation , nullptr ,
" Will affect only enemies in the world. \n Default value is 1. " } ;
2025-12-13 18:12:22 +01:00
}
}
// Settings functions
2026-01-04 21:39:34 +01:00
static void SaveSettings ( ) {
2025-12-13 18:12:22 +01:00
ini : : IniFile pluginIniFile ;
pluginIniFile [ " 1#General fix " ] . setComment ( std : : vector < std : : string > { " The following sections are saved by plugin " ,
" You should not need to modify them " ,
" " ,
" Controls if fix mod (globally) is enabled " ,
" Set Console to false if you don't want dev console to be enabled " } ) ;
pluginIniFile [ " 1#General fix " ] [ " Enabled " ] = fix_enabled ;
pluginIniFile [ " 1#General fix " ] [ " Console " ] = console ;
2025-12-31 14:31:47 +01:00
pluginIniFile [ " 1#General fix " ] [ " OSD duration " ] = OSD_duration ;
2025-12-13 18:12:22 +01:00
pluginIniFile [ " 2#Individual fix " ] . setComment ( " Controls each fix individually " ) ;
pluginIniFile [ " 2#Individual fix " ] [ " FOV " ] = fov_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " Camera " ] = Camera_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " HUD " ] = HUD_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " Chromatic aberrations " ] = CA_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " Vignetting " ] = Vignetting_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " Fog " ] = Fog_fix_enabled ;
2025-12-28 14:51:49 +01:00
pluginIniFile [ " 2#Individual fix " ] [ " Time dilation " ] = Time_Dilation_fix_enabled ;
2026-01-04 21:39:34 +01:00
pluginIniFile [ " 2#Individual fix " ] [ " God Mode " ] = GodMode_fix_enabled ;
pluginIniFile [ " 2#Individual fix " ] [ " Ignore hits " ] = Ignore_hits_fix_enabled ;
2026-01-05 21:21:39 +01:00
pluginIniFile [ " 2#Individual fix " ] [ " Stealth " ] = Stealth_fix_enabled ;
2025-12-13 18:12:22 +01:00
pluginIniFile [ " 3#Fixes tuning " ] . setComment ( " Individual fix fine tune " ) ;
pluginIniFile [ " 3#Fixes tuning " ] [ " World FOV " ] = worldFOVValue ;
pluginIniFile [ " 3#Fixes tuning " ] [ " HUD scale " ] = HUDScaleValue ;
pluginIniFile [ " 3#Fixes tuning " ] [ " Camera offset " ] = cameraOffsetValue ;
2025-12-21 18:13:22 +01:00
pluginIniFile [ " 3#Fixes tuning " ] [ " World time dilation scale " ] = worldTimeDilationValue ;
2025-12-28 14:51:49 +01:00
pluginIniFile [ " 3#Fixes tuning " ] [ " AI time dilation scale " ] = AITimeDilationValue ;
2025-12-26 19:17:24 +01:00
pluginIniFile [ " 3#Fixes tuning " ] [ " Camera smoothness " ] = cameraSmoothnessValue ;
2025-12-13 18:12:22 +01:00
pluginIniFile . save ( SETTINGS_FILE ) ;
}
2026-01-04 21:39:34 +01:00
static void LoadSettings ( ) {
2025-12-13 18:12:22 +01:00
ini : : IniFile pluginIniFile ;
try {
pluginIniFile . load ( SETTINGS_FILE ) ;
2025-12-21 18:13:22 +01:00
fix_enabled = pluginIniFile [ " 1#General fix " ] [ " Enabled " ] . as < bool > ( ) ;
console = pluginIniFile [ " 1#General fix " ] [ " Console " ] . as < bool > ( ) ;
2025-12-31 14:31:47 +01:00
OSD_duration = pluginIniFile [ " 1#General fix " ] [ " OSD duration " ] . as < float > ( ) ;
2025-12-21 18:13:22 +01:00
fov_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " FOV " ] . as < bool > ( ) ;
HUD_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " HUD " ] . as < bool > ( ) ;
Camera_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Camera " ] . as < bool > ( ) ;
CA_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Chromatic aberrations " ] . as < bool > ( ) ;
Vignetting_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Vignetting " ] . as < bool > ( ) ;
Fog_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Fog " ] . as < bool > ( ) ;
2025-12-28 14:51:49 +01:00
Time_Dilation_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Time dilation " ] . as < bool > ( ) ;
2026-01-04 21:39:34 +01:00
GodMode_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " God Mode " ] . as < bool > ( ) ;
Ignore_hits_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Ignore hits " ] . as < bool > ( ) ;
2026-01-05 21:21:39 +01:00
Stealth_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Stealth " ] . as < bool > ( ) ;
2025-12-21 18:13:22 +01:00
worldFOVValue = pluginIniFile [ " 3#Fixes tuning " ] [ " World FOV " ] . as < int > ( ) ;
HUDScaleValue = pluginIniFile [ " 3#Fixes tuning " ] [ " HUD scale " ] . as < int > ( ) ;
cameraOffsetValue = pluginIniFile [ " 3#Fixes tuning " ] [ " Camera offset " ] . as < float > ( ) ;
worldTimeDilationValue = pluginIniFile [ " 3#Fixes tuning " ] [ " World time dilation scale " ] . as < float > ( ) ;
2025-12-28 14:51:49 +01:00
AITimeDilationValue = pluginIniFile [ " 3#Fixes tuning " ] [ " AI time dilation scale " ] . as < float > ( ) ;
2025-12-27 09:38:56 +01:00
cameraSmoothnessValue = pluginIniFile [ " 3#Fixes tuning " ] [ " Camera smoothness " ] . as < float > ( ) ;
2025-12-13 18:12:22 +01:00
}
catch ( const std : : exception & e ) { }
}
// Read plugin log file
2025-12-31 14:31:47 +01:00
static std : : string read_log_file ( const std : : string & filename ) {
2025-12-13 18:12:22 +01:00
std : : ifstream file ( filename ) ;
2025-12-31 14:31:47 +01:00
std : : string log ;
if ( ! file . is_open ( ) ) {
log = " Impossible to open file : " + filename ;
return log ;
2025-12-13 18:12:22 +01:00
}
std : : ostringstream ss ;
ss < < file . rdbuf ( ) ;
2025-12-31 14:31:47 +01:00
log = ss . str ( ) ;
return log ;
2025-12-13 18:12:22 +01:00
}
// Initialize ImGui widgets for Reshade
2026-01-04 21:39:34 +01:00
static void on_overlay_draw ( reshade : : api : : effect_runtime * runtime ) {
2025-12-13 18:12:22 +01:00
ImGuiStyle & style = ImGui : : GetStyle ( ) ;
style . ItemSpacing = ImVec2 ( 8 * scale , 8 * scale ) ; // Spacing between widgets
style . FramePadding = ImVec2 ( 3 * scale , 3 * scale ) ; // Widgets padding
style . WindowPadding = ImVec2 ( 10 * scale , 10 * scale ) ; // Overlay padding
style . CellPadding = ImVec2 ( 10 * scale , 10 * scale ) ; // Table cells padding
ImGui : : SetNextWindowSize ( ImVec2 ( 350 * scale , 150 * scale ) , ImGuiCond_Once ) ;
ImGui : : PushStyleColor ( ImGuiCol_Button , ImVec4 ( 0.84f , 0.12f , 0.51f , 1.0f ) ) ; // pink
ImGui : : PushStyleColor ( ImGuiCol_ButtonHovered , ImVec4 ( 0.84f , 0.12f , 0.51f , 1.0f ) ) ; // pink
ImGui : : PushStyleColor ( ImGuiCol_ButtonActive , ImVec4 ( 0.84f , 0.2f , 0.51f , 1.0f ) ) ; // pink
ImGui : : PushStyleColor ( ImGuiCol_Text , ImVec4 ( 0.8f , 1.f , 1.f , 1.f ) ) ; // white
if ( ImGui : : Button ( " Like my work ? Consider donation " ) ) ShellExecuteA ( NULL , " open " , DONATION_URL , NULL , NULL , SW_SHOWNORMAL ) ; // Donation
ImGui : : PopStyleColor ( 4 ) ; // Restore color
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Fix informations " ) ) popup_Informations = true ; // Fix information
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " View logs " ) ) {
2025-12-31 14:31:47 +01:00
log_content = read_log_file ( " TheCallistoProtocol.log " ) ;
2025-12-13 18:12:22 +01:00
show_log_overlay = true ; // Fix information
}
2026-01-04 21:39:34 +01:00
if ( popup_Informations ) {
2025-12-13 18:12:22 +01:00
ImGui : : Begin ( " Informations " , & popup_Informations , ImGuiWindowFlags_AlwaysAutoResize ) ;
ImGui : : Text ( " Version : %s " , FIX_VERSION ) ;
ImGui : : Text ( FIX_INFORMATIONS ) ;
ImGui : : End ( ) ;
}
2026-01-04 21:39:34 +01:00
if ( show_log_overlay ) {
2025-12-13 18:12:22 +01:00
ImGui : : Begin ( " Game log " , & show_log_overlay , ImGuiWindowFlags_AlwaysAutoResize ) ;
ImGui : : TextUnformatted ( log_content . c_str ( ) ) ;
ImGui : : End ( ) ;
}
ImGui : : PushStyleVar ( ImGuiStyleVar_CellPadding , ImVec2 ( 10 * scale , 10 * scale ) ) ;
2025-12-28 14:51:49 +01:00
if ( ImGui : : BeginTabBar ( " MainTabs " ) ) {
if ( ImGui : : BeginTabItem ( " Fixes " ) ) {
if ( ImGui : : BeginTable ( " FixesTable " , 2 , ImGuiTableFlags_SizingStretchSame ) ) {
ImGui : : TableSetupColumn ( " LeftFix " , ImGuiTableColumnFlags_WidthStretch , 0.4f ) ;
ImGui : : TableSetupColumn ( " RightFix " , ImGuiTableColumnFlags_WidthStretch , 0.6f ) ;
2025-12-13 18:12:22 +01:00
ImGui : : TableNextRow ( ) ;
2025-12-28 14:51:49 +01:00
// Drawing a left column with slider and general fix
2025-12-13 18:12:22 +01:00
ImGui : : TableSetColumnIndex ( 0 ) ;
2025-12-28 14:51:49 +01:00
if ( ImGui : : CollapsingHeader ( " Enable fixes " , ImGuiTreeNodeFlags_DefaultOpen ) )
if ( ImGui : : Checkbox ( " Fix enabled " , & fix_enabled ) ) {
if ( SetFixEnabled ) SetFixEnabled ( fix_enabled , false ) ;
SaveSettings ( ) ;
}
2025-12-13 18:12:22 +01:00
2025-12-28 14:51:49 +01:00
// Individual fixes
ImGui : : TableSetColumnIndex ( 1 ) ;
if ( ImGui : : CollapsingHeader ( " Individual fixes " , ImGuiTreeNodeFlags_DefaultOpen ) ) {
if ( ImGui : : BeginTable ( " IndividualFixesTable " , 2 , ImGuiTableFlags_SizingStretchSame ) ) {
ImGui : : TableSetupColumn ( " IndFix1 " , ImGuiTableColumnFlags_WidthStretch , 0.35f ) ;
ImGui : : TableSetupColumn ( " IndFix2 " , ImGuiTableColumnFlags_WidthStretch , 0.65f ) ;
ImGui : : TableNextRow ( ) ;
ImGui : : TableSetColumnIndex ( 0 ) ;
2026-01-04 21:39:34 +01:00
for ( int i = 0 ; i < 3 ; + + i ) DrawFixCheckbox ( individualFixes [ i ] ) ;
2025-12-28 14:51:49 +01:00
ImGui : : TableSetColumnIndex ( 1 ) ;
2026-01-04 21:39:34 +01:00
for ( int i = 3 ; i < IM_ARRAYSIZE ( individualFixes ) ; + + i ) DrawFixCheckbox ( individualFixes [ i ] ) ;
2025-12-28 14:51:49 +01:00
ImGui : : EndTable ( ) ;
}
2025-12-13 18:12:22 +01:00
}
2025-12-28 14:51:49 +01:00
ImGui : : EndTable ( ) ;
}
2025-12-13 18:12:22 +01:00
2025-12-31 14:31:47 +01:00
// Sliders
2025-12-28 14:51:49 +01:00
if ( ImGui : : BeginTable ( " SlidersTable " , 2 , ImGuiTableFlags_SizingStretchSame ) ) {
ImGui : : TableSetupColumn ( " LeftSliders " , ImGuiTableColumnFlags_WidthStretch , 0.5f ) ;
ImGui : : TableSetupColumn ( " RightSliders " , ImGuiTableColumnFlags_WidthStretch , 0.5f ) ;
ImGui : : TableNextRow ( ) ;
ImGui : : TableSetColumnIndex ( 0 ) ;
2026-01-04 21:39:34 +01:00
for ( int i = 0 ; i < 2 ; + + i ) DrawSlider ( sliders [ i ] , 200 ) ;
2025-12-28 14:51:49 +01:00
ImGui : : TableSetColumnIndex ( 1 ) ;
2026-01-04 21:39:34 +01:00
for ( int i = 2 ; i < 4 ; + + i ) DrawSlider ( sliders [ i ] , 180 ) ;
2025-12-13 18:12:22 +01:00
ImGui : : EndTable ( ) ;
}
2025-12-28 14:51:49 +01:00
ImGui : : EndTabItem ( ) ;
2025-12-13 18:12:22 +01:00
}
2025-12-28 14:51:49 +01:00
if ( ImGui : : BeginTabItem ( " Cheats " ) )
2025-12-13 18:12:22 +01:00
{
2026-01-04 21:39:34 +01:00
for ( const auto & cheat : cheatFixes ) DrawFixCheckbox ( cheat ) ;
2025-12-13 18:12:22 +01:00
2025-12-28 14:51:49 +01:00
if ( ImGui : : BeginTable ( " SlidersTable " , 2 , ImGuiTableFlags_SizingStretchSame ) ) {
ImGui : : TableSetupColumn ( " LeftSliders " , ImGuiTableColumnFlags_WidthStretch , 0.5f ) ;
ImGui : : TableSetupColumn ( " RightSliders " , ImGuiTableColumnFlags_WidthStretch , 0.5f ) ;
ImGui : : TableNextRow ( ) ;
2025-12-26 19:17:24 +01:00
2025-12-28 14:51:49 +01:00
ImGui : : TableSetColumnIndex ( 0 ) ;
2026-01-04 21:39:34 +01:00
DrawSlider ( sliders [ 4 ] , 180 ) ;
2025-12-28 14:51:49 +01:00
ImGui : : TableSetColumnIndex ( 1 ) ;
2026-01-04 21:39:34 +01:00
DrawSlider ( sliders [ 5 ] , 180 ) ;
2025-12-28 14:51:49 +01:00
ImGui : : EndTable ( ) ;
2025-12-26 19:17:24 +01:00
}
2025-12-28 14:51:49 +01:00
ImGui : : EndTabItem ( ) ;
2025-12-26 19:17:24 +01:00
}
2025-12-28 14:51:49 +01:00
ImGui : : EndTabBar ( ) ;
2025-12-13 18:12:22 +01:00
}
ImGui : : PopStyleVar ( ) ;
// Fix status
if ( ImGui : : CollapsingHeader ( " Fix informations " , ImGuiTreeNodeFlags_DefaultOpen ) ) {
ImGui : : Text ( " Screen width: %d, height: %d, aspect ratio: %.2f " , screenWidth , screenHeight , aspectRatio ) ;
if ( GetGameInfos ) {
GameInfos infos { } ;
GetGameInfos ( & infos ) ;
2026-01-04 21:39:34 +01:00
if ( infos . consoleEnabled ) ImGui : : Text ( " Console enabled and bound to key F2 " ) ;
2025-12-17 19:19:11 +01:00
ImGui : : TextColored ( ImColor ( 48 , 179 , 25 ) , " FOV In: %.2f, Out: %.2f, Pawn camera offset: %.2f " , infos . FOVIn , infos . FOVOut , infos . CompensatedFOV ) ;
2025-12-13 18:12:22 +01:00
}
}
}
2025-12-23 15:43:36 +01:00
static void on_reshade_present ( reshade : : api : : effect_runtime * runtime ) {
2026-01-04 21:39:34 +01:00
static auto last = std : : chrono : : steady_clock : : now ( ) ;
2025-12-31 14:31:47 +01:00
auto now = std : : chrono : : steady_clock : : now ( ) ;
2025-12-23 15:43:36 +01:00
2026-01-04 21:39:34 +01:00
float dt = std : : chrono : : duration < float > ( now - last ) . count ( ) ;
last = now ;
2025-12-31 14:31:47 +01:00
2026-01-04 21:39:34 +01:00
ProcessHotkeys ( runtime ) ;
UpdateOSD ( runtime , dt ) ;
2025-12-23 15:43:36 +01:00
}
2025-12-31 14:31:47 +01:00
// Retrieve all shader uniform variables
static void on_reshade_begin_effects ( reshade : : api : : effect_runtime * runtime , reshade : : api : : command_list * cmd_list ,
reshade : : api : : resource_view rtv , reshade : : api : : resource_view rtv_srgb ) {
2026-01-04 21:39:34 +01:00
if ( ! runtime ) return ;
2026-01-06 09:59:39 +01:00
FindAllUniformVariables ( runtime , OSD_SHADER_NAME ) ;
2026-01-04 21:39:34 +01:00
if ( InterlockedCompareExchange ( & g_uniformReseted , 1 , 0 ) ! = 0 ) return ; // reset OSD uniforms once
ResetAllUniformVariables ( runtime , OSD_SHADER_NAME ) ;
runtime - > save_current_preset ( ) ; // Save shader preset
}
2026-01-05 21:21:39 +01:00
static void InitializeHotkeys ( ) { // Initialize hotkeys for cheats
2026-01-04 21:39:34 +01:00
if ( InterlockedCompareExchange ( & g_hotkeysInitialized , 1 , 0 ) ! = 0 ) return ; // Initialize hotkeys once
2026-01-05 21:21:39 +01:00
RegisterHotkey ( ' 1 ' , Modifier : : Alt , [ ] {
ToggleOSD ( Time_Dilation_fix_enabled , GameFixes : : TimeDilation ,
u_td_show , u_td_enabled , OSD_duration ,
{ { u_td_world , worldTimeDilationValue } , { u_td_AI , AITimeDilationValue } } ) ;
} ) ;
RegisterHotkey ( ' 2 ' , Modifier : : Alt , [ ] {
ToggleOSD ( GodMode_fix_enabled , GameFixes : : GodMode , u_GodMode_show , u_GodMode_enabled , OSD_duration ) ;
2026-01-04 21:39:34 +01:00
} ) ;
2026-01-05 21:21:39 +01:00
RegisterHotkey ( ' 3 ' , Modifier : : Alt , [ ] {
ToggleOSD ( Ignore_hits_fix_enabled , GameFixes : : Invulnerable , u_Invulnerability_show , u_Invulnerability_enabled , OSD_duration ) ;
2026-01-04 21:39:34 +01:00
} ) ;
2026-01-05 21:21:39 +01:00
RegisterHotkey ( ' 4 ' , Modifier : : Alt , [ ] {
ToggleOSD ( Stealth_fix_enabled , GameFixes : : Stealth , u_Stealth_show , u_Stealth_enabled , OSD_duration ) ;
2026-01-04 21:39:34 +01:00
} ) ;
2025-12-31 14:31:47 +01:00
}
2025-12-13 18:12:22 +01:00
// Main dll intrance
BOOL WINAPI DllMain ( HINSTANCE hinstDLL , DWORD ul_reason_for_call , LPVOID )
{
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH :
if ( ! reshade : : register_addon ( hinstDLL ) )
return FALSE ;
LoadSettings ( ) ;
reshade : : register_overlay ( " The Callisto Protocol " , & on_overlay_draw ) ;
reshade : : register_event < reshade : : addon_event : : init_effect_runtime > (
[ ] ( reshade : : api : : effect_runtime * runtime ) {
LoadFixDLL ( ) ;
2026-01-04 21:39:34 +01:00
InitializeHotkeys ( ) ;
2025-12-13 18:12:22 +01:00
} ) ;
2025-12-23 15:43:36 +01:00
reshade : : register_event < reshade : : addon_event : : reshade_present > ( & on_reshade_present ) ;
2025-12-31 14:31:47 +01:00
reshade : : register_event < reshade : : addon_event : : reshade_begin_effects > ( & on_reshade_begin_effects ) ;
2025-12-13 18:12:22 +01:00
break ;
case DLL_PROCESS_DETACH :
2025-12-23 15:43:36 +01:00
reshade : : unregister_event < reshade : : addon_event : : reshade_present > ( & on_reshade_present ) ;
2025-12-31 14:31:47 +01:00
reshade : : unregister_event < reshade : : addon_event : : reshade_begin_effects > ( & on_reshade_begin_effects ) ;
2025-12-13 18:12:22 +01:00
reshade : : unregister_addon ( hinstDLL ) ;
break ;
}
return TRUE ;
}