From 193455259cad9ee0b42de8fe788451889f3a6e10 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Thu, 24 Jul 2025 11:07:52 +0200 Subject: [PATCH] Added The Last Of Us Part I --- Reshade Plugins Addons.sln | 10 ++ TLOU/TLOU.vcxproj | 156 ++++++++++++++++++++ TLOU/dllmain.cpp | 286 +++++++++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+) create mode 100644 TLOU/TLOU.vcxproj create mode 100644 TLOU/dllmain.cpp diff --git a/Reshade Plugins Addons.sln b/Reshade Plugins Addons.sln index f695cf3..4e811f4 100644 --- a/Reshade Plugins Addons.sln +++ b/Reshade Plugins Addons.sln @@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Metro Exodus", "Metro Exodu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Robocop UB", "Robocop UB\RobocopUB.vcxproj", "{B6C09563-1AF1-4226-A6B6-76802399CCDB}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLOU", "TLOU\TLOU.vcxproj", "{01175866-A908-4941-B4EE-2ECDD7AF075C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -123,6 +125,14 @@ Global {B6C09563-1AF1-4226-A6B6-76802399CCDB}.Release|x64.Build.0 = Release|x64 {B6C09563-1AF1-4226-A6B6-76802399CCDB}.Release|x86.ActiveCfg = Release|Win32 {B6C09563-1AF1-4226-A6B6-76802399CCDB}.Release|x86.Build.0 = Release|Win32 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Debug|x64.ActiveCfg = Debug|x64 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Debug|x64.Build.0 = Debug|x64 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Debug|x86.ActiveCfg = Debug|Win32 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Debug|x86.Build.0 = Debug|Win32 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Release|x64.ActiveCfg = Release|x64 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Release|x64.Build.0 = Release|x64 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Release|x86.ActiveCfg = Release|Win32 + {01175866-A908-4941-B4EE-2ECDD7AF075C}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/TLOU/TLOU.vcxproj b/TLOU/TLOU.vcxproj new file mode 100644 index 0000000..73deb4b --- /dev/null +++ b/TLOU/TLOU.vcxproj @@ -0,0 +1,156 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {01175866-A908-4941-B4EE-2ECDD7AF075C} + TLOU + 10.0 + TLOU + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + .addon + + + .addon + + + .addon + + + .addon + + + + Level3 + true + WIN32;_DEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui + MultiThreadedDLL + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui + MultiThreadedDLL + + + Windows + true + false + + + + + Level3 + true + _DEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui + MultiThreadedDLL + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui + MultiThreadedDLL + + + Windows + true + false + + + + + + + + + \ No newline at end of file diff --git a/TLOU/dllmain.cpp b/TLOU/dllmain.cpp new file mode 100644 index 0000000..ba7b2b9 --- /dev/null +++ b/TLOU/dllmain.cpp @@ -0,0 +1,286 @@ +#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H +#define IMGUI_HAS_DOCK 1 + +#include +#include +#include +#include + +// Core game dll functions declarations +typedef void (*SetBoolFn)(bool,bool); +typedef void (*SetIntFn)(int); +typedef void (*SetFloatFn)(float); +typedef float (*GetFloatFn)(); + +static HMODULE fixLib = nullptr; +static SetBoolFn SetFixEnabled = nullptr; +static SetBoolFn SetFOVFixEnabled = nullptr; +static SetBoolFn SetCameraFixEnabled = nullptr; +static SetBoolFn SetSharpnessFixEnabled = nullptr; +static SetIntFn SetFOV = nullptr; +static SetFloatFn SetCamera = nullptr; +static SetFloatFn SetSharpness = nullptr; +static GetFloatFn GetFOVIn = nullptr; +static GetFloatFn GetFOVOut = nullptr; + +// Plugin variables for checkboxes and sliders +static bool fix_enabled = false; +static bool fov_fix_enabled = false; +static bool camera_fix_enabled = false; +static bool sharpness_fix_enabled = false; +static int worldFOVvalue = 0; +static float cameraDistancevalue = 0; +static float sharpnessvalue = 0; +static bool popup_Informations = false; + +// Plugin settings +const char* SETTINGS_FILE = "PluginSettings.ini"; +const char* GENERAL_FIX_SETTING = "GeneralFIX="; +const char* WORLD_FOV_FIX_SETTING = "WorldFOVFIX="; +const char* CAMERA_FIX_SETTING = "CameraFIX="; +const char* SHARPNESS_FIX_SETTING = "SharpnessFIX="; +const char* WORLD_FOV_SETTING = "WorldFOV="; +const char* CAMERA_SETTING = "Camera="; +const char* SHARPNESS_SETTING = "Sharpness="; +const char* FIX_VERSION = "1.0.1"; +const char* FIX_INFORMATIONS = "This fix allows to:\r\n - Control in game FOV.\r\n - Control camera distance.\r\n - Control image sharpening.\n\nModifying FOV may affect performance.\r\nSharpening fix will override game's setting. A good range would be (0 - 1).\r\nSet the slider to 0 to completely deactivate it.\r\nCamera distance in settings is a scale between 0.9 - 1.1 (-5 to +5 slider)."; +const char* DONATION_URL = "https://www.paypal.com/donate/?business=W92C47N3WZZZG&no_recurring=0¤cy_code=EUR"; + +// Load and unload game core dll functions /!\ necessary +static void LoadFixDLL() +{ + if (fixLib) return; + fixLib = GetModuleHandleA("TLOUCore.asi"); // ou EmpireOfTheAntsCore.dll si tu gardes le .dll + + if (!fixLib) { + // Optionnel: message d'erreur ou fallback + MessageBoxA(nullptr, "Impossible to laod game core dll", "Erreur", MB_OK); + return; + } + + SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled"); + SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled"); + SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled"); + SetSharpnessFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetSharpnessFixEnabled"); + SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); + SetCamera = (SetFloatFn)GetProcAddress(fixLib, "SetCamera"); + SetSharpness = (SetFloatFn)GetProcAddress(fixLib, "SetSharpness"); + GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); + GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");; + + // Appliquer les valeurs initiales chargées + if (SetFOV) SetFOV(worldFOVvalue); + if (SetCamera) SetCamera(cameraDistancevalue); + if (SetSharpness) SetSharpness(sharpnessvalue); + if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true); + if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, true); + if (SetSharpnessFixEnabled) SetSharpnessFixEnabled(sharpness_fix_enabled, true); + if (SetFixEnabled) SetFixEnabled(fix_enabled, true); +} + +// Addon functions +static void SaveSettings() +{ + std::ofstream file(SETTINGS_FILE); + if (file.is_open()) + { + file << GENERAL_FIX_SETTING << (fix_enabled ? "1" : "0") << "\n"; + file << WORLD_FOV_FIX_SETTING << (fov_fix_enabled ? "1" : "0") << "\n"; + file << CAMERA_FIX_SETTING << (camera_fix_enabled ? "1" : "0") << "\n"; + file << SHARPNESS_FIX_SETTING << (sharpness_fix_enabled ? "1" : "0") << "\n"; + file << WORLD_FOV_SETTING << worldFOVvalue << "\n"; + file << CAMERA_SETTING << cameraDistancevalue << "\n"; + file << SHARPNESS_SETTING << sharpnessvalue << "\n"; + + file.close(); + } +} + +static void LoadSettings() +{ + std::ifstream file(SETTINGS_FILE); + if (file.is_open()) + { + std::string line; + while (std::getline(file, line)) + { + if (line.find(GENERAL_FIX_SETTING) == 0) + { + std::string val = line.substr(strlen(GENERAL_FIX_SETTING)); + fix_enabled = (val == "1" || val == "true"); + } + else if (line.find(WORLD_FOV_FIX_SETTING) == 0) + { + std::string val = line.substr(strlen(WORLD_FOV_FIX_SETTING)); + fov_fix_enabled = (val == "1" || val == "true"); + } + else if (line.find(CAMERA_FIX_SETTING) == 0) + { + std::string val = line.substr(strlen(CAMERA_FIX_SETTING)); + camera_fix_enabled = (val == "1" || val == "true"); + } + else if (line.find(SHARPNESS_FIX_SETTING) == 0) + { + std::string val = line.substr(strlen(SHARPNESS_FIX_SETTING)); + sharpness_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_SETTING) == 0) + cameraDistancevalue = std::stof(line.substr(strlen(CAMERA_SETTING))); + else if (line.find(SHARPNESS_SETTING) == 0) + sharpnessvalue = std::stof(line.substr(strlen(SHARPNESS_SETTING))); + } + file.close(); + } +} + +static void displayFixInformations() { + // Fix version + ImGui::Begin("Informations", &popup_Informations); // + ImGui::SetCursorPos(ImVec2(10, 36)); + ImGui::Text("Version : %s", FIX_VERSION); + ImGui::SetCursorPos(ImVec2(10, 76)); + ImGui::Text(FIX_INFORMATIONS); + ImGui::End(); +} + +// Initialize ImGui widgets for Reshade +static void on_overlay_draw(reshade::api::effect_runtime* runtime) +{ + ImGui::SetNextWindowPos(ImVec2(100, 200), ImGuiCond_Once); + ImGui::SetNextWindowSize(ImVec2(350, 150), ImGuiCond_Once); + + // Donation ? + ImGui::SetCursorPos(ImVec2(10, 36)); + ImGui::Text("Like my work ?"); + ImGui::SetCursorPos(ImVec2(130, 33)); + if (ImGui::Button("consider donation")) + { + ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL); + } + + // Fix informations + ImGui::SetCursorPos(ImVec2(270, 33)); + if (ImGui::Button("Fix informations")) + popup_Informations = true; + + if (popup_Informations) + displayFixInformations(); + + // Generic fix + ImGui::SetCursorPos(ImVec2(10, 60)); + ImGui::BeginChild("AllFixesHeader", ImVec2(220, 0), false); // true = bordure + if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::SetCursorPos(ImVec2(5, 30)); + if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { + if (SetFixEnabled) SetFixEnabled(fix_enabled, false); + SaveSettings(); + } + } + ImGui::EndChild(); + + // FOV adjustment + ImGui::SetCursorPos(ImVec2(10, 120)); + ImGui::BeginChild("FOVHeader", ImVec2(220, 0), false); // true = bordure + if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::SetCursorPos(ImVec2(5, 30)); + ImGui::SetNextItemWidth(150.0f); + if (ImGui::SliderInt("##FOVSlider", &worldFOVvalue, -20, 50)) {} + if (ImGui::IsItemDeactivatedAfterEdit()) { + if (SetFOV) SetFOV(worldFOVvalue); + SaveSettings(); + } + } + ImGui::EndChild(); + + // Camera distance adjustment + ImGui::SetCursorPos(ImVec2(10, 200)); + ImGui::BeginChild("CAMERAHeader", ImVec2(220, 0), false); // true = bordure + if (ImGui::CollapsingHeader("Camera distance", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::SetCursorPos(ImVec2(5, 30)); + ImGui::SetNextItemWidth(150.0f); + if (ImGui::SliderFloat("##CAMERASlider", &cameraDistancevalue, 0, 3)) {} + if (ImGui::IsItemDeactivatedAfterEdit()) { + if (SetCamera) SetCamera(cameraDistancevalue); + SaveSettings(); + } + } + ImGui::EndChild(); + + // Sharpness adjustment + ImGui::SetCursorPos(ImVec2(10, 280)); + ImGui::BeginChild("SHARPNESSHeader", ImVec2(220, 0), false); // true = bordure + if (ImGui::CollapsingHeader("Sharpness", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::SetCursorPos(ImVec2(5, 30)); + ImGui::SetNextItemWidth(150.0f); + if (ImGui::SliderFloat("##SHARPNESSSlider", &sharpnessvalue, 0, 3)) {} + if (ImGui::IsItemDeactivatedAfterEdit()) { + if (SetSharpness) SetSharpness(sharpnessvalue); + SaveSettings(); + } + } + ImGui::EndChild(); + + // Individual fixes + ImGui::SetCursorPos(ImVec2(240, 60)); + ImGui::BeginChild("IndividualFixesHeader", ImVec2(250, 0), false); // true = bordure + if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::SetCursorPos(ImVec2(5, 30)); + if (ImGui::Checkbox("Enable FOV Fix", &fov_fix_enabled)) { + if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false); + SaveSettings(); + } + + ImGui::SetCursorPos(ImVec2(5, 55)); + if (ImGui::Checkbox("Enable camera Fix", &camera_fix_enabled)) { + if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false); + SaveSettings(); + } + + ImGui::SetCursorPos(ImVec2(5, 80)); + if (ImGui::Checkbox("Enable sharpness Fix", &sharpness_fix_enabled)) { + if (SetSharpnessFixEnabled) SetSharpnessFixEnabled(sharpness_fix_enabled, false); + SaveSettings(); + } + } + ImGui::EndChild(); + + // Fix status + ImGui::SetCursorPos(ImVec2(10, 350)); + ImGui::Text("=============== Fix informations ==============="); + ImGui::Text("FOV In: %.2f, Out : %.2f", GetFOVIn(), GetFOVOut()); +} + +DWORD WINAPI MainThread(LPVOID) +{ + // Tu peux ensuite réactiver LoadSettings/LoadFixDLL ici + LoadSettings(); + reshade::register_overlay("The Last Of Us : Part I", &on_overlay_draw); + LoadFixDLL(); + + return 0; +} +// Main dll intrance +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + if (!reshade::register_addon(hinstDLL)) + return FALSE; + + LoadSettings(); + reshade::register_overlay("The Last Of Us : Part I", &on_overlay_draw); + reshade::register_event( + [](reshade::api::effect_runtime* runtime) { + LoadFixDLL(); + }); + break; + case DLL_PROCESS_DETACH: + fixLib = nullptr; + reshade::unregister_addon(hinstDLL); + break; + } + return TRUE; +} \ No newline at end of file