mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 01:18:01 -05:00
seperate setup of mod
This commit is contained in:
parent
1de4fd93f7
commit
643abe64ab
4 changed files with 10 additions and 0 deletions
|
@ -129,6 +129,9 @@ namespace geode {
|
|||
friend void GEODE_CALL ::geode_implicit_load(Mod*);
|
||||
|
||||
public:
|
||||
// TODO: impl pimpl
|
||||
Result<> setup();
|
||||
|
||||
std::string getID() const;
|
||||
std::string getName() const;
|
||||
std::string getDeveloper() const;
|
||||
|
|
|
@ -54,5 +54,6 @@ InternalMod::~InternalMod() {}
|
|||
|
||||
InternalMod* InternalMod::get() {
|
||||
static auto g_mod = new InternalMod;
|
||||
g_mod->setup();
|
||||
return g_mod;
|
||||
}
|
||||
|
|
|
@ -190,6 +190,8 @@ Result<Mod*> Loader::Impl::loadModFromInfo(ModInfo const& info) {
|
|||
|
||||
// create Mod instance
|
||||
auto mod = new Mod(info);
|
||||
mod->setup();
|
||||
|
||||
m_mods.insert({ info.id, mod });
|
||||
mod->m_enabled = InternalMod::get()->getSavedValue<bool>(
|
||||
"should-load-" + info.id, true
|
||||
|
|
|
@ -17,6 +17,9 @@ Mod::Mod(ModInfo const& info) {
|
|||
m_info = info;
|
||||
m_saveDirPath = dirs::getModsSaveDir() / info.id;
|
||||
ghc::filesystem::create_directories(m_saveDirPath);
|
||||
}
|
||||
|
||||
Result<> Mod::setup() {
|
||||
this->setupSettings();
|
||||
auto loadRes = this->loadData();
|
||||
if (!loadRes) {
|
||||
|
@ -25,6 +28,7 @@ Mod::Mod(ModInfo const& info) {
|
|||
info.id, loadRes.unwrapErr()
|
||||
);
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
Mod::~Mod() {
|
||||
|
|
Loading…
Reference in a new issue