CLOSES #604, CLOSES #666, CLOSES #716, CLOSES #727, CLOSES #763, CLOSES #781, CLOSES #784, CLOSES #799, CLOSES #801, CLOSES #810, CLOSES #828, CLOSES #834, CLOSES #838, CLOSES #849, CLOSES #852, CLOSES #857, CLOSES #863, CLOSES #864, CLOSES #867, CLOSES #869, CLOSES #870, CLOSES #872, CLOSES #839

This commit is contained in:
bryanthaboi
2026-08-05 16:36:37 -04:00
parent f56970350a
commit e2820e02c5
36 changed files with 4046 additions and 64 deletions
+20
View File
@@ -44,6 +44,19 @@ local DATA_MODULES = {
maps = { "data.generated.maps", "data/generated/maps.lua" },
charmap = { "src.save_convert.data.charmap", "src/save_convert/data/charmap.lua" },
eventFlags = { "src.save_convert.data.event_flags", "src/save_convert/data/event_flags.lua" },
toggleObjects = { "src.save_convert.data.toggle_objects", "src/save_convert/data/toggle_objects.lua" },
}
-- Yellow renumbers wEventFlags bits: pokeyellow's constants/event_constants.asm
-- inserts events pokered does not have (the Jessie & James fights, catch
-- training, the Officer Jenny Squirtle) and shifts the Mt Moon 3 / Silph Co
-- 11F block, so writing a Yellow save through the Red table lands bits on the
-- wrong events and drops every Yellow-only flag. Kept outside DATA_MODULES so
-- the ensureData loop never loads it as a crosswalk of its own -- it
-- substitutes for `eventFlags` when the caller names Yellow (#838).
local YELLOW_EVENT_FLAGS = {
"src.save_convert.data.event_flags_yellow",
"src/save_convert/data/event_flags_yellow.lua",
}
local function loadTable(requirePath, filePath)
@@ -112,6 +125,9 @@ local function ensureData(gameVersion)
local data = {}
for name, spec in pairs(DATA_MODULES) do
if name ~= "charmap" then
if name == "eventFlags" and gameVersion == "yellow" then
spec = YELLOW_EVENT_FLAGS -- Yellow's bit numbering differs (#838)
end
local mod = loadCacheTable(gameVersion, spec[2])
if not mod then
local e
@@ -121,6 +137,10 @@ local function ensureData(gameVersion)
data[name] = mod
end
end
-- record which game's tables these are: the codec gates Yellow-only
-- bytes (wPikachuFriendship) on it, since those offsets are map
-- scratch in Red/Blue (#763, #838)
data.gameVersion = gameVersion
crosswalks[key] = data
end
if not charmapReady then