diff --git a/loader/resources/mod.json.in b/loader/resources/mod.json.in index 990155334..b751bc9c0 100644 --- a/loader/resources/mod.json.in +++ b/loader/resources/mod.json.in @@ -84,13 +84,13 @@ "type": "bool", "default": true, "name": "Check For Updates", - "description": "Automatically check for Geode updates on startup" + "description": "Automatically check for Geode updates on startup." }, "disable-last-crashed-popup": { "type": "bool", "default": false, "name": "Disable Crash Popup", - "description": "Disables the popup at startup asking if you'd like to send a bug report; intended for developers" + "description": "Disables the popup at startup asking if you'd like to send a bug report; intended for developers." }, "used-theme": { "type": "string", @@ -108,7 +108,7 @@ "type": "bool", "default": false, "name": "Expand Installed Mods List", - "description": "Make the installed mods list a single infinite scrollable list instead of having pages" + "description": "Make the installed mods list a single infinite scrollable list instead of having pages." }, "developer-title": { "type": "title", @@ -118,7 +118,7 @@ "type": "bool", "default": false, "name": "Show Platform Console", - "description": "Show the native console (if one exists). This setting is meant for developers", + "description": "Show the native console (if one exists). This setting is meant for developers.", "platforms": [ "win", "mac" @@ -129,7 +129,13 @@ "type": "bool", "default": false, "name": "Show Restart Button", - "description": "Show a button in the Geode Menu to restart the game" + "description": "Show a button in the Geode Menu to restart the game." + }, + "disable-fallback": { + "type": "bool", + "default": false, + "name": "Disable fallback textures", + "description": "Disables the fallback texture warning to make debugging easier." }, "console-log-level": { "type": "string", @@ -157,7 +163,7 @@ "type": "bool", "default": false, "name": "Log Milliseconds", - "description": "Shows milliseconds in all logs" + "description": "Shows milliseconds in all logs." }, "log-thread": { "type": "bool", diff --git a/loader/src/hooks/FallbackSprite.cpp b/loader/src/hooks/FallbackSprite.cpp index e5f52870b..e9fef894d 100644 --- a/loader/src/hooks/FallbackSprite.cpp +++ b/loader/src/hooks/FallbackSprite.cpp @@ -85,7 +85,7 @@ static void assignFallbackObj(CCNode* node) { class $modify(CCSprite) { static CCSprite* create(const char* name) { auto* sprite = CCSprite::create(name); - if (sprite == nullptr) { + if (sprite == nullptr && !Mod::get()->getSettingValue("disable-fallback")) { geode::log::warn("CCSprite::create - Using fallback texture for `{}`", name); sprite = CCSprite::createWithTexture(getFallbackTexture()); @@ -122,8 +122,10 @@ class $modify(CCSprite) { } virtual bool initWithSpriteFrame(CCSpriteFrame* frame) { - if (CCSprite::initWithSpriteFrame(frame)) { - return true; + bool result = CCSprite::initWithSpriteFrame(frame); + + if (result || Mod::get()->getSettingValue("disable-fallback")) { + return result; } geode::log::warn("CCSprite::initWithSpriteFrame - Using fallback texture for `{}`", frame); @@ -133,8 +135,11 @@ class $modify(CCSprite) { } virtual bool initWithFile(const char *pszFilename) { - if (CCSprite::initWithFile(pszFilename)) - return true; + bool result = CCSprite::initWithFile(pszFilename); + + if (result || Mod::get()->getSettingValue("disable-fallback")) { + return result; + } geode::log::warn("CCSprite::initWithFile - Using fallback texture for `{}`", pszFilename); @@ -143,8 +148,11 @@ class $modify(CCSprite) { } virtual bool initWithFile(const char *pszFilename, const CCRect& rect) { - if (CCSprite::initWithFile(pszFilename, rect)) - return true; + bool result = CCSprite::initWithFile(pszFilename, rect); + + if (result || Mod::get()->getSettingValue("disable-fallback")) { + return result; + } geode::log::warn("CCSprite::initWithFile - Using fallback texture for `{}`", pszFilename); @@ -180,6 +188,10 @@ class $modify(CCSpriteFrameCache) { } } + if (Mod::get()->getSettingValue("disable-fallback")) { + return nullptr; + } + geode::log::warn("CCSpriteFrameCache::spriteFrameByName - Using fallback texture for `{}`", name); // check if the fallback was already added @@ -204,7 +216,7 @@ class $modify (CCSpriteBatchNode) { bool initWithTexture(CCTexture2D *tex, unsigned int capacity) { - if (!tex) + if (!tex && !Mod::get()->getSettingValue("disable-fallback")) { geode::log::warn("CCSpriteBatchNode::initWithTexture - using fallback");