From bdeadc503673757a636820b33588f67048fc62ba Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Sun, 1 Feb 2026 21:57:07 +0100 Subject: [PATCH] Add cheats --- SilentHill2Remake/dllmain.cpp | 260 +++++++++++++++++++++++----------- 1 file changed, 181 insertions(+), 79 deletions(-) diff --git a/SilentHill2Remake/dllmain.cpp b/SilentHill2Remake/dllmain.cpp index 38a49f7..7e58773 100644 --- a/SilentHill2Remake/dllmain.cpp +++ b/SilentHill2Remake/dllmain.cpp @@ -2,6 +2,9 @@ #define IMGUI_HAS_DOCK 1 #include "CommonHeaders.h" +#include "HotkeysManager.h" +#include "OSDManager.h" +#include #include // Screen informations @@ -12,22 +15,20 @@ 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); -typedef void (*SetFloatFn)(float); +typedef void (*SetFloatFn)(GameSetting, float); static HMODULE fixLib = nullptr; static LONG g_coreInitialized = 0; +static LONG g_hotkeysInitialized = 0; +static LONG g_uniformReseted = 0; static SetBoolFn SetFixEnabled = nullptr; static SetFixesFn SetFixes = nullptr; -static SetIntFn SetFOV = nullptr; -static SetFloatFn SetCameraDistance = nullptr; -static SetFloatFn SetFogDensity = nullptr; -static SetFloatFn SetFogMaxOpacity = nullptr; +static SetFloatFn SetValues = nullptr; static GetGameInfosStruct GetGameInfos = nullptr; - void SetFixesEnabled(GameFixes fix, bool value) { if (SetFixes) SetFixes(fix, value); } // Plugin variables for checkboxes and sliders +static bool skip_Intro_enabled = true; static bool fov_fix_enabled = false; static bool ultrawide_fix_enabled = false; static bool cutscenes_FPS_fix_enabled = false; @@ -37,11 +38,18 @@ static bool CA_fix_enabled = false; static bool Vignetting_fix_enabled = false; static bool Fog_fix_enabled = false; static bool fix_enabled = false; +static bool Time_Dilation_fix_enabled = false; +static bool GodMode_fix_enabled = false; +static bool Ignore_hits_fix_enabled = false; +static bool StealthMode_fix_enabled = false; static bool console = true; static int worldFOVvalue = 0.f; static float CameraDistancevalue = 1.f; static float fogDensityValue = 0.15f; static float fogMaxOpacityValue = 1.f; +static float worldTimeDilationValue = 1.f; +static float AITimeDilationValue = 1.f; +static float OSD_duration = 3.f; // Overlays popups static bool popup_Informations = false; @@ -50,8 +58,8 @@ static std::string log_content; // Plugin settings const std::string SETTINGS_FILE = "./pluginsettings.ini"; -const char* FIX_VERSION = "1.0.2"; -const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Enable ultrawide in custcenes.\n - Unlock cutscenes framerate.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console."; +const char* FIX_VERSION = "1.0.3"; +const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Enable ultrawide in custcenes.\n - Unlock cutscenes framerate.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.\n - Enable cheats"; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; // Prepare arrays of checkboxes for ImGui @@ -66,14 +74,20 @@ static FixToggle individualFixes[] = { { "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.\nJames won't receive any damage." }, + { "Ignore hits", &Ignore_hits_fix_enabled, GameFixes::IgnoreHits, "ALT + 3 (top keyboard row) to toggle.\nJames can't be hit." }, + { "Stealth mode",&StealthMode_fix_enabled, GameFixes::Stealth, "ALT + 4 (top keyboard row) to toggle.\nEnemies won't attack." } +}; + // Scaling factor based on screen resolution float scale = (float)screenHeight / 1200; // Prepare array of sliders for ImGui -static SliderFix sliders[4]; +static SliderFix2 sliders[6]; // Load and unload game core dll functions /!\ necessary -static void LoadFixDLL() -{ +static void LoadFixDLL() { if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0) return; @@ -87,19 +101,21 @@ static void LoadFixDLL() SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled"); SetFixes = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled"); - SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); - SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance"); - SetFogDensity = (SetFloatFn)GetProcAddress(fixLib, "SetFogDensity"); - SetFogMaxOpacity = (SetFloatFn)GetProcAddress(fixLib, "SetFogMaxOpacity"); + SetValues = (SetFloatFn)GetProcAddress(fixLib, "SetValues"); GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos"); // Apply initial values loaded from settings - if (SetFOV) SetFOV(worldFOVvalue); - if (SetCameraDistance) SetCameraDistance(CameraDistancevalue); - if (SetFogDensity) SetFogDensity(fogDensityValue); - if (SetFogMaxOpacity) SetFogMaxOpacity(fogMaxOpacityValue); + if (SetValues) { + SetValues(GameSetting::FOV, worldFOVvalue); + SetValues(GameSetting::CameraDistance, CameraDistancevalue); + SetValues(GameSetting::FogDensity, fogDensityValue); + SetValues(GameSetting::FogMaxOpacity, fogMaxOpacityValue); + SetValues(GameSetting::WorldTimeDilation, worldTimeDilationValue); + SetValues(GameSetting::AITimeDilation, AITimeDilationValue); + } if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixes) { + SetFixes(GameFixes::SkipIntro, skip_Intro_enabled); SetFixes(GameFixes::FOV, fov_fix_enabled); SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled); SetFixes(GameFixes::Framerate, cutscenes_FPS_fix_enabled); @@ -108,29 +124,38 @@ static void LoadFixDLL() 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::IgnoreHits, Ignore_hits_fix_enabled); + SetFixes(GameFixes::Stealth, StealthMode_fix_enabled); SetFixes(GameFixes::DevConsole, console); } - sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 70, SetFOV }; - sliders[1] = { "Camera distance (*)", "##CameraOffset", SliderType::Float, &CameraDistancevalue, 0, 4, SetCameraDistance, "%.2f", "Value is a multiplier." }; - sliders[2] = { "Fog density (*)", "##FogDensityValue", SliderType::Float, &fogDensityValue, 0, 5, SetFogDensity, "%.2f", + sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 70, GameSetting::FOV, SetValues }; + sliders[1] = { "Camera distance (*)", "##CameraOffset", SliderType::Float, &CameraDistancevalue, 0, 4, GameSetting::CameraDistance, SetValues, "%.2f", "Value is a multiplier." }; + sliders[2] = { "Fog density (*)", "##FogDensityValue", SliderType::Float, &fogDensityValue, 0, 5, GameSetting::FogDensity, SetValues, "%.2f", "This will override engine dynamic value." }; - sliders[3] = { "Fog opacity (*)", "##FogOpacityValue", SliderType::Float, &fogMaxOpacityValue, 0, 1, SetFogMaxOpacity, "%.2f", + sliders[3] = { "Fog opacity (*)", "##FogOpacityValue", SliderType::Float, &fogMaxOpacityValue, 0, 1, GameSetting::FogMaxOpacity, SetValues, "%.2f", "This will override engine dynamic value." }; + sliders[4] = { "World time dilation", "##WorldTimeDilationValue", SliderType::Float, &worldTimeDilationValue, 0.f, 2.f,GameSetting::WorldTimeDilation , SetValues, nullptr, + "Will affect everything in the world.\nDefault value is 1." }; + sliders[5] = { "AI time dilation", "##AITimeDilationValue", SliderType::Float, &AITimeDilationValue, 0.f, 2.f, GameSetting::AITimeDilation, SetValues, nullptr, + "Will affect only enemies in the world.\nDefault value is 1." }; } } // Settings functions -static void SaveSettings() -{ +static void SaveSettings() { ini::IniFile pluginIniFile; pluginIniFile["1#General fix"].setComment(std::vector{ "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 to enable it" }); + "Set Console to false if you don't want to enable it", + "Set Skip Intro to false if you don't wan't to skip them" }); pluginIniFile["1#General fix"]["Enabled"] = fix_enabled; pluginIniFile["1#General fix"]["Console"] = console; + pluginIniFile["1#General fix"]["Skip Intro"] = skip_Intro_enabled; pluginIniFile["2#Individual fix"].setComment("Controls each fix individually"); pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled; pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled; @@ -140,11 +165,17 @@ static void SaveSettings() pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled; pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled; pluginIniFile["2#Individual fix"]["Cutscenes FPS"] = cutscenes_FPS_fix_enabled; + pluginIniFile["2#Individual fix"]["Time dilation"] = Time_Dilation_fix_enabled; + pluginIniFile["2#Individual fix"]["God Mode"] = GodMode_fix_enabled; + pluginIniFile["2#Individual fix"]["Ignore hits"] = Ignore_hits_fix_enabled; + pluginIniFile["2#Individual fix"]["Stealth"] = StealthMode_fix_enabled; pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune"); pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue; pluginIniFile["3#Fixes tuning"]["Camera distance"] = CameraDistancevalue; pluginIniFile["3#Fixes tuning"]["Fog density"] = fogDensityValue; pluginIniFile["3#Fixes tuning"]["Fog opacity"] = fogMaxOpacityValue; + pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue; + pluginIniFile["3#Fixes tuning"]["AI time dilation scale"] = AITimeDilationValue; pluginIniFile.save(SETTINGS_FILE); } @@ -155,6 +186,7 @@ static void LoadSettings() { pluginIniFile.load(SETTINGS_FILE); fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as(); console = pluginIniFile["1#General fix"]["Console"].as(); + skip_Intro_enabled = pluginIniFile["1#General fix"]["Skip Intro"].as(); fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as(); ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as(); camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as(); @@ -163,11 +195,16 @@ static void LoadSettings() { Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as(); Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as(); cutscenes_FPS_fix_enabled = pluginIniFile["2#Individual fix"]["Cutscenes FPS"].as(); + Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["Time dilation"].as(); + GodMode_fix_enabled = pluginIniFile["2#Individual fix"]["God Mode"].as(); + Ignore_hits_fix_enabled = pluginIniFile["2#Individual fix"]["Ignore hits"].as(); + StealthMode_fix_enabled = pluginIniFile["2#Individual fix"]["Stealth"].as(); worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as(); CameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as(); fogDensityValue = pluginIniFile["3#Fixes tuning"]["Fog density"].as(); fogMaxOpacityValue = pluginIniFile["3#Fixes tuning"]["Fog opacity"].as(); - + worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as(); + AITimeDilationValue = pluginIniFile["3#Fixes tuning"]["AI time dilation scale"].as(); } catch (const std::exception& e) {} } @@ -175,8 +212,7 @@ static void LoadSettings() { // Read plugin log file void read_log_file(const std::string& filename) { std::ifstream file(filename); - if (!file.is_open()) - { + if (!file.is_open()) { log_content = "Impossible to open file : " + filename; return; } @@ -188,12 +224,7 @@ void read_log_file(const std::string& filename) { // Initialize ImGui widgets for Reshade static void on_overlay_draw(reshade::api::effect_runtime* runtime) { - 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::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(8 * scale, 8 * scale)); ImGui::SetNextWindowSize(ImVec2(350 * scale, 150 * scale), ImGuiCond_Once); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink @@ -223,61 +254,127 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) { ImGui::End(); } - if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) { - ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f); - ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f); - ImGui::TableNextRow(); + if (ImGui::BeginTabBar("MainTabs")) { + if (ImGui::BeginTabItem("Fixes")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale)); + if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) { + ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f); + ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f); + ImGui::TableNextRow(); - // Drawing a left column with slider and general fix - ImGui::TableSetColumnIndex(0); - if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen)) - if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { - if (SetFixEnabled) SetFixEnabled(fix_enabled, false); - SaveSettings(); + // Drawing a left column with slider and general fix + ImGui::TableSetColumnIndex(0); + if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen)) + if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { + if (SetFixEnabled) SetFixEnabled(fix_enabled, false); + SaveSettings(); + } + // 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.4f); + ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.6f); + ImGui::TableNextRow(); + + ImGui::TableSetColumnIndex(0); + for (int i = 0; i < 4; ++i) DrawFixCheckbox(individualFixes[i]); + + ImGui::TableSetColumnIndex(1); + for (int i = 4; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]); + + ImGui::EndTable(); + } + } + ImGui::EndTable(); } - // 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.4f); - ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.6f); + + ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2 /** 1 style.ItemSpacing.y*/); + if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + for (int i = 0; i < 2; ++i) DrawSlider2(sliders[i], 200); + ImGui::TableSetColumnIndex(1); + for (int i = 2; i < 4; ++i) DrawSlider2(sliders[i], 200); + ImGui::EndTable(); + } + ImGui::PopStyleVar(); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("Cheats")) { + for (const auto& cheat : cheatFixes) DrawFixCheckbox(cheat); + + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale)); + 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); - for (int i = 0; i < 4; ++i) DrawFixCheckbox(individualFixes[i]); - + DrawSlider2(sliders[4], 180); ImGui::TableSetColumnIndex(1); - for (int i = 4; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]); - + DrawSlider2(sliders[5], 180); ImGui::EndTable(); } + ImGui::PopStyleVar(); + ImGui::EndTabItem(); + if (ImGui::CollapsingHeader("Cheat informations", ImGuiTreeNodeFlags_DefaultOpen)) { + if (GetGameInfos) { + GameInfos infos{}; + GetGameInfos(&infos); + ImGui::TextColored(ImColor(48, 179, 25), "James health: %.2f", infos.Health); + } + } } - ImGui::EndTable(); - } - // Draw individual fix sliders - ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2 * style.ItemSpacing.y); - if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) { - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - for (int i = 0; i < 2; ++i) DrawSlider(sliders[i], 200); - ImGui::TableSetColumnIndex(1); - for (int i = 2; i < 4; ++i) DrawSlider(sliders[i], 200); - ImGui::EndTable(); - } - ImGui::EndTabItem(); + ImGui::EndTabBar(); - // 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); - if (infos.consoleEnabled) - ImGui::Text("Console enabled and bound to key F2"); - ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", infos.FOVIn, infos.CompensatedFOV, infos.FOVOut); - ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut); + // 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); + if (infos.consoleEnabled) + ImGui::Text("Console enabled and bound to key F2"); + ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", infos.FOVIn, infos.CompensatedFOV, infos.FOVOut); + ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut); + } } } + ImGui::PopStyleVar(); +} + +static void on_reshade_present(reshade::api::effect_runtime* runtime) { + static auto last = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); + float dt = std::chrono::duration(now - last).count(); + last = now; + + ProcessHotkeys(runtime); + UpdateOSD(runtime, dt); +} + +// 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) { + if (!runtime) return; + FindAllUniformVariables(runtime, OSD_SHADER_NAME); // Find all uniforms and set their handle + + if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once + ResetAllUniformVariables(runtime, OSD_SHADER_NAME); + runtime->save_current_preset(); // Save shader preset +} + +static void InitializeHotkeys() { // Initialize hotkeys for cheats + if (InterlockedCompareExchange(&g_hotkeysInitialized, 1, 0) != 0) return; // Initialize hotkeys once + + 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); }); + RegisterHotkey('3', Modifier::Alt, [] { ToggleOSD(Ignore_hits_fix_enabled, GameFixes::IgnoreHits, u_IgnoreHits_show, u_IgnoreHits_enabled, OSD_duration); }); + RegisterHotkey('4', Modifier::Alt, [] { ToggleOSD(StealthMode_fix_enabled, GameFixes::Stealth, u_Stealth_show, u_Stealth_enabled, OSD_duration); }); } // Main dll intrance @@ -292,9 +389,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) { reshade::register_event( [](reshade::api::effect_runtime* runtime) { LoadFixDLL(); + InitializeHotkeys(); }); + reshade::register_event(&on_reshade_present); + reshade::register_event(&on_reshade_begin_effects); break; case DLL_PROCESS_DETACH: + reshade::unregister_event(&on_reshade_present); + reshade::unregister_event(&on_reshade_begin_effects); reshade::unregister_addon(hinstDLL); break; }