diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index a51af6b9..01f9380a 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -412,6 +412,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 43a94026..1f2a8573 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -592,14 +592,14 @@ 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]; + log::debug("Expanding sprite name {} for {}", name, m_metadata.getID()); + 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 ff5084d6..55e5c88d 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -61,6 +61,8 @@ namespace geode { */ bool m_loggingEnabled = true; + std::unordered_map m_expandedSprites; + ModRequestedAction m_requestedAction = ModRequestedAction::None;