Compare commits
9 Commits
1f6cc0668f
...
7b00683c4a
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b00683c4a | |||
| 1d06fbd529 | |||
| 48bc0f93a1 | |||
| 74d99528e8 | |||
| fd515406a8 | |||
| af804f153c | |||
| 5149da3fc2 | |||
| 70b8c4e3e6 | |||
| 0cab1ed550 |
@@ -5,7 +5,7 @@
|
||||
#include "HotkeysManager.h"
|
||||
#include "OSDManager.h"
|
||||
#include <chrono>
|
||||
#include <Windows.h>
|
||||
//#include <Windows.h>
|
||||
|
||||
// Screen informations
|
||||
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
@@ -40,7 +40,6 @@ static bool fix_enabled = false;
|
||||
static bool Time_Dilation_fix_enabled = false;
|
||||
static bool GodMode_fix_enabled = false;
|
||||
static bool StealthMode_fix_enabled = false;
|
||||
static bool console = true;
|
||||
static int worldFOVvalue = 0;
|
||||
static float cameraDistancevalue = 1.f;
|
||||
static int HUDOffsetValue = 0;
|
||||
@@ -55,7 +54,7 @@ static bool popup_Informations = false;
|
||||
|
||||
// Plugin settings
|
||||
const char* SETTINGS_FILE = "pluginSettings.ini";
|
||||
const char* FIX_VERSION = "1.0.2";
|
||||
const char* FIX_VERSION = "1.0.2.1";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Camera distance.\n - Control HUD scaling.\n - Enable ultrawide.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.\n - Enable cheats.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
@@ -127,7 +126,6 @@ static void LoadFixDLL() { // Ensure the Core dll is loaded only once
|
||||
SetFixes(GameFixes::TimeDilation, Time_Dilation_fix_enabled);
|
||||
SetFixes(GameFixes::GodMode, GodMode_fix_enabled);
|
||||
SetFixes(GameFixes::Stealth, StealthMode_fix_enabled);
|
||||
SetFixes(GameFixes::DevConsole, console);
|
||||
}
|
||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 70, GameSetting::FOV, SetValues };
|
||||
sliders[1] = { "Camera distance (*)", "##CameraOffset", SliderType::Float, &cameraDistancevalue, 0, 4, GameSetting::CameraDistance, SetValues, "%.2f", "Value is a multiplier." };
|
||||
@@ -145,10 +143,8 @@ static void SaveSettings() {
|
||||
pluginIniFile["1#General fix"].setComment(std::vector<std::string>{ "The following sections are saved by plugin",
|
||||
"You should not need to modify them",
|
||||
" ",
|
||||
"Controls if fix mod (globally) is enabled",
|
||||
"Set Console to false if you don't want dev console to be enabled"});
|
||||
"Controls if fix mod (globally) is enabled" });
|
||||
pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
|
||||
pluginIniFile["1#General fix"]["Console"] = console;
|
||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Ultrawide"] = ultrawide_fix_enabled;
|
||||
@@ -176,7 +172,6 @@ static void LoadSettings() {
|
||||
try {
|
||||
pluginIniFile.load(SETTINGS_FILE);
|
||||
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
||||
console = pluginIniFile["1#General fix"]["Console"].as<bool>();
|
||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["Ultrawide"].as<bool>();
|
||||
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||
|
||||
@@ -126,6 +126,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Death Stranding 2", "DeathS
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Styx Shards Of Darkness", "StyxShardsOfDarkness\StyxShardsOfDarkness.vcxproj", "{D63F7F27-D275-4622-9117-1471678AEFFE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cthulhu The Cosmic Abyss", "Cthulhu\Cthulhu.vcxproj", "{BCB87EF2-3D89-4001-A4D4-CE41745A858F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Samson", "Samson\Samson.vcxproj", "{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -558,6 +562,22 @@ Global
|
||||
{D63F7F27-D275-4622-9117-1471678AEFFE}.Release|x64.Build.0 = Release|x64
|
||||
{D63F7F27-D275-4622-9117-1471678AEFFE}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D63F7F27-D275-4622-9117-1471678AEFFE}.Release|x86.Build.0 = Release|Win32
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Debug|x64.Build.0 = Debug|x64
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Release|x64.ActiveCfg = Release|x64
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Release|x64.Build.0 = Release|x64
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{BCB87EF2-3D89-4001-A4D4-CE41745A858F}.Release|x86.Build.0 = Release|Win32
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Debug|x64.Build.0 = Debug|x64
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Release|x64.ActiveCfg = Release|x64
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Release|x64.Build.0 = Release|x64
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
198
Samson/Samson.vcxproj
Normal file
198
Samson/Samson.vcxproj
Normal file
@@ -0,0 +1,198 @@
|
||||
<?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>{E5EA91E0-D7CE-4D78-96E7-B063FF9B5F61}</ProjectGuid>
|
||||
<RootNamespace>Samson</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Samson</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>false</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)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</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>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetExt>.addon64</TargetExt>
|
||||
<TargetName>SamsonUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetExt>.addon64</TargetExt>
|
||||
<TargetName>SamsonUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetExt>.addon64</TargetExt>
|
||||
<TargetName>SamsonUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetExt>.addon64</TargetExt>
|
||||
<TargetName>SamsonUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\libs\HotkeysManager.cpp" />
|
||||
<ClCompile Include="..\libs\OSDManager.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
394
Samson/dllmain.cpp
Normal file
394
Samson/dllmain.cpp
Normal file
@@ -0,0 +1,394 @@
|
||||
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
||||
#define IMGUI_HAS_DOCK 1
|
||||
|
||||
#include "CommonHeaders.h"
|
||||
#include "HotkeysManager.h"
|
||||
#include "OSDManager.h"
|
||||
#include <chrono>
|
||||
|
||||
// Screen informations
|
||||
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
static float aspectRatio = (float)screenWidth / screenHeight;
|
||||
|
||||
// Core game dll functions declarations
|
||||
typedef void (*SetBoolFn)(bool, bool);
|
||||
typedef void (*SetFixesFn)(GameFixes, bool);
|
||||
typedef void (*SetFloatFn)(GameSetting, float);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
static LONG g_hotkeysInitialized = 0;
|
||||
static LONG g_uniformReseted = 0; static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetFixesFn SetFixes = nullptr;
|
||||
static SetFloatFn SetValues = nullptr;
|
||||
void SetFixesEnabled(GameFixes fix, bool value) { if (SetFixes) SetFixes(fix, value); }
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
// Plugin variables for checkboxes and sliders
|
||||
static bool fov_fix_enabled = false;
|
||||
static bool ultrawide_fix_enabled = false;
|
||||
static bool camera_fix_enabled = false;
|
||||
static bool letterboxing_fix_enabled = false;
|
||||
static bool HUD_fix_enabled = false;
|
||||
static bool CA_fix_enabled = false;
|
||||
static bool Vignetting_fix_enabled = false;
|
||||
static bool Fog_fix_enabled = false;
|
||||
static bool fix_enabled = false;
|
||||
static bool Time_Dilation_fix_enabled = false;
|
||||
static bool GodMode_fix_enabled = false;
|
||||
static bool StealthMode_fix_enabled = false;
|
||||
static bool Boost_fix_enabled = false;
|
||||
static int worldFOVvalue = 0;
|
||||
static float cameraDistancevalue = 1.f;
|
||||
static float cameraAltDistancevalue = 1.f;
|
||||
static int HUDvalue = 0;
|
||||
static int UIvalue = 0;
|
||||
static float worldTimeDilationValue = 1.f;
|
||||
static float AITimeDilationValue = 1.f;
|
||||
static float OSD_duration = 3.f;
|
||||
|
||||
// Overlays popups
|
||||
static bool popup_Informations = false;
|
||||
static bool show_log_overlay = false;
|
||||
static std::string log_content;
|
||||
|
||||
// Plugin settings
|
||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||
const char* FIX_VERSION = "1.0.2";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance."
|
||||
"\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.\n - Enable cheats.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
// Scaling factor based on screen resolution
|
||||
float scale = (float)screenHeight / 1200;
|
||||
|
||||
// Prepare arrays of checkboxes for ImGui
|
||||
static FixToggle individualFixes[] = {
|
||||
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
||||
{ "Vignetting", &Vignetting_fix_enabled, GameFixes::Vignetting },
|
||||
{ "Fog", &Fog_fix_enabled, GameFixes::Fog },
|
||||
{ "Chromatic aberrations", &CA_fix_enabled, GameFixes::ChromaticAberrations },
|
||||
{ "Ultrawide", &ultrawide_fix_enabled, GameFixes::UltraWide , "This fix is intended for ultrawide displays (> 16/9)." },
|
||||
{ "HUD", &HUD_fix_enabled, GameFixes::HUD, "This is only intended for ultrawide displays."},
|
||||
{ "Cutscenes", &letterboxing_fix_enabled, GameFixes::Cutscenes , "Removes letterboxing" },
|
||||
{ "Camera", &camera_fix_enabled, GameFixes::Camera, "Controls the camera distance behind Samson."}
|
||||
};
|
||||
|
||||
static FixToggle cheatFixes[] = {
|
||||
{ "Time dilation", &Time_Dilation_fix_enabled, GameFixes::TimeDilation, "CTRL + 1 (top keyboard row) to toggle" },
|
||||
{ "God mode", &GodMode_fix_enabled, GameFixes::GodMode, "CTRL + 2 (top keyboard row) to toggle.\nPlayer & vehicle health won't decrease." },
|
||||
{ "Stealth mode", &StealthMode_fix_enabled, GameFixes::Stealth, "CTRL + 3 (top keyboard row) to toggle.\nEnemies will ignore you until you hit them." },
|
||||
{ "Infinite Nitro",& Boost_fix_enabled, GameFixes::Boost, "CTRL + 4 (top keyboard row) to toggle." }
|
||||
};
|
||||
// Prepare array of sliders for ImGui
|
||||
static SliderFix2 sliders[7];
|
||||
|
||||
static void InitializeHotkeys();
|
||||
// Load and unload game core dll functions /!\ necessary
|
||||
static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
||||
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
if (GetModuleHandleA("SamsonCore.dll") == nullptr) {
|
||||
fixLib = LoadLibraryA("SamsonCore.dll");
|
||||
|
||||
if (!fixLib) {
|
||||
MessageBoxA(nullptr, "Impossible to load game core dll", "Error", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||
SetFixes = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||
SetValues = (SetFloatFn)GetProcAddress(fixLib, "SetValues");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetValues) {
|
||||
SetValues(GameSetting::FOV, worldFOVvalue);
|
||||
SetValues(GameSetting::CameraDistance, cameraDistancevalue);
|
||||
SetValues(GameSetting::CamAltDistance, cameraAltDistancevalue);
|
||||
SetValues(GameSetting::HUD, HUDvalue);
|
||||
SetValues(GameSetting::UI, UIvalue);
|
||||
SetValues(GameSetting::WorldTimeDilation, worldTimeDilationValue);
|
||||
SetValues(GameSetting::AITimeDilation, AITimeDilationValue);
|
||||
}
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixes) {
|
||||
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SetFixes(GameFixes::HUD, HUD_fix_enabled);
|
||||
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
||||
SetFixes(GameFixes::Cutscenes, letterboxing_fix_enabled);
|
||||
SetFixes(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SetFixes(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SetFixes(GameFixes::Fog, Fog_fix_enabled);
|
||||
SetFixes(GameFixes::TimeDilation, Time_Dilation_fix_enabled);
|
||||
SetFixes(GameFixes::GodMode, GodMode_fix_enabled);
|
||||
SetFixes(GameFixes::Stealth, StealthMode_fix_enabled);
|
||||
SetFixes(GameFixes::Boost, Boost_fix_enabled);
|
||||
}
|
||||
|
||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 70, GameSetting::FOV, SetValues };
|
||||
sliders[1] = { "Character camera (*)", "##CameraOffset", SliderType::Float, &cameraDistancevalue, 0, 4, GameSetting::CameraDistance, SetValues, "%.1f",
|
||||
"Value is a multiplier." };
|
||||
sliders[2] = { "Vehicle distance (*)", "##CameraAltOffset", SliderType::Float, &cameraAltDistancevalue, 0, 4, GameSetting::CamAltDistance,
|
||||
SetValues, "%.1f", "Value is a multiplier." };
|
||||
sliders[3] = { "HUD scaling", "##HUDValue", SliderType::Int, &HUDvalue, 0, 40, GameSetting::HUD, SetValues, nullptr, "This will only affect HUD" };
|
||||
sliders[4] = { "UI scaling", "##UIValue", SliderType::Int, &UIvalue, 0, 40, GameSetting::UI, SetValues, nullptr, "This will only affect UI (menus)" };
|
||||
sliders[5] = { "World time dilation", "##WorldTimeDilationValue", SliderType::Float, &worldTimeDilationValue, 0.f, 3.f,GameSetting::WorldTimeDilation , SetValues, "%.1f",
|
||||
"Will affect everything in the world.\nDefault value is 1." };
|
||||
sliders[6] = { "AI time dilation", "##AITimeDilationValue", SliderType::Float, &AITimeDilationValue, 0.f, 3.f, GameSetting::AITimeDilation, SetValues, "%.1f",
|
||||
"Will affect enemies in the world.\nDefault value is 1." };
|
||||
}
|
||||
InitializeHotkeys();
|
||||
}
|
||||
|
||||
// Settings functions
|
||||
static void SaveSettings() {
|
||||
ini::IniFile pluginIniFile;
|
||||
pluginIniFile["1#General fix"].setComment(std::vector<std::string>{ "The following sections are saved by plugin",
|
||||
"You should not need to modify them",
|
||||
" ",
|
||||
"Controls if fix mod (globally) is enabled" });
|
||||
pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
|
||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["HUD"] = HUD_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Letterboxing"] = letterboxing_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Chromatic aberrations"] = CA_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Time dilation"] = Time_Dilation_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["God mode"] = GodMode_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Stealth"] = StealthMode_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Nitro"] = Boost_fix_enabled;
|
||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["HUD scaling"] = HUDvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["UI scaling"] = UIvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["Character camera distance"] = cameraDistancevalue;
|
||||
pluginIniFile["3#Fixes tuning"]["Vehicle camera distance"] = cameraAltDistancevalue;
|
||||
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
|
||||
pluginIniFile["3#Fixes tuning"]["AI time dilation scale"] = AITimeDilationValue;
|
||||
|
||||
pluginIniFile.save(SETTINGS_FILE);
|
||||
}
|
||||
|
||||
static void LoadSettings() {
|
||||
ini::IniFile pluginIniFile;
|
||||
try {
|
||||
pluginIniFile.load(SETTINGS_FILE);
|
||||
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
|
||||
HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as<bool>();
|
||||
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||
letterboxing_fix_enabled = pluginIniFile["2#Individual fix"]["Letterboxing"].as<bool>();
|
||||
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
||||
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
||||
Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["Time dilation"].as<bool>();
|
||||
GodMode_fix_enabled = pluginIniFile["2#Individual fix"]["God mode"].as<bool>();
|
||||
StealthMode_fix_enabled = pluginIniFile["2#Individual fix"]["Stealth"].as<bool>();
|
||||
Boost_fix_enabled = pluginIniFile["2#Individual fix"]["Nitro"].as<bool>();
|
||||
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||
HUDvalue = pluginIniFile["3#Fixes tuning"]["HUD scaling"].as<int>();
|
||||
UIvalue = pluginIniFile["3#Fixes tuning"]["UI scaling"].as<int>();
|
||||
cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Character camera distance"].as<float>();
|
||||
cameraAltDistancevalue = pluginIniFile["3#Fixes tuning"]["Vehicle camera distance"].as<float>();
|
||||
worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as<float>();
|
||||
AITimeDilationValue = pluginIniFile["3#Fixes tuning"]["AI time dilation scale"].as<float>();
|
||||
}
|
||||
catch (const std::exception& e) {}
|
||||
}
|
||||
|
||||
// Read plugin log file
|
||||
void read_log_file(const std::string& filename) {
|
||||
std::ifstream file(filename);
|
||||
if (!file.is_open()) {
|
||||
log_content = "Impossible to open file : " + filename;
|
||||
return;
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << file.rdbuf();
|
||||
log_content = ss.str();
|
||||
}
|
||||
|
||||
// Initialize ImGui widgets for Reshade
|
||||
static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||
ImGui::SetNextWindowSize(ImVec2(350 * scale, 150 * scale), ImGuiCond_Once);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.84f, 0.2f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 1.f, 1.f, 1.f)); // white
|
||||
if (ImGui::Button("Like my work ? Consider donation")) ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL); // Donation
|
||||
ImGui::PopStyleColor(4); // Restore color
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("View logs")) {
|
||||
read_log_file("Samson.log");
|
||||
show_log_overlay = true; // Fix information
|
||||
}
|
||||
|
||||
if (popup_Informations) {
|
||||
ImGui::Begin("Informations", &popup_Informations, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("Version : %s", FIX_VERSION);
|
||||
ImGui::Text(FIX_INFORMATIONS);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (show_log_overlay) {
|
||||
ImGui::Begin("Game log", &show_log_overlay, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::TextUnformatted(log_content.c_str());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabBar("MainTabs")) {
|
||||
if (ImGui::BeginTabItem("Fixes")) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
||||
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Drawing a left column with slider and general fix
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
if (ImGui::Checkbox("Fix enabled", &fix_enabled)) {
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
// Individual fixes
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (ImGui::BeginTable("IndividualFixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("IndFix1", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||
ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
for (int i = 0; i < 4; ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
for (int i = 4; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 2 /** 1 style.ItemSpacing.y*/);
|
||||
if (ImGui::BeginTable("FixesSliders", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
for (int i = 0; i < 3; ++i) DrawSlider2(sliders[i], 200);
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
for (int i = 3; i < 5; ++i) DrawSlider2(sliders[i], 200);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Cheats")) {
|
||||
for (const auto& cheat : cheatFixes) DrawFixCheckbox(cheat);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
||||
if (ImGui::BeginTable("SlidersTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||
ImGui::TableSetupColumn("RightSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
DrawSlider2(sliders[5], 180);
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
DrawSlider2(sliders[6], 180);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::EndTabItem();
|
||||
if (ImGui::CollapsingHeader("Cheat informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (GetGameInfos) {
|
||||
GameInfos infos{};
|
||||
GetGameInfos(&infos);
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "Player health: %.f", infos.Health);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
|
||||
// Fix status
|
||||
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (GetGameInfos) {
|
||||
GameInfos infos{};
|
||||
GetGameInfos(&infos);
|
||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", infos.screenWidth, infos.screenHeight, infos.aspectRatio);
|
||||
if (infos.consoleEnabled)
|
||||
ImGui::Text("Console enabled and bound to key F2");
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", infos.FOVIn, infos.CompensatedFOV, infos.FOVOut);
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void on_reshade_present(reshade::api::effect_runtime* runtime) {
|
||||
static auto last = std::chrono::steady_clock::now();
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
float dt = std::chrono::duration<float>(now - last).count();
|
||||
last = now;
|
||||
|
||||
ProcessHotkeys(runtime);
|
||||
UpdateOSD(runtime, dt);
|
||||
}
|
||||
|
||||
// Retrieve all shader uniform variables
|
||||
static void on_reshade_begin_effects(reshade::api::effect_runtime* runtime, reshade::api::command_list* cmd_list,
|
||||
reshade::api::resource_view rtv, reshade::api::resource_view rtv_srgb) {
|
||||
if (!runtime) return;
|
||||
FindAllUniformVariables(runtime, OSD_SHADER_NAME); // Find all uniforms and set their handle
|
||||
|
||||
if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once
|
||||
ResetAllUniformVariables(runtime, OSD_SHADER_NAME);
|
||||
runtime->save_current_preset(); // Save shader preset
|
||||
}
|
||||
|
||||
static void InitializeHotkeys() { // Initialize hotkeys for cheats
|
||||
if (InterlockedCompareExchange(&g_hotkeysInitialized, 1, 0) != 0) return; // Initialize hotkeys once
|
||||
|
||||
RegisterHotkey('1', Modifier::Ctrl, [] {
|
||||
ToggleOSD(Time_Dilation_fix_enabled, GameFixes::TimeDilation, u_td_show, u_td_enabled, OSD_duration,
|
||||
{ {u_td_world, worldTimeDilationValue}, {u_td_AI, AITimeDilationValue} }); });
|
||||
RegisterHotkey('2', Modifier::Ctrl, [] { ToggleOSD(GodMode_fix_enabled, GameFixes::GodMode, u_GodMode_show, u_GodMode_enabled, OSD_duration); });
|
||||
RegisterHotkey('3', Modifier::Ctrl, [] { ToggleOSD(StealthMode_fix_enabled, GameFixes::Stealth, u_Stealth_show, u_Stealth_enabled, OSD_duration); });
|
||||
RegisterHotkey('4', Modifier::Ctrl, [] { ToggleOSD(Boost_fix_enabled, GameFixes::Boost, u_Boost_show, u_Boost_enabled, OSD_duration); });
|
||||
}
|
||||
// Main dll intrance
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (!reshade::register_addon(hinstDLL)) return FALSE;
|
||||
LoadSettings();
|
||||
|
||||
reshade::register_overlay("Samson", &on_overlay_draw);
|
||||
reshade::register_event<reshade::addon_event::init_effect_runtime>(&LoadFixDLL);
|
||||
reshade::register_event<reshade::addon_event::reshade_present>(&on_reshade_present);
|
||||
reshade::register_event<reshade::addon_event::reshade_begin_effects>(&on_reshade_begin_effects);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
reshade::unregister_overlay("Samson", &on_overlay_draw);
|
||||
reshade::unregister_event<reshade::addon_event::init_effect_runtime>(&LoadFixDLL);
|
||||
reshade::unregister_event<reshade::addon_event::reshade_present>(&on_reshade_present);
|
||||
reshade::unregister_event<reshade::addon_event::reshade_begin_effects>(&on_reshade_begin_effects);
|
||||
reshade::unregister_addon(hinstDLL);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
27
external/reshade/shaders/OSD.fx
vendored
27
external/reshade/shaders/OSD.fx
vendored
@@ -27,6 +27,9 @@ uniform bool Stamina_Enabled = false;
|
||||
// Mana
|
||||
uniform bool OSD_ShowMana = false;
|
||||
uniform bool Mana_Enabled = false;
|
||||
// Boost
|
||||
uniform bool OSD_ShowBoost = false;
|
||||
uniform bool Boost_Enabled = false;
|
||||
|
||||
// --- Character arrays for labels ---
|
||||
static const int ON_LENGTH = 2;
|
||||
@@ -104,6 +107,15 @@ static float MANA_CHARS[32] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const int BOOST_LEN = 6;
|
||||
static float BOOST_CHARS[32] =
|
||||
{
|
||||
66 - 32, 111 - 32, 111 - 32, 115 - 32, 116 - 32, 32 - 32, 0, 0, // Boost
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
// --- SDF Rectangle ---
|
||||
float sdRoundRect(float2 p, float2 b, float r) {
|
||||
float2 q = abs(p) - b + r;
|
||||
@@ -198,7 +210,7 @@ float4 DrawFlag(float2 uv, inout float2 pen, float2 charSize, const float label[
|
||||
float4 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||
float4 col = tex2D(ReShade::BackBuffer, uv);
|
||||
|
||||
if (!OSD_ShowTD && !OSD_ShowGodMode && !OSD_ShowIgnoreHits && !OSD_ShowStealth && !OSD_ShowStamina && !OSD_ShowMana)
|
||||
if (!OSD_ShowTD && !OSD_ShowGodMode && !OSD_ShowIgnoreHits && !OSD_ShowStealth && !OSD_ShowStamina && !OSD_ShowMana && !OSD_ShowBoost)
|
||||
return col;
|
||||
|
||||
float2 pixelPos = uv * ReShade::ScreenSize;
|
||||
@@ -261,6 +273,16 @@ float4 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||
totalLen = MANA_LEN + OFF_LENGTH;
|
||||
color = float3(1.0, 0.3, 0.3);
|
||||
}
|
||||
if (Boost_Enabled && OSD_ShowBoost)
|
||||
{
|
||||
totalLen = BOOST_LEN + ON_LENGTH;
|
||||
color = float3(0.3, 1.0, 0.3);
|
||||
}
|
||||
if (!Boost_Enabled && OSD_ShowBoost)
|
||||
{
|
||||
totalLen = BOOST_LEN + OFF_LENGTH;
|
||||
color = float3(1.0, 0.3, 0.3);
|
||||
}
|
||||
|
||||
float verticalPadding = 6.0; // ajuste ici
|
||||
float2 sizePx = float2(totalLen * charAdvance * 0.5 + charAdvance,
|
||||
@@ -312,6 +334,9 @@ float4 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||
if (OSD_ShowMana)
|
||||
AlphaBlend(combined, DrawFlag(uv, pen, charSize, MANA_CHARS, MANA_LEN, Mana_Enabled));
|
||||
|
||||
if (OSD_ShowBoost)
|
||||
AlphaBlend(combined, DrawFlag(uv, pen, charSize, BOOST_CHARS, BOOST_LEN, Boost_Enabled));
|
||||
|
||||
combined.rgb *= color;
|
||||
col.rgb = lerp(col.rgb, combined.rgb, combined.a);
|
||||
|
||||
|
||||
@@ -25,5 +25,6 @@ enum class GameFixes : int {
|
||||
Stealth,
|
||||
Stamina,
|
||||
Mana,
|
||||
Boost,
|
||||
None
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
enum class GameSetting : int {
|
||||
FOV,
|
||||
CameraDistance,
|
||||
CamAltDistance,
|
||||
CameraLateral,
|
||||
CameraHeight,
|
||||
Sharpening,
|
||||
|
||||
@@ -23,6 +23,8 @@ extern reshade::api::effect_uniform_variable u_Stamina_show;
|
||||
extern reshade::api::effect_uniform_variable u_Stamina_enabled;
|
||||
extern reshade::api::effect_uniform_variable u_Mana_show;
|
||||
extern reshade::api::effect_uniform_variable u_Mana_enabled;
|
||||
extern reshade::api::effect_uniform_variable u_Boost_show;
|
||||
extern reshade::api::effect_uniform_variable u_Boost_enabled;
|
||||
|
||||
extern void SetFixesEnabled(GameFixes fix, bool value);
|
||||
extern void SaveSettings();
|
||||
|
||||
@@ -19,6 +19,8 @@ reshade::api::effect_uniform_variable u_Stamina_show = {};
|
||||
reshade::api::effect_uniform_variable u_Stamina_enabled = {};
|
||||
reshade::api::effect_uniform_variable u_Mana_show = {};
|
||||
reshade::api::effect_uniform_variable u_Mana_enabled = {};
|
||||
reshade::api::effect_uniform_variable u_Boost_show = {};
|
||||
reshade::api::effect_uniform_variable u_Boost_enabled = {};
|
||||
|
||||
void ShowOSD(float duration, OSDUpdateFn onUpdate, OSDEndFn onEnd) {
|
||||
g_timer = duration;
|
||||
@@ -56,6 +58,8 @@ void FindAllUniformVariables(reshade::api::effect_runtime* runtime, const char*
|
||||
u_Stamina_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Stamina_Enabled");
|
||||
u_Mana_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowMana");
|
||||
u_Mana_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Mana_Enabled");
|
||||
u_Boost_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowBoost");
|
||||
u_Boost_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Boost_Enabled");
|
||||
}
|
||||
|
||||
void ResetAllUniformVariables(reshade::api::effect_runtime* runtime, const char* effect_name) {
|
||||
|
||||
Reference in New Issue
Block a user