mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-23 03:15:58 -04:00
show currently loading mod in crashlog
This commit is contained in:
parent
5c6ea93c8b
commit
0692bc1a20
3 changed files with 12 additions and 1 deletions
loader/src
|
@ -1,6 +1,7 @@
|
|||
#include "crashlog.hpp"
|
||||
#include <fmt/core.h>
|
||||
#include "about.hpp"
|
||||
#include "../loader/ModImpl.hpp"
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -33,7 +34,7 @@ void crashlog::printMods(std::stringstream& stream) {
|
|||
using namespace std::string_view_literals;
|
||||
for (auto& mod : mods) {
|
||||
stream << fmt::format("{} | [{}] {}\n",
|
||||
mod->isEnabled() ? "x"sv : mod->shouldLoad() ? "~"sv : " "sv,
|
||||
mod->isEnabled() ? "x"sv : mod->shouldLoad() ? "~"sv : ModImpl::getImpl(mod)->isCurrentlyLoading() ? "o"sv : " "sv,
|
||||
mod->getVersion().toString(), mod->getID()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -381,14 +381,17 @@ Result<> Mod::Impl::loadBinary() {
|
|||
LoaderImpl::get()->provideNextMod(m_self);
|
||||
|
||||
m_enabled = true;
|
||||
m_isCurrentlyLoading = true;
|
||||
auto res = this->loadPlatformBinary();
|
||||
if (!res) {
|
||||
m_isCurrentlyLoading = false;
|
||||
m_enabled = false;
|
||||
// make sure to free up the next mod mutex
|
||||
LoaderImpl::get()->releaseNextMod();
|
||||
log::error("Failed to load binary for mod {}: {}", m_metadata.getID(), res.unwrapErr());
|
||||
return res;
|
||||
}
|
||||
m_isCurrentlyLoading = false;
|
||||
|
||||
LoaderImpl::get()->releaseNextMod();
|
||||
|
||||
|
@ -745,6 +748,10 @@ bool Mod::Impl::shouldLoad() const {
|
|||
return Mod::get()->getSavedValue<bool>("should-load-" + m_metadata.getID(), true);
|
||||
}
|
||||
|
||||
bool Mod::Impl::isCurrentlyLoading() const {
|
||||
return m_isCurrentlyLoading;
|
||||
}
|
||||
|
||||
static Result<ModMetadata> getModImplInfo() {
|
||||
std::string error;
|
||||
auto res = matjson::parse(LOADER_MOD_JSON, error);
|
||||
|
|
|
@ -64,6 +64,8 @@ namespace geode {
|
|||
|
||||
std::unordered_map<std::string, char const*> m_expandedSprites;
|
||||
|
||||
bool m_isCurrentlyLoading = false;
|
||||
|
||||
ModRequestedAction m_requestedAction = ModRequestedAction::None;
|
||||
|
||||
Impl(Mod* self, ModMetadata const& metadata);
|
||||
|
@ -150,6 +152,7 @@ namespace geode {
|
|||
void setLoggingEnabled(bool enabled);
|
||||
|
||||
bool shouldLoad() const;
|
||||
bool isCurrentlyLoading() const;
|
||||
};
|
||||
|
||||
class ModImpl : public Mod::Impl {
|
||||
|
|
Loading…
Reference in a new issue