|
|
|
@ -5,8 +5,10 @@ RE::BSEventNotifyControl HeroMenuPatch::ProcessEvent_Hook(RE::InputEvent** a_eve |
|
|
|
|
if (RE::UI::GetSingleton()->GameIsPaused() && a_event && *a_event) { |
|
|
|
|
auto buttonEvent = (*a_event)->AsButtonEvent(); |
|
|
|
|
if (buttonEvent && buttonEvent->IsDown() && RE::UI::GetSingleton()->IsMenuOpen("CustomMenu")) { |
|
|
|
|
|
|
|
|
|
auto& eventName = (*a_event)->QUserEvent(); |
|
|
|
|
auto userEvents = RE::UserEvents::GetSingleton(); |
|
|
|
|
|
|
|
|
|
if (eventName == userEvents->cancel || eventName == userEvents->quickStats) { |
|
|
|
|
auto uiMovie = RE::UI::GetSingleton()->GetMovieView("CustomMenu"); |
|
|
|
|
if (uiMovie && std::strstr(uiMovie->GetMovieDef()->GetFileURL(), "00e_heromenu.swf") != NULL) { |
|
|
|
@ -21,17 +23,17 @@ RE::BSEventNotifyControl HeroMenuPatch::ProcessEvent_Hook(RE::InputEvent** a_eve |
|
|
|
|
|
|
|
|
|
void HeroMenuPatch::Install() |
|
|
|
|
{ |
|
|
|
|
// Patch MenuControls
|
|
|
|
|
// Patch MenuControls to close the menu
|
|
|
|
|
REL::Relocation<std::uintptr_t> vTable(RE::VTABLE_MenuControls[0]); |
|
|
|
|
_ProcessEvent = vTable.write_vfunc(0x1, &HeroMenuPatch::ProcessEvent_Hook); |
|
|
|
|
|
|
|
|
|
// Patch the Quick Stats hotkey
|
|
|
|
|
// Patch the Quick Stats hotkey to open the menu
|
|
|
|
|
// Checked: 1.5.97, 1.6.640, 1.6.659, 1.6.1130
|
|
|
|
|
REL::Relocation<std::uintptr_t> target{ REL::RelocationID(51400, 52249), REL::Relocate(0x41E, 0x421) }; |
|
|
|
|
REL::safe_fill(target.address(), REL::NOP, 45); |
|
|
|
|
|
|
|
|
|
auto& trampoline = SKSE::GetTrampoline(); |
|
|
|
|
SKSE::AllocTrampoline(14); |
|
|
|
|
_OpenStats = trampoline.write_call<5>(target.address(), OpenStats); |
|
|
|
|
_OpenStats = SKSE::GetTrampoline().write_call<5>(target.address(), OpenStats); |
|
|
|
|
|
|
|
|
|
REL::Relocation<std::uintptr_t> target2{ REL::RelocationID(51400, 52249), REL::Relocate(0x436, 0x439) }; |
|
|
|
|
std::uint8_t code[] = { 0x40, 0xB5, 0x01 }; |
|
|
|
@ -60,7 +62,7 @@ void HeroMenuPatch::FillMenuValues() |
|
|
|
|
if (a_result.IsString()) { |
|
|
|
|
auto uiMovie = RE::UI::GetSingleton()->GetMovieView("CustomMenu"); |
|
|
|
|
if (uiMovie) { |
|
|
|
|
uiMovie->SetVariable("_root.heromenu_mc.stats.playerclass.stat_value.text", a_result.GetString()); |
|
|
|
|
uiMovie->SetVariable("heromenu_mc.stats.playerclass.stat_value.text", a_result.GetString(), RE::GFxMovie::SetVarType::kNormal); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -69,6 +71,12 @@ void HeroMenuPatch::FillMenuValues() |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
auto uiMovie = RE::UI::GetSingleton()->GetMovieView("CustomMenu"); |
|
|
|
|
|
|
|
|
|
if (!uiMovie) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Fit the movie into the screen (widescreen support)
|
|
|
|
|
uiMovie->SetViewScaleMode(RE::BSScaleformManager::ScaleModeType::kShowAll); |
|
|
|
|
|
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
@ -89,7 +97,7 @@ void HeroMenuPatch::FillMenuValues() |
|
|
|
|
RE::GFxValue args[2]; |
|
|
|
|
args[0].SetString(player->GetDisplayFullName()); |
|
|
|
|
args[1].SetString(""); |
|
|
|
|
uiMovie->Invoke("_root.heromenu_mc.SetStringValues", nullptr, args, 2); |
|
|
|
|
uiMovie->Invoke("heromenu_mc.SetStringValues", nullptr, args, 2); |
|
|
|
|
|
|
|
|
|
RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> stackCallback{ new ScriptClassNameCallback }; |
|
|
|
|
RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("_00E_AffinityControl", "GetPlayerClassNameGlobal", RE::MakeFunctionArguments(), stackCallback); |
|
|
|
@ -129,7 +137,7 @@ void HeroMenuPatch::FillMenuValues() |
|
|
|
|
|
|
|
|
|
args2[31].SetNumber(playerExp->value - fEXPNeededForCurrentLevel); |
|
|
|
|
args2[32].SetNumber(fEXPNeededForNextLevel - fEXPNeededForCurrentLevel); |
|
|
|
|
uiMovie->Invoke("_root.heromenu_mc.SetIntValues", nullptr, args2, 33); |
|
|
|
|
uiMovie->Invoke("heromenu_mc.SetIntValues", nullptr, args2, 33); |
|
|
|
|
|
|
|
|
|
RE::GFxValue args3[21]; |
|
|
|
|
args3[0].SetNumber(0); |
|
|
|
@ -153,5 +161,5 @@ void HeroMenuPatch::FillMenuValues() |
|
|
|
|
args3[18].SetNumber(playerAV->GetActorValue(RE::ActorValue::kEnchanting) - playerAV->GetBaseActorValue(RE::ActorValue::kEnchanting)); |
|
|
|
|
args3[19].SetNumber(playerAV->GetActorValue(RE::ActorValue::kSmithing) - playerAV->GetBaseActorValue(RE::ActorValue::kSmithing)); |
|
|
|
|
args3[20].SetNumber(playerAV->GetActorValue(RE::ActorValue::kSpeech) - playerAV->GetBaseActorValue(RE::ActorValue::kSpeech)); |
|
|
|
|
uiMovie->Invoke("_root.heromenu_mc.SetModifier", nullptr, args3, 21); |
|
|
|
|
uiMovie->Invoke("heromenu_mc.SetModifier", nullptr, args3, 21); |
|
|
|
|
} |
|
|
|
|