mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 16:21:30 +02:00
fix(import): mount Blue/Yellow save-dir cache without FFI
NX Play for Blue failed because mountVersion relied on absolute PHYSFS_mount first. Prefer love.filesystem.mount of blue|yellow, overlay generated trees by version prefix, and align CacheFs.prefix in bootGame. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+12
-3
@@ -198,11 +198,20 @@ local function loadModule(dir, name)
|
||||
end
|
||||
local ok, mod = pcall(require, "data.generated." .. name)
|
||||
if ok then return true, mod end
|
||||
-- Fused PhysFS may hide save-dir data/generated behind the archive's
|
||||
-- data/ tree even after mountVersion; load bytes explicitly as fallback.
|
||||
-- Fused PhysFS / Blue|Yellow prefix: load bytes from the active version's
|
||||
-- cache explicitly when require cannot see the mounted tree.
|
||||
local CacheFs = require("src.import.CacheFs")
|
||||
local path = "data/generated/" .. name .. ".lua"
|
||||
local GameVersion = require("src.core.GameVersion")
|
||||
local prefix = GameVersion.cachePrefix()
|
||||
local path = prefix .. "data/generated/" .. name .. ".lua"
|
||||
local saved = CacheFs.prefix
|
||||
CacheFs.prefix = ""
|
||||
local bytes = CacheFs.read(path)
|
||||
CacheFs.prefix = saved
|
||||
if type(bytes) ~= "string" then
|
||||
-- Also try with CacheFs.prefix if the caller set it for this version.
|
||||
bytes = CacheFs.read("data/generated/" .. name .. ".lua")
|
||||
end
|
||||
if type(bytes) == "string" then
|
||||
local chunk, err = loadstring(bytes, "@" .. path)
|
||||
if not chunk then return false, err or mod end
|
||||
|
||||
Reference in New Issue
Block a user