diff --git a/HellIsUs/dllmain.cpp b/HellIsUs/dllmain.cpp index e814205..3fe8ee1 100644 --- a/HellIsUs/dllmain.cpp +++ b/HellIsUs/dllmain.cpp @@ -18,7 +18,7 @@ typedef void (*SetIntFn)(int); typedef void (*SetFloatFn)(float); typedef float (*GetFloatFn)(); typedef bool (*GetBoolFn)(); -typedef void (*SetUEConsole)(); +//typedef void (*SetUEConsole)(); static HMODULE fixLib = nullptr; static SetBoolFn SetFixEnabled = nullptr; @@ -28,15 +28,16 @@ static SetBoolFn SetDOFFixEnabled = nullptr; static SetBoolFn SetCAFixEnabled = nullptr; static SetBoolFn SetVignettingFixEnabled = nullptr; static SetBoolFn SetFogFixEnabled = nullptr; -static SetBoolFn SetCameraDistanceFixEnabled = nullptr; +static SetBoolFn SetCameraFixEnabled = nullptr; static SetIntFn SetFOV = nullptr; static SetFloatFn SetCameraDistance = nullptr; +static SetIntFn SetCameraHeight = nullptr; static GetFloatFn GetFOVIn = nullptr; static GetFloatFn GetCompensadedFOV = nullptr; static GetFloatFn GetFOVOut = nullptr; static GetBoolFn GetConsoleEnabled = nullptr; -static SetUEConsole SetConsole = nullptr; +//static SetUEConsole SetConsole = nullptr; // Plugin variables for checkboxes and sliders static bool fov_fix_enabled = false; @@ -45,10 +46,11 @@ 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 camera_fix_enabled = false; static bool fix_enabled = false; static int worldFOVvalue = 0; static float cameraDistancevalue = 1.f; +static int cameraHeightvalue = -15; static bool popup_Informations = false; @@ -57,15 +59,16 @@ 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* CAMERA_FIX_SETTING = "CameraFIX="; 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* CAMERA_DISTANCE_SETTING = "CameraDistance="; +const char* CAMERA_HEIGHT_SETTING = "CameraHeight="; 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* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable pillar boxing in cutscences.\n - Control camera.\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 @@ -114,27 +117,29 @@ static void LoadFixDLL() SetCAFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCAFixEnabled"); SetVignettingFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetVignettingFixEnabled"); SetFogFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFogFixEnabled"); - SetCameraDistanceFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraDistanceFixEnabled"); + SetCameraFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetCameraFixEnabled"); SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV"); SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance"); + SetCameraHeight = (SetIntFn)GetProcAddress(fixLib, "SetCameraHeight"); GetFOVIn = (GetFloatFn)GetProcAddress(fixLib, "GetFOVIn"); GetCompensadedFOV = (GetFloatFn)GetProcAddress(fixLib, "GetCompensatedFOV"); GetFOVOut = (GetFloatFn)GetProcAddress(fixLib, "GetFOVOut");; - SetConsole = (SetUEConsole)GetProcAddress(fixLib, "SetConsole"); + //SetConsole = (SetUEConsole)GetProcAddress(fixLib, "SetConsole"); GetConsoleEnabled = (GetBoolFn)GetProcAddress(fixLib, "GetConsoleEnabled"); // Apply initial values loaded from settings if (SetFOV) SetFOV(worldFOVvalue); if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); + if (SetCameraHeight) SetCameraHeight(cameraHeightvalue); if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, true); - if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_distance_fix_enabled, true); + if (SetCameraFixEnabled) SetCameraFixEnabled(camera_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); - if (SetConsole) SetConsole(); + //if (SetConsole) SetConsole(); } } @@ -147,13 +152,14 @@ 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 << CAMERA_FIX_SETTING << (camera_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 << CAMERA_HEIGHT_SETTING << cameraHeightvalue << "\n"; file.close(); } } @@ -176,10 +182,10 @@ 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) + else if (line.find(CAMERA_FIX_SETTING) == 0) { - std::string val = line.substr(strlen(CAMERA_DISTANCE_FIX_SETTING)); - camera_distance_fix_enabled = (val == "1" || val == "true"); + std::string val = line.substr(strlen(CAMERA_FIX_SETTING)); + camera_fix_enabled = (val == "1" || val == "true"); } else if (line.find(ASPECT_FIX_SETTING) == 0) { @@ -210,6 +216,8 @@ static void LoadSettings() worldFOVvalue = std::stoi(line.substr(strlen(WORLD_FOV_SETTING))); else if (line.find(CAMERA_DISTANCE_SETTING) == 0) cameraDistancevalue = std::stof(line.substr(strlen(CAMERA_DISTANCE_SETTING))); + else if (line.find(CAMERA_HEIGHT_SETTING) == 0) + cameraHeightvalue = std::stoi(line.substr(strlen(CAMERA_HEIGHT_SETTING))); } file.close(); } @@ -264,14 +272,26 @@ 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 (ImGui::SliderFloat("##CameraDistanceValue", &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(); + } + + if (ImGui::CollapsingHeader("Camera height (*)", ImGuiTreeNodeFlags_DefaultOpen)) + { + ImGui::SetNextItemWidth(150 * scale); + if (ImGui::SliderInt("##CameraHeightValue", &cameraHeightvalue, -80, 80)) { + if (SetCameraHeight) SetCameraHeight(cameraHeightvalue); SaveSettings(); + } + } + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Default value is -15."); ImGui::EndTooltip(); } @@ -294,6 +314,16 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) ImGui::EndTooltip(); } + if (ImGui::Checkbox("Camera", &camera_fix_enabled)) { + if (SetCameraFixEnabled) SetCameraFixEnabled(camera_fix_enabled, false); + SaveSettings(); + } + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Controls distance and height."); + ImGui::EndTooltip(); + } + if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) { if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false); SaveSettings(); @@ -323,11 +353,6 @@ 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();