@ -34,18 +34,8 @@ namespace {
void InitializeMessaging ( )
void InitializeMessaging ( )
{
{
GetMessagingInterface ( ) - > RegisterListener ( [ ] ( MessagingInterface : : Message * message ) {
GetMessagingInterface ( ) - > RegisterListener ( [ ] ( MessagingInterface : : Message * message ) {
if ( message - > type = = MessagingInterface : : kPostLoad ) {
if ( DataFileExists ( " Dawnguard.esm " ) | | DataFileExists ( " Dragonborn.esm " ) | | DataFileExists ( " HearthFires.esm " ) | | DataFileExists ( " Update.esm " ) ) {
MessageBoxW ( NULL , L " Skyrim DLCs are incompatible with Enderal. " , L " Error " , MB_OK | MB_ICONERROR ) ;
exit ( EXIT_FAILURE ) ;
}
if ( DataFileExists ( " Unofficial Skyrim Special Edition Patch.esp " ) ) {
MessageBoxW ( NULL , L " Unofficial Skyrim Special Edition Patch is incompatible with Enderal. " , L " Error " , MB_OK | MB_ICONERROR ) ;
exit ( EXIT_FAILURE ) ;
}
CheckCCMods ( ) ;
if ( message - > type = = MessagingInterface : : kPostLoad ) {
if ( g_settings . at ( " StayAtSystemPage " ) ) {
if ( g_settings . at ( " StayAtSystemPage " ) ) {
if ( const auto pluginInfo = GetLoadInterface ( ) - > GetPluginInfo ( " StayAtSystemPage " ) ; pluginInfo ) {
if ( const auto pluginInfo = GetLoadInterface ( ) - > GetPluginInfo ( " StayAtSystemPage " ) ; pluginInfo ) {
MessageBoxW ( NULL , L " Stay At The System Page is already included in Enderal, please, disable it. " , L " Error " , MB_OK | MB_ICONERROR ) ;
MessageBoxW ( NULL , L " Stay At The System Page is already included in Enderal, please, disable it. " , L " Error " , MB_OK | MB_ICONERROR ) ;
@ -59,11 +49,6 @@ namespace {
}
}
}
}
SetINISettings ( ) ;
EventListener : : Install ( ) ;
} else if ( message - > type = = MessagingInterface : : kPostPostLoad ) {
SKSE : : GetModCallbackEventSource ( ) - > AddEventSink ( EventListener : : GetSingleton ( ) ) ;
} else if ( message - > type = = MessagingInterface : : kDataLoaded ) {
} else if ( message - > type = = MessagingInterface : : kDataLoaded ) {
const auto dataHandler = RE : : TESDataHandler : : GetSingleton ( ) ;
const auto dataHandler = RE : : TESDataHandler : : GetSingleton ( ) ;
if ( dataHandler ) {
if ( dataHandler ) {
@ -77,21 +62,38 @@ namespace {
}
}
}
}
if ( ! RE : : BSScript : : Internal : : VirtualMachine : : GetSingleton ( ) - > TypeIsValid ( " UI " ) ) {
RE : : DebugMessageBox ( " Unable to detect SKSE scripts, make sure SKSE is properly installed. " ) ;
}
bool bScripts = RE : : BSScript : : Internal : : VirtualMachine : : GetSingleton ( ) - > TypeIsValid ( " PRKF__00E_CraftQuestPotionPe_0300146D " ) ;
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. " ) ;
}
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. " ) ;
}
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 ( ) ;
bool bMeshes = RE : : BSResourceNiBinaryStream ( " meshes/enderal/loadscreenart/loadscreenundercity.nif " ) . good ( ) ;
bool bTextures = RE : : BSResourceNiBinaryStream ( " textures/enderal/forgottenstories/theriantrophist/theriantrophistrecipe.dds " ) . good ( ) ;
bool bInterface = RE : : BSResourceNiBinaryStream ( " interface/00e_heromenu.swf " ) . good ( ) ;
if ( ! bScripts | | ! bSounds | | ! b Voices | | ! bMeshes | | ! bTextures | | ! bInterface ) {
if ( ! bVoices ) {
MessageBoxW ( NULL , L " One or more of Enderal's BSA archives are not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files." , L " Error " , MB_OK | MB_ICONERROR ) ;
RE : : DebugMessageBox ( " L - Voices.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files. " ) ;
exit ( EXIT_FAILURE ) ;
exit ( EXIT_FAILURE ) ;
}
}
bool bMeshes = RE : : BSResourceNiBinaryStream ( " meshes/enderal/loadscreenart/loadscreenundercity.nif " ) . good ( ) ;
if ( ! bMeshes ) {
RE : : DebugMessageBox ( " E - Meshes.bsa is not loaded. Make sure Enderal - Forgotten Stories.esm is enabled and revalidate your files. " ) ;
}
CheckIncompatibleMods ( ) ;
CheckIncompatibleMods ( ) ;
} else if ( message - > type = = MessagingInterface : : kPreLoadGame ) {
//
} else if ( ( message - > type = = MessagingInterface : : kPostLoadGame & & message - > data ) | | message - > type = = MessagingInterface : : kNewGame ) {
} else if ( ( message - > type = = MessagingInterface : : kPostLoadGame & & message - > data ) | | message - > type = = MessagingInterface : : kNewGame ) {
NewGameCount ( true ) ;
NewGameCount ( true ) ;
}
}
@ -101,6 +103,18 @@ namespace {
SKSEPluginLoad ( const LoadInterface * skse ) {
SKSEPluginLoad ( const LoadInterface * skse ) {
if ( DataFileExists ( " Dawnguard.esm " ) | | DataFileExists ( " Dragonborn.esm " ) | | DataFileExists ( " HearthFires.esm " ) | | DataFileExists ( " Update.esm " ) ) {
MessageBoxW ( NULL , L " Skyrim DLCs are incompatible with Enderal. " , L " Error " , MB_OK | MB_ICONERROR ) ;
exit ( EXIT_FAILURE ) ;
}
if ( DataFileExists ( " Unofficial Skyrim Special Edition Patch.esp " ) ) {
MessageBoxW ( NULL , L " Unofficial Skyrim Special Edition Patch is incompatible with Enderal. " , L " Error " , MB_OK | MB_ICONERROR ) ;
exit ( EXIT_FAILURE ) ;
}
CheckCCMods ( ) ;
GetLoadInterface ( skse ) ;
GetLoadInterface ( skse ) ;
InitializeLogging ( ) ;
InitializeLogging ( ) ;
@ -114,6 +128,8 @@ SKSEPluginLoad(const LoadInterface* skse) {
Init ( skse ) ;
Init ( skse ) ;
InitializeMessaging ( ) ;
InitializeMessaging ( ) ;
SKSE : : GetModCallbackEventSource ( ) - > AddEventSink ( EventListener : : GetSingleton ( ) ) ;
GetPapyrusInterface ( ) - > Register ( Papyrus : : Bind ) ;
GetPapyrusInterface ( ) - > Register ( Papyrus : : Bind ) ;
if ( ! IsVR ( ) ) {
if ( ! IsVR ( ) ) {