From 9a28e58639db72526b7e50d684b52ae31333fc6d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:07:53 +0300 Subject: [PATCH] add GEODE_HIDDEN to _spr --- loader/include/Geode/loader/Mod.hpp | 2 +- loader/src/loader/ModImpl.cpp | 5 ++--- loader/src/loader/ModImpl.hpp | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index bdc57981..0cf2ed64 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -398,6 +398,6 @@ namespace geode { }; } -inline char const* operator"" _spr(char const* str, size_t) { +GEODE_HIDDEN inline char const* operator"" _spr(char const* str, size_t) { return geode::Mod::get()->expandSpriteName(str); } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index dcb8e662..6ffacdc0 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -572,14 +572,13 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - static std::unordered_map expanded = {}; - if (expanded.count(name)) return expanded[name]; + if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; auto exps = m_metadata.getID() + "/" + name; memcpy(exp, exps.c_str(), exps.size() + 1); - expanded[name] = exp; + m_expandedSprites[name] = exp; return exp; } diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index 7e983d09..a8bdc09f 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -57,6 +57,13 @@ namespace geode { * Whether the mod resources are loaded or not */ bool m_resourcesLoaded = false; + /** + * Whether logging is enabled for this mod + */ + bool m_loggingEnabled = true; + + std::unordered_map m_expandedSprites; + ModRequestedAction m_requestedAction = ModRequestedAction::None;