Several optimizations
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#define IMGUI_HAS_DOCK 1
|
#define IMGUI_HAS_DOCK 1
|
||||||
|
|
||||||
#include "GameInformations.h"
|
#include "GameInformations.h"
|
||||||
|
#include "GameFixes.h"
|
||||||
#include "inicpp.h"
|
#include "inicpp.h"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <reshade.hpp>
|
#include <reshade.hpp>
|
||||||
@@ -15,22 +16,15 @@ static float aspectRatio = (float)screenWidth / screenHeight;
|
|||||||
|
|
||||||
// Core game dll functions declarations
|
// Core game dll functions declarations
|
||||||
typedef void (*SetBoolFn)(bool, bool);
|
typedef void (*SetBoolFn)(bool, bool);
|
||||||
|
typedef void (*SetFixesFn)(GameFixes, bool);
|
||||||
typedef void (*SetIntFn)(int);
|
typedef void (*SetIntFn)(int);
|
||||||
typedef void (*SetFloatFn)(float);
|
typedef void (*SetFloatFn)(float);
|
||||||
typedef float (*GetFloatFn)();
|
//typedef bool (*GetBoolFn)();
|
||||||
typedef bool (*GetBoolFn)();
|
|
||||||
|
|
||||||
static HMODULE fixLib = nullptr;
|
static HMODULE fixLib = nullptr;
|
||||||
static LONG g_coreInitialized = 0;
|
static LONG g_coreInitialized = 0;
|
||||||
static SetBoolFn SetFixEnabled = nullptr;
|
static SetBoolFn SetFixEnabled = nullptr;
|
||||||
static SetBoolFn SetFOVFixEnabled = nullptr;
|
static SetFixesFn SetFixesEnabled = nullptr;
|
||||||
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetDOFFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetCAFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetVignettingFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetFogFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetCameraFixEnabled = nullptr;
|
|
||||||
static SetBoolFn SetHUDFixEnabled = nullptr;
|
|
||||||
static SetIntFn SetFOV = nullptr;
|
static SetIntFn SetFOV = nullptr;
|
||||||
static SetFloatFn SetCameraDistance = nullptr;
|
static SetFloatFn SetCameraDistance = nullptr;
|
||||||
static SetIntFn SetCameraHeight = nullptr;
|
static SetIntFn SetCameraHeight = nullptr;
|
||||||
@@ -59,7 +53,7 @@ static bool popup_Informations = false;
|
|||||||
|
|
||||||
// Plugin settings
|
// Plugin settings
|
||||||
const char* SETTINGS_FILE = "pluginSettings.ini";
|
const char* SETTINGS_FILE = "pluginSettings.ini";
|
||||||
const char* FIX_VERSION = "1.0.8";
|
const char* FIX_VERSION = "1.0.8.1";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera distance and height.\n - Control HUD safezone.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera distance and height.\n - Control HUD safezone.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
@@ -81,14 +75,7 @@ static void LoadFixDLL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||||
SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled");
|
SetFixesEnabled = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||||
SetAspectRatioFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetAspectRatioFixEnabled");
|
|
||||||
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
|
|
||||||
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
|
|
||||||
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
|
|
||||||
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
|
|
||||||
SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
|
|
||||||
SetHUDFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetHUDFixEnabled");
|
|
||||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||||
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
|
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
|
||||||
SetCameraHeight = (SetIntFn)GetProcAddress(fixLib, "SetCameraHeight");
|
SetCameraHeight = (SetIntFn)GetProcAddress(fixLib, "SetCameraHeight");
|
||||||
@@ -100,15 +87,18 @@ static void LoadFixDLL()
|
|||||||
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
|
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
|
||||||
if (SetCameraHeight) SetCameraHeight(cameraHeightvalue);
|
if (SetCameraHeight) SetCameraHeight(cameraHeightvalue);
|
||||||
if (SetHUD) SetHUD(HUDvalue);
|
if (SetHUD) SetHUD(HUDvalue);
|
||||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
|
|
||||||
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, true);
|
|
||||||
if (SetHUDFixEnabled) SetHUDFixEnabled(HUD_fix_enabled, true);
|
|
||||||
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_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 (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||||
|
if (SetFixesEnabled) {
|
||||||
|
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||||
|
SetFixesEnabled(GameFixes::UltraWide, Aspect_fix_enabled);
|
||||||
|
SetFixesEnabled(GameFixes::Camera, camera_fix_enabled);
|
||||||
|
SetFixesEnabled(GameFixes::HUD, HUD_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::DevConsole, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +264,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
|
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
|
||||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
@@ -284,7 +274,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
|
if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
|
||||||
if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Camera, camera_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
@@ -294,18 +284,18 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
|
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
|
||||||
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
||||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) {
|
if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) {
|
||||||
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::UltraWide, Aspect_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
@@ -316,7 +306,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("HUD safe zone", &HUD_fix_enabled)) {
|
if (ImGui::Checkbox("HUD safe zone", &HUD_fix_enabled)) {
|
||||||
if (SetHUDFixEnabled) SetHUDFixEnabled(HUD_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
@@ -326,12 +316,12 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
|
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();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Checkbox("Chromatic aberrations", &CA_fix_enabled)) {
|
if (ImGui::Checkbox("Chromatic aberrations", &CA_fix_enabled)) {
|
||||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, false);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
|||||||
Reference in New Issue
Block a user