Fix optimizations. UI rewrite

This commit is contained in:
2025-11-06 11:36:46 +01:00
parent d2111f43c6
commit 6804232027

View File

@@ -1,6 +1,9 @@
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H #define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
#define IMGUI_HAS_DOCK 1 #define IMGUI_HAS_DOCK 1
#include "GameInformations.h"
#include "GameFixes.h"
#include "inicpp.h"
#include <imgui.h> #include <imgui.h>
#include <reshade.hpp> #include <reshade.hpp>
#include <fstream> #include <fstream>
@@ -14,34 +17,20 @@ 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 void (*SetUEConsole)();
static HMODULE fixLib = nullptr; static HMODULE fixLib = nullptr;
static LONG g_coreInitialized = 0;
static SetBoolFn SetFixEnabled = nullptr; static SetBoolFn SetFixEnabled = nullptr;
static SetBoolFn SetFOVFixEnabled = nullptr; static SetFixesFn SetFixesEnabled = nullptr;
static SetBoolFn SetFPSFixEnabled = nullptr; static GetGameInfosStruct GetGameInfos = nullptr;
static SetBoolFn SetResolutionFixEnabled = nullptr;
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
static SetBoolFn SetDOFFixEnabled = nullptr;
static SetBoolFn SetVignettingFixEnabled = nullptr;
static SetBoolFn SetFogFixEnabled = nullptr;
static SetBoolFn SetCameraDistanceFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr; static SetIntFn SetFOV = nullptr;
static SetFloatFn SetCameraDistance = nullptr; static SetFloatFn SetCameraDistance = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetCompensadedFOV = nullptr;
static GetFloatFn GetFOVOut = nullptr;
static GetBoolFn GetConsoleEnabled = nullptr;
static SetUEConsole SetConsole = nullptr;
// Plugin variables for checkboxes and sliders // Plugin variables for checkboxes and sliders
static bool fov_fix_enabled = false; static bool fov_fix_enabled = false;
static bool FPS_fix_enabled = false;
static bool Resolution_fix_enabled = false;
static bool Aspect_fix_enabled = false; static bool Aspect_fix_enabled = false;
static bool DOF_fix_enabled = false; static bool DOF_fix_enabled = false;
static bool Vignetting_fix_enabled = false; static bool Vignetting_fix_enabled = false;
@@ -50,54 +39,27 @@ static bool camera_Distance_fix_enabled = false;
static bool fix_enabled = false; static bool fix_enabled = false;
static int worldFOVvalue = 0; static int worldFOVvalue = 0;
static float cameraDistancevalue = 0.f; static float cameraDistancevalue = 0.f;
static bool console = true;
// Overlays popups
static bool popup_Informations = false; static bool popup_Informations = false;
static bool show_log_overlay = false;
static std::string log_content;
// Plugin settings // Plugin settings
const char* SETTINGS_FILE = "PluginSettings.ini"; const std::string SETTINGS_FILE = "./pluginsettings.ini";
const char* GENERAL_FIX_SETTING = "GeneralFIX="; const char* FIX_VERSION = "1.0.6.1";
const char* WORLD_FOV_FIX_SETTING = "WorldFOVFIX=";
const char* ASPECT_FIX_SETTING = "AspectFIX=";
const char* DOF_FIX_SETTING = "DOFFIX=";
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
const char* FOG_FIX_SETTING = "FogFIX=";
const char* CAMERA_DISTANCE_FIX_SETTING = "CameraDistanceFIX=";
const char* WORLD_FOV_SETTING = "WorldFOV=";
const char* CAMERA_DISTANCE_SETTING = "CameraDistance=";
const char* FIX_VERSION = "1.0.6";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Unlock ultrawide resolutions.\n - Remove depth of field.\n - Remove vignetting.\n - Remove fog.\n - Re enable console."; const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Unlock ultrawide resolutions.\n - Remove depth of field.\n - Remove vignetting.\n - Remove fog.\n - Re enable console.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Facteur de scaling basé sur la résolution verticale // Facteur de scaling basé sur la résolution verticale
float scale = 1.f; float scale = 1.f;
bool IsAlreadyInitialized()
{
// Declare a lock
HANDLE hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Local\\CronosFixSharedSection");
// If lock is not yet initialized
if (hMap == nullptr)
{
// We create the lock only once
hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 1, "Local\\CronosFixSharedSection");
if (hMap == nullptr) // We ensure the lock is valid
return true;
return false; // First time created we return false
}
// Otherwise we return true
CloseHandle(hMap);
return true;
}
// Load and unload game core dll functions /!\ necessary // Load and unload game core dll functions /!\ necessary
static void LoadFixDLL() static void LoadFixDLL()
{ {
if (IsAlreadyInitialized()) if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
return; // déjà lancé dans un autre chargement return;
if (GetModuleHandleA("CronosTNDCore.dll") == nullptr) { if (GetModuleHandleA("CronosTNDCore.dll") == nullptr) {
fixLib = LoadLibraryA("CronosTNDCore.dll"); fixLib = LoadLibraryA("CronosTNDCore.dll");
@@ -108,114 +70,82 @@ 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");
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
SetCameraDistanceFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraDistanceFixEnabled");
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance"); SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");
SetConsole = (SetUEConsole)GetProcAddress(fixLib, "SetConsole");
GetConsoleEnabled = (GetBoolFn)GetProcAddress(fixLib, "GetConsoleEnabled");
// Apply initial values loaded from settings // Apply initial values loaded from settings
if (SetFOV) SetFOV(worldFOVvalue); if (SetFOV) SetFOV(worldFOVvalue);
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, true);
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_Distance_fix_enabled, true);
if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
if (SetConsole) SetConsole(); if (SetFixesEnabled) {
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
SetFixesEnabled(GameFixes::UltraWide, Aspect_fix_enabled);
SetFixesEnabled(GameFixes::Camera, camera_Distance_fix_enabled);
SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
SetFixesEnabled(GameFixes::DevConsole, console);
}
} }
} }
// Settings functions // Settings functions
static void SaveSettings() static void SaveSettings()
{ {
std::ofstream file(SETTINGS_FILE); ini::IniFile pluginIniFile;
if (file.is_open()) pluginIniFile["1#General fix"].setComment(std::vector<std::string>{ "The following sections are saved by plugin",
{ "You should not need to modify them",
file << GENERAL_FIX_SETTING << (fix_enabled ? "1" : "0") << "\n"; " ",
file << WORLD_FOV_FIX_SETTING << (fov_fix_enabled ? "1" : "0") << "\n"; "Controls if fix mod (globally) is enabled",
file << ASPECT_FIX_SETTING << (Aspect_fix_enabled ? "1" : "0") << "\n"; "Set Console to false if you don't want to enable it" });
file << DOF_FIX_SETTING << (DOF_fix_enabled ? "1" : "0") << "\n"; pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
file << VIGNETTING_FIX_SETTING << (Vignetting_fix_enabled ? "1" : "0") << "\n"; pluginIniFile["1#General fix"]["Console"] = console;
file << FOG_FIX_SETTING << (Fog_fix_enabled ? "1" : "0") << "\n"; pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
file << CAMERA_DISTANCE_FIX_SETTING << (camera_Distance_fix_enabled ? "1" : "0") << "\n"; pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
file << WORLD_FOV_SETTING << worldFOVvalue << "\n"; pluginIniFile["2#Individual fix"]["UltraWide"] = Aspect_fix_enabled;
file << CAMERA_DISTANCE_SETTING << cameraDistancevalue << "\n"; pluginIniFile["2#Individual fix"]["Camera"] = camera_Distance_fix_enabled;
file.close(); pluginIniFile["2#Individual fix"]["DOF"] = DOF_fix_enabled;
} pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
pluginIniFile["2#Individual fix"]["Fog"] = Fog_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.save(SETTINGS_FILE);
} }
static void LoadSettings() static void LoadSettings() {
{ ini::IniFile pluginIniFile;
std::ifstream file(SETTINGS_FILE); try {
if (file.is_open()) pluginIniFile.load(SETTINGS_FILE);
{ fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
std::string line; console = pluginIniFile["1#General fix"]["Console"].as<bool>();
while (std::getline(file, line)) fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
{ Aspect_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
if (line.find(GENERAL_FIX_SETTING) == 0) camera_Distance_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
{ DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as<bool>();
std::string val = line.substr(strlen(GENERAL_FIX_SETTING)); Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
fix_enabled = (val == "1" || val == "true"); Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
} worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
else if (line.find(WORLD_FOV_FIX_SETTING) == 0) cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
{
std::string val = line.substr(strlen(WORLD_FOV_FIX_SETTING));
fov_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(ASPECT_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(ASPECT_FIX_SETTING));
Aspect_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(DOF_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(DOF_FIX_SETTING));
DOF_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(VIGNETTING_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(VIGNETTING_FIX_SETTING));
Vignetting_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(FOG_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(FOG_FIX_SETTING));
Fog_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(CAMERA_DISTANCE_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(CAMERA_DISTANCE_FIX_SETTING));
camera_Distance_fix_enabled = (val == "1" || val == "true");
}
else if (line.find(WORLD_FOV_SETTING) == 0)
worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_SETTING)));
else if (line.find(CAMERA_DISTANCE_SETTING) == 0)
cameraDistancevalue = std::stof(line.substr(strlen(CAMERA_DISTANCE_SETTING)));
}
file.close();
} }
catch (const std::exception& e) {}
} }
// Fix informations // Read plugin log file
static void displayFixInformations() { void read_log_file(const std::string& filename) {
ImGui::SetNextWindowSize(ImVec2(250 * scale, 200 * scale)); std::ifstream file(filename);
ImGui::Begin("Informations", &popup_Informations); // if (!file.is_open())
ImGui::SetCursorPos(ImVec2(10 * scale, 36 * scale)); {
ImGui::Text("Version : %s", FIX_VERSION); log_content = "Impossible to open file : " + filename;
ImGui::SetCursorPos(ImVec2(10 * scale, 76 * scale)); return;
ImGui::Text(FIX_INFORMATIONS); }
ImGui::End();
std::ostringstream ss;
ss << file.rdbuf();
log_content = ss.str();
} }
static void on_overlay_draw(reshade::api::effect_runtime* runtime) static void on_overlay_draw(reshade::api::effect_runtime* runtime)
@@ -224,109 +154,146 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
style.ItemSpacing = ImVec2(8 * scale, 8 * scale); // Spacing between widgets style.ItemSpacing = ImVec2(8 * scale, 8 * scale); // Spacing between widgets
style.FramePadding = ImVec2(3 * scale, 3 * scale); // Widgets padding style.FramePadding = ImVec2(3 * scale, 3 * scale); // Widgets padding
style.WindowPadding = ImVec2(10 * scale, 10 * scale); // Overlay padding style.WindowPadding = ImVec2(10 * scale, 10 * scale); // Overlay padding
style.CellPadding = ImVec2(10 * scale, 10 * scale); // Table cells padding
scale = (float)screenHeight / 1200.f; ImGui::SetNextWindowSize(ImVec2(350 * scale, 150 * scale), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(480 * scale, 400 * 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 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(); ImGui::SameLine();
if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information
ImGui::SameLine();
if (ImGui::Button("View logs")) {
read_log_file("CronosTND.log");
show_log_overlay = true; // Fix information
}
if (popup_Informations) if (popup_Informations)
{ {
ImGui::Begin("Informations", &popup_Informations); ImGui::Begin("Informations", &popup_Informations, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("Version : %s", FIX_VERSION); ImGui::Text("Version : %s", FIX_VERSION);
ImGui::Text(FIX_INFORMATIONS); ImGui::Text(FIX_INFORMATIONS);
ImGui::End(); ImGui::End();
} }
ImGui::Columns(2, NULL, false); if (show_log_overlay)
// Drawing a left column with slider and general fix
if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { if (SetFixEnabled) SetFixEnabled(fix_enabled, false); SaveSettings(); }
// Sliders
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
{ {
ImGui::SetNextItemWidth(150 * scale); ImGui::Begin("Game log", &show_log_overlay, ImGuiWindowFlags_AlwaysAutoResize);
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 70)) { ImGui::TextUnformatted(log_content.c_str());
if (SetFOV) SetFOV(worldFOVvalue); SaveSettings(); ImGui::End();
}
} }
if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen)) if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
{ ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
ImGui::SetNextItemWidth(150 * scale); ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
if (ImGui::SliderFloat("##CameraValue", &cameraDistancevalue, 0, 3)) { ImGui::TableNextRow();
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); SaveSettings();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("Value is a multiplier.");
ImGui::Text("Affects both normal and weapon aiming distance.");
ImGui::EndTooltip();
}
// Individual fixes // Drawing a left column with slider and general fix
ImGui::NextColumn(); ImGui::TableSetColumnIndex(0);
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen))
{ // Drawing a left column with slider and general fix
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) { if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false); if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { if (SetFixEnabled) SetFixEnabled(fix_enabled, false); SaveSettings(); }
SaveSettings();
// Sliders
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(150 * scale);
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 70)) {
if (SetFOV) SetFOV(worldFOVvalue); SaveSettings();
}
} }
if (ImGui::Checkbox("Camera distance", &camera_Distance_fix_enabled)) { if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_Distance_fix_enabled, false); {
SaveSettings(); ImGui::SetNextItemWidth(150 * scale);
} if (ImGui::SliderFloat("##CameraValue", &cameraDistancevalue, 0, 3)) {
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); SaveSettings();
if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) { }
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, false);
SaveSettings();
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text("This is intended for ultrawide only."); ImGui::Text("Value is a multiplier.");
ImGui::Text("Set panini to off in settings to avoid blurry textures and narrow FOV."); ImGui::Text("Affects both normal and weapon aiming distance.");
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) { // Individual fixes
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false); ImGui::TableSetColumnIndex(1);
SaveSettings(); 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();
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) { ImGui::TableSetColumnIndex(0);
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false); if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
SaveSettings(); if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
} SaveSettings();
}
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) { if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false); if (SetFixesEnabled) SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
SaveSettings(); SaveSettings();
} }
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
ImGui::Text("Enabling this fix is a one way."); if (SetFixesEnabled) SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
ImGui::Text("Reverting it in real time would end in game crash."); SaveSettings();
ImGui::Text("So disabling this fix is only possible by doing it here and restart the game."); }
ImGui::EndTooltip(); if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("Enabling this fix is a one way.");
ImGui::Text("Reverting it in real time would end in game crash.");
ImGui::Text("So disabling this fix is only possible by doing it here and restart the game.");
ImGui::EndTooltip();
}
ImGui::TableSetColumnIndex(1);
if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) {
if (SetFixesEnabled) SetFixesEnabled(GameFixes::UltraWide, Aspect_fix_enabled);
SaveSettings();
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("This is intended for ultrawide only.");
ImGui::Text("Set panini to off in settings to avoid blurry textures and narrow FOV.");
ImGui::EndTooltip();
}
if (ImGui::Checkbox("Camera distance", &camera_Distance_fix_enabled)) {
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Camera, camera_Distance_fix_enabled);
SaveSettings();
}
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
if (SetFixesEnabled) SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
SaveSettings();
}
ImGui::EndTable();
}
} }
ImGui::EndTable();
} }
ImGui::Columns(1);
// Fix status // Fix status
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen))
{ {
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio); ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
if (GetConsoleEnabled && GetConsoleEnabled()) if (GetGameInfos) {
ImGui::Text("Console enabled and bound to key Tilde"); GameInfos infos{};
if (GetFOVIn && GetCompensadedFOV && GetFOVOut) GetGameInfos(&infos);
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut()); if (infos.consoleEnabled)
ImGui::Text("Console enabled and bound to key Tilde");
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);
}
} }
} }