Centralized fixes with one function
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define IMGUI_HAS_DOCK 1
|
||||
|
||||
#include "GameInformations.h"
|
||||
#include "GameFixes.h"
|
||||
#include "inicpp.h"
|
||||
#include <imgui.h>
|
||||
#include <reshade.hpp>
|
||||
@@ -15,22 +16,13 @@ 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 float (*GetFloatFn)();
|
||||
typedef bool (*GetBoolFn)();
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetBoolFn SetFOVFixEnabled = nullptr;
|
||||
static SetBoolFn SetUltraWideFixEnabled = nullptr;
|
||||
static SetBoolFn SetDOFFixEnabled = nullptr;
|
||||
static SetBoolFn SetCAFixEnabled = nullptr;
|
||||
static SetBoolFn SetVignettingFixEnabled = nullptr;
|
||||
static SetBoolFn SetFogFixEnabled = nullptr;
|
||||
static SetBoolFn SetVolumetricFogFixEnabled = nullptr;
|
||||
static SetBoolFn SetSkipIntroEnabled = nullptr;
|
||||
static SetFixesFn SetFixesEnabled = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
@@ -53,7 +45,7 @@ static std::string log_content;
|
||||
|
||||
// Plugin settings
|
||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||
const char* FIX_VERSION = "1.0.3";
|
||||
const char* FIX_VERSION = "1.0.3.1";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Enable ultrawide.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.\n - Skip intros.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
@@ -75,28 +67,24 @@ static void LoadFixDLL()
|
||||
}
|
||||
|
||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||
SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled");
|
||||
SetUltraWideFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetUltraWideFixEnabled");
|
||||
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
|
||||
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
|
||||
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
|
||||
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
|
||||
SetVolumetricFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVolumetricFogFixEnabled");
|
||||
SetSkipIntroEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetSkipIntroEnabled");
|
||||
SetFixesEnabled = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
|
||||
if (SetUltraWideFixEnabled) SetUltraWideFixEnabled(ultrawide_fix_enabled, true);
|
||||
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
|
||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
|
||||
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
|
||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
|
||||
if (SetVolumetricFogFixEnabled) SetVolumetricFogFixEnabled(VolumetricFog_fix_enabled, true);
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetSkipIntroEnabled) SetSkipIntroEnabled(skip_intro, true);
|
||||
if (SetFixesEnabled) {
|
||||
SetFixesEnabled(GameFixes::SkipIntro, skip_intro);
|
||||
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::VolumetricFog, VolumetricFog_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DevConsole, skip_intro);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +96,7 @@ static void SaveSettings()
|
||||
"You should not need to modify them",
|
||||
" ",
|
||||
"Controls if fix mod (globally) is enabled",
|
||||
"Set Skip intro to false if you want spash screens :)"});
|
||||
"Set Skip intro to false if you want splash screens :)"});
|
||||
pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
|
||||
pluginIniFile["1#General fix"]["Skip intro"] = skip_intro;
|
||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||
@@ -237,17 +225,17 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
|
||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
|
||||
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
@@ -257,23 +245,23 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Volumetric fog", &VolumetricFog_fix_enabled)) {
|
||||
if (SetVolumetricFogFixEnabled) SetVolumetricFogFixEnabled(VolumetricFog_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::VolumetricFog, VolumetricFog_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::Checkbox("Ultrawide", &ultrawide_fix_enabled)) {
|
||||
if (SetUltraWideFixEnabled) SetUltraWideFixEnabled(ultrawide_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
|
||||
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Chromatic aberrations", &CA_fix_enabled)) {
|
||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, false);
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::ChromaticAberrations ,CA_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
@@ -305,7 +293,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
|
||||
return FALSE;
|
||||
LoadSettings();
|
||||
|
||||
reshade::register_overlay("Little Nightmare III", &on_overlay_draw);
|
||||
reshade::register_overlay("Little Nightmares III", &on_overlay_draw);
|
||||
reshade::register_event<reshade::addon_event::init_effect_runtime>(
|
||||
[](reshade::api::effect_runtime* runtime) {
|
||||
LoadFixDLL();
|
||||
|
||||
Reference in New Issue
Block a user