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(); } }
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(); }