mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-19 12:15:31 +02:00
ingested
This commit is contained in:
@@ -97,10 +97,11 @@ local launcher = love.graphics.newImage("assets/launcher/gear.png")
|
||||
eq(launcher.path, "assets/launcher/gear.png",
|
||||
"overlay leaves non-generated paths alone")
|
||||
|
||||
-- The real un-prefixed file wins when it exists
|
||||
-- Leftover un-prefixed Red cache must not shadow the versioned copy
|
||||
-- (pre-#899 assets/generated at the save-dir root).
|
||||
love.filesystem.write(PNG, "root-png-bytes")
|
||||
eq(love.filesystem.read(PNG), "root-png-bytes",
|
||||
"overlay prefers the real un-prefixed file over the versioned copy")
|
||||
eq(love.filesystem.read(PNG), "yellow-png-bytes",
|
||||
"overlay prefers the versioned copy over leftover unprefixed")
|
||||
clearPath(PNG)
|
||||
|
||||
-- Blue gets the same treatment
|
||||
@@ -110,9 +111,18 @@ clearPath("yellow/" .. PNG)
|
||||
eq(love.filesystem.read(PNG), "blue-png-bytes",
|
||||
"overlay maps generated reads to blue/ for Blue")
|
||||
|
||||
-- Leftover unprefixed font (old Red root) must not beat Gold's copy.
|
||||
GameVersion.set("gold")
|
||||
local FONT = "assets/generated/fonts/font.png"
|
||||
love.filesystem.write(FONT, "stale-red-font")
|
||||
love.filesystem.write("gold/" .. FONT, "gold-font")
|
||||
eq(love.filesystem.read(FONT), "gold-font",
|
||||
"Gold versioned font wins over leftover unprefixed Red font")
|
||||
clearPath(FONT)
|
||||
clearPath("gold/" .. FONT)
|
||||
|
||||
-- Gold data/generated: fused NX hides gold/maps.lua at the unprefixed path,
|
||||
-- which is the "Gold cache incomplete / maps.lua Does not exist" crash.
|
||||
GameVersion.set("gold")
|
||||
local MAPS = "data/generated/maps.lua"
|
||||
love.filesystem.write("gold/" .. MAPS, "return { NEW_BARK_TOWN = true }")
|
||||
local mapsChunk = love.filesystem.load(MAPS)
|
||||
@@ -122,7 +132,8 @@ eq(love.filesystem.read(MAPS), "return { NEW_BARK_TOWN = true }",
|
||||
"wrapped filesystem.read returns gold maps.lua bytes")
|
||||
clearPath("gold/" .. MAPS)
|
||||
|
||||
-- Red has no prefix: nothing is rewritten
|
||||
-- Red has no empty prefix anymore (cachePrefix is red/), but with no
|
||||
-- red/ copy the unprefixed miss stays a miss.
|
||||
GameVersion.set("red")
|
||||
clearPath("blue/" .. PNG)
|
||||
eq(love.filesystem.read(PNG), nil, "Red keeps the stock miss behavior")
|
||||
|
||||
@@ -66,4 +66,21 @@ check(mainSrc:find("isNX", 1, true) ~= nil
|
||||
and mainSrc:find('require("src.core.NxAssetOverlay").install()', 1, true) ~= nil,
|
||||
"the overlay install stays gated on Platform.isNX()")
|
||||
|
||||
-- Gold Game2 / World must compile data/generated via CacheFs.loadActive so
|
||||
-- a fused NX boot does not depend on mounting gold/ onto data/generated.
|
||||
local function readSrc(path)
|
||||
local fh = io.open(path, "r")
|
||||
local body = fh and fh:read("*a") or ""
|
||||
if fh then fh:close() end
|
||||
return body
|
||||
end
|
||||
local game2Src = readSrc("src/core/Game2.lua")
|
||||
check(game2Src:find("loadActive", 1, true) ~= nil,
|
||||
"Game2 compiles generated modules through CacheFs.loadActive")
|
||||
check(game2Src:find("loadActive(path)", 1, true) ~= nil,
|
||||
"Game2.loadGenerated calls loadActive")
|
||||
local worldSrc = readSrc("src/world/gen2/World.lua")
|
||||
check(worldSrc:find("loadActive", 1, true) ~= nil,
|
||||
"World's on-disk fallback also uses CacheFs.loadActive")
|
||||
|
||||
T.finish()
|
||||
|
||||
@@ -59,7 +59,7 @@ package.loaded["src.import.RomImporter"] = nil
|
||||
RomImporter = require("src.import.RomImporter")
|
||||
|
||||
local function clearSavesInbox()
|
||||
for _, ver in ipairs({ "red", "blue", "yellow" }) do
|
||||
for _, ver in ipairs({ "red", "blue", "yellow", "gold" }) do
|
||||
local dir = "imports/saves/" .. ver
|
||||
for _, name in ipairs(love.filesystem.getDirectoryItems(dir) or {}) do
|
||||
love.filesystem.remove(dir .. "/" .. name)
|
||||
@@ -135,6 +135,8 @@ check(createdDirs["imports/saves/blue"] == true,
|
||||
"RES-01: ensureSavesInboxDir creates imports/saves/blue/")
|
||||
check(createdDirs["imports/saves/yellow"] == true,
|
||||
"RES-01: ensureSavesInboxDir creates imports/saves/yellow/")
|
||||
check(createdDirs["imports/saves/gold"] == true,
|
||||
"RES-01: ensureSavesInboxDir creates imports/saves/gold/")
|
||||
|
||||
-- NXSAV-02: notice/hint includes save dir + per-game imports/saves/<version>/ MTP path
|
||||
ri = freshImporter()
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
-- sourceTreeHasData must use each version's required-file list. Gold's
|
||||
-- cache has no Gen 1 trade art / pikachu.png; validating it against
|
||||
-- REQUIRED_FILES made a Gold source tree look incomplete forever.
|
||||
package.path = "./?.lua;./?/init.lua;" .. package.path
|
||||
|
||||
local T = require("tests.harness")
|
||||
local check = T.check
|
||||
|
||||
local f = assert(io.open("src/import/RomImporter.lua", "r"))
|
||||
local src = f:read("*a")
|
||||
f:close()
|
||||
|
||||
local start = src:find("local function sourceTreeHasData", 1, true)
|
||||
check(start ~= nil, "sourceTreeHasData is defined")
|
||||
local finish = src:find("\nfunction RomImporter.isReady", start, true)
|
||||
check(finish ~= nil, "sourceTreeHasData ends before isReady")
|
||||
local body = src:sub(start, finish)
|
||||
|
||||
check(body:find("requiredFilesFor", 1, true) ~= nil,
|
||||
"sourceTreeHasData uses requiredFilesFor (Gold override, not Gen 1 only)")
|
||||
check(body:find("ipairs(REQUIRED_FILES)", 1, true) == nil,
|
||||
"sourceTreeHasData does not iterate the Gen 1 REQUIRED_FILES list raw")
|
||||
|
||||
local helperStart = src:find("local function requiredFilesFor", 1, true)
|
||||
check(helperStart ~= nil, "requiredFilesFor helper exists")
|
||||
local helper = src:sub(helperStart, start)
|
||||
check(helper:find("VERSION_REQUIRED_FILES_OVERRIDE", 1, true) ~= nil,
|
||||
"requiredFilesFor consults VERSION_REQUIRED_FILES_OVERRIDE")
|
||||
|
||||
T.finish()
|
||||
@@ -30,6 +30,7 @@ mustContain(transfer, "FTP", "transfer")
|
||||
mustContain(transfer, "sdmc:/switch/gen1recomp/", "transfer")
|
||||
mustContain(transfer, "imports/", "transfer")
|
||||
mustContain(transfer, "imports/mods/", "transfer")
|
||||
mustContain(transfer, "gold", "transfer")
|
||||
mustContain(transfer, "1: SD Card", "transfer")
|
||||
mustContain(transfer, "Scan again", "transfer")
|
||||
mustContain(transfer, "documented example", "transfer")
|
||||
@@ -70,6 +71,9 @@ mustContain(install, "PERFORMANCE", "install")
|
||||
mustContain(install, "Stock engine effect", "install")
|
||||
mustContain(install, "## Limitations", "install")
|
||||
mustContain(install, "Launch with title override", "install")
|
||||
mustContain(install, "Gold", "install")
|
||||
mustContain(install, "imports/saves/gold/", "install")
|
||||
mustContain(install, "exports/gold/", "install")
|
||||
mustNotContain(install, "VoxelMod", "install")
|
||||
mustNotContain(install, "switch-development", "install")
|
||||
mustContain(build, "switch-transfer.md", "build")
|
||||
|
||||
Reference in New Issue
Block a user