mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 19:24:01 +02:00
Bind gen2Constants in the save editor's Gold bootstrap
bindGoldData points gen2Palettes, gen2Icons, gen2Pokedex, gen2Landmarks,
gen2Roofs and gen2Sprites at the extractor's own Gold tables through
loadGen, but never gen2Constants -- despite Schemas.GEN2 routing
`constants` to that same namespaced-and-differently-shaped category
palettes and icons are in. A save editor boot left data.gen2Constants
unset, so mod.content.constants:get(...) read an empty table instead
of the cart's ordered name lists, misreading the generation and
rejecting every record a mod shaped off it.
data.gen2Constants now goes through the same loadGen("constants") path
the other five already use, falling back the same way they do when no
ROM cache is active.
This commit is contained in:
@@ -324,6 +324,23 @@ do
|
||||
check(bound.gen2Tilesets == bound.tilesets, "bindGoldData aliases gen2Tilesets")
|
||||
check(Gen.tilesets({ gen2Tilesets = { TILESET_GYM = true } }).TILESET_GYM,
|
||||
"Gen.tilesets prefers gen2Tilesets")
|
||||
|
||||
-- bindGoldData bound gen2Palettes/gen2Icons/gen2Pokedex/gen2Landmarks/
|
||||
-- gen2Roofs/gen2Sprites through loadGen but never gen2Constants, so any
|
||||
-- mod reading mod.content.constants:get(...) under a save-editor Gold
|
||||
-- bootstrap saw an empty table where it expected the cart's ordered name
|
||||
-- lists. loadGen falls back to require("data.generated.constants") when
|
||||
-- the ROM cache has nothing active, which is what a checkout with no
|
||||
-- ROM imported hits too -- stub that module the same way to prove the
|
||||
-- wiring without needing a real Gold extraction.
|
||||
package.loaded["data.generated.constants"] = { badges = { "ZEPHYR" } }
|
||||
local withConstants = Gen.bindGoldData({})
|
||||
package.loaded["data.generated.constants"] = nil
|
||||
check(withConstants.gen2Constants ~= nil,
|
||||
"bindGoldData populates gen2Constants")
|
||||
check(withConstants.gen2Constants and withConstants.gen2Constants.badges
|
||||
and withConstants.gen2Constants.badges[1] == "ZEPHYR",
|
||||
"gen2Constants carries the extractor's own name lists")
|
||||
end
|
||||
|
||||
do
|
||||
|
||||
@@ -95,6 +95,12 @@ function Gen.bindGoldData(data)
|
||||
end
|
||||
|
||||
data.gen2Palettes = data.gen2Palettes or loadGen("palettes")
|
||||
-- Namespaced AND differently shaped in Schemas.GEN2 (the cart's ordered
|
||||
-- name lists, not Gen 1's rule table), same as palettes/icons below --
|
||||
-- omitting it left mod.content.constants:get(...) reading an empty table
|
||||
-- under a Gold save-editor boot, which is what misreads "generation" and
|
||||
-- rejects every record a mod shapes off it.
|
||||
data.gen2Constants = data.gen2Constants or loadGen("constants")
|
||||
data.gen2Icons = data.gen2Icons or loadGen("icons")
|
||||
data.gen2Pokedex = data.gen2Pokedex or loadGen("pokedex")
|
||||
data.gen2Landmarks = data.gen2Landmarks or loadGen("landmarks")
|
||||
|
||||
Reference in New Issue
Block a user