Check size of incompatible mods to allow placeholders

This commit is contained in:
Eddoursul 2022-09-01 11:20:08 +02:00
parent ffbe03a199
commit 509c54e62a
7 changed files with 19 additions and 13 deletions

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

Binary file not shown.

View File

@ -4,6 +4,12 @@ static bool bMessageShown = false;
static std::unordered_set<std::string> aModNames;
inline bool DataFileExists(std::string filename, int maxSize = 1000000)
{
const auto path = std::format("Data\\{}", filename);
return std::filesystem::exists(path) && std::filesystem::file_size(path) > maxSize;
}
inline void NotifyInvalidForm(const RE::TESForm* form)
{
if (!form) {
@ -1177,7 +1183,7 @@ inline void CheckCCMods()
};
for (short i = 0; i < 74; i++) {
if (std::filesystem::exists(std::format("Data\\{}", filenames[i]))) {
if (DataFileExists(filenames[i], 800)) {
MessageBoxW(NULL, L"Creation Club mods are incompatible with Enderal.", L"Error", MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}

View File

@ -35,11 +35,11 @@ namespace {
{
GetMessagingInterface()->RegisterListener([](MessagingInterface::Message* message) {
if (message->type == MessagingInterface::kPostLoad) {
if ((std::filesystem::exists("Data\\Dawnguard.esm") && std::filesystem::file_size("Data\\Dawnguard.esm") > 1000000) || (std::filesystem::exists("Data\\Dragonborn.esm") && std::filesystem::file_size("Data\\Dragonborn.esm") > 1000000) || (std::filesystem::exists("Data\\HearthFires.esm") && std::filesystem::file_size("Data\\HearthFires.esm") > 1000000) || (std::filesystem::exists("Data\\Update.esm") && std::filesystem::file_size("Data\\Update.esm") > 1000000)) {
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 (std::filesystem::exists("Data\\Unofficial Skyrim Special Edition Patch.esp")) {
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);
}

View File

@ -7,7 +7,7 @@ namespace Papyrus
bool Bind(VM* a_vm)
{
if (!a_vm) {
logger::critical("couldn't get VM State"sv);
logger::critical("{}", "couldn't get VM State"sv);
return false;
}

View File

@ -65,12 +65,12 @@ namespace Papyrus::PapyrusFunctions
inline void Bind(VM& a_vm)
{
BIND(CreatePotion);
logger::info("Registered CreatePotion"sv);
logger::info("{}", "Registered CreatePotion"sv);
BIND(GetNewGameCount);
logger::info("Registered GetNewGameCount"sv);
logger::info("{}", "Registered GetNewGameCount"sv);
BIND(GetCurrentContainer);
logger::info("Registered GetCurrentContainer"sv);
logger::info("{}", "Registered GetCurrentContainer"sv);
BIND(GetPlayerFollowers);
logger::info("Registered GetPlayerFollowers"sv);
logger::info("{}", "Registered GetPlayerFollowers"sv);
}
}

View File

@ -154,6 +154,6 @@ namespace Papyrus::PhasmalistFunctions
inline void Bind(VM& a_vm)
{
BIND(calculateContentStrength);
logger::info("Registered calculateContentStrength"sv);
logger::info("{}", "Registered calculateContentStrength"sv);
}
}

View File

@ -51,7 +51,7 @@ inline void SetINISettings()
inline void CheckIncompatibleMods()
{
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition port v2.0.12 by Eddoursul et al");
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v2.0.12 by Eddoursul and contributors");
CheckWorldspaces();
CheckUnconvertedMap();
@ -102,6 +102,6 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
}
} catch (const std::exception& e) {
logger::error(e.what());
logger::error("{}", e.what());
}
}