Compare commits
1 Commits
master
...
feature/GO
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ac4fe3678 |
216
GOWR/GOWR.vcxproj
Normal file
216
GOWR/GOWR.vcxproj
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
<?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>{644C5E16-6AE0-43E5-855D-1B59481AEC0D}</ProjectGuid>
|
||||||
|
<RootNamespace>Gears Of War Reloaded</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>Gears Of War Reloaded</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'">
|
||||||
|
<TargetName>GOWRCore</TargetName>
|
||||||
|
<TargetExt>.dll</TargetExt>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<TargetName>GOWRCore</TargetName>
|
||||||
|
<TargetExt>.dll</TargetExt>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<TargetName>GOWRCore</TargetName>
|
||||||
|
<TargetExt>.dll</TargetExt>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<TargetName>GOWRCore</TargetName>
|
||||||
|
<TargetExt>.dll</TargetExt>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>
|
||||||
|
</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>
|
||||||
|
</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile />
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)Memory;$(SolutionDir)Maths;$(SolutionDir)Obfuscate;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp23</LanguageStandard>
|
||||||
|
<UseStandardPreprocessor>true</UseStandardPreprocessor>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableUAC>false</EnableUAC>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>Zydis.lib;Maths.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>
|
||||||
|
</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>
|
||||||
|
</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile />
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)Memory;$(SolutionDir)Maths;$(SolutionDir)Obfuscate;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp23</LanguageStandard>
|
||||||
|
<UseStandardPreprocessor>true</UseStandardPreprocessor>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableUAC>false</EnableUAC>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>Zydis.lib;Maths.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>
|
||||||
|
</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>
|
||||||
|
</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile />
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)Memory;$(SolutionDir)Maths;$(SolutionDir)Obfuscate;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp23</LanguageStandard>
|
||||||
|
<UseStandardPreprocessor>true</UseStandardPreprocessor>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableUAC>false</EnableUAC>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>Zydis.lib;Maths.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>
|
||||||
|
</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>
|
||||||
|
</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile />
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)Memory;$(SolutionDir)Maths;$(SolutionDir)Obfuscate;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp23</LanguageStandard>
|
||||||
|
<UseStandardPreprocessor>true</UseStandardPreprocessor>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableUAC>false</EnableUAC>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>Zydis.lib;Maths.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\Obfuscate\ObfuscateString.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Memory\Memory.vcxproj">
|
||||||
|
<Project>{f9b5bbc6-67d4-4290-986f-08c6bac41ba3}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\allocator.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\easy.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\inline_hook.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\mid_hook.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\os.linux.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\os.windows.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\utility.cpp" />
|
||||||
|
<ClCompile Include="..\external\safetyhook\src\vmt_hook.cpp" />
|
||||||
|
<ClCompile Include="dllmain.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
191
GOWR/dllmain.cpp
Normal file
191
GOWR/dllmain.cpp
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
#include "Memory.hpp";
|
||||||
|
#include "Maths.hpp";
|
||||||
|
#include "ObfuscateString.h"
|
||||||
|
#include <string>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
#include <spdlog/sinks/rotating_file_sink.h>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <safetyhook.hpp>
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const std::string PLUGIN_NAME = "GOWR";
|
||||||
|
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
|
||||||
|
const std::string gameExecutable = "GOWDE-Steam.exe";
|
||||||
|
|
||||||
|
// Logger
|
||||||
|
std::shared_ptr<spdlog::logger> logger;
|
||||||
|
|
||||||
|
// Screen informations
|
||||||
|
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
static float aspectRatio = (float)screenWidth / screenHeight;
|
||||||
|
|
||||||
|
// Plugin states
|
||||||
|
static bool AOBScanDone = false;
|
||||||
|
static bool g_fix_enabled = false;
|
||||||
|
static bool g_fov_fix_enabled = false;
|
||||||
|
static bool g_DOF_fix_enabled = false;
|
||||||
|
static int g_AdditionalFOVValue = 0;
|
||||||
|
|
||||||
|
// Shared values
|
||||||
|
static float g_FOV_In = 0;
|
||||||
|
static float g_FOV_Out = 0;
|
||||||
|
|
||||||
|
// AOB Scan pointers
|
||||||
|
static uint8_t* FOVaddress = nullptr;
|
||||||
|
static uint8_t* DOFaddress = nullptr;
|
||||||
|
|
||||||
|
// Hooking
|
||||||
|
static SafetyHookMid FOVHook{};
|
||||||
|
|
||||||
|
// Prototypes
|
||||||
|
static void FOVFixEnabled(bool fix_enabled);
|
||||||
|
static void DOFFixEnabled(bool fix_enabled);
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
g_fix_enabled = enabled;
|
||||||
|
if (g_fix_enabled && !AOBScanDone) {
|
||||||
|
logger->info("--------------- AOB scan started ---------------");
|
||||||
|
if (FOVaddress == nullptr) {
|
||||||
|
constexpr auto FOVStringObfuscated = make_obfuscated<0x4A>("C5 FA ?? ?? ?? ?? 48 8B ?? ?? ?? 48 ?? ?? ?? 5F C3 CC CC 48 ?? ?? 48 89 ?? ?? 48 89 ?? ?? C5");
|
||||||
|
FOVaddress = Memory::AOBScan(gameExecutable, FOVStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||||
|
//"GOWDE-Steam.exe" + 213C8C - 48 8B CF - mov rcx, rdi
|
||||||
|
//"GOWDE-Steam.exe" + 213C8F - FF D3 - call rbx
|
||||||
|
//"GOWDE-Steam.exe" + 213C91 - C5 FA 10 44 24 28 - vmovss xmm0, [rsp + 28]
|
||||||
|
//"GOWDE-Steam.exe" + 213C97 - 48 8B 5C 24 40 - mov rbx, [rsp + 40]
|
||||||
|
//"GOWDE-Steam.exe" + 213C9C - 48 83 C4 30 - add rsp, 30
|
||||||
|
|
||||||
|
if (!FOVaddress)
|
||||||
|
logger->warn("FOV signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||||
|
else {
|
||||||
|
logger->info("FOV signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(FOVaddress));
|
||||||
|
FOVaddress += 0x6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (DOFaddress == nullptr) {
|
||||||
|
// constexpr auto DOFStringObfuscated = make_obfuscated<0x4A>("75 ?? BF ?? ?? ?? ?? 8B ?? ?? 48 ?? ?? E8");
|
||||||
|
// DOFaddress = Memory::AOBScan(gameExecutable, DOFStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||||
|
// //"SwordOfTheSea-Win64-Shipping.exe" + 2359B92 - 75 05 - jne "SwordOfTheSea-Win64-Shipping.exe" + 2359B99
|
||||||
|
// //"SwordOfTheSea-Win64-Shipping.exe" + 2359B94 - BF 04 00 00 00 - mov edi, "Sword Of The Sea._Init_thread_epoch"
|
||||||
|
// //"SwordOfTheSea-Win64-Shipping.exe" + 2359B99 - 8B 3C 37 - mov edi, [rdi + rsi]
|
||||||
|
// //"SwordOfTheSea-Win64-Shipping.exe" + 2359B9C - 48 8B CB - mov rcx, rbx
|
||||||
|
// //"SwordOfTheSea-Win64-Shipping.exe" + 2359B9F - E8 EC ED 61 01 - call "SwordOfTheSea-Win64-Shipping.exe" + 3978990
|
||||||
|
|
||||||
|
// if (!DOFaddress)
|
||||||
|
// logger->warn("DOF signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||||
|
// else {
|
||||||
|
// logger->info("DOF signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(DOFaddress));
|
||||||
|
// DOFaddress += 0x7;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (FOVaddress /*&& DOFaddress*/) {
|
||||||
|
logger->info("All AOB signatures found. Ready to patch...");
|
||||||
|
AOBScanDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger->info("--------------- AOB scan finished ---------------");
|
||||||
|
}
|
||||||
|
if (g_fix_enabled) {
|
||||||
|
if (FOVaddress) FOVFixEnabled(g_fov_fix_enabled);
|
||||||
|
//if (DOFaddress) DOFFixEnabled(g_DOF_fix_enabled);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (FOVaddress) FOVFixEnabled(false);
|
||||||
|
//if (DOFaddress) DOFFixEnabled(false);
|
||||||
|
logger->info("All fixes disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters for Reshade addon call
|
||||||
|
extern "C" __declspec(dllexport) void SetFOVFixEnabled(bool enabled, bool init)
|
||||||
|
{
|
||||||
|
g_fov_fix_enabled = enabled;
|
||||||
|
if (!init) FOVFixEnabled(g_fov_fix_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void SetDOFFixEnabled(bool enabled, bool init)
|
||||||
|
{
|
||||||
|
g_DOF_fix_enabled = enabled;
|
||||||
|
if (!init) DOFFixEnabled(g_DOF_fix_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
||||||
|
{
|
||||||
|
g_AdditionalFOVValue = fov;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters for Reshade addon call
|
||||||
|
extern "C" __declspec(dllexport) float GetFOVIn() {
|
||||||
|
return g_FOV_In;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) float GetFOVOut() {
|
||||||
|
return g_FOV_Out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code injection functions
|
||||||
|
static void FOVFixEnabled(bool fix_enabled) {
|
||||||
|
if (g_fix_enabled && fix_enabled && FOVaddress != nullptr) {
|
||||||
|
if (!FOVHook) { // Hook only once
|
||||||
|
FOVHook = safetyhook::create_mid(FOVaddress,
|
||||||
|
[](SafetyHookContext& ctx) {
|
||||||
|
g_FOV_In = ctx.xmm0.f32[0];
|
||||||
|
g_FOV_Out = ctx.xmm0.f32[0] += (g_fov_fix_enabled ? g_AdditionalFOVValue : 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else FOVHook.enable();
|
||||||
|
logger->info("FOV fix enabled");
|
||||||
|
}
|
||||||
|
if (!fix_enabled) {
|
||||||
|
if (FOVHook) FOVHook.disable();
|
||||||
|
logger->info("FOV fix disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Memory patch fixes
|
||||||
|
static void DOFFixEnabled(bool fix_enabled) {
|
||||||
|
if (g_fix_enabled && fix_enabled && DOFaddress) {
|
||||||
|
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
|
||||||
|
logger->info("Depth of field fix enabled");
|
||||||
|
}
|
||||||
|
if (!fix_enabled && DOFaddress) {
|
||||||
|
Memory::RestoreBytes(DOFaddress);
|
||||||
|
logger->info("Depth of field fix disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InitializeLogger()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::filesystem::path log_path = std::filesystem::absolute(PLUGIN_LOG);
|
||||||
|
if (std::filesystem::exists(log_path))
|
||||||
|
std::filesystem::remove(log_path);
|
||||||
|
logger = std::make_shared<spdlog::logger>("Gears Of War : Reloaded", std::make_shared<spdlog::sinks::rotating_file_sink_st>(PLUGIN_LOG, 10 * 1024 * 1024, 1));
|
||||||
|
logger->flush_on(spdlog::level::debug); // Flush automatically
|
||||||
|
}
|
||||||
|
catch (const spdlog::spdlog_ex& ex)
|
||||||
|
{
|
||||||
|
std::string plugin_error_message = "Could not open " + PLUGIN_LOG;
|
||||||
|
MessageBoxA(nullptr, plugin_error_message.c_str(), "Logger Error", MB_ICONERROR | MB_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standard dll entry
|
||||||
|
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID)
|
||||||
|
{
|
||||||
|
if (reason == DLL_PROCESS_ATTACH)
|
||||||
|
{
|
||||||
|
InitializeLogger();
|
||||||
|
logger->info("Plugin {} loaded.", PLUGIN_NAME);
|
||||||
|
}
|
||||||
|
else if (reason == DLL_PROCESS_DETACH)
|
||||||
|
{
|
||||||
|
logger->info("Plugin {} unloaded.", PLUGIN_NAME);
|
||||||
|
spdlog::drop_all();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
@@ -51,6 +51,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sword Of The Sea", "Sword O
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Metal Gear Solid Delta Snake Eater", "Metal Gear Solid Delta\MGSDelta.vcxproj", "{F34FF148-7868-4D6E-8E55-6741C00A7E4B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Metal Gear Solid Delta Snake Eater", "Metal Gear Solid Delta\MGSDelta.vcxproj", "{F34FF148-7868-4D6E-8E55-6741C00A7E4B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gears Of War Reloaded", "GOWR\GOWR.vcxproj", "{644C5E16-6AE0-43E5-855D-1B59481AEC0D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
@@ -243,6 +245,14 @@ Global
|
|||||||
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x64.Build.0 = Release|x64
|
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x64.Build.0 = Release|x64
|
||||||
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x86.ActiveCfg = Release|Win32
|
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x86.Build.0 = Release|Win32
|
{F34FF148-7868-4D6E-8E55-6741C00A7E4B}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{644C5E16-6AE0-43E5-855D-1B59481AEC0D}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user