Add HUD fix. Code refactoring
This commit is contained in:
@@ -14,8 +14,7 @@ static uint32_t g_height = 0;
|
||||
// Core game dll functions declarations
|
||||
typedef void (*SetFixesFn)(GameFixes, bool);
|
||||
typedef void (*SetBoolFn)(bool, bool);
|
||||
typedef void (*SetIntFn)(int);
|
||||
typedef void (*SetFloatFn)(float);
|
||||
typedef void (*SetFloatFn)(GameSetting, float);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
@@ -23,12 +22,7 @@ static LONG g_hotkeysInitialized = 0;
|
||||
static LONG g_uniformReseted = 0;
|
||||
static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetFixesFn SetFixes = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static SetFloatFn SetCameraDistance = nullptr;
|
||||
static SetFloatFn SetFogDensity = nullptr;
|
||||
static SetFloatFn SetFogMaxOpacity = nullptr;
|
||||
static SetFloatFn SetWorldTimeDilation = nullptr;
|
||||
static SetFloatFn SetAITimeDilation = nullptr;
|
||||
static SetFloatFn SetValues = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
void SetFixesEnabled(GameFixes fix, bool value) {
|
||||
@@ -42,6 +36,7 @@ static bool DOF_fix_enabled = false;
|
||||
static bool CA_fix_enabled = false;
|
||||
static bool Vignetting_fix_enabled = false;
|
||||
static bool camera_fix_enabled = false;
|
||||
static bool HUD_fix_enabled = false;
|
||||
static bool cutscenes_fix_enabled = false;
|
||||
static bool cutscenes_FPS_fix_enabled = false;
|
||||
static bool volumetric_fog_fix_enabled = false;
|
||||
@@ -52,6 +47,7 @@ static bool StealthMode_fix_enabled;
|
||||
static bool GodMode_fix_enabled;
|
||||
static int worldFOVvalue = 0;
|
||||
static float cameraDistanceValue = 1.f;
|
||||
static int HUDvalue = 0;
|
||||
static float fogDensityValue = 0.1f;
|
||||
static float fogMaxOpacityValue = 1.f;
|
||||
static float worldTimeDilationValue = 1.f;
|
||||
@@ -66,13 +62,14 @@ static std::string log_content;
|
||||
|
||||
// Plugin settings
|
||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||
const char* FIX_VERSION = "1.0.5";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Unlock cutscenes FPS and enable ultrawide.\n - Enable cheats.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Control fog.\n - Re enable console.";
|
||||
const char* FIX_VERSION = "1.0.6";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Unlock cutscenes FPS and enable ultrawide.\n - Enable cheats.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Control fog.\n - Re enable console.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
// Prepare arrays of checkboxes for ImGui
|
||||
static FixToggle individualFixes[] = {
|
||||
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
||||
{ "HUD scaling", &HUD_fix_enabled, GameFixes::HUD },
|
||||
{ "Cutscenes", &cutscenes_fix_enabled, GameFixes::Cutscenes, "Remove black bars"},
|
||||
{ "Vignetting", &Vignetting_fix_enabled, GameFixes::Vignetting },
|
||||
{ "Fog", &Fog_fix_enabled, GameFixes::Fog },
|
||||
@@ -91,7 +88,7 @@ static FixToggle cheatFixes[] = {
|
||||
"Hinako won't loose stamina, sanity and health during fight."},
|
||||
};
|
||||
// Prepare array of sliders for ImGui
|
||||
static SliderFix sliders[6];
|
||||
static SliderFix2 sliders[7];
|
||||
|
||||
// Load and unload game core dll functions /!\ necessary
|
||||
static void LoadFixDLL() {
|
||||
@@ -107,26 +104,25 @@ static void LoadFixDLL() {
|
||||
|
||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||
SetFixes = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
|
||||
SetFogDensity = (SetFloatFn)GetProcAddress(fixLib,"SetFogDensity");
|
||||
SetFogMaxOpacity = (SetFloatFn)GetProcAddress(fixLib, "SetFogMaxOpacity");
|
||||
SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation");
|
||||
SetAITimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetAITimeDilation");
|
||||
SetValues = (SetFloatFn)GetProcAddress(fixLib, "SetValues");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistanceValue);
|
||||
if (SetFogDensity) SetFogDensity(fogDensityValue);
|
||||
if (SetFogMaxOpacity) SetFogMaxOpacity(fogMaxOpacityValue);
|
||||
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue);
|
||||
if (SetAITimeDilation) SetAITimeDilation(AITimeDilationValue);
|
||||
if (SetValues) {
|
||||
SetValues(GameSetting::FOV, worldFOVvalue);
|
||||
SetValues(GameSetting::CameraDistance, cameraDistanceValue);
|
||||
SetValues(GameSetting::FogDensity, fogDensityValue);
|
||||
SetValues(GameSetting::FogMaxOpacity, fogMaxOpacityValue);
|
||||
SetValues(GameSetting::WorldTimeDilation, worldTimeDilationValue);
|
||||
SetValues(GameSetting::AITimeDilation, AITimeDilationValue);
|
||||
SetValues(GameSetting::HUD, HUDvalue);
|
||||
}
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixes) {
|
||||
SetFixes(GameFixes::SkipIntro, skip_Intro_enabled);
|
||||
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
||||
SetFixes(GameFixes::HUD, HUD_fix_enabled);
|
||||
SetFixes(GameFixes::Cutscenes, cutscenes_fix_enabled);
|
||||
SetFixes(GameFixes::Framerate, cutscenes_FPS_fix_enabled);
|
||||
SetFixes(GameFixes::DOF, DOF_fix_enabled);
|
||||
@@ -141,15 +137,16 @@ static void LoadFixDLL() {
|
||||
}
|
||||
|
||||
// Declare sliders only when function pointers are initilized (SetFOV ...)
|
||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, SetFOV };
|
||||
sliders[1] = { "Camera distance (*)", "##CameraOffset", SliderType::Float, &cameraDistanceValue, 0, 3, SetCameraDistance, "%.2f", "Value is a multiplier."};
|
||||
sliders[2] = { "Fog density (*)", "##FogDensityValue", SliderType::Float, &fogDensityValue, 0, 5, SetFogDensity, "%.2f",
|
||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
||||
sliders[1] = { "Camera distance (*)", "##CameraOffset", SliderType::Float, &cameraDistanceValue, 0, 3, GameSetting::CameraDistance, SetValues, "%.1f", "Value is a multiplier."};
|
||||
sliders[2] = { "HUD scaling", "##HUDOffset", SliderType::Int, &HUDvalue, 0, 40, GameSetting::HUD, SetValues };
|
||||
sliders[3] = { "Fog density (*)", "##FogDensityValue", SliderType::Float, &fogDensityValue, 0, 5, GameSetting::FogDensity, SetValues, "%.1f",
|
||||
"This will override engine dynamic value." };
|
||||
sliders[3] = { "Fog opacity (*)", "##CameraSmoothnessValue", SliderType::Float, &fogMaxOpacityValue, 0, 1, SetFogMaxOpacity, "%.2f",
|
||||
sliders[4] = { "Fog opacity (*)", "##FogOpacityValue", SliderType::Float, &fogMaxOpacityValue, 0, 1, GameSetting::FogMaxOpacity, SetValues, "%.1f",
|
||||
"This will override engine dynamic value." };
|
||||
sliders[4] = { "World time dilation", "##WorldTimeDilationValue", SliderType::Float, &worldTimeDilationValue, 0.f, 2.f, SetWorldTimeDilation, nullptr,
|
||||
sliders[5] = { "World time dilation", "##WorldTimeDilationValue", SliderType::Float, &worldTimeDilationValue, 0.f, 2.f, GameSetting::WorldTimeDilation, SetValues, nullptr,
|
||||
"Will affect everything in the world.\nDefault value is 1." };
|
||||
sliders[5] = { "AI time dilation", "##AITimeDilationValue", SliderType::Float, &AITimeDilationValue, 0.f, 2.f, SetAITimeDilation, nullptr,
|
||||
sliders[6] = { "AI time dilation", "##AITimeDilationValue", SliderType::Float, &AITimeDilationValue, 0.f, 2.f, GameSetting::AITimeDilation, SetValues, nullptr,
|
||||
"Will affect only enemies in the world.\nDefault value is 1." };
|
||||
}
|
||||
}
|
||||
@@ -170,6 +167,7 @@ static void SaveSettings()
|
||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["HUD"] = HUD_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Cutscenes"] = cutscenes_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["CutscenesFPS"] = cutscenes_FPS_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["DOF"] = DOF_fix_enabled;
|
||||
@@ -183,6 +181,7 @@ static void SaveSettings()
|
||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistanceValue;
|
||||
pluginIniFile["3#Fixes tuning"]["HUD scaling"] = HUDvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["Fog density"] = fogDensityValue;
|
||||
pluginIniFile["3#Fixes tuning"]["Fog opacity"] = fogMaxOpacityValue;
|
||||
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
|
||||
@@ -201,6 +200,7 @@ static void LoadSettings()
|
||||
skip_Intro_enabled = pluginIniFile["1#General fix"]["Skip Intro"].as<bool>();
|
||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||
HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as<bool>();
|
||||
cutscenes_fix_enabled = pluginIniFile["2#Individual fix"]["Cutscenes"].as<bool>();
|
||||
cutscenes_FPS_fix_enabled = pluginIniFile["2#Individual fix"]["CutscenesFPS"].as<bool>();
|
||||
DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as<bool>();
|
||||
@@ -213,6 +213,7 @@ static void LoadSettings()
|
||||
GodMode_fix_enabled = pluginIniFile["2#Individual fix"]["God Mode"].as<bool>();
|
||||
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||
cameraDistanceValue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
|
||||
HUDvalue = pluginIniFile["3#Fixes tuning"]["HUD scaling"].as<float>();
|
||||
fogDensityValue = pluginIniFile["3#Fixes tuning"]["Fog density"].as<float>();
|
||||
fogMaxOpacityValue = pluginIniFile["3#Fixes tuning"]["Fog opacity"].as<float>();
|
||||
worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as<float>();
|
||||
@@ -312,9 +313,9 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||
TableNextRow();
|
||||
|
||||
TableSetColumnIndex(0);
|
||||
for (int i = 0; i < 4; ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
for (int i = 0; i < 5; ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
TableSetColumnIndex(1);
|
||||
for (int i = 4; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
for (int i = 5; i < IM_ARRAYSIZE(individualFixes); ++i) DrawFixCheckbox(individualFixes[i]);
|
||||
EndTable();
|
||||
}
|
||||
}
|
||||
@@ -326,9 +327,9 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||
TableNextRow();
|
||||
// Sliders
|
||||
TableSetColumnIndex(0);
|
||||
for (int i = 0; i < 2; ++i) DrawSlider(sliders[i], 200);
|
||||
for (int i = 0; i < 3; ++i) DrawSlider2(sliders[i], 200);
|
||||
TableSetColumnIndex(1);
|
||||
for (int i = 2; i < 4; ++i) DrawSlider(sliders[i], 200);
|
||||
for (int i = 3; i < 5; ++i) DrawSlider2(sliders[i], 200);
|
||||
EndTable();
|
||||
}
|
||||
EndTabItem();
|
||||
@@ -343,9 +344,9 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||
TableNextRow();
|
||||
|
||||
TableSetColumnIndex(0);
|
||||
DrawSlider(sliders[4], 180);
|
||||
DrawSlider2(sliders[5], 180);
|
||||
TableSetColumnIndex(1);
|
||||
DrawSlider(sliders[5], 180);
|
||||
DrawSlider2(sliders[6], 180);
|
||||
EndTable();
|
||||
}
|
||||
EndTabItem();
|
||||
|
||||
Reference in New Issue
Block a user