diff --git a/VoidTrain/VoidTrain.vcxproj b/VoidTrain/VoidTrain.vcxproj
new file mode 100644
index 0000000..5643dbc
--- /dev/null
+++ b/VoidTrain/VoidTrain.vcxproj
@@ -0,0 +1,184 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 17.0
+ Win32Proj
+ {17180713-A273-49BF-BF7B-F2468D25C97E}
+ VoidTrain
+ 10.0
+ VoidTrain
+
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+ true
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+ true
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .addon
+ VoidTrainUI
+
+
+ .addon
+ VoidTrainUI
+
+
+ .addon
+ VoidTrainUI
+
+
+ .addon
+
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes
+ MultiThreadedDLL
+ stdcpp20
+ false
+ MinSpace
+ Default
+ Size
+ false
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ false
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes
+ MultiThreadedDLL
+ stdcpp20
+ MinSpace
+ Default
+ Size
+ false
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes
+ MultiThreadedDLL
+ stdcpp20
+ false
+ MinSpace
+ Default
+ Size
+ false
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ false
+ true
+ NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ $(SolutionDir)external\reshade\include;$(SolutionDir)external\reshade\deps\imgui;$(SolutionDir)includes
+ MultiThreadedDLL
+ false
+ stdcpp20
+ MinSpace
+ Default
+ Size
+
+
+ Windows
+ true
+ false
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VoidTrain/dllmain.cpp b/VoidTrain/dllmain.cpp
new file mode 100644
index 0000000..b1ffa1b
--- /dev/null
+++ b/VoidTrain/dllmain.cpp
@@ -0,0 +1,312 @@
+#define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
+#define IMGUI_HAS_DOCK 1
+
+#include "GameInformations.h"
+#include "GameFixes.h"
+#include "inicpp.h"
+#include
+#include
+#include
+#include
+
+// 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 SetHUD = nullptr;
+static GetGameInfosStruct GetGameInfos = nullptr;
+
+// Plugin variables for checkboxes and sliders
+static bool fov_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 HUD_fix_enabled = false;
+static bool fix_enabled = false;
+static bool console = true;
+static int worldFOVvalue = 0;
+static int HUDvalue = 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 = "1.0.1";
+const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Disable depth of field.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Control HUD safe zone.\n - Re enable dev console.";
+const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
+
+// Scaling factor based on screen resolution
+float scale = 1.f;
+
+// Load and unload game core dll functions /!\ necessary
+static void LoadFixDLL()
+{
+ if (InterlockedCompareExchange(&g_coreInitialized, 1, 0) != 0)
+ return;
+
+ if (GetModuleHandleA("VoidTrainCore.dll") == nullptr) {
+ fixLib = LoadLibraryA("VoidTrainCore.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");
+ SetHUD = (SetIntFn)GetProcAddress(fixLib, "SetHUD");
+ GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
+
+ // Apply initial values loaded from settings
+ if (SetFOV) SetFOV(worldFOVvalue);
+ if (SetHUD) SetHUD(HUDvalue);
+ if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
+ if (SetFixesEnabled) {
+ SetFixesEnabled(GameFixes::FOV, fov_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::HUD, HUD_fix_enabled);
+ SetFixesEnabled(GameFixes::DevConsole, true);
+ }
+ }
+}
+
+// Settings functions
+static void SaveSettings()
+{
+ ini::IniFile pluginIniFile;
+ pluginIniFile["1#General fix"].setComment(std::vector{ "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 to disable it"});
+ 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"]["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["2#Individual fix"]["HUD"] = HUD_fix_enabled;
+ pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
+ pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
+ pluginIniFile["3#Fixes tuning"]["HUD percent"] = HUDvalue;
+
+ pluginIniFile.save(SETTINGS_FILE);
+}
+
+static void LoadSettings()
+{
+ ini::IniFile pluginIniFile;
+ try {
+ pluginIniFile.load(SETTINGS_FILE);
+ fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as();
+ console = pluginIniFile["1#General fix"]["Console"].as();
+ fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as();
+ DOF_fix_enabled = pluginIniFile["2#Individual fix"]["DOF"].as();
+ CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as();
+ Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as();
+ Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as();
+ HUD_fix_enabled = pluginIniFile["2#Individual fix"]["HUD"].as();
+ worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as();
+ HUDvalue = pluginIniFile["3#Fixes tuning"]["HUD percent"].as();
+ }
+ 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("VoidTrain.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();
+ }
+
+ 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
+ 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::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::Text("This will affect in game FOV only.");
+ ImGui::EndTooltip();
+ }
+
+ if (ImGui::CollapsingHeader("HUD safe zone (*)", ImGuiTreeNodeFlags_DefaultOpen))
+ {
+ ImGui::SetNextItemWidth(180 * scale);
+ if (ImGui::SliderInt("##HUDValue", &HUDvalue, 0, 40)) {
+ if (SetHUD) SetHUD(HUDvalue);
+ SaveSettings();
+ }
+ }
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::Text("Percentage of width offsets for each side.");
+ 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.4f);
+ ImGui::TableSetupColumn("IndFix2", ImGuiTableColumnFlags_WidthStretch, 0.6f);
+ ImGui::TableNextRow();
+
+ ImGui::TableSetColumnIndex(0);
+ if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
+ if (SetFixesEnabled) SetFixesEnabled(GameFixes::FOV, fov_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("HUD safe zone", &HUD_fix_enabled)) {
+ if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
+ SaveSettings();
+ }
+
+ 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();
+ }
+
+ // 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, Compensated: %.2f, Out: %.2f", infos.FOVIn, infos.CompensatedFOV, 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("VoidTrain", &on_overlay_draw);
+ reshade::register_event(
+ [](reshade::api::effect_runtime* runtime) {
+ LoadFixDLL();
+ });
+ break;
+ case DLL_PROCESS_DETACH:
+ reshade::unregister_addon(hinstDLL);
+ break;
+ }
+ return TRUE;
+}
\ No newline at end of file