From e3b11ce1ac00aa1601fce0b60aeaeff6e26bbea2 Mon Sep 17 00:00:00 2001 From: Eddoursul Date: Sun, 27 Jul 2025 19:45:30 +0200 Subject: [PATCH] Added an INI option toggling hero menu autoscaling --- SKSE/Plugins/EnderalSE.ini | 1 + source/Enderal DLL/src/Main.cpp | 9 +++++---- source/Enderal DLL/src/Patches/HeroMenuPatch.cpp | 10 ++++++++-- source/Enderal DLL/src/Patches/HeroMenuPatch.h | 4 +++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/SKSE/Plugins/EnderalSE.ini b/SKSE/Plugins/EnderalSE.ini index 0eee24e0b..d68f5fbc4 100644 --- a/SKSE/Plugins/EnderalSE.ini +++ b/SKSE/Plugins/EnderalSE.ini @@ -5,3 +5,4 @@ AchievementFix = true VideoInterruptPatch = true ForceBorderless = true AttachLightHitEffectCrashFix = true +AutoScaleHeroMenu = true diff --git a/source/Enderal DLL/src/Main.cpp b/source/Enderal DLL/src/Main.cpp index 27736b604..d9d1dfb82 100644 --- a/source/Enderal DLL/src/Main.cpp +++ b/source/Enderal DLL/src/Main.cpp @@ -23,7 +23,8 @@ static std::map g_settings{ { "AchievementFix", true }, { "VideoInterruptPatch", true }, { "ForceBorderless", true }, - { "AttachLightHitEffectCrashFix", true } + { "AttachLightHitEffectCrashFix", true }, + { "AutoScaleHeroMenu", true } }; namespace { @@ -191,14 +192,14 @@ SKSEPluginLoad(const LoadInterface* skse) { GetPapyrusInterface()->Register(Papyrus::Bind); + LoadINI(&g_settings, "Data/SKSE/Plugins/EnderalSE.ini"); + MainMenuPatch::Install(); DialogueMenuPatch::Install(); - HeroMenuPatch::Install(); + HeroMenuPatch::Install(g_settings.at("AutoScaleHeroMenu")); TweenMenuPatch::Install(); HUDMenuPatch::Install(); - LoadINI(&g_settings, "Data/SKSE/Plugins/EnderalSE.ini"); - if (g_settings.at("AchievementFix")) { logger::info("Patching achievements..."); AchievementFix::Install(); diff --git a/source/Enderal DLL/src/Patches/HeroMenuPatch.cpp b/source/Enderal DLL/src/Patches/HeroMenuPatch.cpp index 11e8e0070..77dfad36f 100644 --- a/source/Enderal DLL/src/Patches/HeroMenuPatch.cpp +++ b/source/Enderal DLL/src/Patches/HeroMenuPatch.cpp @@ -21,8 +21,14 @@ RE::BSEventNotifyControl HeroMenuPatch::ProcessEvent_Hook(RE::InputEvent** a_eve return _ProcessEvent(this, a_event, a_source); } -void HeroMenuPatch::Install() +void HeroMenuPatch::Install(bool aAutoScaleHeroMenu) { + HeroMenuPatch::bAutoScaleHeroMenu = aAutoScaleHeroMenu; + + if (HeroMenuPatch::bAutoScaleHeroMenu) { + logger::info("Hero menu autoscaling has been enabled."); + } + // Patch MenuControls to close the menu REL::Relocation vTable(RE::VTABLE_MenuControls[0]); _ProcessEvent = vTable.write_vfunc(0x1, &HeroMenuPatch::ProcessEvent_Hook); @@ -80,7 +86,7 @@ void HeroMenuPatch::FillMenuValues() return; } - if (!REL::Module::IsVR()) { + if (HeroMenuPatch::bAutoScaleHeroMenu && !REL::Module::IsVR()) { // Fit the movie into the screen (widescreen support) uiMovie->SetViewScaleMode(RE::BSScaleformManager::ScaleModeType::kShowAll); } diff --git a/source/Enderal DLL/src/Patches/HeroMenuPatch.h b/source/Enderal DLL/src/Patches/HeroMenuPatch.h index 28a207798..530b579d9 100644 --- a/source/Enderal DLL/src/Patches/HeroMenuPatch.h +++ b/source/Enderal DLL/src/Patches/HeroMenuPatch.h @@ -5,7 +5,7 @@ class HeroMenuPatch : public RE::MenuControls { public: - static void Install(); + static void Install(bool bAutoScaleHeroMenu = true); static uint64_t OpenStats(uint32_t arg_1, uint32_t arg_2, uint32_t arg_3, uint32_t arg_4, uint32_t arg_5); @@ -19,4 +19,6 @@ public: using ProcessEvent_t = decltype(static_cast*)>(&RE::MenuControls::ProcessEvent)); static inline REL::Relocation _ProcessEvent; + + inline static bool bAutoScaleHeroMenu; };