mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 11:11:10 +02:00
fix(switch): pass NX cache prefix to the chip-audio worker
Yellow music was still silent because the background worker thread loads ChipSynth.lua in a fresh Lua state with no GameVersion/Platform context. The main thread's prefix never reached it. ChipAudio.slimAudio now resolves the versioned cache prefix on the main thread and includes it in the audio payload as `programPrefix`. ChipSynth.loadBanks prefers `audio.programPrefix` when present, falling back to its own NX detection for the sync path. Blue and Yellow are handled the same way. Tests cover the worker prefix hand-off and Blue's programs.bin path. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-7
@@ -124,13 +124,16 @@ local function loadBanks(data)
|
||||
return cachedBanks
|
||||
end
|
||||
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
|
||||
-- NX-only: Blue/Yellow live under a versioned save-dir prefix. The main
|
||||
-- thread resolves it before sending audio to the worker; the sync path
|
||||
-- resolves it here so desktop keeps the mountVersion overlay behavior.
|
||||
local prefix = audio.programPrefix
|
||||
if not prefix and require("src.core.Platform").isNX() then
|
||||
local gv = require("src.core.GameVersion").cachePrefix()
|
||||
if gv ~= "" then prefix = gv end
|
||||
end
|
||||
if prefix and prefix ~= "" then
|
||||
raw, readError = love.filesystem.read(prefix .. audio.programFile)
|
||||
end
|
||||
if not raw then
|
||||
raw, readError = love.filesystem.read(audio.programFile)
|
||||
|
||||
Reference in New Issue
Block a user