74 lines
2.3 KiB
C++
74 lines
2.3 KiB
C++
#include "EventListener.h"
|
|
#include "Util.h"
|
|
#include <shellapi.h>
|
|
|
|
auto EventListener::GetSingleton() -> EventListener*
|
|
{
|
|
static EventListener singleton{};
|
|
return std::addressof(singleton);
|
|
}
|
|
|
|
void EventListener::Install()
|
|
{
|
|
RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
|
|
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const SKSE::ModCallbackEvent* a_event,
|
|
RE::BSTEventSource<SKSE::ModCallbackEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
if (a_event->eventName == "Enderal_OpenHelpURL") {
|
|
ShowWindow(GetForegroundWindow(), SW_MINIMIZE);
|
|
ShellExecuteA(NULL, "open", "https://go.eddoursul.win/enderal-se-support", NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
//} else if (a_event->eventName == "Enderal_OpenQuestJournal") {
|
|
// RE::UIMessageQueue::GetSingleton()->AddMessage(RE::InterfaceStrings::GetSingleton()->journalMenu, RE::UI_MESSAGE_TYPE::kShow, 0i64);
|
|
}
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::TESContainerChangedEvent* a_event,
|
|
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
//
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::MenuOpenCloseEvent* a_event,
|
|
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
if (a_event->opening && a_event->menuName == RE::JournalMenu::MENU_NAME) {
|
|
if (RE::UI::GetSingleton()->IsMenuOpen(RE::DialogueMenu::MENU_NAME)) {
|
|
const auto movie = RE::UI::GetSingleton()->GetMovieView(RE::JournalMenu::MENU_NAME);
|
|
if (movie) {
|
|
// skse.OpenMenu("Journal Menu") opens quest journal uninitialized, without any tab active and hotkeys bound
|
|
// We have to activate a tab for it to work properly
|
|
std::array<RE::GFxValue, 2> args;
|
|
args[0].SetNumber(2);
|
|
args[1].SetBoolean(true);
|
|
movie->Invoke("_root.QuestJournalFader.Menu_mc.RestoreSavedSettings", nullptr, args.data(), static_cast<std::uint32_t>(args.size()));
|
|
}
|
|
}
|
|
}
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::TESActivateEvent* a_event,
|
|
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
//
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|