Compare commits

...

4 Commits

Author SHA1 Message Date
d9f3070e43 Add console information. Add project optimization 2025-09-17 11:25:04 +02:00
71251f9b25 Add project optimization 2025-09-17 11:24:01 +02:00
957a998f74 Rewritten Core dll loading 2025-09-17 11:23:29 +02:00
d1ad5e28fb Add project optimization 2025-09-17 11:18:27 +02:00
4 changed files with 50 additions and 60 deletions

View File

@@ -140,7 +140,7 @@
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -20,6 +20,7 @@ typedef float (*GetFloatFn)();
typedef bool (*GetBoolFn)();
static HMODULE fixLib = nullptr;
static LONG g_coreInitialized = 0;
static SetBoolFn SetFixEnabled = nullptr;
static SetBoolFn SetFOVFixEnabled = nullptr;
static SetBoolFn SetAspectRatioFixEnabled = nullptr;
@@ -72,33 +73,11 @@ const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Scaling factor based on screen resolution
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
static void LoadFixDLL()
{
if (IsAlreadyInitialized())
return; // déjà lancé dans un autre chargement
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
return;
if (GetModuleHandleA("HellIsUsCore.dll") == nullptr) {
fixLib = LoadLibraryA("HellIsUsCore.dll");

View File

@@ -50,7 +50,7 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -140,6 +140,7 @@
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -16,8 +16,10 @@ static float aspectRatio = (float)screenWidth / screenHeight;
typedef void (*SetBoolFn)(bool, bool);
typedef void (*SetIntFn)(int);
typedef float (*GetFloatFn)();
typedef bool (*GetBoolFn)();
static HMODULE fixLib = nullptr;
static LONG g_coreInitialized = 0;
static SetBoolFn SetFixEnabled = nullptr;
static SetBoolFn SetFOVFixEnabled = nullptr;
static SetBoolFn SetFPSFixEnabled = nullptr;
@@ -28,9 +30,11 @@ static SetBoolFn SetCAFixEnabled = nullptr;
static SetBoolFn SetVignettingFixEnabled = nullptr;
static SetBoolFn SetFogFixEnabled = nullptr;
static SetIntFn SetFOV = nullptr;
static GetFloatFn GetFOVIn = nullptr;
static GetFloatFn GetCompensadedFOV = nullptr;
static GetFloatFn GetFOVOut = nullptr;
static GetBoolFn GetConsoleEnabled = nullptr;
// Plugin variables for checkboxes and sliders
static bool fov_fix_enabled = false;
@@ -58,8 +62,8 @@ const char* CA_FIX_SETTING = "ChromaticAberrationsFIX=";
const char* VIGNETTING_FIX_SETTING = "VignettingFIX=";
const char* FOG_FIX_SETTING = "FogFIX=";
const char* WORLD_FOV_SETTING = "WorldFOV=";
const char* FIX_VERSION = "1.0.3";
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_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.\n - Enable dev console.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Scaling factor based vertical resolution
@@ -68,8 +72,10 @@ float scale = 1.f;
// Load and unload game core dll functions /!\ necessary
static void LoadFixDLL()
{
if (fixLib) return;
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
return;
if (GetModuleHandleA("MGSDSECore.dll") == nullptr) {
fixLib = LoadLibraryA("MGSDSECore.dll");
if (!fixLib) {
@@ -90,6 +96,7 @@ static void LoadFixDLL()
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);
@@ -103,6 +110,7 @@ static void LoadFixDLL()
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, true);
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
}
}
// Settings functions
static void SaveSettings()
@@ -301,6 +309,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
// Fix status
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
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)
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
}