#pragma once #include "vpc/keyvalues.h" #include "vpc/rson.h" #include class CModAppSystemGroup; class CModSystem { public: enum eModState : int8_t { UNLOADED = -1, // loading was unsuccessful (error occurred) LOADING = 0, // if mod is being loaded DISABLED = 1, // if disabled by user ENABLED = 2, // if enabled by user and loaded properly }; struct ModInstance_t { ModInstance_t(const fs::path& basePath); inline void SetState(eModState state) { m_iState = state; }; inline bool IsEnabled() { return m_iState == eModState::ENABLED; }; inline const fs::path& GetBasePath() { return m_BasePath; }; inline fs::path GetScriptCompileListPath() { return (m_BasePath / "scripts/vscripts/scripts.rson"); }; RSON::Node_t* LoadScriptCompileList() { return RSON::LoadFromFile(GetScriptCompileListPath().string().c_str()); }; bool m_bHasScriptCompileList; // if this mod has a scripts.rson file that exists string m_szName; // mod display name string m_szModID; // internal mod identifier fs::path m_BasePath; // path to folder containg all mod files string m_szDescription; // mod description string m_szVersion; // version string KeyValues* m_SettingsKV; eModState m_iState = eModState::UNLOADED; std::vector m_vszLocalizationFiles; }; void Init(); // load mod enabled/disabled status from file on disk void LoadModStatusList(); void WriteModStatusList(); inline vector& GetModList() { return m_vModList; }; inline std::map& GetEnabledList() { return m_vEnabledList; }; private: vector m_vModList; std::map m_vEnabledList; }; extern CModSystem* g_pModSystem;