Add unique function to retrieve game informations

This commit is contained in:
2025-09-29 12:02:11 +02:00
parent 7ee585d4a6
commit a2fad9c942

View File

@@ -1,6 +1,7 @@
#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 <imgui.h> #include <imgui.h>
#include <reshade.hpp> #include <reshade.hpp>
#include <fstream> #include <fstream>
@@ -30,11 +31,7 @@ static SetBoolFn SetCameraFixEnabled = nullptr;
static SetBoolFn SetFogFixEnabled = nullptr; static SetBoolFn SetFogFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr; static SetIntFn SetFOV = nullptr;
static SetFloatFn SetCameraDistance = nullptr; static SetFloatFn SetCameraDistance = nullptr;
static GetGameInfosStruct GetGameInfos = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetFOVOut = nullptr;
static GetBoolFn GetConsoleEnabled = 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;
@@ -90,9 +87,7 @@ static void LoadFixDLL()
SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled"); SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled");
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");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
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);
@@ -299,10 +294,14 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
// 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 && GetFOVOut) GetGameInfos(&infos);
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", GetFOVIn(), GetFOVOut()); if (infos.consoleEnabled)
ImGui::Text("Console enabled and bound to key Tilde");
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut);
}
} }
} }