Compare commits
4 Commits
070ec0ca43
...
d9f3070e43
| Author | SHA1 | Date | |
|---|---|---|---|
| d9f3070e43 | |||
| 71251f9b25 | |||
| 957a998f74 | |||
| d1ad5e28fb |
@@ -140,7 +140,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ typedef float (*GetFloatFn)();
|
|||||||
typedef bool (*GetBoolFn)();
|
typedef bool (*GetBoolFn)();
|
||||||
|
|
||||||
static HMODULE fixLib = nullptr;
|
static HMODULE fixLib = nullptr;
|
||||||
|
static LONG g_coreInitialized = 0;
|
||||||
static SetBoolFn SetFixEnabled = nullptr;
|
static SetBoolFn SetFixEnabled = nullptr;
|
||||||
static SetBoolFn SetFOVFixEnabled = nullptr;
|
static SetBoolFn SetFOVFixEnabled = nullptr;
|
||||||
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
|
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
|
||||||
@@ -72,33 +73,11 @@ const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
|||||||
// Scaling factor based on screen resolution
|
// Scaling factor based on screen resolution
|
||||||
float scale = 1.f;
|
float scale = 1.f;
|
||||||
|
|
||||||
bool IsAlreadyInitialized()
|
|
||||||
{
|
|
||||||
// Declare a lock
|
|
||||||
HANDLE hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Local\\HellisUsFixSharedSection");
|
|
||||||
|
|
||||||
// If lock is not yet initialized
|
|
||||||
if (hMap == nullptr)
|
|
||||||
{
|
|
||||||
// We create the lock only once
|
|
||||||
hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 1, "Local\\HellisUsFixSharedSection");
|
|
||||||
|
|
||||||
if (hMap == nullptr) // We ensure the lock is valid
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false; // First time created we return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise we return true
|
|
||||||
CloseHandle(hMap);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load and unload game core dll functions /!\ necessary
|
// Load and unload game core dll functions /!\ necessary
|
||||||
static void LoadFixDLL()
|
static void LoadFixDLL()
|
||||||
{
|
{
|
||||||
if (IsAlreadyInitialized())
|
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
|
||||||
return; // déjà lancé dans un autre chargement
|
return;
|
||||||
|
|
||||||
if (GetModuleHandleA("HellIsUsCore.dll") == nullptr) {
|
if (GetModuleHandleA("HellIsUsCore.dll") == nullptr) {
|
||||||
fixLib = LoadLibraryA("HellIsUsCore.dll");
|
fixLib = LoadLibraryA("HellIsUsCore.dll");
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
@@ -140,6 +140,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ static float aspectRatio = (float)screenWidth / screenHeight;
|
|||||||
typedef void (*SetBoolFn)(bool, bool);
|
typedef void (*SetBoolFn)(bool, bool);
|
||||||
typedef void (*SetIntFn)(int);
|
typedef void (*SetIntFn)(int);
|
||||||
typedef float (*GetFloatFn)();
|
typedef float (*GetFloatFn)();
|
||||||
|
typedef bool (*GetBoolFn)();
|
||||||
|
|
||||||
static HMODULE fixLib = nullptr;
|
static HMODULE fixLib = nullptr;
|
||||||
|
static LONG g_coreInitialized = 0;
|
||||||
static SetBoolFn SetFixEnabled = nullptr;
|
static SetBoolFn SetFixEnabled = nullptr;
|
||||||
static SetBoolFn SetFOVFixEnabled = nullptr;
|
static SetBoolFn SetFOVFixEnabled = nullptr;
|
||||||
static SetBoolFn SetFPSFixEnabled = nullptr;
|
static SetBoolFn SetFPSFixEnabled = nullptr;
|
||||||
@@ -28,9 +30,11 @@ static SetBoolFn SetCAFixEnabled = nullptr;
|
|||||||
static SetBoolFn SetVignettingFixEnabled = nullptr;
|
static SetBoolFn SetVignettingFixEnabled = nullptr;
|
||||||
static SetBoolFn SetFogFixEnabled = nullptr;
|
static SetBoolFn SetFogFixEnabled = nullptr;
|
||||||
static SetIntFn SetFOV = nullptr;
|
static SetIntFn SetFOV = nullptr;
|
||||||
|
|
||||||
static GetFloatFn GetFOVIn = nullptr;
|
static GetFloatFn GetFOVIn = nullptr;
|
||||||
static GetFloatFn GetCompensadedFOV = nullptr;
|
static GetFloatFn GetCompensadedFOV = nullptr;
|
||||||
static GetFloatFn GetFOVOut = nullptr;
|
static GetFloatFn GetFOVOut = nullptr;
|
||||||
|
static GetBoolFn GetConsoleEnabled = nullptr;
|
||||||
|
|
||||||
// Plugin variables for checkboxes and sliders
|
// Plugin variables for checkboxes and sliders
|
||||||
static bool fov_fix_enabled = false;
|
static bool fov_fix_enabled = false;
|
||||||
@@ -58,8 +62,8 @@ const char* CA_FIX_SETTING = "ChromaticAberrationsFIX=";
|
|||||||
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
|
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
|
||||||
const char* FOG_FIX_SETTING = "FogFIX=";
|
const char* FOG_FIX_SETTING = "FogFIX=";
|
||||||
const char* WORLD_FOV_SETTING = "WorldFOV=";
|
const char* WORLD_FOV_SETTING = "WorldFOV=";
|
||||||
const char* FIX_VERSION = "1.0.3";
|
const char* FIX_VERSION = "1.0.4";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Unlock ultrawide resolutions.\n - Remove pillar boxing.\n - Unlock FPS.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Unlock ultrawide resolutions.\n - Remove pillar boxing.\n - Unlock FPS.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.\n - Enable dev console.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
// Scaling factor based vertical resolution
|
// Scaling factor based vertical resolution
|
||||||
@@ -68,40 +72,44 @@ float scale = 1.f;
|
|||||||
// Load and unload game core dll functions /!\ necessary
|
// Load and unload game core dll functions /!\ necessary
|
||||||
static void LoadFixDLL()
|
static void LoadFixDLL()
|
||||||
{
|
{
|
||||||
if (fixLib) return;
|
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
|
||||||
|
|
||||||
fixLib = LoadLibraryA("MGSDSECore.dll");
|
|
||||||
|
|
||||||
if (!fixLib) {
|
|
||||||
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (GetModuleHandleA("MGSDSECore.dll") == nullptr) {
|
||||||
|
fixLib = LoadLibraryA("MGSDSECore.dll");
|
||||||
|
|
||||||
|
if (!fixLib) {
|
||||||
|
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||||
|
SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled");
|
||||||
|
SetFPSFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFPSFixEnabled");
|
||||||
|
SetResolutionFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetResolutionFixEnabled");
|
||||||
|
SetAspectRatioFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetAspectRatioFixEnabled");
|
||||||
|
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
|
||||||
|
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
|
||||||
|
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
|
||||||
|
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
|
||||||
|
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||||
|
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
|
||||||
|
GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV");
|
||||||
|
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
|
||||||
|
GetConsoleEnabled = (GetBoolFn)GetProcAddress(fixLib, "GetConsoleEnabled");
|
||||||
|
|
||||||
|
// Apply initial values loaded from settings
|
||||||
|
if (SetFOV) SetFOV(worldFOVvalue);
|
||||||
|
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
|
||||||
|
if (SetFPSFixEnabled) SetFPSFixEnabled(FPS_fix_enabled, true);
|
||||||
|
if (SetResolutionFixEnabled) SetResolutionFixEnabled(Resolution_fix_enabled, true);
|
||||||
|
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, true);
|
||||||
|
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
|
||||||
|
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
|
||||||
|
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
|
||||||
|
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
|
||||||
|
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
|
||||||
SetFOVFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFOVFixEnabled");
|
|
||||||
SetFPSFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFPSFixEnabled");
|
|
||||||
SetResolutionFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetResolutionFixEnabled");
|
|
||||||
SetAspectRatioFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetAspectRatioFixEnabled");
|
|
||||||
SetDOFFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetDOFFixEnabled");
|
|
||||||
SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled");
|
|
||||||
SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled");
|
|
||||||
SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled");
|
|
||||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
|
||||||
GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn");
|
|
||||||
GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV");
|
|
||||||
GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");;
|
|
||||||
|
|
||||||
// Apply initial values loaded from settings
|
|
||||||
if (SetFOV) SetFOV(worldFOVvalue);
|
|
||||||
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true);
|
|
||||||
if (SetFPSFixEnabled) SetFPSFixEnabled(FPS_fix_enabled, true);
|
|
||||||
if (SetResolutionFixEnabled) SetResolutionFixEnabled(Resolution_fix_enabled, true);
|
|
||||||
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, true);
|
|
||||||
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, true);
|
|
||||||
if (SetCAFixEnabled) SetCAFixEnabled(CA_fix_enabled, true);
|
|
||||||
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, true);
|
|
||||||
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
|
|
||||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings functions
|
// Settings functions
|
||||||
@@ -301,6 +309,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
// Fix status
|
// Fix status
|
||||||
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
|
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
|
||||||
|
if (GetConsoleEnabled && GetConsoleEnabled())
|
||||||
|
ImGui::Text("Console enabled and bound to key Tilde");
|
||||||
if (GetFOVIn && GetCompensadedFOV && GetFOVOut)
|
if (GetFOVIn && GetCompensadedFOV && GetFOVOut)
|
||||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
|
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user