Disable sIntroSequence with DLL, removed redundant functions

This commit is contained in:
Eddoursul 2023-12-11 02:44:41 +01:00
parent 8a4e3ef71b
commit 623789c5bf
5 changed files with 22 additions and 22 deletions

BIN
SKSE/Plugins/EnderalSE.dll (Stored with Git LFS)

Binary file not shown.

View File

@ -3,6 +3,7 @@
#include "Util.h"
// Based on Ryan McKenzie's Flat Map Markers
// CommonLibSSE-NG update by Eddoursul
namespace FlatMapMarkers
{
inline void Hook_WorldPtToScreenPt3(RE::NiCamera* a_camera, RE::NiPoint3& a_in, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance)
@ -13,7 +14,7 @@ namespace FlatMapMarkers
inline void Install()
{
REL::Relocation<std::uintptr_t> offset{ RELOCATION_ID(52224, 53111), IsSE() ? 0x22F : 0x21F };
REL::Relocation<std::uintptr_t> offset{ REL::RelocationID(52224, 53111), REL::Relocate(0x22F, 0x21F) };
SKSE::AllocTrampoline(14);
auto& trampoline = SKSE::GetTrampoline();
trampoline.write_call<5>(offset.address(), &Hook_WorldPtToScreenPt3);

View File

@ -42,13 +42,13 @@ namespace {
if (message->type == MessagingInterface::kPostLoad) {
if (g_settings.at("StayAtSystemPage")) {
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"Enderal SE Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
if (g_settings.at("FlatMapMarkers")) {
if (const auto pluginInfo = GetLoadInterface()->GetPluginInfo("FlatMapMarkersSSE"); pluginInfo) {
MessageBoxW(NULL, L"Flat Map Markers is already included in Enderal, please, disable it (remove file Data\\SKSE\\Plugins\\FlatMapMarkersSSE.dll).", L"Error", MB_OK | MB_ICONERROR);
MessageBoxW(NULL, L"Flat Map Markers is already included in Enderal, please, disable it (remove file Data\\SKSE\\Plugins\\FlatMapMarkersSSE.dll).", L"Enderal SE Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
@ -60,11 +60,11 @@ namespace {
const auto dataHandler = RE::TESDataHandler::GetSingleton();
if (dataHandler) {
if (!dataHandler->LookupLoadedModByName("Update.esm")) {
MessageBoxW(NULL, L"Update.esm is not loaded!", L"Error", MB_OK | MB_ICONERROR);
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"Error", MB_OK | MB_ICONERROR);
MessageBoxW(NULL, L"Enderal - Forgotten Stories.esm is not loaded!", L"Enderal SE Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
@ -117,18 +117,23 @@ SKSEPluginLoad(const LoadInterface* skse) {
};
for (int i = 0; i < 4; i++) {
if (std::filesystem::exists(std::format("Data\\SKSE\\Plugins\\{}", filenames[i]))) {
MessageBoxA(NULL, std::format("Found a leftover file from a previous version of Enderal SE. Please, delete Data\\SKSE\\Plugins\\{}.", filenames[i]).c_str(), "Error", MB_OK | MB_ICONERROR);
MessageBoxA(NULL, std::format("Found a leftover file from a previous version of Enderal SE. Please, delete Data\\SKSE\\Plugins\\{}.", filenames[i]).c_str(), "Enderal SE Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
}
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);
MessageBoxW(NULL, L"Skyrim DLCs are incompatible with Enderal.", L"Enderal SE 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);
MessageBoxW(NULL, L"Unofficial Skyrim Special Edition Patch is incompatible with Enderal.", L"Enderal SE Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}
if (!DataFileExists("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);
}
@ -147,6 +152,10 @@ SKSEPluginLoad(const LoadInterface* skse) {
Init(skse);
InitializeMessaging();
auto setting = RE::INISettingCollection::GetSingleton()->GetSetting("sIntroSequence:General");
setting->data.s = nullptr;
RE::INISettingCollection::GetSingleton()->WriteSetting(setting);
SKSE::GetModCallbackEventSource()->AddEventSink(EventListener::GetSingleton());
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
@ -157,7 +166,7 @@ SKSEPluginLoad(const LoadInterface* skse) {
AchievementFix::Install();
}
if (!IsVR()) {
if (!REL::Module::IsVR()) {
if (g_settings.at("FlatMapMarkers")) {
logger::info("Initializing Flat Map Markers...");
FlatMapMarkers::Install();

View File

@ -1,6 +1,5 @@
#pragma once
// Based on powerofthree's Tweaks 1.8.1 by powerofthree (MIT)
namespace MapMarkerPlacement
{
constexpr std::uint8_t NOP{ 0x90 };
@ -20,6 +19,7 @@ namespace MapMarkerPlacement
static inline REL::Relocation<decltype(thunk)> func;
};
// Based on powerofthree's Tweaks 1.8.1 by powerofthree (MIT)
void InstallPlacementDiscoveredFix()
{
// Place a marker, if a location has been discovered and fast travel is disabled

View File

@ -24,16 +24,6 @@ inline uint8_t NewGameCount(bool increment = false)
return g_NewGameStarted;
}
inline bool IsSE()
{
return GetLoadInterface()->RuntimeVersion().minor() == 5;
}
inline bool IsVR()
{
return GetLoadInterface()->RuntimeVersion() == SKSE::RUNTIME_VR_1_4_15 || GetLoadInterface()->RuntimeVersion() == SKSE::RUNTIME_LATEST_VR;
}
inline void CheckIncompatibleMods()
{
bool bPrinted = false;