mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-25 15:01:11 +02:00
Update crystal_version_test.lua
This commit is contained in:
@@ -84,37 +84,32 @@ GameVersion.set(savedCurrent)
|
|||||||
|
|
||||||
-- ------- 6. the importer's required-file list
|
-- ------- 6. the importer's required-file list
|
||||||
|
|
||||||
local RomImporter = require("src.import.RomImporter")
|
local CacheContract = require("src.import.CacheContract")
|
||||||
|
|
||||||
love.filesystem = love.filesystem or {}
|
local function requiredSet(version)
|
||||||
local savedGetInfo = love.filesystem.getInfo
|
local prefix = version == "red" and "" or GameVersion.cachePrefix(version)
|
||||||
local savedGetReal = love.filesystem.getRealDirectory
|
local required, isOverride = CacheContract.requiredFilesFor(version)
|
||||||
local savedGetSource = love.filesystem.getSource
|
local seen, count = {}, 0
|
||||||
|
local function add(path)
|
||||||
local function probe(version)
|
if not seen[prefix .. path] then count = count + 1 end
|
||||||
local seen, order = {}, {}
|
seen[prefix .. path] = true
|
||||||
love.filesystem.getInfo = function(name)
|
|
||||||
if not seen[name] then
|
|
||||||
seen[name] = true
|
|
||||||
order[#order + 1] = name
|
|
||||||
end
|
|
||||||
return { type = "file" }
|
|
||||||
end
|
end
|
||||||
love.filesystem.getRealDirectory = function() return "/source" end
|
for _, path in ipairs(required) do add(path) end
|
||||||
love.filesystem.getSource = function() return "/source" end
|
if not isOverride then
|
||||||
RomImporter.isReady(version)
|
for _, path in ipairs(CacheContract.VERSION_REQUIRED_FILES[version] or {}) do
|
||||||
return seen, order
|
add(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return seen, count
|
||||||
end
|
end
|
||||||
|
|
||||||
local crystalSeen, crystalOrder = probe("crystal")
|
local crystalSeen, crystalCount = requiredSet("crystal")
|
||||||
local redSeen = probe("red")
|
local redSeen = requiredSet("red")
|
||||||
|
|
||||||
love.filesystem.getInfo = savedGetInfo
|
check(select(2, CacheContract.requiredFilesFor("crystal")) == true,
|
||||||
love.filesystem.getRealDirectory = savedGetReal
|
"crystal has its own required-file override, not the Gen 1 list")
|
||||||
love.filesystem.getSource = savedGetSource
|
check(crystalCount > 20,
|
||||||
|
("the crystal list is substantial (%d entries)"):format(crystalCount))
|
||||||
check(#crystalOrder > 20,
|
|
||||||
("the crystal list is substantial (%d entries probed)"):format(#crystalOrder))
|
|
||||||
for _, path in ipairs({
|
for _, path in ipairs({
|
||||||
"crystal/data/generated/encounters.lua",
|
"crystal/data/generated/encounters.lua",
|
||||||
"crystal/data/generated/landmarks.lua",
|
"crystal/data/generated/landmarks.lua",
|
||||||
@@ -184,6 +179,8 @@ check(Opcodes.TERMINATORS.farjumptext == true,
|
|||||||
|
|
||||||
-- ------- 8. the launcher reaches the crystal tab
|
-- ------- 8. the launcher reaches the crystal tab
|
||||||
|
|
||||||
|
local RomImporter = require("src.import.RomImporter")
|
||||||
|
|
||||||
local visited = {}
|
local visited = {}
|
||||||
local fake = setmetatable({ tab = GameVersion.ORDER[1] }, RomImporter)
|
local fake = setmetatable({ tab = GameVersion.ORDER[1] }, RomImporter)
|
||||||
fake._switchTab = function(self, id)
|
fake._switchTab = function(self, id)
|
||||||
|
|||||||
Reference in New Issue
Block a user