2025-10-17 17:18:51 +02:00
# define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
# define IMGUI_HAS_DOCK 1
2026-02-27 22:23:59 +01:00
# include "CommonHeaders.h"
2025-10-17 17:18:51 +02:00
// 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
2026-02-27 22:23:59 +01:00
using SetBoolFn = void ( * ) ( bool , bool ) ;
using SetFixesFn = void ( * ) ( GameFixes , bool ) ;
using SetFloatFn = void ( * ) ( GameSetting , float ) ;
2025-10-17 17:18:51 +02:00
static HMODULE fixLib = nullptr ;
static LONG g_coreInitialized = 0 ;
2026-02-27 22:23:59 +01:00
static LONG g_hotkeysInitialized = 0 ;
static LONG g_uniformReseted = 0 ;
2025-10-17 17:18:51 +02:00
static SetBoolFn SetFixEnabled = nullptr ;
2026-02-27 22:23:59 +01:00
static SetFixesFn SetFixes = nullptr ;
static SetFloatFn SetValues = nullptr ;
2025-10-17 17:18:51 +02:00
static GetGameInfosStruct GetGameInfos = nullptr ;
2026-02-27 22:23:59 +01:00
void SetFixesEnabled ( GameFixes fix , bool value ) { if ( SetFixes ) SetFixes ( fix , value ) ; }
2025-10-17 17:18:51 +02:00
// Plugin variables for checkboxes and sliders
static bool fov_fix_enabled = false ;
static bool ultrawide_fix_enabled = false ;
static bool camera_fix_enabled = false ;
2026-02-27 22:23:59 +01:00
static bool HUD_fix_enabled = false ;
2025-10-17 17:18:51 +02:00
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 VolumetricFog_fix_enabled = false ;
static bool fix_enabled = false ;
2025-11-29 22:11:14 +01:00
static bool console = true ;
2025-10-17 17:18:51 +02:00
static int worldFOVvalue = 0 ;
static float cameraDistance = 1.f ;
2026-02-27 22:23:59 +01:00
static int HUDvalue = 0 ;
2025-10-17 17:18:51 +02:00
// 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 " ;
2026-02-27 22:23:59 +01:00
const char * FIX_VERSION = " 1.0.3 " ;
const char * FIX_INFORMATIONS = " This fix allows to: \n - Control FOV in game. \n - Enable ultrawide. \n - Control HUD scaling. \n - Control camera distance. \n - Disable depth of field. \n - Disable chromatic aberrations. \n - Disable vignetting. \n - Disable fog & volumetric fog. \n - Re enable dev console. " ;
2025-10-17 17:18:51 +02:00
const char * DONATION_URL = " https://buymeacoffee.com/k4sh44 " ;
2026-02-27 22:23:59 +01:00
// Prepare arrays of checkboxes for ImGui
static FixToggle individualFixes [ ] = {
{ " FOV " , & fov_fix_enabled , GameFixes : : FOV } ,
{ " Camera " , & camera_fix_enabled , GameFixes : : Camera } ,
{ " Vignetting " , & Vignetting_fix_enabled , GameFixes : : Vignetting } ,
{ " Fog " , & Fog_fix_enabled , GameFixes : : Fog } ,
{ " Ultrawide " , & ultrawide_fix_enabled , GameFixes : : UltraWide } ,
{ " HUD " , & HUD_fix_enabled , GameFixes : : HUD } ,
{ " Depth of field " , & DOF_fix_enabled , GameFixes : : DOF } ,
{ " Chromatic aberrations " , & CA_fix_enabled , GameFixes : : ChromaticAberrations } ,
{ " Volumetric fog " , & VolumetricFog_fix_enabled , GameFixes : : VolumetricFog } ,
} ;
2025-11-29 22:11:14 +01:00
// Reshade addon name and description
extern " C " __declspec ( dllexport ) const char * NAME = " Eternal Strands " ;
extern " C " __declspec ( dllexport ) const char * DESCRIPTION = " Reshade addon to re-enable console, enable ultrawide, control FOV, camera distance and some effects. " ;
2025-10-17 17:18:51 +02:00
// Scaling factor based on screen resolution
2026-02-27 22:23:59 +01:00
float scale = ( float ) screenHeight / 1200 ;
// Prepare array of sliders for ImGui
static SliderFix2 sliders [ 3 ] ;
2025-10-17 17:18:51 +02:00
// Load and unload game core dll functions /!\ necessary
2026-02-27 22:23:59 +01:00
static void LoadFixDLL ( ) {
2025-10-17 17:18:51 +02:00
if ( InterlockedCompareExchange ( & g_coreInitialized , 1 , 0 ) ! = 0 )
return ;
if ( GetModuleHandleA ( " EternalStrandsCore.dll " ) = = nullptr ) {
fixLib = LoadLibraryA ( " EternalStrandsCore.dll " ) ;
if ( ! fixLib ) {
MessageBoxA ( nullptr , " Impossible to load game core dll " , " Erreur " , MB_OK ) ;
return ;
}
SetFixEnabled = ( SetBoolFn ) GetProcAddress ( fixLib , " SetFixEnabled " ) ;
2026-02-27 22:23:59 +01:00
SetFixes = ( SetFixesFn ) GetProcAddress ( fixLib , " SetFixesEnabled " ) ;
SetValues = ( SetFloatFn ) GetProcAddress ( fixLib , " SetValues " ) ;
2025-10-17 17:18:51 +02:00
GetGameInfos = ( GetGameInfosStruct ) GetProcAddress ( fixLib , " GetGameInfos " ) ;
// Apply initial values loaded from settings
2026-02-27 22:23:59 +01:00
if ( SetValues ) {
SetValues ( GameSetting : : FOV , worldFOVvalue ) ;
SetValues ( GameSetting : : CameraDistance , cameraDistance ) ;
SetValues ( GameSetting : : HUD , HUDvalue ) ;
}
2025-10-17 17:18:51 +02:00
if ( SetFixEnabled ) SetFixEnabled ( fix_enabled , true ) ;
2026-02-27 22:23:59 +01:00
if ( SetFixes ) {
SetFixes ( GameFixes : : FOV , fov_fix_enabled ) ;
SetFixes ( GameFixes : : UltraWide , ultrawide_fix_enabled ) ;
SetFixes ( GameFixes : : Camera , camera_fix_enabled ) ;
SetFixes ( GameFixes : : HUD , HUD_fix_enabled ) ;
SetFixes ( GameFixes : : DOF , DOF_fix_enabled ) ;
SetFixes ( GameFixes : : ChromaticAberrations , CA_fix_enabled ) ;
SetFixes ( GameFixes : : Vignetting , Vignetting_fix_enabled ) ;
SetFixes ( GameFixes : : Fog , Fog_fix_enabled ) ;
SetFixes ( GameFixes : : VolumetricFog , VolumetricFog_fix_enabled ) ;
SetFixes ( GameFixes : : DevConsole , console ) ;
2025-10-17 17:18:51 +02:00
}
2026-02-27 22:23:59 +01:00
sliders [ 0 ] = { " In game additional FOV " , " ##FOVValue " , SliderType : : Int , & worldFOVvalue , - 20 , 70 , GameSetting : : FOV , SetValues } ;
sliders [ 1 ] = { " Camera distance (*) " , " ##CameraOffset " , SliderType : : Float , & cameraDistance , 0 , 4 , GameSetting : : CameraDistance , SetValues , " %.1f " ,
" Value is a multiplier. " } ;
sliders [ 2 ] = { " HUD scaling " , " ##HUDValue " , SliderType : : Int , & HUDvalue , 0 , 40 , GameSetting : : HUD , SetValues , nullptr , " This will only affect HUD " } ;
2025-10-17 17:18:51 +02:00
}
}
// Settings functions
2026-02-27 22:23:59 +01:00
static void SaveSettings ( ) {
2025-10-17 17:18:51 +02:00
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 " ,
" " ,
2025-11-29 22:11:14 +01:00
" Controls if fix mod (globally) is enabled " ,
" Set Console to false if you don't want dev console to be enabled " } ) ;
2025-10-17 17:18:51 +02:00
pluginIniFile [ " 1#General fix " ] [ " Enabled " ] = fix_enabled ;
2025-11-29 22:11:14 +01:00
pluginIniFile [ " 1#General fix " ] [ " Console " ] = console ;
2025-10-17 17:18:51 +02:00
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 ;
2026-02-27 22:23:59 +01:00
pluginIniFile [ " 2#Individual fix " ] [ " HUD " ] = HUD_fix_enabled ;
2025-10-17 17:18:51 +02:00
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 " ] [ " Volumetric fog " ] = VolumetricFog_fix_enabled ;
pluginIniFile [ " 3#Fixes tuning " ] . setComment ( " Individual fix fine tune " ) ;
pluginIniFile [ " 3#Fixes tuning " ] [ " World FOV " ] = worldFOVvalue ;
pluginIniFile [ " 3#Fixes tuning " ] [ " Camera distance " ] = cameraDistance ;
2026-02-27 22:23:59 +01:00
pluginIniFile [ " 3#Fixes tuning " ] [ " HUD scaling " ] = HUDvalue ;
2025-10-17 17:18:51 +02:00
pluginIniFile . save ( SETTINGS_FILE ) ;
}
2026-02-27 22:23:59 +01:00
static void LoadSettings ( ) {
2025-10-17 17:18:51 +02:00
ini : : IniFile pluginIniFile ;
try {
pluginIniFile . load ( SETTINGS_FILE ) ;
fix_enabled = pluginIniFile [ " 1#General fix " ] [ " Enabled " ] . as < bool > ( ) ;
2025-11-29 22:11:14 +01:00
console = pluginIniFile [ " 1#General fix " ] [ " Console " ] . as < bool > ( ) ;
2025-10-17 17:18:51 +02:00
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 > ( ) ;
2026-02-27 22:23:59 +01:00
HUD_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " HUD " ] . as < bool > ( ) ;
2025-10-17 17:18:51 +02:00
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 > ( ) ;
VolumetricFog_fix_enabled = pluginIniFile [ " 2#Individual fix " ] [ " Volumetric fog " ] . as < bool > ( ) ;
worldFOVvalue = pluginIniFile [ " 3#Fixes tuning " ] [ " World FOV " ] . as < int > ( ) ;
cameraDistance = pluginIniFile [ " 3#Fixes tuning " ] [ " Camera distance " ] . as < float > ( ) ;
2026-02-27 22:23:59 +01:00
HUDvalue = pluginIniFile [ " 3#Fixes tuning " ] [ " HUD scaling " ] . as < int > ( ) ;
2025-10-17 17:18:51 +02:00
}
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
2026-02-27 22:23:59 +01:00
static void on_overlay_draw ( reshade : : api : : effect_runtime * runtime ) {
2025-10-17 17:18:51 +02:00
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 ( " EternalStrands.log " ) ;
show_log_overlay = true ; // Fix information
}
2026-02-27 22:23:59 +01:00
if ( popup_Informations ) {
2025-10-17 17:18:51 +02:00
ImGui : : Begin ( " Informations " , & popup_Informations , ImGuiWindowFlags_AlwaysAutoResize ) ;
ImGui : : Text ( " Version : %s " , FIX_VERSION ) ;
ImGui : : Text ( FIX_INFORMATIONS ) ;
ImGui : : End ( ) ;
}
2026-02-27 22:23:59 +01:00
if ( show_log_overlay ) {
2025-10-17 17:18:51 +02:00
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 ( ) ;
}
// 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 ) ;
2026-02-27 22:23:59 +01:00
for ( int i = 0 ; i < 4 ; + + i ) DrawFixCheckbox ( individualFixes [ i ] ) ;
2025-10-17 17:18:51 +02:00
ImGui : : TableSetColumnIndex ( 1 ) ;
2026-02-27 22:23:59 +01:00
for ( int i = 4 ; i < IM_ARRAYSIZE ( individualFixes ) ; + + i ) DrawFixCheckbox ( individualFixes [ i ] ) ;
ImGui : : EndTable ( ) ;
2025-10-17 17:18:51 +02:00
ImGui : : EndTable ( ) ;
}
}
ImGui : : EndTable ( ) ;
2026-02-27 22:23:59 +01:00
ImGui : : SetCursorPosY ( ImGui : : GetCursorPosY ( ) - 2 ) ;
if ( ImGui : : BeginTable ( " FixesSliders " , 2 , ImGuiTableFlags_SizingStretchSame ) ) {
ImGui : : TableNextRow ( ) ;
ImGui : : TableSetColumnIndex ( 0 ) ;
DrawSlider2 ( sliders [ 0 ] , 200 ) ;
DrawSlider2 ( sliders [ 1 ] , 200 ) ;
ImGui : : TableSetColumnIndex ( 1 ) ;
DrawSlider2 ( sliders [ 2 ] , 200 ) ;
ImGui : : EndTable ( ) ;
}
2025-10-17 17:18:51 +02:00
}
// 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 )
2026-02-27 22:23:59 +01:00
ImGui : : Text ( " Console enabled and bound to key F2 " ) ;
2025-10-17 17:18:51 +02:00
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
2026-02-27 22:23:59 +01:00
BOOL WINAPI DllMain ( HINSTANCE hinstDLL , DWORD ul_reason_for_call , LPVOID ) {
2025-10-17 17:18:51 +02:00
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH :
if ( ! reshade : : register_addon ( hinstDLL ) )
return FALSE ;
LoadSettings ( ) ;
reshade : : register_overlay ( " Eternal Strands " , & 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 ;
}