4
Fork 0

Compare commits

...

2 Commits

  1. BIN
      SKSE/Plugins/EnderalSE.dll
  2. BIN
      scripts/_00e_game_skillmenusc.pex
  3. BIN
      scripts/_00e_playersetupscript.pex
  4. BIN
      scripts/_00e_questfunctions.pex
  5. BIN
      scripts/_00e_theriantrophist_alchemycontrol.pex
  6. 4
      source/Enderal DLL/src/EventListener.cpp
  7. 1
      source/Enderal DLL/src/Main.cpp
  8. 68
      source/Enderal DLL/src/Util.h
  9. 2
      source/Enderal DLL/vcpkg-configuration.json
  10. 4
      source/scripts/_00e_game_skillmenusc.psc
  11. 3
      source/scripts/_00e_playersetupscript.psc
  12. 4
      source/scripts/_00e_questfunctions.psc
  13. 4
      source/scripts/_00e_theriantrophist_alchemycontrol.psc

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -8,6 +8,7 @@ auto EventListener::GetSingleton() -> EventListener*
return std::addressof(singleton);
}
// Unused
void EventListener::Install()
{
RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
@ -57,6 +58,9 @@ auto EventListener::ProcessEvent(
movie->Invoke("_root.QuestJournalFader.Menu_mc.RestoreSavedSettings", nullptr, args.data(), static_cast<std::uint32_t>(args.size()));
}
}
} else if (!a_event->opening && a_event->menuName == RE::MainMenu::MENU_NAME) {
RE::UI::GetSingleton()->RemoveEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
CheckScriptVersions();
}
return RE::BSEventNotifyControl::kContinue;

@ -141,6 +141,7 @@ SKSEPluginLoad(const LoadInterface* skse) {
InitializeMessaging();
SKSE::GetModCallbackEventSource()->AddEventSink(EventListener::GetSingleton());
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
GetPapyrusInterface()->Register(Papyrus::Bind);

@ -65,6 +65,72 @@ inline void CheckIncompatibleMods()
CheckEnderalStatics();
}
inline bool PapyrusGlobalFunctionExists(const char* scriptName, const char* funcName)
{
logger::info("Real - GetGlobalFunctionNames of {}", scriptName);
std::vector<std::string> functionNames;
RE::BSTSmartPointer<RE::BSScript::ObjectTypeInfo> typeInfoPtr;
RE::BSScript::Internal::VirtualMachine::GetSingleton()->GetScriptObjectType(RE::BSFixedString(scriptName), typeInfoPtr);
auto functionCount = typeInfoPtr->GetNumGlobalFuncs();
auto functions = typeInfoPtr->GetGlobalFuncIter();
for (uint32_t i = 0; i < functionCount; i++) {
if (functions[i].func->GetName().c_str() == funcName) {
return true;
}
}
return false;
}
inline void CheckScriptVersions()
{
class ScriptVersionCallback : public RE::BSScript::IStackCallbackFunctor
{
private:
std::uint32_t expectedVersion;
const RE::BSFixedString scriptName;
const RE::BSFixedString funcName = "_GetScriptVersion";
public:
ScriptVersionCallback(const RE::BSFixedString a_scriptName, int a_version) :
scriptName(a_scriptName),
expectedVersion(a_version)
{
if (PapyrusGlobalFunctionExists(scriptName.c_str(), funcName.c_str())) {
const auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
auto callbackPtr = RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor>(this);
vm->DispatchStaticCall(scriptName, funcName, RE::MakeFunctionArguments(), callbackPtr);
} else {
auto a_script = scriptName;
auto a_version = expectedVersion;
SKSE::GetTaskInterface()->AddTask([a_script, a_version]() {
RE::DebugMessageBox(std::format("Script {} is overwritten by a mod, incompatible with current version of Enderal. Expected version: {}, installed version: N/A.", a_script.c_str(), a_version).c_str());
});
}
}
void operator()(RE::BSScript::Variable a_result)
{
if (a_result.GetUInt() != expectedVersion) {
RE::DebugMessageBox(std::format("Script {} is overwritten by a mod, incompatible with current version of Enderal. Expected version: {}, installed version: {}.", scriptName.c_str(), expectedVersion, a_result.GetUInt()).c_str());
}
}
bool CanSave() { return false; }
void SetObject(const RE::BSTSmartPointer<RE::BSScript::Object>&) {}
};
RE::BSTSmartPointer<ScriptVersionCallback>{
new ScriptVersionCallback("_00E_PlayerSetUpScript", 1)
};
RE::BSTSmartPointer<ScriptVersionCallback>{
new ScriptVersionCallback("_00E_QuestFunctions", 1)
};
RE::BSTSmartPointer<ScriptVersionCallback>{
new ScriptVersionCallback("_00E_Game_SkillmenuSC", 1)
};
RE::BSTSmartPointer<ScriptVersionCallback>{
new ScriptVersionCallback("_00E_Theriantrophist_AlchemyControl", 1)
};
}
inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
{
for (auto it = settings->begin(); it != settings->end(); it++) {
@ -103,7 +169,7 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
}
if (bUpdateINI) {
logger::info("New settings detected, adding to ArtifactTracker.ini");
logger::info("New settings detected, adding to EnderalSE.ini");
ini.SaveFile(iniPath);
}

@ -3,7 +3,7 @@
{
"kind": "git",
"repository": "https://gitlab.com/colorglass/vcpkg-colorglass",
"baseline": "bbd09a56b951d86dec3ea484ec183d00b013b486",
"baseline": "6309841a1ce770409708a67a9ba5c26c537d2937",
"packages": [
"commonlibsse-ng",
"gluino",

@ -11,6 +11,10 @@ Import Math
Import ActorValueInfo
Import _00E_QuestFunctions
int function _GetScriptVersion() Global
return 1
endFunction
; This script handles the custom character menu
;=====================================================================================

@ -3,6 +3,9 @@ Scriptname _00E_PlayerSetUpScript extends ObjectReference
Float Property CURRENT_PATCH_VERSION = 2.13 AutoReadOnly
int function _GetScriptVersion() Global
return 1
endFunction
;=====================================================================================
; EVENTS

@ -4,6 +4,10 @@ Scriptname _00E_QuestFunctions extends Quest Conditional
Import math
Import Utility
int function _GetScriptVersion() Global
return 1
endFunction
;=====================================================================================
; EXP
;=====================================================================================

@ -91,6 +91,10 @@ string[] aPotionModels
; FUNCTIONS
;=====================================================================================
int function _GetScriptVersion() Global
return 1
endFunction
function _addNamedPotion(Potion aPotion, string sName, string sModel)
if ! aPotion || sName == ""

Loading…
Cancel
Save