improve lag because of cc_2x2_white_image

This commit is contained in:
matcool 2023-08-27 11:23:36 -03:00
parent 8b9860be5b
commit 9875f5d597
No known key found for this signature in database
GPG key ID: BF58756086D7AB1C

View file

@ -93,4 +93,18 @@ struct FileUtilsUpdatePaths : Modify<FileUtilsUpdatePaths, CCFileUtils> {
}
return ret;
}
gd::string fullPathForFilename(const char* filename, bool unk) override {
using namespace std::string_literals;
using namespace std::string_view_literals;
// this filename in particular is never cached because its not actually present anywhere.
// this is only an issue because cocos itself requests the full path for this in CCSprite,
// and with a lot of search paths (specially ones added by geode), this can cause a significant amount of lag.
if (filename == "cc_2x2_white_image"sv) {
return "cc_2x2_white_image"s;
}
return CCFileUtils::fullPathForFilename(filename, unk);
}
};