#pragma once #include #include #include namespace fs = std::filesystem; const fs::path MOD_FOLDER_PATH = "R2Northstar/mods"; struct ModConVar { public: std::string Name; std::string DefaultValue; std::string HelpString; int Flags; }; struct ModScriptCallback { public: // would've liked to make it possible to hook arbitrary codecallbacks, but couldn't find a function that calls some ui ones //std::string HookedCodeCallback; Context Context; // called before the codecallback is executed std::string BeforeCallback; // called after the codecallback has finished executing std::string AfterCallback; }; struct ModScript { public: std::string Path; std::string RsonRunOn; std::vector Callbacks; }; class Mod { public: fs::path ModDirectory; // mod.json stuff: // the mod's name std::string Name; // the mod's description std::string Description; // the mod's version, should be in semver std::string Version; // a download link to the mod, for clients that try to join without the mod std::string DownloadLink; // whether clients need the mod to join servers running this mod bool RequiredOnClient = true; // custom scripts used by the mod std::vector Scripts; // convars created by the mod std::vector ConVars; // other files: std::vector Vpks; //std::vector KeyValues; // other stuff bool wasReadSuccessfully = false; public: Mod(fs::path modPath, char* jsonBuf); }; struct ModOverrideFile { public: Mod* owningMod; fs::path path; }; class ModManager { public: std::vector m_loadedMods; std::vector m_modFiles; public: ModManager(); void LoadMods(); }; void InitialiseModManager(HMODULE baseAddress); extern ModManager* g_ModManager;