mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
make mod binaries not load not silently fail
This commit is contained in:
parent
4ecc4ac23a
commit
0eb5f01ca8
1 changed files with 21 additions and 3 deletions
|
@ -195,6 +195,8 @@ Result<Mod*> Loader::Impl::loadModFromInfo(ModInfo const& info) {
|
|||
auto mod = new Mod(info);
|
||||
auto setupRes = mod->m_impl->setup();
|
||||
if (!setupRes) {
|
||||
// old code artifcat, idk why we are not using unique_ptr TBH
|
||||
delete mod;
|
||||
return Err(fmt::format(
|
||||
"Unable to setup mod '{}': {}",
|
||||
info.id(), setupRes.unwrapErr()
|
||||
|
@ -202,10 +204,19 @@ Result<Mod*> Loader::Impl::loadModFromInfo(ModInfo const& info) {
|
|||
}
|
||||
|
||||
m_mods.insert({ info.id(), mod });
|
||||
|
||||
mod->m_impl->m_enabled = Mod::get()->getSavedValue<bool>(
|
||||
"should-load-" + info.id(), true
|
||||
);
|
||||
|
||||
// this loads the mod if its dependencies are resolved
|
||||
auto dependenciesRes = mod->updateDependencies();
|
||||
if (!dependenciesRes) {
|
||||
delete mod;
|
||||
m_mods.erase(info.id());
|
||||
return Err("Unable to update dependencies and load: " + dependenciesRes.unwrapErr());
|
||||
}
|
||||
|
||||
// add mod resources
|
||||
this->queueInGDThread([this, mod]() {
|
||||
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
||||
|
@ -214,9 +225,6 @@ Result<Mod*> Loader::Impl::loadModFromInfo(ModInfo const& info) {
|
|||
this->updateModResources(mod);
|
||||
});
|
||||
|
||||
// this loads the mod if its dependencies are resolved
|
||||
GEODE_UNWRAP(mod->updateDependencies());
|
||||
|
||||
return Ok(mod);
|
||||
}
|
||||
|
||||
|
@ -363,6 +371,11 @@ void Loader::Impl::refreshModsList() {
|
|||
auto load = this->loadModFromInfo(mod);
|
||||
if (!load) {
|
||||
log::error("Unable to load {}: {}", mod.id(), load.unwrapErr());
|
||||
|
||||
m_invalidMods.push_back(InvalidGeodeFile {
|
||||
.path = mod.path(),
|
||||
.reason = load.unwrapErr(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -377,6 +390,11 @@ void Loader::Impl::refreshModsList() {
|
|||
auto load = this->loadModFromInfo(mod);
|
||||
if (!load) {
|
||||
log::error("Unable to load {}: {}", mod.id(), load.unwrapErr());
|
||||
|
||||
m_invalidMods.push_back(InvalidGeodeFile {
|
||||
.path = mod.path(),
|
||||
.reason = load.unwrapErr(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue