|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
#include "EventListener.h" |
|
|
|
|
#include "Util.h" |
|
|
|
|
#include "EventListener.h" |
|
|
|
|
#include "Papyrus.h" |
|
|
|
|
#include "Patches/MainMenuPatch.h" |
|
|
|
|
#include "Patches/FlatMapMarkers.h" |
|
|
|
@ -27,14 +27,26 @@ static std::map<std::string, bool> g_settings{ |
|
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
void InitializeLogging() { |
|
|
|
|
auto path = logger::log_directory(); |
|
|
|
|
if (!path) { |
|
|
|
|
SKSE::stl::report_and_fail("Failed to find standard logging directory"sv); |
|
|
|
|
wchar_t* buffer{ nullptr }; |
|
|
|
|
const auto result = ::SHGetKnownFolderPath(::FOLDERID_Documents, ::KNOWN_FOLDER_FLAG::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); |
|
|
|
|
std::unique_ptr<wchar_t[], decltype(&::CoTaskMemFree)> knownPath(buffer, ::CoTaskMemFree); |
|
|
|
|
|
|
|
|
|
if (!knownPath || result != S_OK) { |
|
|
|
|
logger::error("failed to get known folder path"sv); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*path /= "EnderalSE.log"sv; |
|
|
|
|
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true); |
|
|
|
|
std::filesystem::path path = knownPath.get(); |
|
|
|
|
path /= "My Games"sv; |
|
|
|
|
if (GetModuleHandle(L"Galaxy64.dll") != NULL) { |
|
|
|
|
path /= "Skyrim Special Edition GOG"sv; |
|
|
|
|
} else { |
|
|
|
|
path /= "Skyrim Special Edition"sv; |
|
|
|
|
} |
|
|
|
|
path /= "SKSE"sv; |
|
|
|
|
path /= "EnderalSE.log"sv; |
|
|
|
|
|
|
|
|
|
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path.string(), true); |
|
|
|
|
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink)); |
|
|
|
|
|
|
|
|
|
log->set_level(spdlog::level::info); |
|
|
|
@ -75,45 +87,46 @@ namespace { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
if (dataHandler) { |
|
|
|
|
if (!dataHandler->LookupLoadedModByName("Update.esm")) { |
|
|
|
|
MessageBoxW(NULL, L"Update.esm is not loaded!", L"Enderal SE Error", MB_OK | MB_ICONERROR); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
} |
|
|
|
|
if (!dataHandler->LookupLoadedModByName("Enderal - Forgotten Stories.esm")) { |
|
|
|
|
MessageBoxW(NULL, L"Enderal - Forgotten Stories.esm is not loaded!", L"Enderal SE Error", MB_OK | MB_ICONERROR); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
SKSE::GetTaskInterface()->AddTask([]() { |
|
|
|
|
const auto dataHandler = RE::TESDataHandler::GetSingleton(); |
|
|
|
|
if (dataHandler) { |
|
|
|
|
if (!dataHandler->LookupLoadedModByName("Update.esm")) { |
|
|
|
|
MessageBoxW(NULL, L"Update.esm is not loaded!", L"Enderal SE Error", MB_OK | MB_ICONERROR); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
} |
|
|
|
|
if (!dataHandler->LookupLoadedModByName("Enderal - Forgotten Stories.esm")) { |
|
|
|
|
MessageBoxW(NULL, L"Enderal - Forgotten Stories.esm is not loaded!", L"Enderal SE Error", MB_OK | MB_ICONERROR); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool bScripts = RE::BSScript::Internal::VirtualMachine::GetSingleton()->TypeIsValid("PRKF__00E_CraftQuestPotionPe_0300146D"); |
|
|
|
|
bool bInterface = RE::BSResourceNiBinaryStream("interface/00e_heromenu.swf").good(); |
|
|
|
|
bool bScripts = RE::BSScript::Internal::VirtualMachine::GetSingleton()->TypeIsValid("PRKF__00E_CraftQuestPotionPe_0300146D"); |
|
|
|
|
bool bInterface = RE::BSResourceNiBinaryStream("interface/00e_heromenu.swf").good(); |
|
|
|
|
|
|
|
|
|
if (!bScripts || !bInterface) { |
|
|
|
|
RE::DebugMessageBox("E - Misc.bsa is not loaded or is outdated. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
if (!bScripts || !bInterface) { |
|
|
|
|
RE::DebugMessageBox("E - Misc.bsa is not loaded or is outdated. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool bSounds = RE::BSResourceNiBinaryStream("sound/fx/enderal/laughingchild.wav").good(); |
|
|
|
|
bool bSounds = RE::BSResourceNiBinaryStream("sound/fx/enderal/laughingchild.wav").good(); |
|
|
|
|
|
|
|
|
|
if (!bSounds) { |
|
|
|
|
RE::DebugMessageBox("E - Sounds.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
if (!bSounds) { |
|
|
|
|
RE::DebugMessageBox("E - Sounds.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool bVoices = RE::BSResourceNiBinaryStream("sound/voice/enderal - forgotten stories.esm/vt_calia/fs_mq18c__0002a4ed_1.fuz").good(); |
|
|
|
|
bool bVoices = RE::BSResourceNiBinaryStream("sound/voice/enderal - forgotten stories.esm/vt_calia/fs_mq18c__0002a4ed_1.fuz").good(); |
|
|
|
|
|
|
|
|
|
if (!bVoices) { |
|
|
|
|
RE::DebugMessageBox("L - Voices.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool bMeshes = RE::BSResourceNiBinaryStream("meshes/enderal/loadscreenart/loadscreenundercity.nif").good(); |
|
|
|
|
if (!bVoices) { |
|
|
|
|
RE::DebugMessageBox("L - Voices.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!bMeshes) { |
|
|
|
|
RE::DebugMessageBox("E - Meshes.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
bool bMeshes = RE::BSResourceNiBinaryStream("meshes/enderal/loadscreenart/loadscreenundercity.nif").good(); |
|
|
|
|
|
|
|
|
|
CheckIncompatibleMods(); |
|
|
|
|
if (!bMeshes) { |
|
|
|
|
RE::DebugMessageBox("E - Meshes.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CheckIncompatibleMods(); |
|
|
|
|
}); |
|
|
|
|
} else if ((message->type == MessagingInterface::kPostLoadGame && message->data) || message->type == MessagingInterface::kNewGame) { |
|
|
|
|
NewGameCount(true); |
|
|
|
|
} |
|
|
|
|