Added an INI option toggling hero menu autoscaling

This commit is contained in:
Eddoursul 2025-07-27 19:45:30 +02:00
parent 96f0e89d72
commit e3b11ce1ac
4 changed files with 17 additions and 7 deletions

View File

@ -5,3 +5,4 @@ AchievementFix = true
VideoInterruptPatch = true VideoInterruptPatch = true
ForceBorderless = true ForceBorderless = true
AttachLightHitEffectCrashFix = true AttachLightHitEffectCrashFix = true
AutoScaleHeroMenu = true

View File

@ -23,7 +23,8 @@ static std::map<std::string, bool> g_settings{
{ "AchievementFix", true }, { "AchievementFix", true },
{ "VideoInterruptPatch", true }, { "VideoInterruptPatch", true },
{ "ForceBorderless", true }, { "ForceBorderless", true },
{ "AttachLightHitEffectCrashFix", true } { "AttachLightHitEffectCrashFix", true },
{ "AutoScaleHeroMenu", true }
}; };
namespace { namespace {
@ -191,14 +192,14 @@ SKSEPluginLoad(const LoadInterface* skse) {
GetPapyrusInterface()->Register(Papyrus::Bind); GetPapyrusInterface()->Register(Papyrus::Bind);
LoadINI(&g_settings, "Data/SKSE/Plugins/EnderalSE.ini");
MainMenuPatch::Install(); MainMenuPatch::Install();
DialogueMenuPatch::Install(); DialogueMenuPatch::Install();
HeroMenuPatch::Install(); HeroMenuPatch::Install(g_settings.at("AutoScaleHeroMenu"));
TweenMenuPatch::Install(); TweenMenuPatch::Install();
HUDMenuPatch::Install(); HUDMenuPatch::Install();
LoadINI(&g_settings, "Data/SKSE/Plugins/EnderalSE.ini");
if (g_settings.at("AchievementFix")) { if (g_settings.at("AchievementFix")) {
logger::info("Patching achievements..."); logger::info("Patching achievements...");
AchievementFix::Install(); AchievementFix::Install();

View File

@ -21,8 +21,14 @@ RE::BSEventNotifyControl HeroMenuPatch::ProcessEvent_Hook(RE::InputEvent** a_eve
return _ProcessEvent(this, a_event, a_source); 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 // Patch MenuControls to close the menu
REL::Relocation<std::uintptr_t> vTable(RE::VTABLE_MenuControls[0]); REL::Relocation<std::uintptr_t> vTable(RE::VTABLE_MenuControls[0]);
_ProcessEvent = vTable.write_vfunc(0x1, &HeroMenuPatch::ProcessEvent_Hook); _ProcessEvent = vTable.write_vfunc(0x1, &HeroMenuPatch::ProcessEvent_Hook);
@ -80,7 +86,7 @@ void HeroMenuPatch::FillMenuValues()
return; return;
} }
if (!REL::Module::IsVR()) { if (HeroMenuPatch::bAutoScaleHeroMenu && !REL::Module::IsVR()) {
// Fit the movie into the screen (widescreen support) // Fit the movie into the screen (widescreen support)
uiMovie->SetViewScaleMode(RE::BSScaleformManager::ScaleModeType::kShowAll); uiMovie->SetViewScaleMode(RE::BSScaleformManager::ScaleModeType::kShowAll);
} }

View File

@ -5,7 +5,7 @@
class HeroMenuPatch : public RE::MenuControls class HeroMenuPatch : public RE::MenuControls
{ {
public: 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); 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::BSEventNotifyControl (RE::MenuControls::*)(RE::InputEvent* const*, RE::BSTEventSource<RE::InputEvent*>*)>(&RE::MenuControls::ProcessEvent)); using ProcessEvent_t = decltype(static_cast<RE::BSEventNotifyControl (RE::MenuControls::*)(RE::InputEvent* const*, RE::BSTEventSource<RE::InputEvent*>*)>(&RE::MenuControls::ProcessEvent));
static inline REL::Relocation<ProcessEvent_t> _ProcessEvent; static inline REL::Relocation<ProcessEvent_t> _ProcessEvent;
inline static bool bAutoScaleHeroMenu;
}; };