Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions loader/resources/mod.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@
"type": "bool",
"default": true,
"name": "Check For Updates",
"description": "Automatically check for <cy>Geode</c> updates on startup"
"description": "Automatically check for <cy>Geode</c> 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",
Expand All @@ -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",
Expand All @@ -118,7 +118,7 @@
"type": "bool",
"default": false,
"name": "Show Platform Console",
"description": "Show the native console (if one exists). <cr>This setting is meant for developers</c>",
"description": "Show the native console (if one exists). <cr>This setting is meant for developers</c>.",
"platforms": [
"win",
"mac"
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
28 changes: 20 additions & 8 deletions loader/src/hooks/FallbackSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>("disable-fallback")) {
geode::log::warn("CCSprite::create - Using fallback texture for `{}`", name);

sprite = CCSprite::createWithTexture(getFallbackTexture());
Expand Down Expand Up @@ -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<bool>("disable-fallback")) {
return result;
}

geode::log::warn("CCSprite::initWithSpriteFrame - Using fallback texture for `{}`", frame);
Expand All @@ -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<bool>("disable-fallback")) {
return result;
}

geode::log::warn("CCSprite::initWithFile - Using fallback texture for `{}`", pszFilename);

Expand All @@ -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<bool>("disable-fallback")) {
return result;
}

geode::log::warn("CCSprite::initWithFile - Using fallback texture for `{}`", pszFilename);

Expand Down Expand Up @@ -180,6 +188,10 @@ class $modify(CCSpriteFrameCache) {
}
}

if (Mod::get()->getSettingValue<bool>("disable-fallback")) {
return nullptr;
}

geode::log::warn("CCSpriteFrameCache::spriteFrameByName - Using fallback texture for `{}`", name);

// check if the fallback was already added
Expand All @@ -204,7 +216,7 @@ class $modify (CCSpriteBatchNode)
{
bool initWithTexture(CCTexture2D *tex, unsigned int capacity)
{
if (!tex)
if (!tex && !Mod::get()->getSettingValue<bool>("disable-fallback"))
{
geode::log::warn("CCSpriteBatchNode::initWithTexture - using fallback");

Expand Down
Loading