fix(switch): extend NX-only asset prefix to audio and title/intro art

The previous NX gate only rewrote image paths that go through Assets.resolve.
Pokemon Yellow still had no sound and a blank title screen because:

- ChipSynth reads programs.bin directly via love.filesystem.read, bypassing
  Assets. On NX the unprefixed path is missing when the mount overlay fails,
  so the engine never built and every song/SFX was silent.
- Sound.playPikaCry loads pika_cries WAVs with love.audio.newSource, also
  bypassing Assets.resolve.
- TitleState, YellowIntro, and IntroMovie call love.graphics.newImage
  directly on unprefixed assets/generated paths, so the Pikachu title and
  intro atlases failed to load.

Fix: apply the same NX-only prefix rewrite in those four places.
Desktop/Android keep the existing mountVersion overlay behavior.

Also add ChipSynth._loadBanksForTest and tests covering the new paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-03 15:19:15 -03:00
parent f099593136
commit e4ce1063a1
6 changed files with 88 additions and 4 deletions
+17 -1
View File
@@ -123,7 +123,18 @@ local function loadBanks(data)
if cachedProgramFile == audio.programFile and cachedBanks then
return cachedBanks
end
local raw, readError = love.filesystem.read(audio.programFile)
local raw, readError
-- NX-only: Blue/Yellow live under a versioned save-dir prefix; desktop
-- relies on mountVersion overlay. Read the prefixed path when present.
if require("src.core.Platform").isNX() then
local prefix = require("src.core.GameVersion").cachePrefix()
if prefix ~= "" then
raw, readError = love.filesystem.read(prefix .. audio.programFile)
end
end
if not raw then
raw, readError = love.filesystem.read(audio.programFile)
end
if not raw then error("could not read sound programs: " .. tostring(readError)) end
local banks = {}
for index, bank in ipairs(audio.bankOrder) do
@@ -140,6 +151,11 @@ function ChipSynth.invalidateBanks()
cachedProgramFile, cachedBanks = nil, nil
end
-- test-only: exercise loadBanks without building a full engine
function ChipSynth._loadBanksForTest(data)
return loadBanks(data)
end
-- A def-local program (ChipAsm output) is mounted as pseudo-bank 0 next to
-- the ROM banks, so the 0x4000-window byte reader and every call/loop
-- target work unchanged. The ROM's own cached bank table is never touched