void StartupManager::LoadStartupPlugin() { bool Load = settings::startup::kLoadPlugin.GetData().i; const char* PluginName = settings::startup::kPluginName.GetData().s; if (Load) { hooks::_MemHdlr(AutoLoadActivePluginOnStartup).WriteJump(); TESFile* File = _DATAHANDLER->LookupPluginByName(PluginName); if (File) { BGSEECONSOLE_MESSAGE("Loading plugin '%s'", PluginName); BGSEECONSOLE->Indent(); File->SetLoaded(true); if (_stricmp(PluginName, "Oblivion.esm")) File->SetActive(true); SendMessage(*TESCSMain::WindowHandle, WM_COMMAND, TESCSMain::kToolbar_DataFiles, 0); BGSEECONSOLE->Exdent(); } else if (strlen(PluginName) >= 1) BGSEECONSOLE_MESSAGE("Non-existent startup plugin '%s'", PluginName); hooks::_MemHdlr(AutoLoadActivePluginOnStartup).WriteBuffer(); } }
// serialization bool DispelMgefHandler::LoadHandlerChunk(TESFile& file, UInt32 RecordVersion) { if (file.currentChunk.chunkLength != kEHNDChunkSize) return false; // wrong chunk size file.GetChunkData(&ehCode,kEHNDChunkSize); TESFileFormats::ResolveModValue(mgefCode,file,TESFileFormats::kResType_MgefCode); // resolve targeted mgefCode TESFileFormats::ResolveModValue(magicitemFormID,file,TESFileFormats::kResType_FormID); // resolve targeted magic item return true; }
// serialization bool ScriptMgefHandler::LoadHandlerChunk(TESFile& file, UInt32 RecordVersion) { if (file.currentChunk.chunkLength != kEHNDChunkSize) return false; // wrong chunk size file.GetChunkData(&scriptFormID,kEHNDChunkSize); TESFileFormats::ResolveModValue(scriptFormID,file,TESFileFormats::kResType_FormID); // resolve script formID TESFileFormats::ResolveModValue(customParam,file,customParamResType); // resolve script formID return true; }
void BGSEEConsoleCmd_LoadPlugin_ExecuteHandler(BGSEECONSOLECMD_ARGS) { SME::StringHelpers::Tokenizer ArgParser(Args, " ,"); std::string CurrentArg; std::string PluginName; bool SetActive = false; for (int i = 1; i <= ParamCount; i++) { ArgParser.NextToken(CurrentArg); switch (i) { case 1: PluginName = CurrentArg; break; case 2: SetActive = (_stricmp(CurrentArg.c_str(), "1") == 0); break; } } // prolog hooks::_MemHdlr(AutoLoadActivePluginOnStartup).WriteJump(); TESFile* File = _DATAHANDLER->LookupPluginByName(PluginName.c_str()); if (File) { File->SetActive(SetActive); File->SetLoaded(true); SendMessage(BGSEEUI->GetMainWindow(), WM_COMMAND, TESCSMain::kToolbar_DataFiles, 0); } else BGSEECONSOLE_MESSAGE("Plugin '%s' doesn't exist!", PluginName.c_str()); // epilog hooks::_MemHdlr(AutoLoadActivePluginOnStartup).WriteBuffer(); }