Compare commits
7 Commits
c23db87f19
...
3378ba51c4
| Author | SHA1 | Date | |
|---|---|---|---|
| 3378ba51c4 | |||
| 04e38c80d6 | |||
| e7835848e4 | |||
| b4a04d6346 | |||
| 5b0aa777a7 | |||
| 7ea8806501 | |||
| d59cb679f1 |
@@ -47,6 +47,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Silent Hill f", "SilentHill
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "includes", "includes", "{3514D178-6BD5-4744-849B-517AAE8343D4}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "includes", "includes", "{3514D178-6BD5-4744-849B-517AAE8343D4}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
includes\CommonHeaders.h = includes\CommonHeaders.h
|
||||||
includes\GameFixes.h = includes\GameFixes.h
|
includes\GameFixes.h = includes\GameFixes.h
|
||||||
includes\GameInformations.h = includes\GameInformations.h
|
includes\GameInformations.h = includes\GameInformations.h
|
||||||
includes\HotkeysManager.h = includes\HotkeysManager.h
|
includes\HotkeysManager.h = includes\HotkeysManager.h
|
||||||
@@ -93,6 +94,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sleep Awake", "SleepAwake\S
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "The Callisto Protocol", "The Callisto Protocol\TheCallistoProtocol.vcxproj", "{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "The Callisto Protocol", "The Callisto Protocol\TheCallistoProtocol.vcxproj", "{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shaders", "Shaders", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
external\reshade\shaders\OSD.fx = external\reshade\shaders\OSD.fx
|
||||||
|
external\reshade\shaders\ReShade.fxh = external\reshade\shaders\ReShade.fxh
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
||||||
#define IMGUI_HAS_DOCK 1
|
#define IMGUI_HAS_DOCK 1
|
||||||
|
|
||||||
#include "ImGuiWidgets.h"
|
#include "CommonHeaders.h"
|
||||||
#include "GameInformations.h"
|
|
||||||
#include "GameFixes.h"
|
|
||||||
#include "HotkeysManager.h"
|
#include "HotkeysManager.h"
|
||||||
#include "OSDManager.h"
|
#include "OSDManager.h"
|
||||||
#include "inicpp.h"
|
|
||||||
#include <imgui.h>
|
|
||||||
#include <reshade.hpp>
|
|
||||||
#include <string>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
@@ -53,6 +47,7 @@ static bool Fog_fix_enabled = false;
|
|||||||
static bool Time_Dilation_fix_enabled = false;
|
static bool Time_Dilation_fix_enabled = false;
|
||||||
static bool GodMode_fix_enabled = false;
|
static bool GodMode_fix_enabled = false;
|
||||||
static bool Ignore_hits_fix_enabled = false;
|
static bool Ignore_hits_fix_enabled = false;
|
||||||
|
static bool Stealth_fix_enabled = false;
|
||||||
static bool fix_enabled = false;
|
static bool fix_enabled = false;
|
||||||
static bool console = true;
|
static bool console = true;
|
||||||
static int worldFOVValue = 0;
|
static int worldFOVValue = 0;
|
||||||
@@ -77,11 +72,12 @@ static reshade::api::effect_uniform_variable u_GodMode_show = {};
|
|||||||
static reshade::api::effect_uniform_variable u_GodMode_enabled = {};
|
static reshade::api::effect_uniform_variable u_GodMode_enabled = {};
|
||||||
static reshade::api::effect_uniform_variable u_Invulnerability_show = {};
|
static reshade::api::effect_uniform_variable u_Invulnerability_show = {};
|
||||||
static reshade::api::effect_uniform_variable u_Invulnerability_enabled = {};
|
static reshade::api::effect_uniform_variable u_Invulnerability_enabled = {};
|
||||||
constexpr auto OSD_SHADER_NAME = "OSD.fx";
|
static reshade::api::effect_uniform_variable u_Stealth_show = {};
|
||||||
|
static reshade::api::effect_uniform_variable u_Stealth_enabled = {};
|
||||||
|
|
||||||
// Plugin settings
|
// Plugin settings
|
||||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||||
const char* FIX_VERSION = "0.9.6";
|
const char* FIX_VERSION = "0.9.7";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Enable cheats.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Enable cheats.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
@@ -138,6 +134,7 @@ static void LoadFixDLL()
|
|||||||
SetFixes(GameFixes::TimeDilation, Time_Dilation_fix_enabled);
|
SetFixes(GameFixes::TimeDilation, Time_Dilation_fix_enabled);
|
||||||
SetFixes(GameFixes::GodMode, GodMode_fix_enabled);
|
SetFixes(GameFixes::GodMode, GodMode_fix_enabled);
|
||||||
SetFixes(GameFixes::Invulnerable, Ignore_hits_fix_enabled);
|
SetFixes(GameFixes::Invulnerable, Ignore_hits_fix_enabled);
|
||||||
|
SetFixes(GameFixes::Stealth, Stealth_fix_enabled);
|
||||||
SetFixes(GameFixes::DevConsole, console);
|
SetFixes(GameFixes::DevConsole, console);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +172,7 @@ static void SaveSettings() {
|
|||||||
pluginIniFile["2#Individual fix"]["Time dilation"] = Time_Dilation_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"]["God Mode"] = GodMode_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["Ignore hits"] = Ignore_hits_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Ignore hits"] = Ignore_hits_fix_enabled;
|
||||||
|
pluginIniFile["2#Individual fix"]["Stealth"] = Stealth_fix_enabled;
|
||||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
||||||
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
||||||
@@ -202,6 +200,7 @@ static void LoadSettings() {
|
|||||||
Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["Time dilation"].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>();
|
GodMode_fix_enabled = pluginIniFile["2#Individual fix"]["God Mode"].as<bool>();
|
||||||
Ignore_hits_fix_enabled = pluginIniFile["2#Individual fix"]["Ignore hits"].as<bool>();
|
Ignore_hits_fix_enabled = pluginIniFile["2#Individual fix"]["Ignore hits"].as<bool>();
|
||||||
|
Stealth_fix_enabled = pluginIniFile["2#Individual fix"]["Stealth"].as<bool>();
|
||||||
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||||
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
||||||
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
||||||
@@ -238,9 +237,10 @@ static FixToggle individualFixes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static FixToggle cheatFixes[] = {
|
static FixToggle cheatFixes[] = {
|
||||||
{ "Time dilation", &Time_Dilation_fix_enabled, GameFixes::TimeDilation, "ALT + F1 to toggle" },
|
{ "Time dilation", &Time_Dilation_fix_enabled, GameFixes::TimeDilation, "ALT + F5 to toggle" },
|
||||||
{ "God mode", &GodMode_fix_enabled, GameFixes::GodMode, "ALT + F2 to toggle.\nJacob won't receive any damage." },
|
{ "God mode", &GodMode_fix_enabled, GameFixes::GodMode, "ALT + F6 to toggle.\nJacob won't receive any damage." },
|
||||||
{ "Ignore hits", &Ignore_hits_fix_enabled, GameFixes::Invulnerable, "ALT + F3 to toggle.\nJacob can't be hit." }
|
{ "Ignore hits", &Ignore_hits_fix_enabled, GameFixes::Invulnerable, "ALT + F7 to toggle.\nJacob can't be hit." },
|
||||||
|
{ "Stealth mode",&Stealth_fix_enabled, GameFixes::Stealth, "ALT + F8 to toggle.\nEnemies won't attack you" }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize ImGui widgets for Reshade
|
// Initialize ImGui widgets for Reshade
|
||||||
@@ -377,14 +377,16 @@ static void on_reshade_present(reshade::api::effect_runtime* runtime) {
|
|||||||
static void on_reshade_begin_effects(reshade::api::effect_runtime* runtime, reshade::api::command_list* cmd_list,
|
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) {
|
reshade::api::resource_view rtv, reshade::api::resource_view rtv_srgb) {
|
||||||
if (!runtime) return;
|
if (!runtime) return;
|
||||||
u_td_show = runtime->find_uniform_variable(nullptr, "OSD_ShowTD");
|
u_td_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowTD");
|
||||||
u_td_enabled = runtime->find_uniform_variable(nullptr, "TD_Enabled");
|
u_td_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_Enabled");
|
||||||
u_td_world = runtime->find_uniform_variable(nullptr, "TD_World");
|
u_td_world = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_World");
|
||||||
u_td_AI = runtime->find_uniform_variable(nullptr, "TD_AI");
|
u_td_AI = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_AI");
|
||||||
u_GodMode_show = runtime->find_uniform_variable(nullptr, "OSD_ShowGodMode");
|
u_GodMode_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowGodMode");
|
||||||
u_GodMode_enabled = runtime->find_uniform_variable(nullptr, "GodMode_Enabled");
|
u_GodMode_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "GodMode_Enabled");
|
||||||
u_Invulnerability_show = runtime->find_uniform_variable(nullptr, "OSD_ShowInvuln");
|
u_Invulnerability_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowInvuln");
|
||||||
u_Invulnerability_enabled = runtime->find_uniform_variable(nullptr, "Invulnerability_Enabled");
|
u_Invulnerability_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Invulnerability_Enabled");
|
||||||
|
u_Stealth_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowStealth");
|
||||||
|
u_Stealth_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Stealth_Enabled");
|
||||||
|
|
||||||
if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once
|
if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once
|
||||||
|
|
||||||
@@ -392,51 +394,25 @@ static void on_reshade_begin_effects(reshade::api::effect_runtime* runtime, resh
|
|||||||
runtime->save_current_preset(); // Save shader preset
|
runtime->save_current_preset(); // Save shader preset
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitializeHotkeys() {
|
static void InitializeHotkeys() { // Initialize hotkeys for cheats
|
||||||
if (InterlockedCompareExchange(&g_hotkeysInitialized, 1, 0) != 0) return; // Initialize hotkeys once
|
if (InterlockedCompareExchange(&g_hotkeysInitialized, 1, 0) != 0) return; // Initialize hotkeys once
|
||||||
|
|
||||||
RegisterHotkey(VK_F1, Modifier::Alt, [] {
|
RegisterHotkey('1', Modifier::Alt, [] {
|
||||||
Time_Dilation_fix_enabled = !Time_Dilation_fix_enabled;
|
ToggleOSD(Time_Dilation_fix_enabled, GameFixes::TimeDilation,
|
||||||
SetFixesEnabled(GameFixes::TimeDilation, Time_Dilation_fix_enabled);
|
u_td_show, u_td_enabled, OSD_duration,
|
||||||
SaveSettings();
|
{ {u_td_world, worldTimeDilationValue}, {u_td_AI, AITimeDilationValue} });
|
||||||
|
});
|
||||||
|
|
||||||
ShowOSD(OSD_duration,
|
RegisterHotkey('2', Modifier::Alt, [] {
|
||||||
[](reshade::api::effect_runtime* rt) {
|
ToggleOSD(GodMode_fix_enabled, GameFixes::GodMode, u_GodMode_show, u_GodMode_enabled, OSD_duration);
|
||||||
ResetAllUniformVariables(rt, OSD_SHADER_NAME);
|
|
||||||
rt->set_uniform_value_bool(u_td_show, true);
|
|
||||||
rt->set_uniform_value_bool(u_td_enabled, Time_Dilation_fix_enabled);
|
|
||||||
rt->set_uniform_value_float(u_td_world, worldTimeDilationValue);
|
|
||||||
rt->set_uniform_value_float(u_td_AI, AITimeDilationValue);
|
|
||||||
},
|
|
||||||
[](reshade::api::effect_runtime* rt) { rt->set_uniform_value_bool(u_td_show, false); });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
RegisterHotkey(VK_F2, Modifier::Alt, [] {
|
RegisterHotkey('3', Modifier::Alt, [] {
|
||||||
GodMode_fix_enabled = !GodMode_fix_enabled;
|
ToggleOSD(Ignore_hits_fix_enabled, GameFixes::Invulnerable, u_Invulnerability_show, u_Invulnerability_enabled, OSD_duration);
|
||||||
SetFixesEnabled(GameFixes::GodMode, GodMode_fix_enabled);
|
|
||||||
SaveSettings();
|
|
||||||
|
|
||||||
ShowOSD(OSD_duration,
|
|
||||||
[](reshade::api::effect_runtime* rt) {
|
|
||||||
ResetAllUniformVariables(rt, OSD_SHADER_NAME);
|
|
||||||
rt->set_uniform_value_bool(u_GodMode_show, true);
|
|
||||||
rt->set_uniform_value_bool(u_GodMode_enabled, GodMode_fix_enabled);
|
|
||||||
},
|
|
||||||
[](reshade::api::effect_runtime* rt) { rt->set_uniform_value_bool(u_GodMode_show, false); });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
RegisterHotkey(VK_F3, Modifier::Alt, [] {
|
RegisterHotkey('4', Modifier::Alt, [] {
|
||||||
Ignore_hits_fix_enabled = !Ignore_hits_fix_enabled;
|
ToggleOSD(Stealth_fix_enabled, GameFixes::Stealth, u_Stealth_show, u_Stealth_enabled, OSD_duration);
|
||||||
SetFixesEnabled(GameFixes::Invulnerable, Ignore_hits_fix_enabled);
|
|
||||||
SaveSettings();
|
|
||||||
|
|
||||||
ShowOSD(OSD_duration,
|
|
||||||
[](reshade::api::effect_runtime* rt) {
|
|
||||||
ResetAllUniformVariables(rt, OSD_SHADER_NAME);
|
|
||||||
rt->set_uniform_value_bool(u_Invulnerability_show, true);
|
|
||||||
rt->set_uniform_value_bool(u_Invulnerability_enabled, Ignore_hits_fix_enabled);
|
|
||||||
},
|
|
||||||
[](reshade::api::effect_runtime* rt) { rt->set_uniform_value_bool(u_Invulnerability_show, false); });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
external/reshade/shaders/OSD.fx
vendored
44
external/reshade/shaders/OSD.fx
vendored
@@ -18,6 +18,10 @@ uniform bool GodMode_Enabled = false;
|
|||||||
// Invulnerability
|
// Invulnerability
|
||||||
uniform bool OSD_ShowInvuln = false;
|
uniform bool OSD_ShowInvuln = false;
|
||||||
uniform bool Invulnerability_Enabled = false;
|
uniform bool Invulnerability_Enabled = false;
|
||||||
|
// Stealth
|
||||||
|
uniform bool OSD_ShowStealth = false;
|
||||||
|
uniform bool Stealth_Enabled = false;
|
||||||
|
|
||||||
// --- Character arrays for labels ---
|
// --- Character arrays for labels ---
|
||||||
static const int ON_LENGTH = 2;
|
static const int ON_LENGTH = 2;
|
||||||
static float ON_CHARS[32] = {
|
static float ON_CHARS[32] = {
|
||||||
@@ -48,7 +52,7 @@ static float WORLD_CHARS[32] = {
|
|||||||
};
|
};
|
||||||
static const int AI_LEN = 5;
|
static const int AI_LEN = 5;
|
||||||
static float AI_CHARS[32] = {
|
static float AI_CHARS[32] = {
|
||||||
32-32,65-32,73-32,58-32,32-32,0,0,0,
|
32-32,65-32,73-32,58-32,32-32,0,0,0, // AI :
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
@@ -63,10 +67,18 @@ static float GOD_CHARS[32] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const int INV_LEN = 12;
|
static const int INV_LEN = 12;
|
||||||
static float INV_CHARS[32] = { // 73 103 110 111 114 101 32 104 105 116 115 32
|
static float INV_CHARS[32] = {
|
||||||
73-32, 103-32, 110-32, 111-32, 114-32, 101-32, 32-32, 104-32, // "Ignore hits"
|
73-32, 103-32, 110-32, 111-32, 114-32, 101-32, 32-32, 104-32, // "Ignore hits"
|
||||||
105-32, 116-32, 115-32, 32-32, 0, 0, 0, 0,
|
105-32, 116-32, 115-32, 32-32, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int STEALTH_LEN = 13;
|
||||||
|
static float STEALTH_CHARS[32] = {
|
||||||
|
83-32, 116-32, 101-32, 97-32, 108-32, 116-32, 104-32, 32-32, // "Stealth Mode"
|
||||||
|
77-32, 111-32, 100-32, 101-32, 32-32, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,14 +166,12 @@ 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 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||||
float4 col = tex2D(ReShade::BackBuffer, uv);
|
float4 col = tex2D(ReShade::BackBuffer, uv);
|
||||||
|
|
||||||
if (!OSD_ShowTD && !OSD_ShowGodMode && !OSD_ShowInvuln)
|
if (!OSD_ShowTD && !OSD_ShowGodMode && !OSD_ShowInvuln && !OSD_ShowStealth)
|
||||||
return col;
|
return col;
|
||||||
|
|
||||||
float margin_top = 20.0;
|
float margin_top = 20.0;
|
||||||
float2 screen_size = float2(BUFFER_WIDTH, BUFFER_HEIGHT);
|
float2 center_uv = float2(0.5, margin_top / ReShade::ScreenSize.y + 0.01);
|
||||||
float aspect = screen_size.x/screen_size.y;
|
float2 p = uv - center_uv; p.x *= ReShade::AspectRatio;
|
||||||
float2 center_uv = float2(0.5, margin_top/screen_size.y+0.01);
|
|
||||||
float2 p = uv - center_uv; p.x *= aspect;
|
|
||||||
|
|
||||||
// --- Frame rect ---
|
// --- Frame rect ---
|
||||||
float charAdvance = 0.003;
|
float charAdvance = 0.003;
|
||||||
@@ -192,17 +202,22 @@ float4 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
|||||||
totalLen = INV_LEN + OFF_LENGTH;
|
totalLen = INV_LEN + OFF_LENGTH;
|
||||||
color = float3(1.0, 0.3, 0.3);
|
color = float3(1.0, 0.3, 0.3);
|
||||||
}
|
}
|
||||||
|
if (Stealth_Enabled && OSD_ShowStealth) {
|
||||||
|
totalLen = STEALTH_LEN + ON_LENGTH;
|
||||||
|
color = float3(0.3, 1.0, 0.3);
|
||||||
|
}
|
||||||
|
if (!Stealth_Enabled && OSD_ShowStealth) {
|
||||||
|
totalLen = STEALTH_LEN + OFF_LENGTH;
|
||||||
|
color = float3(1.0, 0.3, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
float2 size_uv = float2((totalLen* charAdvance * 0.5 + charAdvance * 1.0) * aspect, 20.0/screen_size.y);
|
float2 size_uv = float2((totalLen* charAdvance * 0.5 + charAdvance * 1.0) * ReShade::AspectRatio, 20.0 / ReShade::ScreenSize.y);
|
||||||
float thickness_px = 1.0;
|
float thickness_px = 1.0;
|
||||||
float thickness = thickness_px * ReShade::PixelSize.y;
|
float thickness = thickness_px * ReShade::PixelSize.y;
|
||||||
float radius_px = 2.0;
|
float radius_px = 2.0;
|
||||||
float radius = radius_px * ReShade::PixelSize.y;
|
float radius = radius_px * ReShade::PixelSize.y;
|
||||||
float d = sdRoundRect(p,size_uv,radius);
|
float d = sdRoundRect(p,size_uv,radius);
|
||||||
if (abs(d)<thickness) {
|
if (abs(d)<thickness) col.rgb = lerp(col.rgb, color, 0.85);
|
||||||
//float3 border = TD_Enabled ? float3(0.3,1.0,0.3) : float3(1.0,0.3,0.3);
|
|
||||||
col.rgb = lerp(col.rgb, color, 0.85);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Draw all flags ---
|
// --- Draw all flags ---
|
||||||
float2 pen = center_uv;
|
float2 pen = center_uv;
|
||||||
@@ -235,9 +250,8 @@ float4 PS_OSD(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
|||||||
if (OSD_ShowInvuln)
|
if (OSD_ShowInvuln)
|
||||||
AlphaBlend(combined, DrawFlag(uv, pen, charSize, INV_CHARS, INV_LEN, Invulnerability_Enabled));
|
AlphaBlend(combined, DrawFlag(uv, pen, charSize, INV_CHARS, INV_LEN, Invulnerability_Enabled));
|
||||||
|
|
||||||
|
if (OSD_ShowStealth)
|
||||||
// --- final blend ---
|
AlphaBlend(combined, DrawFlag(uv, pen, charSize, STEALTH_CHARS, STEALTH_LEN, Stealth_Enabled));
|
||||||
//float3 textColor = TD_Enabled ? float3(0.3,1.0,0.3) : float3(1.0,0.3,0.3);
|
|
||||||
|
|
||||||
combined.rgb *= color;
|
combined.rgb *= color;
|
||||||
col.rgb = lerp(col.rgb, combined.rgb, combined.a);
|
col.rgb = lerp(col.rgb, combined.rgb, combined.a);
|
||||||
|
|||||||
124
external/reshade/shaders/ReShade.fxh
vendored
Normal file
124
external/reshade/shaders/ReShade.fxh
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: CC0-1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(__RESHADE__) || __RESHADE__ < 30000
|
||||||
|
#error "ReShade 3.0+ is required to use this header file"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
|
||||||
|
#define RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN 0
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_IS_REVERSED
|
||||||
|
#define RESHADE_DEPTH_INPUT_IS_REVERSED 1
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_IS_MIRRORED
|
||||||
|
#define RESHADE_DEPTH_INPUT_IS_MIRRORED 0
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
|
||||||
|
#define RESHADE_DEPTH_INPUT_IS_LOGARITHMIC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RESHADE_DEPTH_MULTIPLIER
|
||||||
|
#define RESHADE_DEPTH_MULTIPLIER 1
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_LINEARIZATION_FAR_PLANE
|
||||||
|
#define RESHADE_DEPTH_LINEARIZATION_FAR_PLANE 1000.0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Above 1 expands coordinates, below 1 contracts and 1 is equal to no scaling on any axis
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_Y_SCALE
|
||||||
|
#define RESHADE_DEPTH_INPUT_Y_SCALE 1
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_X_SCALE
|
||||||
|
#define RESHADE_DEPTH_INPUT_X_SCALE 1
|
||||||
|
#endif
|
||||||
|
// An offset to add to the Y coordinate, (+) = move up, (-) = move down
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_Y_OFFSET
|
||||||
|
#define RESHADE_DEPTH_INPUT_Y_OFFSET 0
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET
|
||||||
|
#define RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET 0
|
||||||
|
#endif
|
||||||
|
// An offset to add to the X coordinate, (+) = move right, (-) = move left
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_X_OFFSET
|
||||||
|
#define RESHADE_DEPTH_INPUT_X_OFFSET 0
|
||||||
|
#endif
|
||||||
|
#ifndef RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET
|
||||||
|
#define RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BUFFER_PIXEL_SIZE float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
|
||||||
|
#define BUFFER_SCREEN_SIZE float2(BUFFER_WIDTH, BUFFER_HEIGHT)
|
||||||
|
#define BUFFER_ASPECT_RATIO (BUFFER_WIDTH * BUFFER_RCP_HEIGHT)
|
||||||
|
|
||||||
|
namespace ReShade
|
||||||
|
{
|
||||||
|
#if defined(__RESHADE_FXC__)
|
||||||
|
float GetAspectRatio() { return BUFFER_WIDTH * BUFFER_RCP_HEIGHT; }
|
||||||
|
float2 GetPixelSize() { return float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT); }
|
||||||
|
float2 GetScreenSize() { return float2(BUFFER_WIDTH, BUFFER_HEIGHT); }
|
||||||
|
#define AspectRatio GetAspectRatio()
|
||||||
|
#define PixelSize GetPixelSize()
|
||||||
|
#define ScreenSize GetScreenSize()
|
||||||
|
#else
|
||||||
|
// These are deprecated and will be removed eventually.
|
||||||
|
static const float AspectRatio = BUFFER_WIDTH * BUFFER_RCP_HEIGHT;
|
||||||
|
static const float2 PixelSize = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||||
|
static const float2 ScreenSize = float2(BUFFER_WIDTH, BUFFER_HEIGHT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Global textures and samplers
|
||||||
|
texture BackBufferTex : COLOR;
|
||||||
|
texture DepthBufferTex : DEPTH;
|
||||||
|
|
||||||
|
sampler BackBuffer { Texture = BackBufferTex; };
|
||||||
|
sampler DepthBuffer { Texture = DepthBufferTex; };
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
float GetLinearizedDepth(float2 texcoord)
|
||||||
|
{
|
||||||
|
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
|
||||||
|
texcoord.y = 1.0 - texcoord.y;
|
||||||
|
#endif
|
||||||
|
#if RESHADE_DEPTH_INPUT_IS_MIRRORED
|
||||||
|
texcoord.x = 1.0 - texcoord.x;
|
||||||
|
#endif
|
||||||
|
texcoord.x /= RESHADE_DEPTH_INPUT_X_SCALE;
|
||||||
|
texcoord.y /= RESHADE_DEPTH_INPUT_Y_SCALE;
|
||||||
|
#if RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET
|
||||||
|
texcoord.x -= RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET * BUFFER_RCP_WIDTH;
|
||||||
|
#else // Do not check RESHADE_DEPTH_INPUT_X_OFFSET, since it may be a decimal number, which the preprocessor cannot handle
|
||||||
|
texcoord.x -= RESHADE_DEPTH_INPUT_X_OFFSET / 2.000000001;
|
||||||
|
#endif
|
||||||
|
#if RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET
|
||||||
|
texcoord.y += RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET * BUFFER_RCP_HEIGHT;
|
||||||
|
#else
|
||||||
|
texcoord.y += RESHADE_DEPTH_INPUT_Y_OFFSET / 2.000000001;
|
||||||
|
#endif
|
||||||
|
float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x * RESHADE_DEPTH_MULTIPLIER;
|
||||||
|
|
||||||
|
#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
|
||||||
|
const float C = 0.01;
|
||||||
|
depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
|
||||||
|
#endif
|
||||||
|
#if RESHADE_DEPTH_INPUT_IS_REVERSED
|
||||||
|
depth = 1.0 - depth;
|
||||||
|
#endif
|
||||||
|
const float N = 1.0;
|
||||||
|
depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);
|
||||||
|
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vertex shader generating a triangle covering the entire screen
|
||||||
|
// See also https://www.reddit.com/r/gamedev/comments/2j17wk/a_slightly_faster_bufferless_vertex_shader_trick/
|
||||||
|
void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
|
||||||
|
{
|
||||||
|
texcoord.x = (id == 2) ? 2.0 : 0.0;
|
||||||
|
texcoord.y = (id == 1) ? 2.0 : 0.0;
|
||||||
|
position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||||
|
}
|
||||||
8
includes/CommonHeaders.h
Normal file
8
includes/CommonHeaders.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ImGuiWidgets.h"
|
||||||
|
#include "GameInformations.h"
|
||||||
|
#include "GameFixes.h"
|
||||||
|
#include "inicpp.h"
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <reshade.hpp>
|
||||||
@@ -19,5 +19,6 @@ enum class GameFixes : int {
|
|||||||
FilmGrain,
|
FilmGrain,
|
||||||
TimeDilation,
|
TimeDilation,
|
||||||
GodMode,
|
GodMode,
|
||||||
Invulnerable
|
Invulnerable,
|
||||||
|
Stealth
|
||||||
};
|
};
|
||||||
@@ -2,10 +2,15 @@
|
|||||||
|
|
||||||
#include <reshade.hpp>
|
#include <reshade.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include "GameFixes.h"
|
||||||
|
|
||||||
|
constexpr auto OSD_SHADER_NAME = "OSD.fx";
|
||||||
using OSDUpdateFn = std::function<void(reshade::api::effect_runtime*)>;
|
using OSDUpdateFn = std::function<void(reshade::api::effect_runtime*)>;
|
||||||
using OSDEndFn = std::function<void(reshade::api::effect_runtime*)>;
|
using OSDEndFn = std::function<void(reshade::api::effect_runtime*)>;
|
||||||
|
|
||||||
|
extern void SetFixesEnabled(GameFixes fix, bool value);
|
||||||
|
extern void SaveSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Displays an On-Screen Display (OSD) for a specified duration.
|
* @brief Displays an On-Screen Display (OSD) for a specified duration.
|
||||||
*
|
*
|
||||||
@@ -23,7 +28,6 @@ using OSDEndFn = std::function<void(reshade::api::effect_runtime*)>;
|
|||||||
*/
|
*/
|
||||||
void ShowOSD(float duration, OSDUpdateFn onUpdate, OSDEndFn onEnd);
|
void ShowOSD(float duration, OSDUpdateFn onUpdate, OSDEndFn onEnd);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Updates the OSD system each frame and executes callbacks if needed.
|
* @brief Updates the OSD system each frame and executes callbacks if needed.
|
||||||
*
|
*
|
||||||
@@ -47,3 +51,45 @@ void UpdateOSD(reshade::api::effect_runtime* runtime, float deltaTime);
|
|||||||
* @param effect_name File name of the effect file to enumerate uniform variables from (eg. myfile.fx)
|
* @param effect_name File name of the effect file to enumerate uniform variables from (eg. myfile.fx)
|
||||||
*/
|
*/
|
||||||
void ResetAllUniformVariables(reshade::api::effect_runtime* runtime, const char* effect_name);
|
void ResetAllUniformVariables(reshade::api::effect_runtime* runtime, const char* effect_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggle cheats.
|
||||||
|
*
|
||||||
|
* This function must be called once, typically in `init_effect_runtime`,
|
||||||
|
* using an atomic compare-and-exchange operation
|
||||||
|
* @param cheatEnabled cheat variable.
|
||||||
|
* @param fix cheat type to toggle (TimeDilation, God Mode ...)
|
||||||
|
* @param showUniform the Reshade uniform variable to show/hide the cheat on OSD
|
||||||
|
* @param enabledUniform the cheat state (enabled or not)
|
||||||
|
* @param duration the default OSD display duration (default 3 s)
|
||||||
|
* @param effect_name File name of the effect file to enumerate uniform variables from (eg. myfile.fx)
|
||||||
|
* @param extraFloats extra Reshade uniform variable (float) to initialize
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
void ToggleOSD(T& cheatEnabled, GameFixes fix,
|
||||||
|
reshade::api::effect_uniform_variable showUniform,
|
||||||
|
reshade::api::effect_uniform_variable enabledUniform,
|
||||||
|
float duration = 3.f,
|
||||||
|
std::initializer_list<std::pair<reshade::api::effect_uniform_variable, float>> extraFloats = {}) {
|
||||||
|
|
||||||
|
cheatEnabled = !cheatEnabled;
|
||||||
|
SetFixesEnabled(fix, cheatEnabled);
|
||||||
|
SaveSettings();
|
||||||
|
|
||||||
|
std::vector<std::pair<reshade::api::effect_uniform_variable, float>> stableFloats(extraFloats);
|
||||||
|
|
||||||
|
ShowOSD(duration,
|
||||||
|
[=, stableFloats = std::move(stableFloats)](reshade::api::effect_runtime* rt) {
|
||||||
|
ResetAllUniformVariables(rt, OSD_SHADER_NAME);
|
||||||
|
rt->set_uniform_value_bool(showUniform, true);
|
||||||
|
rt->set_uniform_value_bool(enabledUniform, cheatEnabled);
|
||||||
|
|
||||||
|
for (auto& uniform : stableFloats)
|
||||||
|
if (uniform.first.handle)
|
||||||
|
rt->set_uniform_value_float(uniform.first, uniform.second);
|
||||||
|
},
|
||||||
|
[=](reshade::api::effect_runtime* rt) {
|
||||||
|
rt->set_uniform_value_bool(showUniform, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user