Compare commits

...

4 Commits

4 changed files with 1052 additions and 16 deletions

View File

@@ -0,0 +1,324 @@
<?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_internal|Win32">
<Configuration>Release_internal</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_internal|x64">
<Configuration>Release_internal</Configuration>
<Platform>x64</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>{4E749479-CEF0-4E4D-B468-6B9E2A1184A2}</ProjectGuid>
<RootNamespace>Styx Blades Of Greed</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Styx Blades Of Greed</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>
<WholeProgramOptimization>true</WholeProgramOptimization>
</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)'=='Release_internal|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>
<WholeProgramOptimization>true</WholeProgramOptimization>
</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_internal|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 Condition="'$(Configuration)|$(Platform)'=='Release_internal|Win32'" Label="PropertySheets">
<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>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_internal|x64'" Label="PropertySheets">
<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>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_internal|Win32'">
<TargetName>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_internal|x64'">
<TargetName>StyxBladesOfGreedCore</TargetName>
<TargetExt>.dll</TargetExt>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</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\includes;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories);$(SolutionDir)external\includes;$(SolutionDir)external\includes</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</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>ZYDIS_STATIC_BUILD</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile />
<AdditionalIncludeDirectories>$(SolutionDir)libs\Memory;$(SolutionDir)libs\Maths;$(SolutionDir)libs\Obfuscate;$(SolutionDir)libs\Logger;$(ProjectDir)SDK;$(SolutionDir)libs\UEngine;$(SolutionDir)external;$(SolutionDir)external\includes;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories);$(SolutionDir)external\includes;$(SolutionDir)external\includes</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</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_internal|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MY_VERBOSE_LOGS;ZYDIS_STATIC_BUILD</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>
</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(SolutionDir)libs\Memory;$(SolutionDir)libs\Maths;$(SolutionDir)libs\Obfuscate;$(SolutionDir)libs\Logger;$(ProjectDir)SDK;$(SolutionDir)libs\UEngine;$(SolutionDir)external;$(SolutionDir)external\includes;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Zydis.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\includes;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;%(AdditionalIncludeDirectories);$(SolutionDir)external\includes;$(SolutionDir)external\includes</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</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>ZYDIS_STATIC_BUILD</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile />
<AdditionalIncludeDirectories>$(SolutionDir)libs\Memory;$(SolutionDir)libs\Maths;$(SolutionDir)libs\Obfuscate;$(SolutionDir)libs\Logger;$(ProjectDir)SDK;$(SolutionDir)libs\UEngine;$(SolutionDir)external;$(SolutionDir)external\includes;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)UEngine;$(SolutionDir)external;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;$(SolutionDir)external\MinHook\include;$(ProjectDir)SDK;%(AdditionalIncludeDirectories);$(SolutionDir)external\includes;$(SolutionDir)external\includes</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Zydis.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_internal|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MY_VERBOSE_LOGS;ZYDIS_STATIC_BUILD</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>
</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(SolutionDir)libs\Memory;$(SolutionDir)libs\Maths;$(SolutionDir)libs\Obfuscate;$(SolutionDir)libs\Logger;$(ProjectDir)SDK;$(SolutionDir)libs\UEngine;$(SolutionDir)external;$(SolutionDir)external\includes;$(SolutionDir)external\safetyhook\include;$(SolutionDir)external\zydis\dependencies\zycore\include;$(SolutionDir)external\zydis\include;$(SolutionDir)zydis\src;</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp23</LanguageStandard>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
<Optimization>MinSpace</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(SolutionDir)external\zydis\Libs;$(SolutionDir)external\Maths;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Zydis.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<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="..\libs\Maths\Maths.cpp" />
<ClCompile Include="..\libs\Memory\Memory.cpp" />
<ClCompile Include="..\libs\UEngine\UEngine.cpp" />
<ClCompile Include="..\libs\UEngine\UETools.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="SDK\AIModule_functions.cpp" />
<ClCompile Include="SDK\Basic.cpp" />
<ClCompile Include="SDK\CoreUObject_functions.cpp" />
<ClCompile Include="SDK\CyaAI_functions.cpp" />
<ClCompile Include="SDK\CyaTools_functions.cpp" />
<ClCompile Include="SDK\Engine_functions.cpp" />
<ClCompile Include="SDK\Styx3_functions.cpp" />
<ClCompile Include="SDK\UMG_functions.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,565 @@
#include <bit>
#include "CommonHeaders.h"
#include "UEngine.hpp"
#include "UETools.hpp"
#include "UEvars.hpp"
#include "UEMath.hpp"
#include "Logger.hpp"
#include "SDK/Basic.hpp"
#include "SDK/Engine_classes.hpp"
#include "SDK/UI_Settings_classes.hpp"
#include "SDK/UI_InputButton_Menu_classes.hpp"
#include "SDK/UI_Profile_classes.hpp"
#include "SDK/UI_MainMenu_classes.hpp"
#include "SDK/UI_Difficulty_classes.hpp"
#include "SDK/UI_PauseMenu_classes.hpp"
#include "SDK/Styx3_classes.hpp"
using namespace SDK;
// Constants
const std::string PLUGIN_NAME = "Styx";
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
// Logger
std::shared_ptr<spdlog::logger> logger;
// Screen informations
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
float g_AspectRatio = (float)screenWidth / screenHeight;
float g_BaseAspectRatio = 2.39;
// Plugin states
static bool AOBScanDone = false;
static bool g_Console = false;
static std::atomic<bool> g_fix_enabled = false;
static std::atomic<bool> g_fov_fix_enabled = false;
static std::atomic<bool> g_ultrawide_fix_enabled = false;
static std::atomic<bool> g_HUD_fix_enabled = false;
static std::atomic<bool> g_Camera_fix_enabled = false;
static std::atomic<bool> g_DOF_fix_enabled = false;
static std::atomic<bool> g_CA_fix_enabled = false;
static std::atomic<bool> g_Vignetting_fix_enabled = false;
static std::atomic<bool> g_Fog_fix_enabled = false;
static std::atomic<bool> g_TimeDilation_fix_enabled = false;
static std::atomic<bool> g_GodMode_fix_enabled = false;
static std::atomic<bool> g_Amber_fix_enabled = false;
static std::atomic<bool> g_Stealth_fix_enabled = false;
static int g_AdditionalFOVValue = 0;
static float g_CameraMultiplier = 1.f;
static float g_WorldTimeDilationValue = 1.f;
static float g_AITimeDilationValue = 1.f;
static int g_HUDOffsets = 0;
static int g_UIOffsets = 0;
static float g_PlayerHealth = 0.f;
static float g_PlayerAmber = 0.f;
static bool user_inputs_logged = false;
// Shared values
static float g_FOV_In = 60.f;
static float g_CompensatedFOV = 60.f;
static float g_FOV_Out = 60.f;
static float g_CameraIn = 200.f;
static float g_CameraOut = 200.f;
// AOB Scan pointers
static uint8_t* DOFaddress = nullptr;
static uint8_t* CAaddress = nullptr;
static uint8_t* Vignettingaddress = nullptr;
static uint8_t* Fogaddress = nullptr;
static uint8_t* CameraComponentaddress = nullptr;
static uint8_t* CameraDistanceaddress = nullptr;
static uint8_t* ConstrainAspectRatioaddress = nullptr;
static uint8_t* WorldTimedilationaddress = nullptr;
static uint8_t* Timedilationaddress = nullptr;
// Hooking
static SafetyHookMid FOVHook{};
static SafetyHookMid CameraHook{};
static SafetyHookMid UltraWideHook1{};
static SafetyHookMid UltraWideHook2{};
static SafetyHookMid PEHook{};
static SafetyHookMid WorldTimeDilationHook{};
static SafetyHookMid TimeDilationHook{};
// Prototypes
static void FOVFixEnabled();
static void UltraWideFixEnabled();
static void CameraDistanceFixEnabled();
static void HUDUpdate(bool writeLog);
static void HUDFixEnabled(UWidget* widget, float left, float right, bool writeLog, int depth);
static void DOFFixEnabled();
static void CAFixEnabled();
static void VignettingFixEnabled();
static void FogFixEnabled();
static void EnableConsole();
static void EnableCheats(Cheat cheat);
static void ProcessEvent();
// UEngine variable
static UWidget* g_UIMainMenuWidget = nullptr;
static UWidget* g_UISettingsWidget = nullptr;
static UWidget* g_UIDescriptionWidget = nullptr;
static UWidget* g_DifficultyWidget = nullptr;
static UWidget* g_difficultyMenusWidget = nullptr;
static UWidget* g_ProfileWidget = nullptr;
static UWidget* g_PauseWidget = nullptr;
static UWidget* g_StatusWidget = nullptr;
static UWidget* g_GaugesWidget = nullptr;
static UWidget* g_ChangeWheelWidget = nullptr;
static UWidget* g_AbilityWheelWidget = nullptr;
static UWidget* g_CraftingWidget = nullptr;
static AStyx3PlayerCharacter* g_Player = nullptr;
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
g_fix_enabled = enabled;
if (!AOBScanDone) { // Unreal Engine 5.6
logger->info("--------------- AOB scan started ---------------");
constexpr auto CameraComponentStringObfuscated = make_obfuscated<0xF3>("EB ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? 8B 83 ?? ?? ?? ?? 89");
constexpr auto CameraDistanceStringObfuscated = make_obfuscated<0x66>("0F ?? ?? F3 0F ?? ?? 0F ?? ?? 0F 11 ?? ?? ?? 0F 10 ?? ?? ?? 66 0F ?? ?? F2 0F");
constexpr auto DOFStringObfuscated = make_obfuscated<0xC1>("8B ?? ?? 48 ?? ?? E8 ?? ?? ?? ?? 0F ?? ?? 48 8D ?? ?? ?? ?? ?? 48 C1");
constexpr auto CAStringObfuscated = make_obfuscated<0x39>("7F ?? 44 89 ?? ?? ?? ?? ?? 43 8B ?? ?? 39 05 ?? ?? ?? ?? 0F 8F");
constexpr auto VignettingStringObfuscated = make_obfuscated<0xEB>("8B ?? 83 ?? ?? 7D ?? 44 89 ?? ?? ?? ?? ?? EB");
constexpr auto FogStringObfuscated = make_obfuscated<0x75>("74 ?? 48 8B ?? ?? ?? ?? ?? 83 ?? ?? ?? 75 ?? 40 ?? ?? EB ?? 40 ?? ?? 48");
constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0xF6>("F6 81 ?? ?? ?? ?? ?? 74 ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? F3 0F ?? ?? ?? ?? ?? ?? C3");
constexpr auto TimeDilationStringObfuscated = make_obfuscated<0x44>("F3 0F ?? ?? ?? EB ?? F3 0F ?? ?? ?? ?? ?? ?? 48 8B ?? ?? 4C ?? ?? F3 0F ?? ?? 44");
using AOBScan::Make;
using OffsetScan::Make;
// Prepare all data for scanning
std::vector<AOBScanEntry> signatures = {
Make(&CameraComponentaddress, CameraComponentStringObfuscated, "FOV"),
Make(&CameraDistanceaddress, CameraDistanceStringObfuscated, "Camera distance"),
Make(&DOFaddress, DOFStringObfuscated, "DOF"),
Make(&CAaddress, CAStringObfuscated, "Chromatic aberrations"),
Make(&Vignettingaddress, VignettingStringObfuscated, "Vignetting"),
Make(&Fogaddress, FogStringObfuscated, "Fog"),
Make(&WorldTimedilationaddress, WorldTimeDilationStringObfuscated, "World time dilation"),
Make(&Timedilationaddress, TimeDilationStringObfuscated, "Actor time dilation")
};
// Scan all signature in a batch
Memory::AOBScanBatch(signatures, logger);
ConstrainAspectRatioaddress = CameraComponentaddress + 0x18;
if (CameraComponentaddress && CameraDistanceaddress && DOFaddress && CAaddress && Vignettingaddress &&
Fogaddress && ConstrainAspectRatioaddress && WorldTimedilationaddress && Timedilationaddress /*&& Stealthaddress*/)
logger->info("All AOB signatures found. Ready to patch...");
if (!GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
logger->info("------------ UEngine offsets search ------------");
uint8_t* baseModule = reinterpret_cast<uint8_t*>(GetModuleHandleA(nullptr)); // Get game base address
constexpr auto GObjetcsStringObfuscated = make_obfuscated<0x8D>("48 8B ?? ?? ?? ?? ?? 48 8B ?? ?? 48 8D ?? ?? EB ?? 33");
constexpr auto GWorldStringObfuscated = make_obfuscated<0x5B>("48 89 1D ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 48 83 ?? ?? 5B C3");
constexpr auto AppendStringStringObfuscated = make_obfuscated<0x80>("48 89 ?? ?? ?? 48 89 ?? ?? ?? 57 48 83 ?? ?? 80 3D ?? ?? ?? ?? ?? 48 ?? F2 8B ?? 48 ?? ?? 74 ?? 4C 8D ?? ?? ?? ?? ?? EB ?? 48 8D ?? ?? ?? ?? ?? E8 ?? ?? ?? ?? 4C");
constexpr auto ProcessEventStringObfuscated = make_obfuscated<0x56>("40 ?? 56 57 41 ?? 41 ?? 41 ?? 41 ?? 48 81 ?? ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? ?? ?? 8B 41");
// Prepare all data for scanning
std::vector<OffsetScanEntry> UEoffsetsScans = {
Make(&GObjectsaddress, GObjetcsStringObfuscated, "GObjects", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GObjects, 0x3),
Make(&GWorldaddress, GWorldStringObfuscated, "GWorld", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GWorld, 0x3),
Make(&AppendStringaddress, AppendStringStringObfuscated, "AppendString", OffsetCalcType::UE_CalculateOffset, &Offsets::AppendString),
Make(&ProcessEventaddress, ProcessEventStringObfuscated, "ProcessEvent", OffsetCalcType::UE_CalculateOffset, &Offsets::ProcessEvent)
};
// Retrieve all Unreal Engine offsets in a batch
Memory::OffsetScanBatch(UEoffsetsScans, baseModule, logger, "");
}
logger->info("-------------- Fixes initialisation -------------");
AOBScanDone = true;
}
if (!init && CameraComponentaddress) FOVFixEnabled();
if (!init && ConstrainAspectRatioaddress) UltraWideFixEnabled();
if (!init && CameraDistanceaddress) CameraDistanceFixEnabled();
if (!init) HUDUpdate(true);
if (!init && DOFaddress) DOFFixEnabled();
if (!init && CAaddress) CAFixEnabled();
if (!init && Vignettingaddress) VignettingFixEnabled();
if (!init && Fogaddress) FogFixEnabled();
if (!init && WorldTimedilationaddress) {
EnableCheats(Cheat::TimeDilation);
EnableCheats(Cheat::GodMode);
EnableCheats(Cheat::Mana);
EnableCheats(Cheat::Stealth);
}
ProcessEvent();
}
// Setters for Reshade addon call
extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enabled) { // Set each fix individually
if (fix == GameFixes::DevConsole) { g_Console = enabled; EnableConsole(); }
if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); }
if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(); }
if (fix == GameFixes::Camera) { g_Camera_fix_enabled = enabled; CameraDistanceFixEnabled(); }
if (fix == GameFixes::DOF) { g_DOF_fix_enabled = enabled; DOFFixEnabled(); }
if (fix == GameFixes::ChromaticAberrations) { g_CA_fix_enabled = enabled; CAFixEnabled(); }
if (fix == GameFixes::Vignetting) { g_Vignetting_fix_enabled = enabled; VignettingFixEnabled(); }
if (fix == GameFixes::Fog) { g_Fog_fix_enabled = enabled; FogFixEnabled(); }
if (fix == GameFixes::HUD) { g_HUD_fix_enabled = enabled; HUDUpdate(true); }
if (fix == GameFixes::TimeDilation) { g_TimeDilation_fix_enabled = enabled; EnableCheats(Cheat::TimeDilation); }
if (fix == GameFixes::GodMode) { g_GodMode_fix_enabled = enabled; EnableCheats(Cheat::GodMode); }
if (fix == GameFixes::Mana) { g_Amber_fix_enabled = enabled; EnableCheats(Cheat::Mana); }
if (fix == GameFixes::Stealth) { g_Stealth_fix_enabled = enabled; EnableCheats(Cheat::Stealth); }
}
extern "C" __declspec(dllexport) void SetValues(GameSetting setting, float value) {
if (setting == GameSetting::FOV) g_AdditionalFOVValue = (int)(value);
if (setting == GameSetting::CameraDistance) g_CameraMultiplier = value;
if (setting == GameSetting::HUD) {
g_HUDOffsets = ((int)value * screenWidth) / 100;
HUDUpdate(false);
}
if (setting == GameSetting::UI) {
g_UIOffsets = ((int)value * screenWidth) / 100;
HUDUpdate(false);
}
if (setting == GameSetting::WorldTimeDilation) g_WorldTimeDilationValue = value;
if (setting == GameSetting::AITimeDilation) g_AITimeDilationValue = value;
}
// Getters for Reshade addon call
extern "C" __declspec(dllexport) void GetGameInfos(GameInfos* infos) {
if (!infos) return;
infos->FOVIn = g_FOV_In;
infos->FOVOut = g_FOV_Out;
infos->cameraIn = g_CameraIn;
infos->cameraOut = g_CameraOut;
infos->CompensatedFOV = g_CompensatedFOV;
infos->Health = g_PlayerHealth;
infos->Mana = g_PlayerAmber;
infos->consoleEnabled = g_Console_Enabled;
}
// -- Code injection functions --
static void ProcessEvent() {
if (!PEHook && ProcessEventaddress) {
PEHook = safetyhook::create_mid(ProcessEventaddress + 0xc,
[](SafetyHookContext& ctx) {
UObject* object = (UObject*)ctx.rcx;
UFunction* func = (UFunction*)ctx.rdx;
if (!object || !func) return;
std::string funcName = func->GetName();
std::string objectName = object->GetName();
// Full stealth fix: disable AI perception.
if (funcName == "OnPerceptionIntensityUpdated") {
if (object->IsA(AStyx3AIController::StaticClass())) {
auto* AIController = static_cast<AStyx3AIController*>(object);
if (g_Player && AIController->PerceptionGaugeComponent) {
if (g_Stealth_fix_enabled)
AIController->PerceptionGaugeComponent->ResetGauges(g_Player);
else
AIController->PerceptionGaugeComponent->SetActiveBufferDetection(g_Player, true);
}
}
}
if (object->IsA(UUserWidget::StaticClass()) && (funcName == "Construct" || funcName == "Destruct" || funcName == "Tick")) {
auto UpdateUI = [&](const std::vector<UWidget**>& targets, const std::vector<UWidget*>& values) {
if (funcName == "Construct") {
for (size_t i = 0; i < targets.size(); ++i)
*targets[i] = values[i];
HUDUpdate(false);
}
else if (funcName == "Destruct")
for (auto* t : targets) *t = nullptr;
};
// UI scaling
if (object->IsA(UUI_Settings_C::StaticClass())) {
auto* settings = static_cast<UUI_Settings_C*>(object);
auto* widget = static_cast<UUserWidget*>(object);
UpdateUI({ &g_UISettingsWidget, &g_UIDescriptionWidget }, { widget->WidgetTree->RootWidget, settings->Description_Holder });
}
else if (object->IsA(UUI_Difficulty_C::StaticClass())) {
auto* difficulty = static_cast<UUI_Difficulty_C*>(object);
auto* widget = static_cast<UUserWidget*>(object);
UpdateUI({ &g_DifficultyWidget, &g_difficultyMenusWidget }, { widget->WidgetTree->RootWidget, difficulty->VerticalBox_Menu });
}
else if (object->IsA(UUI_PauseMenu_C::StaticClass())) {
auto* pauseMenu = static_cast<UUI_PauseMenu_C*>(object);
UpdateUI({ &g_PauseWidget }, { pauseMenu->WidgetTree->RootWidget });
}
else if (object->IsA(UUI_Profile_C::StaticClass())) {
auto* profile = static_cast<UUI_Profile_C*>(object);
UpdateUI({ &g_ProfileWidget }, { profile->WidgetTree->RootWidget });
}
else if (object->IsA(UUI_MainMenu_C::StaticClass())) {
auto* mainmenu = static_cast<UUI_MainMenu_C*>(object);
UpdateUI({ &g_UIMainMenuWidget }, { mainmenu->WidgetTree->RootWidget });
}
// HUD scaling
else {
std::function<void(SDK::UWidget*)> FindWidgets;
FindWidgets = [&](SDK::UWidget* Widget) { // Find all HUD important widgets in container
if (!Widget) return;
const std::string widgetName = Widget->GetName();
const std::string className = Widget->Class ? Widget->Class->GetName() : "";
auto match = [&](const std::string& pattern) {
return widgetName.find(pattern) != std::string::npos || className.find(pattern) != std::string::npos;
};
if (!g_StatusWidget && match("StatusWidget")) g_StatusWidget = Widget;
else if (!g_GaugesWidget && match("Gauges")) g_GaugesWidget = Widget;
else if (!g_ChangeWheelWidget && match("ChangeWheel")) g_ChangeWheelWidget = Widget;
else if (!g_AbilityWheelWidget && match("AbilityWheel")) g_AbilityWheelWidget = Widget;
// Stop early if everything found-
if (g_StatusWidget && g_GaugesWidget && g_ChangeWheelWidget && g_AbilityWheelWidget /*&& g_CraftingDescWidget*/)
return;
// Descend Panel children
if (Widget->IsA(SDK::UPanelWidget::StaticClass())) {
auto* Panel = static_cast<SDK::UPanelWidget*>(Widget);
for (int i = 0; i < Panel->GetChildrenCount(); ++i)
FindWidgets(Panel->GetChildAt(i));
}
// Descend UserWidget root
if (Widget->IsA(SDK::UUserWidget::StaticClass())) {
auto* UW = static_cast<SDK::UUserWidget*>(Widget);
if (UW->WidgetTree && UW->WidgetTree->RootWidget)
FindWidgets(UW->WidgetTree->RootWidget);
}
};
if (objectName.contains("Crafting")) {
auto* crafting = static_cast<UUserWidget*>(object);
if (funcName == "Construct") {
g_CraftingWidget = crafting->WidgetTree->RootWidget;
HUDUpdate(false);
}
else if (funcName == "Destruct") {
g_CraftingWidget = nullptr;
//g_CraftingDescWidget = nullptr;
}
}
else if (objectName.contains("HUD_Widget_C")) {
auto* HUDWidget = static_cast<UUserWidget*>(object);
if (funcName == "Construct") {
if (HUDWidget && HUDWidget->Class) {
FindWidgets(HUDWidget->WidgetTree->RootWidget);
HUDUpdate(false);
}
}
else if (funcName == "Destruct") {
g_StatusWidget = nullptr;
g_GaugesWidget = nullptr;
g_ChangeWheelWidget = nullptr;
g_AbilityWheelWidget = nullptr;
}
}
}
}
});
}
}
// -- HUD positionning --
static void HUDUpdate(bool writeLog) {
HUDFixEnabled(g_UIMainMenuWidget, g_UIOffsets, g_UIOffsets , false, 1);
HUDFixEnabled(g_UISettingsWidget, g_UIOffsets, g_UIOffsets, false, 1);
HUDFixEnabled(g_UIDescriptionWidget, g_UIOffsets + 1500.f, 675.f, false, 1);
HUDFixEnabled(g_ProfileWidget, g_UIOffsets, g_UIOffsets, false, 1);
HUDFixEnabled(g_DifficultyWidget, g_UIOffsets, g_UIOffsets, false, 1);
HUDFixEnabled(g_difficultyMenusWidget, g_UIOffsets + 576.f + 100.f, 576, false, 1);
HUDFixEnabled(g_PauseWidget, g_UIOffsets, g_UIOffsets, false, 2);
HUDFixEnabled(g_StatusWidget, g_HUDOffsets, 0.f, false, 1);
HUDFixEnabled(g_GaugesWidget, 0 , g_HUDOffsets + 690.f, false, 1); // Use original left and right offset + for Anchors of type 1, 1, 1, 1
HUDFixEnabled(g_AbilityWheelWidget,0 , g_HUDOffsets + 78.f, false, 1); // Use original left and right offset + for Anchors of type 1, 1, 1, 1
HUDFixEnabled(g_ChangeWheelWidget, 0, g_HUDOffsets + 24.f, false, 1); // Use original left and right offset for Anchors of type 1, 1, 1, 1
HUDFixEnabled(g_CraftingWidget, g_UIOffsets, g_UIOffsets, false, 1); // Use original left and right offset + for Anchors of type 1, 1, 1, 1
}
//static bool g_offsetsInitialized = false;
static void HUDFixEnabled(UWidget* widget, float left, float right, bool writeLog, int depth) {
if (writeLog) logger->info("HUD fix {}", g_fix_enabled && g_HUD_fix_enabled ? "enabled" : "disabled");
if (!widget) return;
float targetOffsetLeft = g_fix_enabled && g_HUD_fix_enabled ? left : 100.f;
float targetOffsetRight = g_fix_enabled && g_HUD_fix_enabled ? right : 100.f;
if (widget->IsA(UCanvasPanel::StaticClass()) || (widget->Slot && widget->Slot->IsA(UCanvasPanelSlot::StaticClass()))) // Apply offsets To CanvasPanel
ApplyOffsetsSmart(widget, targetOffsetLeft, targetOffsetRight, depth);
}
static void FOVFixEnabled() {
if (g_fix_enabled && (g_fov_fix_enabled || g_ultrawide_fix_enabled) && CameraComponentaddress) {
if (!FOVHook) { // Hook only once
FOVHook = safetyhook::create_mid(CameraComponentaddress + 0xa,
[](SafetyHookContext& ctx) {
g_FOV_In = ctx.xmm0.f32[0];
if (g_fix_enabled && g_ultrawide_fix_enabled)
ctx.xmm0.f32[0] = Maths::CompensateHorizontalFOV(g_FOV_In, g_BaseAspectRatio, g_AspectRatio);
g_CompensatedFOV = ctx.xmm0.f32[0];
ctx.xmm0.f32[0] += g_fix_enabled && g_fov_fix_enabled ? g_AdditionalFOVValue : 0.f;
g_FOV_Out = ctx.xmm0.f32[0];
});
}
else FOVHook.enable();
logger->info("FOV fix enabled");
}
if (!(g_fix_enabled && (g_fov_fix_enabled || g_ultrawide_fix_enabled)) && CameraComponentaddress) {
if (FOVHook) FOVHook.disable();
logger->info("FOV fix disabled");
}
}
static void UltraWideFixEnabled() {
if (g_fix_enabled && g_ultrawide_fix_enabled && CameraComponentaddress) {
if (!UltraWideHook1) { // Hook only once
UltraWideHook1 = safetyhook::create_mid(CameraComponentaddress + 0x15,
[](SafetyHookContext& ctx) {
g_BaseAspectRatio = std::bit_cast<float>(static_cast<uint32_t>(ctx.rax)); // Retrieve in real time desired aspect ratio
ctx.rax = std::bit_cast<uint32_t>(g_AspectRatio); // Force our aspect ratio
});
}
else UltraWideHook1.enable();
if (!UltraWideHook2) {
UltraWideHook2 = safetyhook::create_mid(CameraComponentaddress + 0x39,
[](SafetyHookContext& ctx) {
ctx.rdx = 0; // bOverrideAspectRatioAxisConstraint = 0
});
}
else UltraWideHook2.enable();
logger->info("Ultrawide fix enabled");
}
if (!(g_fix_enabled && g_ultrawide_fix_enabled) && CameraComponentaddress) {
if (UltraWideHook1) UltraWideHook1.disable();
if (UltraWideHook2) UltraWideHook2.disable();
logger->info("Ultrawide fix disabled");
}
}
static void CameraDistanceFixEnabled() {
if (g_fix_enabled && g_Camera_fix_enabled && CameraDistanceaddress) {
if (!CameraHook) { // Hook only once
CameraHook = safetyhook::create_mid(CameraDistanceaddress,
[](SafetyHookContext& ctx) {
g_CameraIn = -ctx.xmm0.f32[0];
ctx.xmm0.f32[0] *= g_CameraMultiplier;
g_CameraOut = -ctx.xmm0.f32[0];
});
}
else CameraHook.enable();
logger->info("Camera distance fix enabled");
}
if (!(g_fix_enabled && g_Camera_fix_enabled) && CameraDistanceaddress) {
if (CameraHook) CameraHook.disable();
logger->info("Camera distance fix disabled");
}
}
// -- Cheats --
static void EnableCheats(Cheat cheat) {
if (WorldTimedilationaddress && !WorldTimeDilationHook) {
WorldTimeDilationHook = safetyhook::create_mid(WorldTimedilationaddress + 0x19,
[](SafetyHookContext& ctx) { // From AWorldSettings retrieved from world->K2_GetWorldSettings()
ctx.xmm0.f32[0] *= g_TimeDilation_fix_enabled ? g_WorldTimeDilationValue : 1.f;
});
}
// Enemies time dilation
if (Timedilationaddress && !TimeDilationHook) {
TimeDilationHook = safetyhook::create_mid(Timedilationaddress,
[](SafetyHookContext& ctx) {
if (!ctx.rbx) return;
UObject* object = (UObject*)ctx.rbx;
if (!object || !object->Class) return;
if (object->IsA(AStyx3PlayerCharacter::StaticClass())) {
g_Player = static_cast<AStyx3PlayerCharacter*>(object);
g_PlayerHealth = g_Player->CurrentHealth;
if (g_GodMode_fix_enabled) {
float percentageHealth = g_Player->GetHealthPercent();
if (percentageHealth > 0.0001f)
g_Player->CurrentHealth = g_Player->CurrentHealth / percentageHealth;
}
g_PlayerAmber = g_Player->CurrentAmber;
if (g_Amber_fix_enabled) g_Player->CurrentAmber = g_Player->MaxAmber;
g_Player->bIsPerceptible = false;
}
if (object->IsA(AStyx3AICharacter::StaticClass())) {
AStyx3AICharacter* enemy = static_cast<AStyx3AICharacter*>(object);
if (enemy) enemy->CustomTimeDilation = g_TimeDilation_fix_enabled ? g_AITimeDilationValue : 1.f; // Enemy time dilation
}
});
}
if (cheat == Cheat::TimeDilation) logger->info("Time dilation cheat {}", g_TimeDilation_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::GodMode) logger->info("God mode cheat {}", g_GodMode_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::Mana) logger->info("Amber cheat {}", g_Amber_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::Stealth) logger->info("Stealth cheat {}", g_Stealth_fix_enabled ? "enabled" : "disabled");
}
// Memory patch fixes
static void DOFFixEnabled() {
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress) {
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
logger->info("Depth of field fix enabled");
}
if (!(g_fix_enabled && g_DOF_fix_enabled) && DOFaddress) {
Memory::RestoreBytes(DOFaddress);
logger->info("Depth of field fix disabled");
}
}
static void CAFixEnabled() {
if (g_fix_enabled && g_CA_fix_enabled && CAaddress) {
Memory::PatchBytes(CAaddress, "\x90\x90", 2); // NOP x 2 r.SceneColorFringeQuality = 0
logger->info("Chromatics aberrations fix enabled");
}
if (!(g_fix_enabled && g_CA_fix_enabled) && CAaddress) {
Memory::RestoreBytes(CAaddress);
logger->info("Chromatics aberrations fix disabled");
}
}
static void VignettingFixEnabled() {
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress) {
Memory::PatchBytes(Vignettingaddress, "\x31\xC9", 2); // xor ecx,ecx r.Tonemapper.Quality=0
logger->info("Vignetting fix enabled");
}
if (!(g_fix_enabled && g_Vignetting_fix_enabled) && Vignettingaddress) {
Memory::RestoreBytes(Vignettingaddress);
logger->info("Vignetting fix disabled");
}
}
static void FogFixEnabled() {
if (g_Fog_fix_enabled)
DumpUIAnalysis(logger);
if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress)
Memory::PatchBytes(Fogaddress + 0xd, "\xEB", 1); // jmp -> r.Fog 0
if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress)
Memory::RestoreBytes(Fogaddress + 0xd);
if (Fogaddress) {
if (g_fix_enabled && g_Fog_fix_enabled) logger->info("Fog fix enabled");
else logger->info("Fog fix disabled");
}
}
// UE Console creation
static void EnableConsole() {
if (g_Console_Enabled || !g_Console || !GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
if (!g_Console && !user_inputs_logged) {
logger->info("------------------ User inputs ------------------");
user_inputs_logged = true;
}
return;
}
logger->info("-------------- Console re-enabling --------------");
ReactivateDevConsole(logger);
}
// Standard dll entry
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID) {
if (reason == DLL_PROCESS_ATTACH) {
logger = InitializeLogger("Styx: Blades Of Green", PLUGIN_LOG);
logger->info("Plugin {} loaded.", PLUGIN_NAME);
}
else if (reason == DLL_PROCESS_DETACH) {
logger->info("Plugin {} unloaded.", PLUGIN_NAME);
spdlog::drop_all();
}
return TRUE;
}

View File

@@ -1,6 +1,8 @@
#include "UETools.hpp"
#include "UETools.hpp"
#include "Engine_classes.hpp"
std::shared_ptr<spdlog::logger> g_logger;
SDK::APawn* GetPawnFromWorld(SDK::UWorld* world) {
if (!world) world = SDK::UWorld::GetWorld();
if (!world) return nullptr;
@@ -17,6 +19,7 @@ SDK::APawn* GetPawnFromWorld(SDK::UWorld* world) {
}
void ReactivateDevConsole(std::shared_ptr<spdlog::logger> logger) {
g_logger = logger;
std::thread([logger]() {
auto start = std::chrono::high_resolution_clock::now(); // Measure the time to renable console
SDK::UEngine* Engine = nullptr;
@@ -62,14 +65,99 @@ void ReactivateDevConsole(std::shared_ptr<spdlog::logger> logger) {
}).detach();
}
// --- HUD & UI methods ---
static void ApplyOffsetsRecursive_Internal(SDK::UWidget* Widget, float Left, float Right, int CurrentDepth, int MaxDepth) {
void ApplyOffsetsSmart_Internal( SDK::UWidget* Widget, float Left, float Right, int Depth = 0, int MaxDepth = 1) {
if (!Widget) return;
// Apply if CanvasSlot
if (Widget->Slot && Widget->Slot->IsA(SDK::UCanvasPanelSlot::StaticClass())) {
if (Depth <= MaxDepth) {
auto* Slot = static_cast<SDK::UCanvasPanelSlot*>(Widget->Slot);
SDK::FMargin Offsets = Slot->GetOffsets();
SDK::FAnchors Anchors = Slot->GetAnchors();
float MinX = Anchors.Minimum.X;
float MaxX = Anchors.Maximum.X;
#ifdef MY_VERBOSE_LOGS
if (g_logger) g_logger->debug("CanvasPanelSlot: {} {} - Slot: {} {} - Offets: {} {} {} {} - Anchors: {} {} {} {}",
Widget->GetName(), Widget->Class->GetName(),
Slot->GetName(), Slot->Class->GetName(),
Offsets.Left, Offsets.Top, Offsets.Right, Offsets.Bottom,
Anchors.Minimum.X, Anchors.Minimum.Y, Anchors.Maximum.X, Anchors.Maximum.Y);
#endif
if (MinX == 0.f && MaxX == 1.f) return; // Ignore stretch
if (MinX == 0.5f && MaxX == 0.5f) return; // Ignore centered
if (MinX == 0.f && MaxX == 0.f) // Modify only pure left
Offsets.Left = Left;
else if (MinX == 1.f && MaxX == 1.f) // Modify only pure right
Offsets.Left = -Right;
Slot->SetOffsets(Offsets);
}
}
// Stop to max depth
if (Depth >= MaxDepth) return;
// Browse the children
if (Widget->IsA(SDK::UPanelWidget::StaticClass())) {
auto* Panel = static_cast<SDK::UPanelWidget*>(Widget);
for (int i = 0; i < Panel->GetChildrenCount(); ++i)
ApplyOffsetsSmart_Internal(Panel->GetChildAt(i), Left, Right, Depth + 1, MaxDepth);
}
if (Widget->IsA(SDK::UUserWidget::StaticClass())) {
auto* UW = static_cast<SDK::UUserWidget*>(Widget);
if (UW->WidgetTree && UW->WidgetTree->RootWidget)
ApplyOffsetsSmart_Internal(UW->WidgetTree->RootWidget, Left, Right, Depth + 1, MaxDepth);
}
}
void ApplyOffsetsSmart(SDK::UWidget* Widget, float Left, float Right, int MaxDepth) {
#ifdef MY_VERBOSE_LOGS
if (g_logger) g_logger->debug("=========================================================");
if (g_logger) g_logger->debug("Widget offset applying: {} {}",
Widget->GetName(), Widget->Class->GetName());
if (g_logger) g_logger->debug("=========================================================");
#endif
ApplyOffsetsSmart_Internal(Widget, Left, Right, 0, MaxDepth);
}
static void ApplyOffsetsRecursive_Internal(SDK::UWidget* Widget, float Left, float Right,
const std::vector<SDK::UObject*>& ExcludeObjects, const std::vector<std::string>& ExcludeClass,
int CurrentDepth, int MaxDepth) {
if (!Widget || CurrentDepth > MaxDepth) return;
// Apply offsets according to Slot type
for (const auto& ExcludeObject : ExcludeObjects) {
if (ExcludeObject == Widget) return;
}
std::string widgetName;
std::string className;
widgetName = Widget->GetName();
if (Widget->Class) className = Widget->Class->GetName();
for (const auto& pattern : ExcludeClass) {
if (widgetName.find(pattern) != std::string::npos || className.find(pattern) != std::string::npos)
return;
}
if (Widget->Slot) {
if (Widget->Slot->IsA(SDK::UCanvasPanelSlot::StaticClass())) {
auto* Slot = static_cast<SDK::UCanvasPanelSlot*>(Widget->Slot);
SDK::FMargin Offsets = Slot->GetOffsets();
#ifdef MY_VERBOSE_LOGS
SDK::FAnchors anchors = Slot->GetAnchors();
if (g_logger) g_logger->debug("CanvasPanelSlot: {} {} - Slot: {} {} - Offets: {} {} {} {} - Anchors: {} {} {} {}", \
Widget->GetName(), Widget->Class->GetName(), \
Slot->GetName(), Slot->Class->GetName(), \
Offsets.Left, Offsets.Top, Offsets.Right, Offsets.Bottom, \
anchors.Minimum.X, anchors.Minimum.Y, anchors.Maximum.X, anchors.Maximum.Y);
#endif
Offsets.Left = Left;
Offsets.Right = Right;
Slot->SetOffsets(Offsets);
@@ -77,6 +165,12 @@ static void ApplyOffsetsRecursive_Internal(SDK::UWidget* Widget, float Left, flo
else if (Widget->Slot->IsA(SDK::UVerticalBoxSlot::StaticClass())) {
auto* Slot = static_cast<SDK::UVerticalBoxSlot*>(Widget->Slot);
SDK::FMargin Margin = Slot->Padding;
#ifdef MY_VERBOSE_LOGS
if (g_logger) g_logger->debug("VerticalBox Slot: {} {} - Slot: {} {} - Margins: {} {} {} {}", \
Widget->GetName(), Widget->Class->GetName(), \
Slot->GetName(), Slot->Class->GetName(), \
Margin.Left, Margin.Top, Margin.Right, Margin.Bottom);
#endif
Margin.Left = Left;
Margin.Right = Right;
Slot->SetPadding(Margin);
@@ -87,23 +181,24 @@ static void ApplyOffsetsRecursive_Internal(SDK::UWidget* Widget, float Left, flo
auto* Panel = static_cast<SDK::UPanelWidget*>(Widget);
int childrenCount = Panel->GetChildrenCount();
for (int i = 0; i < childrenCount; ++i) {
ApplyOffsetsRecursive_Internal(Panel->GetChildAt(i), Left, Right, CurrentDepth + 1, MaxDepth);
ApplyOffsetsRecursive_Internal(Panel->GetChildAt(i), Left, Right, ExcludeObjects, ExcludeClass, CurrentDepth + 1, MaxDepth);
}
}
// Go deeper if the widget is an UserWidget
if (Widget->IsA(SDK::UUserWidget::StaticClass())) {
auto* ChildWidget = static_cast<SDK::UUserWidget*>(Widget);
if (ChildWidget->WidgetTree && ChildWidget->WidgetTree->RootWidget) {
ApplyOffsetsRecursive_Internal(ChildWidget->WidgetTree->RootWidget, Left, Right, CurrentDepth + 1, MaxDepth);
ApplyOffsetsRecursive_Internal(ChildWidget->WidgetTree->RootWidget, Left, Right, ExcludeObjects, ExcludeClass, CurrentDepth + 1, MaxDepth);
}
}
}
void ApplyOffsetsRecursive(SDK::UWidget* Widget, float Left, float Right, int MaxDepth) {
ApplyOffsetsRecursive_Internal(Widget, Left, Right, 0, MaxDepth);
void ApplyOffsetsRecursive(SDK::UWidget* Widget, float Left, float Right,
const std::vector<SDK::UObject*>& ExcludeObjects, const std::vector<std::string>& ExcludeClass, int MaxDepth) {
ApplyOffsetsRecursive_Internal(Widget, Left, Right, ExcludeObjects, ExcludeClass, 0, MaxDepth);
}
static void ApplyOverlayOffsetRecursive_Internal(SDK::UWidget* Widget, float Offset, SDK::EHorizontalAlignment alignment,
static void ApplyOverlayOffsetRecursive_Internal(SDK::UWidget* Widget, float left, float right, SDK::EHorizontalAlignment alignment,
const std::vector<std::string>& ExcludeNames, int CurrentDepth, int MaxDepth) {
if (!Widget || CurrentDepth > MaxDepth) return;
@@ -121,10 +216,9 @@ static void ApplyOverlayOffsetRecursive_Internal(SDK::UWidget* Widget, float Off
SDK::FMargin Padding = Slot->Padding;
if (Slot->HorizontalAlignment == alignment) {
Padding.Left = Offset;
Padding.Right = Offset;
Padding.Left = left;
Padding.Right = right;
}
Slot->SetPadding(Padding);
};
@@ -135,14 +229,14 @@ static void ApplyOverlayOffsetRecursive_Internal(SDK::UWidget* Widget, float Off
SDK::UPanelWidget* Panel = (SDK::UPanelWidget*)Widget;
int childrenCount = Panel->GetChildrenCount();
for (int i = 0; i < childrenCount; ++i) {
ApplyOverlayOffsetRecursive_Internal(Panel->GetChildAt(i), Offset, alignment, ExcludeNames, CurrentDepth + 1, MaxDepth);
ApplyOverlayOffsetRecursive_Internal(Panel->GetChildAt(i), left, right, alignment, ExcludeNames, CurrentDepth + 1, MaxDepth);
}
}
}
void ApplyOverlayOffsetRecursive(SDK::UWidget* Widget, float Offset, SDK::EHorizontalAlignment alignment,
void ApplyOverlayOffsetRecursive(SDK::UWidget* Widget, float left, float right, SDK::EHorizontalAlignment alignment,
const std::vector<std::string>& ExcludeNames, int MaxDepth) {
ApplyOverlayOffsetRecursive_Internal(Widget, Offset, alignment, ExcludeNames, 0, MaxDepth);
ApplyOverlayOffsetRecursive_Internal(Widget, left, right, alignment, ExcludeNames, 0, MaxDepth);
}
void FindAndApplyCanvasRecursive(SDK::UWidget* widget, float offset, int MaxDepth, int currentDepth) {
@@ -244,4 +338,39 @@ void DumpUIAnalysis(std::shared_ptr<spdlog::logger> logger) {
void ClearWidgetTracking() {
g_WidgetTracker.clear();
}
void DumpWidgetRecursive(SDK::UWidget* Widget, int Depth, int MaxDepth) {
if (!Widget || Depth > MaxDepth) return;
std::string indent(Depth * 2, ' ');
std::string className = Widget->Class ? Widget->Class->GetName() : "UnknownClass";
std::string widgetName = Widget->GetName();
if (g_logger)
g_logger->debug("{}Widget: {} [{}]", indent, widgetName, className);
// Slot info si disponible
if (Widget->Slot) {
std::string slotClass = Widget->Slot->Class ? Widget->Slot->Class->GetName() : "UnknownSlot";
if (g_logger)
g_logger->debug("{} Slot class: {}", indent, slotClass);
}
// Descendre dans les enfants si c'est un panel et qu'on est encore sous MaxDepth
if (Depth < MaxDepth) {
if (Widget->IsA(SDK::UPanelWidget::StaticClass())) {
auto* panel = static_cast<SDK::UPanelWidget*>(Widget);
int count = panel->GetChildrenCount();
for (int i = 0; i < count; ++i) {
DumpWidgetRecursive(panel->GetChildAt(i), Depth + 1, MaxDepth);
}
}
if (Widget->IsA(SDK::UUserWidget::StaticClass())) {
auto* userWidget = static_cast<SDK::UUserWidget*>(Widget);
if (userWidget->WidgetTree && userWidget->WidgetTree->RootWidget) {
DumpWidgetRecursive(userWidget->WidgetTree->RootWidget, Depth + 1, MaxDepth);
}
}
}
}

View File

@@ -46,13 +46,19 @@ SDK::APawn* GetPawnFromWorld(SDK::UWorld* world = nullptr);
*/
void ReactivateDevConsole(std::shared_ptr<spdlog::logger> logger);
void ApplyOffsetsSmart(SDK::UWidget* Widget, float Left, float Right, int MaxDepth);
/**
* @brief Apply offsets recursively to UVCanvasPanelSlot.
* @param widget UUserWidget* pointer.
* @param left offset.
* @param right offset.
* @param ExcludeObjects excluded objects in depth check
* @param ExcludeClass excluded class widgets in depth check
*/
void ApplyOffsetsRecursive(SDK::UWidget* widget, float left, float right = 0, int MaxDepth = INT_MAX);
void ApplyOffsetsRecursive(SDK::UWidget* widget, float left, float right = 0,
const std::vector<SDK::UObject*>& ExcludeObjects = {},
const std::vector<std::string>& ExcludeClass = {}, int MaxDepth = INT_MAX);
/**
* @brief Apply offsets recursively to Overlay.
@@ -62,7 +68,7 @@ void ApplyOffsetsRecursive(SDK::UWidget* widget, float left, float right = 0, in
* @param ExcludeNames excluded class widgets in depth check
* @param MaxDepth Max depth to go through root component
*/
void ApplyOverlayOffsetRecursive(SDK::UWidget* Widget, float Offset, SDK::EHorizontalAlignment alignment,
void ApplyOverlayOffsetRecursive(SDK::UWidget* Widget, float left, float right, SDK::EHorizontalAlignment alignment,
const std::vector<std::string>& ExcludeNames = {}, int MaxDepth = INT_MAX);
void FindAndApplyCanvasRecursive(SDK::UWidget* widget, float offset, int MaxDepth = INT_MAX, int currentDepth = 0);
@@ -84,4 +90,16 @@ void TrackWidgetDestruct(SDK::UUserWidget* widget);
* @param logger the log object.
*/
void DumpUIAnalysis(std::shared_ptr<spdlog::logger> logger);
void ClearWidgetTracking();
/**
* @brief Clear previously tracked widgets
*/
void ClearWidgetTracking();
/**
* @brief Dump all widgets
* @param Widget a UWidget instance to browse
* @param Depth the depth to start from
* @param MaxDepth the maximal depth to reach
*/
void DumpWidgetRecursive(SDK::UWidget* Widget, int Depth = 0, int MaxDepth = 2);