From d96396abe14c23f85d478c28a46654ca1e54fa8d Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Sun, 21 Dec 2025 18:13:22 +0100 Subject: [PATCH] Add World time dilation --- The Callisto Protocol/dllmain.cpp | 56 +++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/The Callisto Protocol/dllmain.cpp b/The Callisto Protocol/dllmain.cpp index 301f194..15a6b5e 100644 --- a/The Callisto Protocol/dllmain.cpp +++ b/The Callisto Protocol/dllmain.cpp @@ -18,6 +18,7 @@ static float aspectRatio = (float)screenWidth / screenHeight; typedef void (*SetBoolFn)(bool, bool); typedef void (*SetFixesFn)(GameFixes ,bool); typedef void (*SetIntFn)(int); +typedef void (*SetFloatFn)(float); static HMODULE fixLib = nullptr; static LONG g_coreInitialized = 0; @@ -26,6 +27,7 @@ static SetFixesFn SetFixesEnabled = nullptr; static SetIntFn SetFOV = nullptr; static SetIntFn SetHUDScale = nullptr; static SetIntFn SetCameraOffset = nullptr; +static SetFloatFn SetWorldTimeDilation = nullptr; static GetGameInfosStruct GetGameInfos = nullptr; // Plugin variables for checkboxes and sliders @@ -35,11 +37,13 @@ static bool HUD_fix_enabled = false; static bool CA_fix_enabled = false; static bool Vignetting_fix_enabled = false; static bool Fog_fix_enabled = false; +static bool World_Time_Dilation_fix_enabled = false; static bool fix_enabled = false; static bool console = true; static int worldFOVValue = 0; static int HUDScaleValue = 0; static int cameraOffsetValue = 0; +static float worldTimeDilationValue = 1.f; // Overlays popups static bool popup_Informations = false; @@ -48,15 +52,15 @@ static std::string log_content; // Plugin settings const std::string SETTINGS_FILE = "./pluginsettings.ini"; -const char* FIX_VERSION = "0.9.2"; -const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console."; +const char* FIX_VERSION = "0.9.3"; +const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Control world time dilation.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console."; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; // Scaling factor based on screen resolution float scale = (float)screenHeight / 1200; extern "C" __declspec(dllexport) const char* NAME = "The Callisto Protocol"; -extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, HUD and some effects."; +extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, world time dilation, HUD and some effects."; // Load and unload game core dll functions /!\ necessary static void LoadFixDLL() @@ -78,12 +82,14 @@ static void LoadFixDLL() SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale"); SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset"); + SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation"); GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos"); // Apply initial values loaded from settings if (SetFOV) SetFOV(worldFOVValue); if (SetHUDScale) SetHUDScale(HUDScaleValue); if (SetCameraOffset) SetCameraOffset(cameraOffsetValue); + if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixesEnabled) { SetFixesEnabled(GameFixes::FOV, fov_fix_enabled); @@ -92,6 +98,7 @@ static void LoadFixDLL() SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled); SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled); SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled); + SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled); SetFixesEnabled(GameFixes::DevConsole, console); } } @@ -115,10 +122,12 @@ static void SaveSettings() 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; + pluginIniFile["2#Individual fix"]["World time dilation"] = World_Time_Dilation_fix_enabled; 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; + pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue; pluginIniFile.save(SETTINGS_FILE); } @@ -128,17 +137,19 @@ static void LoadSettings() ini::IniFile pluginIniFile; try { pluginIniFile.load(SETTINGS_FILE); - fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as(); - console = pluginIniFile["1#General fix"]["Console"].as(); - fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as(); - HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as(); - Camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as(); - CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as(); - Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as(); - Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as(); - worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as(); - HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as(); - cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as(); + fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as(); + console = pluginIniFile["1#General fix"]["Console"].as(); + fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as(); + HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as(); + Camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as(); + CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as(); + Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as(); + Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as(); + World_Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["World time dilation"].as(); + worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as(); + HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as(); + cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as(); + worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as(); } catch (const std::exception& e) {} } @@ -246,6 +257,11 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) ImGui::EndTooltip(); } + if (ImGui::Checkbox("World time dilation", &World_Time_Dilation_fix_enabled)) { + if (SetFixesEnabled) SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled); + SaveSettings(); + } + if (ImGui::Checkbox("HUD scaling", &HUD_fix_enabled)) { if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled); SaveSettings(); @@ -300,6 +316,18 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) ImGui::EndTooltip(); } + if (ImGui::CollapsingHeader("World time dilation", ImGuiTreeNodeFlags_DefaultOpen)) + { + ImGui::SetNextItemWidth(180 * scale); + if (ImGui::SliderFloat("##WorldTimeDilationValue", &worldTimeDilationValue, 0, 2, "%.2f")) { + if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); SaveSettings(); + } + } + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Default value is 1."); + ImGui::EndTooltip(); + } ImGui::EndTable(); } ImGui::PopStyleVar();