mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 11:11:10 +02:00
Merge branch 'dev' of https://github.com/bryanthaboi/gen1recomp into dev
This commit is contained in:
@@ -96,7 +96,14 @@ local function syntheticSave(name)
|
||||
moves = { { id = "TACKLE", pp = 35, ppUps = 0 } },
|
||||
nickname = "SQ", ot = name, otId = seed.player.id, catchRate = 45,
|
||||
} }
|
||||
return GenSave.encode(seed, data, nil)
|
||||
-- The current-map view pointer is part of wMainData's map cache, not a
|
||||
-- modeled save field. Pokémon Red restores that cache before Continue,
|
||||
-- so it is a useful canary for the import -> slot -> export path.
|
||||
local raw = GenSave.encode(seed, data, nil)
|
||||
local cacheOff = OFF.mainData + 104
|
||||
local cacheTemplate = raw:sub(1, cacheOff) .. string.char(0xA5)
|
||||
.. raw:sub(cacheOff + 2)
|
||||
return GenSave.encode(seed, data, cacheTemplate)
|
||||
end
|
||||
|
||||
-- ---------------------------------------------- importToSlot -> listSlots
|
||||
@@ -149,6 +156,8 @@ do
|
||||
eq(outBytes and #outBytes, GenSave.SAVE_SIZE, "the export is exactly 32768 bytes")
|
||||
check(outBytes and mainChecksumValid(outBytes),
|
||||
"the export carries a valid main-data checksum")
|
||||
eq(outBytes and outBytes:byte(OFF.mainData + 105), 0xA5,
|
||||
"the export keeps the saved current-map cache")
|
||||
|
||||
-- the export re-imports to an equivalent save
|
||||
local re = SaveConvert.importSav(outBytes, "red")
|
||||
|
||||
@@ -6,12 +6,20 @@ package.path = "./?.lua;./?/init.lua;" .. package.path
|
||||
local T = require("tests.modkit")
|
||||
local WideBattle = require("src.battle.WideBattle")
|
||||
local Renderer = require("src.render.Renderer")
|
||||
local Game = require("src.core.Game")
|
||||
|
||||
T.eq(WideBattle.WIDTH, 304, "the wide layout runs on a 304px native surface")
|
||||
T.eq(WideBattle.HEIGHT, 144, "the wide surface keeps the native height")
|
||||
T.eq(WideBattle.FIELD_BOTTOM, 104,
|
||||
"the lower 40 rows are the message / command windows")
|
||||
|
||||
local wide = { isWideBattleLayout = function() return true end }
|
||||
local normal = { isWideBattleLayout = function() return false end }
|
||||
T.eq(Game.wideBattleInStack({ states = { normal, wide, normal } }), wide,
|
||||
"a wide battle remains the surface owner under a classic overlay")
|
||||
T.eq(Game.wideBattleInStack({ states = { normal } }), nil,
|
||||
"a classic stack keeps the normal surface")
|
||||
|
||||
-- move grid: slots are laid out 1 2 / 3 4
|
||||
T.eq(WideBattle.moveGridIndex(1, 4, "right"), 2, "RIGHT crosses the row")
|
||||
T.eq(WideBattle.moveGridIndex(2, 4, "left"), 1, "LEFT crosses the row")
|
||||
|
||||
@@ -297,9 +297,10 @@ check(scSave and scSave.lastHeal and scSave.lastHeal.map == scSave.player.map,
|
||||
"SaveConvert.importSav: lastHeal derives from the decoded position")
|
||||
check(scSave and scSave.lastOutdoor and scSave.lastOutdoor.id ~= nil,
|
||||
"SaveConvert.importSav: lastOutdoor is set")
|
||||
-- the import template + decode warnings never leak into the slot table
|
||||
check(scSave and scSave.rawImport == nil and scSave.warnings == nil,
|
||||
"SaveConvert.importSav: rawImport/warnings stripped from the returned table")
|
||||
-- The original SRAM image carries the current-map cache that Red restores on
|
||||
-- Continue, while decode warnings are only import diagnostics.
|
||||
check(scSave and type(scSave.rawImport) == "string" and scSave.warnings == nil,
|
||||
"SaveConvert.importSav: keeps the SRAM template but drops warnings")
|
||||
|
||||
-- size / type validation
|
||||
local badSize, badSizeErr = SaveConvert.importSav("too short", 2)
|
||||
|
||||
Reference in New Issue
Block a user