diff --git a/HellIsUs/dllmain.cpp b/HellIsUs/dllmain.cpp index db0f696..8069c34 100644 --- a/HellIsUs/dllmain.cpp +++ b/HellIsUs/dllmain.cpp @@ -15,6 +15,7 @@ static float aspectRatio = (float)screenWidth / screenHeight; // Core game dll functions declarations typedef void (*SetBoolFn)(bool, bool); typedef void (*SetIntFn)(int); +typedef void (*SetFloatFn)(float); typedef float (*GetFloatFn)(); typedef bool (*GetBoolFn)(); typedef void (*SetUEConsole)(); @@ -27,7 +28,10 @@ static SetBoolFn SetDOFFixEnabled = nullptr; static SetBoolFn SetCAFixEnabled = nullptr; static SetBoolFn SetVignettingFixEnabled = nullptr; static SetBoolFn SetFogFixEnabled = nullptr; +static SetBoolFn SetCameraDistanceFixEnabled = nullptr; static SetIntFn SetFOV = nullptr; +static SetFloatFn SetCameraDistance = nullptr; + static GetFloatFn GetFOVIn = nullptr; static GetFloatFn GetCompensadedFOV = nullptr; static GetFloatFn GetFOVOut = nullptr; @@ -41,8 +45,10 @@ static bool DOF_fix_enabled = false; static bool CA_fix_enabled = false; static bool Vignetting_fix_enabled = false; static bool Fog_fix_enabled = false; +static bool camera_distance_fix_enabled = false; static bool fix_enabled = false; static int worldFOVvalue = 0; +static float cameraDistancevalue = 1.f; static bool popup_Informations = false; @@ -51,13 +57,15 @@ const char* SETTINGS_FILE = "PluginSettings.ini"; const char* GENERAL_FIX_SETTING = "GeneralFIX="; const char* WORLD_FOV_FIX_SETTING = "WorldFOVFIX="; const char* ASPECT_FIX_SETTING = "AspectFIX="; +const char* CAMERA_DISTANCE_FIX_SETTING = "CameraDistanceFIX="; const char* DOF_FIX_SETTING = "DOFFIX="; const char* CA_FIX_SETTING = "CAFIX="; 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 - Disable pillar boxing in cutscences.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.\nDisabling Fog will not entirely remove it."; +const char* CAMERA_DISTANCE_SETTING = "CameraDistance="; +const char* FIX_VERSION = "1.0.4"; +const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera distance.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable FOG.\n - Re enable console.\n\nDisabling pillar boxing will compensate FOV\nfor main menu and cutscenes.\nDisabling Fog will not entirely remove it."; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; // Scaling factor based on screen resolution @@ -106,7 +114,9 @@ static void LoadFixDLL() SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled"); SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled"); SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled"); + SetCameraDistanceFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraDistanceFixEnabled"); SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); + SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance"); GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV"); GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");; @@ -135,11 +145,13 @@ static void SaveSettings() file << GENERAL_FIX_SETTING << (fix_enabled ? "1" : "0") << "\n"; file << WORLD_FOV_FIX_SETTING << (fov_fix_enabled ? "1" : "0") << "\n"; file << ASPECT_FIX_SETTING << (Aspect_fix_enabled ? "1" : "0") << "\n"; + file << CAMERA_DISTANCE_FIX_SETTING << (camera_distance_fix_enabled ? "1" : "0") << "\n"; file << DOF_FIX_SETTING << (DOF_fix_enabled ? "1" : "0") << "\n"; file << CA_FIX_SETTING << (CA_fix_enabled ? "1" : "0") << "\n"; file << VIGNETTING_FIX_SETTING << (Vignetting_fix_enabled ? "1" : "0") << "\n"; file << FOG_FIX_SETTING << (Fog_fix_enabled ? "1" : "0") << "\n"; file << WORLD_FOV_SETTING << worldFOVvalue << "\n"; + file << CAMERA_DISTANCE_SETTING << cameraDistancevalue << "\n"; file.close(); } } @@ -162,6 +174,11 @@ static void LoadSettings() std::string val = line.substr(strlen(WORLD_FOV_FIX_SETTING)); fov_fix_enabled = (val == "1" || val == "true"); } + else if (line.find(CAMERA_DISTANCE_FIX_SETTING) == 0) + { + std::string val = line.substr(strlen(CAMERA_DISTANCE_FIX_SETTING)); + camera_distance_fix_enabled = (val == "1" || val == "true"); + } else if (line.find(ASPECT_FIX_SETTING) == 0) { std::string val = line.substr(strlen(ASPECT_FIX_SETTING)); @@ -189,7 +206,8 @@ static void LoadSettings() } else if (line.find(WORLD_FOV_SETTING) == 0) worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_SETTING))); - + else if (line.find(CAMERA_DISTANCE_SETTING) == 0) + cameraDistancevalue = std::stoi(line.substr(strlen(CAMERA_DISTANCE_SETTING))); } file.close(); } @@ -241,6 +259,20 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) } } + if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen)) + { + ImGui::SetNextItemWidth(150 * scale); + if (ImGui::SliderFloat("##CameraValue", &cameraDistancevalue, 0, 3)) { + if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); SaveSettings(); + } + } + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Value is a multiplier."); + //ImGui::Text("Affects both normal and weapon aiming distance."); + ImGui::EndTooltip(); + } + // Individual fixes ImGui::TableSetColumnIndex(1); if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) { @@ -289,6 +321,11 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) ImGui::EndTooltip(); } + if (ImGui::Checkbox("Camera distance", &camera_distance_fix_enabled)) { + if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_distance_fix_enabled, false); + SaveSettings(); + } + if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) { if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false); SaveSettings();