Compare commits
6 Commits
fe65b5243f
...
94eeb9671f
| Author | SHA1 | Date | |
|---|---|---|---|
| 94eeb9671f | |||
| 2b016e55ac | |||
| e566c27d62 | |||
| 45420fcc45 | |||
| 65b267b8a8 | |||
| 2ac3a064c9 |
171
Hogwarts Legacy/HogwartsLegacy.vcxproj
Normal file
171
Hogwarts Legacy/HogwartsLegacy.vcxproj
Normal file
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{58AC0027-3B50-4BCE-8C56-DD8FFFAE85F0}</ProjectGuid>
|
||||
<RootNamespace>HogwartsLegacy</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>HogwartsLegacy</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>HogwartsLegacyUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>HogwartsLegacyUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>HogwartsLegacyUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>HogwartsLegacyUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
329
Hogwarts Legacy/dllmain.cpp
Normal file
329
Hogwarts Legacy/dllmain.cpp
Normal file
@@ -0,0 +1,329 @@
|
||||
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
||||
#define IMGUI_HAS_DOCK 1
|
||||
|
||||
#include "GameInformations.h"
|
||||
#include "GameFixes.h"
|
||||
#include "inicpp.h"
|
||||
#include <imgui.h>
|
||||
#include <reshade.hpp>
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
|
||||
// Screen informations
|
||||
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
static float aspectRatio = (float)screenWidth / screenHeight;
|
||||
|
||||
// Core game dll functions declarations
|
||||
typedef void (*SetBoolFn)(bool, bool);
|
||||
typedef void (*SetFixesFn)(GameFixes, bool);
|
||||
typedef void (*SetIntFn)(int);
|
||||
typedef void (*SetFloatFn)(float);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetFixesFn SetFixesEnabled = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static SetFloatFn SetCameraDistance = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
// Plugin variables for checkboxes and sliders
|
||||
static bool fov_fix_enabled = false;
|
||||
static bool ultrawide_fix_enabled = false;
|
||||
static bool camera_fix_enabled = false;
|
||||
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 fix_enabled = false;
|
||||
static bool console = true;
|
||||
static int worldFOVvalue = 0;
|
||||
static float cameraDistancevalue = 1.f;
|
||||
|
||||
// Overlay popup
|
||||
static bool show_log_overlay = false;
|
||||
static std::string log_content;
|
||||
static bool popup_Informations = false;
|
||||
|
||||
// Plugin settings
|
||||
const char* SETTINGS_FILE = "pluginSettings.ini";
|
||||
const char* FIX_VERSION = "1.0.1";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Camera distance.\n - Enable ultrawide.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable console.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
// Scaling factor based on screen resolution
|
||||
float scale = (float)screenHeight / 1200;
|
||||
|
||||
// Reshade addon name and description
|
||||
extern "C" __declspec(dllexport) const char* NAME = "Hogwarts Legacy";
|
||||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, enable ultrawide, control FOV, camera distance and some effects.";
|
||||
|
||||
// Load and unload game core dll functions /!\ necessary
|
||||
static void LoadFixDLL()
|
||||
{ // Ensure the Core dll is loaded only once
|
||||
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
if (GetModuleHandleA("HogwartsLegacyCore.dll") == nullptr) {
|
||||
fixLib = LoadLibraryA("HogwartsLegacyCore.dll");
|
||||
|
||||
if (!fixLib) {
|
||||
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||
SetFixesEnabled = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
SetCameraDistance = (SetFloatFn)GetProcAddress(fixLib, "SetCameraDistance");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixesEnabled) {
|
||||
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Camera, camera_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DevConsole, console);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Settings functions
|
||||
static void SaveSettings()
|
||||
{
|
||||
ini::IniFile pluginIniFile;
|
||||
pluginIniFile["1#General fix"].setComment(std::vector<std::string>{ "The following sections are saved by plugin",
|
||||
"You should not need to modify them",
|
||||
" ",
|
||||
"Controls if fix mod (globally) is enabled",
|
||||
"Set Console to false if you don't want dev console to be enabled"});
|
||||
pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
|
||||
pluginIniFile["1#General fix"]["Console"] = console;
|
||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Ultrawide"] = ultrawide_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["DOF"] = DOF_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Chromatic aberrations"] = CA_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
||||
pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistancevalue;
|
||||
|
||||
pluginIniFile.save(SETTINGS_FILE);
|
||||
}
|
||||
|
||||
static void LoadSettings()
|
||||
{
|
||||
ini::IniFile pluginIniFile;
|
||||
try {
|
||||
pluginIniFile.load(SETTINGS_FILE);
|
||||
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
||||
console = pluginIniFile["1#General fix"]["Console"].as<bool>();
|
||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["Ultrawide"].as<bool>();
|
||||
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||
DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as<bool>();
|
||||
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
||||
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
||||
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||
cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
|
||||
}
|
||||
catch (const std::exception& e) {}
|
||||
}
|
||||
|
||||
// Read plugin log file
|
||||
void read_log_file(const std::string& filename) {
|
||||
std::ifstream file(filename);
|
||||
if (!file.is_open())
|
||||
{
|
||||
log_content = "Impossible to open file : " + filename;
|
||||
return;
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << file.rdbuf();
|
||||
log_content = ss.str();
|
||||
}
|
||||
|
||||
// Initialize ImGui widgets for Reshade
|
||||
static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.ItemSpacing = ImVec2(8 * scale, 8 * scale); // Spacing between widgets
|
||||
style.FramePadding = ImVec2(3 * scale, 3 * scale); // Widgets padding
|
||||
style.WindowPadding = ImVec2(10 * scale, 10 * scale); // Overlay padding
|
||||
style.CellPadding = ImVec2(10 * scale, 10 * scale); // Table cells padding
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(350 * scale, 150 * scale), ImGuiCond_Once);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.84f, 0.2f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 1.f, 1.f, 1.f)); // white
|
||||
if (ImGui::Button("Like my work ? Consider donation")) ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL); // Donation
|
||||
ImGui::PopStyleColor(4); // Restore color
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("View logs")) {
|
||||
read_log_file("HogwartsLegacy.log");
|
||||
show_log_overlay = true; // Fix information
|
||||
}
|
||||
|
||||
if (popup_Informations)
|
||||
{
|
||||
ImGui::Begin("Informations", &popup_Informations, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("Version : %s", FIX_VERSION);
|
||||
ImGui::Text(FIX_INFORMATIONS);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (show_log_overlay)
|
||||
{
|
||||
ImGui::Begin("Game log", &show_log_overlay, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::TextUnformatted(log_content.c_str());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
||||
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Drawing a left column with slider and general fix
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
if (ImGui::Checkbox("Fix enabled", &fix_enabled)) {
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// Sliders
|
||||
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(150 * scale);
|
||||
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 50)) {
|
||||
if (SetFOV) SetFOV(worldFOVvalue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(150 * scale);
|
||||
if (ImGui::SliderFloat("##CameraValue", &cameraDistancevalue, 0, 2, "%.2f")) {
|
||||
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Value is a multiplier.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
// Individual fixes
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (ImGui::BeginTable("IndividualFixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("IndFix1", ImGuiTableColumnFlags_WidthStretch, 0.35f);
|
||||
ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.65f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Camera", &camera_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Camera, camera_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::Checkbox("Ultrawide", &ultrawide_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("This fix must be enabled before playing cutscenes");
|
||||
ImGui::Text("to fully remove letter & pillar boxing.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::DOF, DOF_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Chromatic aberrations", &CA_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
// Fix status
|
||||
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
|
||||
if (GetGameInfos) {
|
||||
GameInfos infos{};
|
||||
GetGameInfos(&infos);
|
||||
if (infos.consoleEnabled)
|
||||
ImGui::Text("Console enabled and bound to key F2");
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main dll intrance
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (!reshade::register_addon(hinstDLL))
|
||||
return FALSE;
|
||||
LoadSettings();
|
||||
|
||||
reshade::register_overlay("Hogwarts Legacy", &on_overlay_draw);
|
||||
reshade::register_event<reshade::addon_event::init_effect_runtime>(
|
||||
[](reshade::api::effect_runtime* runtime) {
|
||||
LoadFixDLL();
|
||||
});
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
reshade::unregister_addon(hinstDLL);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -88,6 +88,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HogwartsLegacy", "Hogwarts
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sleep Awake", "SleepAwake\SleepAwake.vcxproj", "{737D4832-3D98-49CA-AFA5-499A3F851265}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "The Callisto Protocol", "The Callisto Protocol\TheCallistoProtocol.vcxproj", "{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -408,6 +410,14 @@ Global
|
||||
{737D4832-3D98-49CA-AFA5-499A3F851265}.Release|x64.Build.0 = Release|x64
|
||||
{737D4832-3D98-49CA-AFA5-499A3F851265}.Release|x86.ActiveCfg = Release|Win32
|
||||
{737D4832-3D98-49CA-AFA5-499A3F851265}.Release|x86.Build.0 = Release|Win32
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Debug|x64.Build.0 = Debug|x64
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Release|x64.ActiveCfg = Release|x64
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Release|x64.Build.0 = Release|x64
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
184
The Callisto Protocol/TheCallistoProtocol.vcxproj
Normal file
184
The Callisto Protocol/TheCallistoProtocol.vcxproj
Normal file
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{D2A82694-26E2-49E8-9AB0-99E26D40AFCF}</ProjectGuid>
|
||||
<RootNamespace>The Callisto Protocol</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>The Callisto Protocol</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>TheCallistoProtocolUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>TheCallistoProtocolUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>TheCallistoProtocolUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetExt>.addon</TargetExt>
|
||||
<TargetName>TheCallistoProtocolUI</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
340
The Callisto Protocol/dllmain.cpp
Normal file
340
The Callisto Protocol/dllmain.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
||||
#define IMGUI_HAS_DOCK 1
|
||||
|
||||
#include "GameInformations.h"
|
||||
#include "GameFixes.h"
|
||||
#include "inicpp.h"
|
||||
#include <imgui.h>
|
||||
#include <reshade.hpp>
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
|
||||
// Screen informations
|
||||
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
static float aspectRatio = (float)screenWidth / screenHeight;
|
||||
|
||||
// Core game dll functions declarations
|
||||
typedef void (*SetBoolFn)(bool, bool);
|
||||
typedef void (*SetFixesFn)(GameFixes ,bool);
|
||||
typedef void (*SetIntFn)(int);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetFixesFn SetFixesEnabled = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static SetIntFn SetHUDScale = nullptr;
|
||||
static SetIntFn SetCameraOffset = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
// Plugin variables for checkboxes and sliders
|
||||
static bool fov_fix_enabled = false;
|
||||
static bool Camera_fix_enabled = false;
|
||||
static bool HUD_fix_enabled = false;
|
||||
static bool CA_fix_enabled = false;
|
||||
static bool Vignetting_fix_enabled = false;
|
||||
static bool Fog_fix_enabled = false;
|
||||
static bool fix_enabled = false;
|
||||
static bool console = true;
|
||||
static int worldFOVValue = 0;
|
||||
static int HUDScaleValue = 0;
|
||||
static int cameraOffsetValue = 0;
|
||||
|
||||
// Overlays popups
|
||||
static bool popup_Informations = false;
|
||||
static bool show_log_overlay = false;
|
||||
static std::string log_content;
|
||||
|
||||
// Plugin settings
|
||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||
const char* FIX_VERSION = "0.9.0";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||
|
||||
// Scaling factor based on screen resolution
|
||||
float scale = (float)screenHeight / 1200;
|
||||
|
||||
extern "C" __declspec(dllexport) const char* NAME = "The Callisto Protocol";
|
||||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, HUD and some effects.";
|
||||
|
||||
// Load and unload game core dll functions /!\ necessary
|
||||
static void LoadFixDLL()
|
||||
{
|
||||
// Ensure the Core dll will be called once
|
||||
if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
if (GetModuleHandleA("TheCallistoProtocolCore.dll") == nullptr) {
|
||||
fixLib = LoadLibraryA("TheCallistoProtocolCore.dll");
|
||||
|
||||
if (!fixLib) {
|
||||
MessageBoxA(nullptr, "Impossible to load game core dll", "Erreur", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
SetFixEnabled = (SetBoolFn)GetProcAddress(fixLib, "SetFixEnabled");
|
||||
SetFixesEnabled = (SetFixesFn)GetProcAddress(fixLib, "SetFixesEnabled");
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale");
|
||||
SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVValue);
|
||||
if (SetHUDScale) SetHUDScale(HUDScaleValue);
|
||||
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue);
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixesEnabled) {
|
||||
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Camera, Camera_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DevConsole, console);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Settings functions
|
||||
static void SaveSettings()
|
||||
{
|
||||
ini::IniFile pluginIniFile;
|
||||
pluginIniFile["1#General fix"].setComment(std::vector<std::string>{ "The following sections are saved by plugin",
|
||||
"You should not need to modify them",
|
||||
" ",
|
||||
"Controls if fix mod (globally) is enabled",
|
||||
"Set Console to false if you don't want dev console to be enabled"});
|
||||
pluginIniFile["1#General fix"]["Enabled"] = fix_enabled;
|
||||
pluginIniFile["1#General fix"]["Console"] = console;
|
||||
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"]["Chromatic aberrations"] = CA_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
||||
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
||||
pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue;
|
||||
|
||||
pluginIniFile.save(SETTINGS_FILE);
|
||||
}
|
||||
|
||||
static void LoadSettings()
|
||||
{
|
||||
ini::IniFile pluginIniFile;
|
||||
try {
|
||||
pluginIniFile.load(SETTINGS_FILE);
|
||||
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
||||
console = pluginIniFile["1#General fix"]["Console"].as<bool>();
|
||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||
HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as<bool>();
|
||||
Camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
||||
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
||||
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
||||
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
||||
}
|
||||
catch (const std::exception& e) {}
|
||||
}
|
||||
|
||||
// Read plugin log file
|
||||
void read_log_file(const std::string& filename) {
|
||||
std::ifstream file(filename);
|
||||
if (!file.is_open())
|
||||
{
|
||||
log_content = "Impossible to open file : " + filename;
|
||||
return;
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << file.rdbuf();
|
||||
log_content = ss.str();
|
||||
}
|
||||
|
||||
// Initialize ImGui widgets for Reshade
|
||||
static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.ItemSpacing = ImVec2(8 * scale, 8 * scale); // Spacing between widgets
|
||||
style.FramePadding = ImVec2(3 * scale, 3 * scale); // Widgets padding
|
||||
style.WindowPadding = ImVec2(10 * scale, 10 * scale); // Overlay padding
|
||||
style.CellPadding = ImVec2(10 * scale, 10 * scale); // Table cells padding
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(350 * scale, 150 * scale), ImGuiCond_Once);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.84f, 0.12f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.84f, 0.2f, 0.51f, 1.0f)); // pink
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 1.f, 1.f, 1.f)); // white
|
||||
if (ImGui::Button("Like my work ? Consider donation")) ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL); // Donation
|
||||
ImGui::PopStyleColor(4); // Restore color
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("View logs")) {
|
||||
read_log_file("TheCallistoProtocol.log");
|
||||
show_log_overlay = true; // Fix information
|
||||
}
|
||||
|
||||
if (popup_Informations)
|
||||
{
|
||||
ImGui::Begin("Informations", &popup_Informations, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("Version : %s", FIX_VERSION);
|
||||
ImGui::Text(FIX_INFORMATIONS);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (show_log_overlay)
|
||||
{
|
||||
ImGui::Begin("Game log", &show_log_overlay, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::TextUnformatted(log_content.c_str());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
||||
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Drawing a left column with slider and general fix
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
if (ImGui::Checkbox("Fix enabled", &fix_enabled)) {
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, false);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// Individual fixes
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
if (ImGui::BeginTable("IndividualFixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("IndFix1", ImGuiTableColumnFlags_WidthStretch, 0.35f);
|
||||
ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.65f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::Checkbox("Camera distance", &Camera_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::Camera, Camera_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Experimental fix. Use at your own risk.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("HUD scaling", &HUD_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Chromatic aberrations", &CA_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("SlidersTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||
ImGui::TableSetupColumn("LeftSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||
ImGui::TableSetupColumn("RightSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Sliders
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderInt("##FOVValue", &worldFOVValue, -20, 50)) {
|
||||
if (SetFOV) SetFOV(worldFOVValue);
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("HUD scaling", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderInt("##HUDScale", &HUDScaleValue, 0, 40)) {
|
||||
if (SetHUDScale) SetHUDScale(HUDScaleValue); SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (ImGui::CollapsingHeader("Camera offset (*)", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(200 * scale);
|
||||
if (ImGui::SliderInt("##CameraOffset", &cameraOffsetValue, 0, 200)) {
|
||||
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue); SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Value is in cms.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
// Fix status
|
||||
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
|
||||
if (GetGameInfos) {
|
||||
GameInfos infos{};
|
||||
GetGameInfos(&infos);
|
||||
if (infos.consoleEnabled)
|
||||
ImGui::Text("Console enabled and bound to key F2");
|
||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main dll intrance
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (!reshade::register_addon(hinstDLL))
|
||||
return FALSE;
|
||||
LoadSettings();
|
||||
|
||||
reshade::register_overlay("The Callisto Protocol", &on_overlay_draw);
|
||||
reshade::register_event<reshade::addon_event::init_effect_runtime>(
|
||||
[](reshade::api::effect_runtime* runtime) {
|
||||
LoadFixDLL();
|
||||
});
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
reshade::unregister_addon(hinstDLL);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -15,5 +15,6 @@ enum class GameFixes : int {
|
||||
Vignetting,
|
||||
Fog,
|
||||
VolumetricFog,
|
||||
Sharpening
|
||||
Sharpening,
|
||||
FilmGrain
|
||||
};
|
||||
Reference in New Issue
Block a user