From a2fad9c942cac8cb4dfa7d7ddede8bde0531df45 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Mon, 29 Sep 2025 12:02:11 +0200 Subject: [PATCH] Add unique function to retrieve game informations --- SilentHillf/dllmain.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/SilentHillf/dllmain.cpp b/SilentHillf/dllmain.cpp index 5f4fd6d..c5af175 100644 --- a/SilentHillf/dllmain.cpp +++ b/SilentHillf/dllmain.cpp @@ -1,6 +1,7 @@ #define IMGUI_DISABLE_INCLUDE_IMCONFIG_H #define IMGUI_HAS_DOCK 1 +#include "GameInformations.h" #include #include #include @@ -30,11 +31,7 @@ static SetBoolFn SetCameraFixEnabled = nullptr; static SetBoolFn SetFogFixEnabled = nullptr; static SetIntFn SetFOV = nullptr; static SetFloatFn SetCameraDistance = nullptr; - - -static GetFloatFn GetFOVIn = nullptr; -static GetFloatFn GetFOVOut = nullptr; -static GetBoolFn GetConsoleEnabled = nullptr; +static GetGameInfosStruct GetGameInfos = nullptr; // Plugin variables for checkboxes and sliders static bool fov_fix_enabled = false; @@ -90,9 +87,7 @@ static void LoadFixDLL() SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled"); SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance"); - GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); - GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");; - GetConsoleEnabled = (GetBoolFn)GetProcAddress(fixLib, "GetConsoleEnabled"); + GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos"); // Apply initial values loaded from settings if (SetFOV) SetFOV(worldFOVvalue); @@ -299,10 +294,14 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) // Fix status if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio); - if (GetConsoleEnabled && GetConsoleEnabled()) - ImGui::Text("Console enabled and bound to key Tilde"); - if (GetFOVIn && GetFOVOut) - ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", GetFOVIn(), GetFOVOut()); + if (GetGameInfos) { + GameInfos infos{}; + GetGameInfos(&infos); + 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); + } } }