Removed junk files. Removed unnecessary code and comments. Reorganized projects.

This commit is contained in:
2025-07-30 14:26:54 +02:00
parent 731218faa7
commit 7a232427dd
13 changed files with 423 additions and 27 deletions

View File

@@ -52,7 +52,7 @@ const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
static void LoadFixDLL() static void LoadFixDLL()
{ {
if (fixLib) return; if (fixLib) return;
fixLib = LoadLibraryA("DaysGoneCore.dll"); // ou EmpireOfTheAntsCore.dll si tu gardes le .dll fixLib = LoadLibraryA("DaysGoneCore.dll");
if (!fixLib) { if (!fixLib) {
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK); MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return; return;

View File

@@ -38,9 +38,8 @@ const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
static void LoadFixDLL() static void LoadFixDLL()
{ {
if (fixLib) return; if (fixLib) return;
fixLib = LoadLibraryA("DeadSpace2023Core.dll"); // ou EmpireOfTheAntsCore.dll si tu gardes le .dll fixLib = LoadLibraryA("DeadSpace2023Core.dll");
if (!fixLib) { if (!fixLib) {
// Optionnel: message d'erreur ou fallback
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK); MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return; return;
} }

View File

@@ -45,10 +45,9 @@ const char* DONATION_URL = "https://www.paypal.com/donate/?business=W92C47N3WZZZ
static void LoadFixDLL() static void LoadFixDLL()
{ {
if (fixLib) return; if (fixLib) return;
fixLib = LoadLibraryA("EmpireOfTheAntsCore.dll"); // ou EmpireOfTheAntsCore.dll si tu gardes le .dll fixLib = LoadLibraryA("EmpireOfTheAntsCore.dll");
if (!fixLib) { if (!fixLib) {
// Optionnel: message d'erreur ou fallback
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK); MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return; return;
} }

View File

@@ -5,7 +5,6 @@
#include <reshade.hpp> #include <reshade.hpp>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <Windows.h>
// Core game dll functions declarations // Core game dll functions declarations
typedef void (*SetBoolFn)(bool,bool); typedef void (*SetBoolFn)(bool,bool);

View File

@@ -47,7 +47,6 @@ static void LoadFixDLL()
fixLib = LoadLibraryA("MindseyeCore.dll"); fixLib = LoadLibraryA("MindseyeCore.dll");
if (!fixLib) { if (!fixLib) {
// Optionnel: message d'erreur ou fallback
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK); MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return; return;
} }
@@ -221,7 +220,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
return FALSE; return FALSE;
LoadSettings(); LoadSettings();
//LoadFixDLL();
reshade::register_overlay("Mindseye", &on_overlay_draw); reshade::register_overlay("Mindseye", &on_overlay_draw);
reshade::register_event<reshade::addon_event::init_effect_runtime>( reshade::register_event<reshade::addon_event::init_effect_runtime>(
[](reshade::api::effect_runtime* runtime) { [](reshade::api::effect_runtime* runtime) {

View File

@@ -31,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLOU", "TLOU\TLOU.vcxproj",
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Starfield", "Starfield\Starfield.vcxproj", "{762480CC-C755-4AB5-A8EE-FBF7050E4DFE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Starfield", "Starfield\Starfield.vcxproj", "{762480CC-C755-4AB5-A8EE-FBF7050E4DFE}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wuchang Fallen Feathers", "WuchangFF\Wuchang.vcxproj", "{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
@@ -143,6 +145,14 @@ Global
{762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x64.Build.0 = Release|x64 {762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x64.Build.0 = Release|x64
{762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x86.ActiveCfg = Release|Win32 {762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x86.ActiveCfg = Release|Win32
{762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x86.Build.0 = Release|Win32 {762480CC-C755-4AB5-A8EE-FBF7050E4DFE}.Release|x86.Build.0 = Release|Win32
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Debug|x64.ActiveCfg = Debug|x64
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Debug|x64.Build.0 = Debug|x64
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Debug|x86.ActiveCfg = Debug|Win32
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Debug|x86.Build.0 = Debug|Win32
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Release|x64.ActiveCfg = Release|x64
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Release|x64.Build.0 = Release|x64
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Release|x86.ActiveCfg = Release|Win32
{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -47,7 +47,6 @@ static void LoadFixDLL()
fixLib = LoadLibraryA("RobocopUBCore.dll"); fixLib = LoadLibraryA("RobocopUBCore.dll");
if (!fixLib) { if (!fixLib) {
// Optionnel: message d'erreur ou fallback
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK); MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return; return;
} }
@@ -221,7 +220,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
return FALSE; return FALSE;
LoadSettings(); LoadSettings();
//LoadFixDLL();
reshade::register_overlay("Robocop Unfinished Business", &on_overlay_draw); reshade::register_overlay("Robocop Unfinished Business", &on_overlay_draw);
reshade::register_event<reshade::addon_event::init_effect_runtime>( reshade::register_event<reshade::addon_event::init_effect_runtime>(
[](reshade::api::effect_runtime* runtime) { [](reshade::api::effect_runtime* runtime) {

View File

@@ -5,7 +5,6 @@
#include <reshade.hpp> #include <reshade.hpp>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <Windows.h>
// Core game dll functions declarations // Core game dll functions declarations
typedef void (*SetBoolFn)(bool, bool); typedef void (*SetBoolFn)(bool, bool);
@@ -41,6 +40,7 @@ const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Load and unload game core dll functions /!\ necessary // Load and unload game core dll functions /!\ necessary
static void LoadFixDLL() static void LoadFixDLL()
{ {
MessageBoxA(nullptr, "LoadFixDll", "Erreur", MB_OK);
if (fixLib) return; if (fixLib) return;
fixLib = LoadLibraryA("SouthOfMidnightCore.dll"); fixLib = LoadLibraryA("SouthOfMidnightCore.dll");
if (!fixLib) { if (!fixLib) {

View File

@@ -221,7 +221,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
return FALSE; return FALSE;
LoadSettings(); LoadSettings();
//LoadFixDLL();
reshade::register_overlay("Spirit Of The North", &on_overlay_draw); reshade::register_overlay("Spirit Of The North", &on_overlay_draw);
reshade::register_event<reshade::addon_event::init_effect_runtime>( reshade::register_event<reshade::addon_event::init_effect_runtime>(
[](reshade::api::effect_runtime* runtime) { [](reshade::api::effect_runtime* runtime) {

View File

@@ -299,10 +299,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::EndChild(); ImGui::EndChild();
} }
static void UnLoadFixDLL() {
MessageBoxA(nullptr, "Déchargement dll", "Erreur", MB_OK);
}
// Main dll intrance // Main dll intrance
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
{ {

View File

@@ -67,7 +67,7 @@ static void LoadFixDLL()
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");; GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
// Appliquer les valeurs initiales chargées // Apply initial values loaded from ini settings
if (SetFOV) SetFOV(worldFOVvalue); if (SetFOV) SetFOV(worldFOVvalue);
if (SetCamera) SetCamera(cameraDistancevalue); if (SetCamera) SetCamera(cameraDistancevalue);
if (SetSharpness) SetSharpness(sharpnessvalue); if (SetSharpness) SetSharpness(sharpnessvalue);
@@ -77,7 +77,7 @@ static void LoadFixDLL()
if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
} }
// Addon functions // Save settings to ini file
static void SaveSettings() static void SaveSettings()
{ {
std::ofstream file(SETTINGS_FILE); std::ofstream file(SETTINGS_FILE);
@@ -95,6 +95,7 @@ static void SaveSettings()
} }
} }
// Load settings from ini file
static void LoadSettings() static void LoadSettings()
{ {
std::ifstream file(SETTINGS_FILE); std::ifstream file(SETTINGS_FILE);
@@ -255,15 +256,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::EndChild(); ImGui::EndChild();
} }
DWORD WINAPI MainThread(LPVOID)
{
// Tu peux ensuite réactiver LoadSettings/LoadFixDLL ici
LoadSettings();
reshade::register_overlay("The Last Of Us : Part II", &on_overlay_draw);
LoadFixDLL();
return 0;
}
// Main dll intrance // Main dll intrance
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
{ {

156
WuchangFF/Wuchang.vcxproj Normal file
View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6BFB12DD-7B5D-4BD7-B763-3374B9F85D10}</ProjectGuid>
<RootNamespace>WuchangFF</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Wuchang Fallen Feathers</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.addon</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.addon</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.addon</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.addon</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;TLOU2_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

250
WuchangFF/dllmain.cpp Normal file
View File

@@ -0,0 +1,250 @@
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
#define IMGUI_HAS_DOCK 1
#include <imgui.h>
#include <reshade.hpp>
#include <fstream>
#include <string>
#include <Windows.h>
#include <thread>
#include <chrono>
// Core game dll functions declarations
typedef void (*SetBoolFn)(bool, bool);
typedef void (*SetIntFn)(int);
typedef float (*GetFloatFn)();
typedef void (*InitDLL)();
static HMODULE fixLib = nullptr;
static SetBoolFn SetFixEnabled = nullptr;
static SetBoolFn SetFOVFixEnabled = nullptr;
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
static SetBoolFn SetDOFFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetCompensadedFOV = nullptr;
static GetFloatFn GetFOVOut = nullptr;
static InitDLL InitializeLogger = nullptr;
// Plugin variables for checkboxes and sliders
static bool fov_fix_enabled = false;
static bool aspect_ratio_fix_enabled = false;
static bool DOF_fix_enabled = false;
static bool fix_enabled = false;
static int worldFOVvalue = 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* ASPECT_FIX_SETTING = "AspectFIX=";
const char* DOF_FIX_SETTING = "DOFFIX=";
const char* WORLD_FOV_SETTING = "WorldFOV=";
const char* FIX_VERSION = "1.0.1";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control in game FOV.\n - Force aspect ratio.\n - Disable depth of field.\r\nFOV will be compensated when aspect fix is checked.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Load and unload game core dll functions /!\ necessary
static void LoadFixDLL()
{
std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(8000)); // Game process is not ready at launch and memory is not yet initialized
if (GetModuleHandleA("WuchangFFCore.dll") == nullptr) {
MessageBoxA(nullptr, "Appel dll", "Logger Error", MB_ICONERROR | MB_OK);
fixLib = LoadLibraryA("WuchangFFCore.dll");
if (!fixLib) {
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
return;
}
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled");
SetAspectRatioFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetAspectRatioFixEnabled");
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV");
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
// Apply initial values loaded from settings
if (SetFOV) SetFOV(worldFOVvalue);
//if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
//if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(aspect_ratio_fix_enabled, true);
//if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
}
}).detach(); // on le détache pour quil tourne indépendamment
}
// 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 << ASPECT_FIX_SETTING << (aspect_ratio_fix_enabled ? "1" : "0") << "\n";
file << DOF_FIX_SETTING << (DOF_fix_enabled ? "1" : "0") << "\n";
file << WORLD_FOV_SETTING << worldFOVvalue << "\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(ASPECT_FIX_SETTING) == 0)
{
std::string val = line.substr(strlen(ASPECT_FIX_SETTING));
aspect_ratio_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(WORLD_FOV_SETTING) == 0)
worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_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 = border
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);
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::SetCursorPos(ImVec2(5, 30));
ImGui::SetNextItemWidth(150.0f);
if (ImGui::SliderInt("", &worldFOVvalue, -20, 50)) {}
if (ImGui::IsItemDeactivatedAfterEdit()) {
if (SetFOV) SetFOV(worldFOVvalue);
SaveSettings();
}
}
ImGui::EndChild();
// Individual fixes
ImGui::SetCursorPos(ImVec2(240, 60));
ImGui::BeginChild("IndividualFixesHeader", ImVec2(250, 0), false);
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 aspect Ratio Fix", &aspect_ratio_fix_enabled)) {
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(aspect_ratio_fix_enabled, false);
SaveSettings();
}
ImGui::SetCursorPos(ImVec2(5, 80));
if (ImGui::Checkbox("Depth of field Fix", &DOF_fix_enabled)) {
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false);
SaveSettings();
}
}
ImGui::EndChild();
// Fix status
ImGui::SetCursorPos(ImVec2(10, 200));
ImGui::BeginChild("INFOSHeader", ImVec2(480, 80), true); // true = border
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::SetCursorPos(ImVec2(5, 30));
if (GetFOVIn && GetCompensadedFOV && GetFOVOut)
ImGui::Text("FOV In: %.2f, Compensated : %.2f, Out : %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
}
ImGui::EndChild();
}
// 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("Wuchang Fallen Feathers", &on_overlay_draw);
//reshade::register_event<reshade::addon_event::init_effect_runtime>(
// [](reshade::api::effect_runtime* runtime) {
// LoadFixDLL();
// });
reshade::register_event<reshade::addon_event::init_command_queue>(
[](reshade::api::command_queue *queue) {
LoadFixDLL();
});
break;
case DLL_PROCESS_DETACH:
reshade::unregister_addon(hinstDLL);
break;
}
return TRUE;
}