Add initial project files (excluding ignored content)
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
<?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>{E8319170-F415-4341-A80E-ED30B08CB431}</ProjectGuid>
|
||||
<RootNamespace>Indiana Jones And The Great Circle</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Indiana Jones And The Great Circle</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>IndianaJonesTGCCore</TargetName>
|
||||
<TargetExt>.asi</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>IndianaJonesTGCCore</TargetName>
|
||||
<TargetExt>.asi</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetName>IndianaJonesTGCCore</TargetName>
|
||||
<TargetExt>.asi</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetName>IndianaJonesTGCCore</TargetName>
|
||||
<TargetExt>.asi</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;%(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;%(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;%(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;%(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" />
|
||||
<ClInclude Include="framework.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>
|
||||
245
Indiana Jones And The Great Circle/dllmain.cpp
Normal file
245
Indiana Jones And The Great Circle/dllmain.cpp
Normal file
@@ -0,0 +1,245 @@
|
||||
#include "Memory.hpp";
|
||||
#include "Maths.hpp";
|
||||
#include "ObfuscateString.h"
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <spdlog/sinks/basic_file_sink.h>
|
||||
#include <iostream>
|
||||
#include <safetyhook.hpp>
|
||||
|
||||
// Constants
|
||||
const std::string PLUGIN_NAME = "IndianaJonesTGC";
|
||||
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
|
||||
const std::string gameExecutable = "TheGreatCircle.exe";
|
||||
const float baseAspect = 1.77777779;
|
||||
|
||||
// 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_cinematics_FOV_fix_enabled = false;
|
||||
static bool g_cinematics_FT_fix_enabled = false;
|
||||
static int g_AdditionalValue = 0;
|
||||
static int g_AdditionalCinematicsValue = 0;
|
||||
|
||||
// Shared values
|
||||
static float g_FOV_In = 0;
|
||||
static float g_FOV_Out = 0;
|
||||
static float g_Cinematics_FOV_In = 0;
|
||||
static float g_Compensated_Cinematics_FOV = 0;
|
||||
static float g_Cinematics_FOV_Out = 0;
|
||||
|
||||
// AOB Scan pointers
|
||||
static uint8_t* FOVaddress = nullptr;
|
||||
static uint8_t* CinematicsFOVaddress = nullptr;
|
||||
static uint8_t* CinematicsFTaddress = nullptr;
|
||||
|
||||
// Hooking
|
||||
static SafetyHookMid FOVHook{};
|
||||
static SafetyHookMid CinematicsFOVHook{};
|
||||
static SafetyHookMid CinematicsFTHook{};
|
||||
|
||||
// Prototypes for hooking
|
||||
static void FOVFixEnabled(bool fix_enabled);
|
||||
static void CinematicsFOVFixEnabled(bool fix_enabled);
|
||||
static void CinematicsFTFixEnabled(bool fix_enabled);
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled)
|
||||
{
|
||||
g_fix_enabled = enabled;
|
||||
if (g_fix_enabled && !AOBScanDone) {
|
||||
if (FOVaddress == nullptr) {
|
||||
constexpr auto FOVStringObfuscated = make_obfuscated<0x4A>("F3 44 ?? ?? ?? ?? 48 8B ?? ?? ?? 4C ?? ?? 49 0F ?? ?? ?? ?? ?? ?? 4C 8D");
|
||||
FOVaddress = Memory::aob_scan(gameExecutable, FOVStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
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; // Offset for the target opcode
|
||||
}
|
||||
}
|
||||
if (CinematicsFOVaddress == nullptr) {
|
||||
constexpr auto CinematicsFOVStringObfuscated = make_obfuscated<0x4A>("F3 0F ?? ?? F3 0F ?? ?? ?? ?? ?? ?? 0F ?? ?? E8 ?? ?? ?? ?? F3 0F ?? ?? E8");
|
||||
CinematicsFOVaddress = Memory::aob_scan(gameExecutable, CinematicsFOVStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!CinematicsFOVaddress)
|
||||
logger->warn("Cinematics FOV signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
logger->info("Cinematics FOV signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CinematicsFOVaddress));
|
||||
}
|
||||
}
|
||||
if (CinematicsFTaddress == nullptr) {
|
||||
constexpr auto FTStringObfuscated = make_obfuscated<0x4A>("75 ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 74 ?? 39 ?? ?? 77");
|
||||
CinematicsFTaddress = Memory::aob_scan(gameExecutable, FTStringObfuscated.decrypt(), PAGE_EXECUTE_READ);
|
||||
|
||||
if (!CinematicsFTaddress)
|
||||
logger->warn("Cinematics frametime signature not found. Maybe your game has been updated and is no more compatible with this plugin.");
|
||||
else {
|
||||
logger->info("Cinematics frametime signature found at address: 0x{:X}.", reinterpret_cast<uintptr_t>(CinematicsFTaddress));
|
||||
}
|
||||
if (FOVaddress && CinematicsFOVaddress && CinematicsFTaddress) {
|
||||
logger->info("All AOB signatures found. Ready to patch...");
|
||||
logger->info("--------------- AOB scanning finished ---------------");
|
||||
AOBScanDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_fix_enabled) {
|
||||
if (FOVaddress) FOVFixEnabled(g_fov_fix_enabled);
|
||||
if (CinematicsFOVaddress) CinematicsFOVFixEnabled(g_cinematics_FOV_fix_enabled);
|
||||
if (CinematicsFTaddress) CinematicsFTFixEnabled(g_cinematics_FT_fix_enabled);
|
||||
}
|
||||
else {
|
||||
if (FOVaddress) FOVFixEnabled(false);
|
||||
if (CinematicsFOVaddress) CinematicsFOVFixEnabled(false);
|
||||
if (CinematicsFTaddress) CinematicsFTFixEnabled(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); // FOV fix must be enabled when aspect ratio is too to compensate FOV
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCinematicsFOVFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_cinematics_FOV_fix_enabled = enabled;
|
||||
if (!init) CinematicsFOVFixEnabled(g_cinematics_FOV_fix_enabled);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCinematicsFTFixEnabled(bool enabled, bool init)
|
||||
{
|
||||
g_cinematics_FT_fix_enabled = enabled;
|
||||
if (!init) CinematicsFTFixEnabled(g_cinematics_FT_fix_enabled);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetFOV(int fov)
|
||||
{
|
||||
g_AdditionalValue = fov;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void SetCinematicsFOV(int fov)
|
||||
{
|
||||
g_AdditionalCinematicsValue = 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;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) float GetCinematicsFOVIn() {
|
||||
return g_Cinematics_FOV_In;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) float GetCinematicsCompensadedFOV() {
|
||||
return g_Compensated_Cinematics_FOV;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) float GetCinematicsFOVOut() {
|
||||
return g_Cinematics_FOV_Out;
|
||||
}
|
||||
|
||||
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.xmm11.f32[0];
|
||||
g_FOV_Out = ctx.xmm11.f32[0] += g_AdditionalValue;
|
||||
});
|
||||
}
|
||||
else FOVHook.enable();
|
||||
logger->info("FOV fix enabled");
|
||||
}
|
||||
if (!fix_enabled && FOVHook) {
|
||||
FOVHook.disable();
|
||||
logger->info("FOV fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void CinematicsFOVFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && CinematicsFOVaddress != nullptr) {
|
||||
if (!CinematicsFOVHook) {
|
||||
CinematicsFOVHook = safetyhook::create_mid(CinematicsFOVaddress,
|
||||
[](SafetyHookContext& ctx) {
|
||||
g_Cinematics_FOV_In = ctx.xmm3.f32[0];
|
||||
if (g_cinematics_FOV_fix_enabled)
|
||||
g_Compensated_Cinematics_FOV = ctx.xmm3.f32[0] = Maths::CompensateHorizontalFOV(g_Cinematics_FOV_In, baseAspect, aspectRatio);
|
||||
else
|
||||
g_Compensated_Cinematics_FOV = ctx.xmm3.f32[0];
|
||||
g_Cinematics_FOV_Out = ctx.xmm3.f32[0] += g_AdditionalCinematicsValue;
|
||||
});
|
||||
}
|
||||
else CinematicsFOVHook.enable();
|
||||
logger->info("Cinematics FOV fix enabled");
|
||||
}
|
||||
if (!fix_enabled && CinematicsFOVHook) {
|
||||
CinematicsFOVHook.disable();
|
||||
logger->info("Cinematics FOV fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void CinematicsFTFixEnabled(bool fix_enabled) {
|
||||
if (g_fix_enabled && fix_enabled && CinematicsFTaddress) {
|
||||
Memory::PatchBytes(CinematicsFTaddress, "\x90\x90", 2); // NOP
|
||||
logger->info("Cinematics frametime fix enabled");
|
||||
}
|
||||
if (!fix_enabled && CinematicsFTaddress) {
|
||||
Memory::RestoreBytes(CinematicsFTaddress);
|
||||
logger->info("Cinematics frametime fix disabled");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialisation de spdlog avec format personnalisé
|
||||
static void InitializeLogger()
|
||||
{
|
||||
try
|
||||
{
|
||||
logger = spdlog::basic_logger_mt("Fixlib", PLUGIN_LOG, true);
|
||||
spdlog::set_default_logger(logger);
|
||||
// Format : [YYYY-MM-DD HH:MM:SS] [INFO] message
|
||||
spdlog::set_pattern("[%Y-%m-%d %H:%M:%S] [%^%l%$] %v");
|
||||
spdlog::set_level(spdlog::level::debug);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Entrée standard DLL
|
||||
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)
|
||||
{
|
||||
//CinematicsDOFFixEnabled(false); // Core is loaded 3 times so i need to restore previous patched bytes
|
||||
logger->info("Plugin {} unloaded.", PLUGIN_NAME);
|
||||
spdlog::drop_all();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user