fix(switch): load Yellow/Blue assets when PhysFS mount hides them

Mirror Data:load's versioned CacheFs read in Assets so Yellow-only NX
Play survives intro without needing a Red root cache mask.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-03 14:20:53 -03:00
parent dd5d8afd82
commit d5886e69aa
5 changed files with 181 additions and 18 deletions
+18
View File
@@ -294,6 +294,24 @@ function CacheFs.read(rel)
return love.filesystem.read(rel)
end
-- Read cache-relative `rel` for the active GameVersion when PhysFS may hide
-- prefixed Blue/Yellow trees (fused NX mount hole). Same order Data:load
-- already used: active version prefix with CacheFs.prefix cleared, then
-- `rel` under the caller's CacheFs.prefix. Returns the bytes or nil.
function CacheFs.readActive(rel)
local GameVersion = require("src.core.GameVersion")
local prefix = GameVersion.cachePrefix()
local saved = CacheFs.prefix
CacheFs.prefix = ""
local bytes = CacheFs.read(prefix .. rel)
CacheFs.prefix = saved
if type(bytes) ~= "string" then
bytes = CacheFs.read(rel)
end
if type(bytes) == "string" then return bytes end
return nil
end
-- does cache-relative `rel` exist as a file?
function CacheFs.exists(rel)
rel = withPrefix(rel)