ROM Hack Pokémon Sacred Gold & Storm Silver

  • Thread starter Thread starter Drayano
  • Start date Start date
  • Views Views 5,619,274
  • Replies Replies 2,284
  • Likes Likes 61
I signed up here to report on how I solved the Safari Zone gate issues for my save plus the additional findings along the way. I did use AI in the process of solving my issue and the following content was authored by AI based on that work:

Sacred Gold — Safari Zone arc (R47/R48 + D47 Gate) flag regression: full save-repair recipe

I hit a save state where the entire Safari Zone Rocket arc had reverted — Routes 47 and 48 both had their grunts back, and the Safari Zone Gate (D47) was permanently blocked by the two door grunts — despite the arc being well past in my playthrough. The in-game Olivine flag-fixer NPC did not restore any of it. Tracing through the save with DSPRE Reloaded + a Node save-editor:

What got reset
  • Every "grunt defeated" visibility flag the arc's completion scripts set, across both the routes and the gate: 0x3FDF, 0x3FE0, 0x3FE3, 0x3FE4, 0x3FE5, 0x3FE6, 0x3FE8. All seven were cleared.
  • 0x3FE1 stayed set (it's set earlier in the arc), and 0x3FFF (the arc master) also stayed set — which is why scripted progression past the arc still worked, masking the regression.
  • 0x3FE7 is a transient flag set during R47 and cleared at the arc finale — its correct done-state is OFF, so don't restore it.

Where the flags map on D47 (header 174), Event File 168
  • Door-blocking grunts: Overworlds 15 and 16, both visibility flag 0x3FE0 (decimal 16352), trigger script 18 on contact. This is the flag specifically controlling the gate door — easy to overlook because it's separate from the route grunts' flags.
  • Post-arc ally NPCs (OW 17/18/19) hang off 0x3FDF, separate from the door pair.
  • The "Run script 22 when Var 24880 (0x6130) is 0" trigger on the same map is a red herring for this bug — 0x6130 is shared with the Saffron Rocket-grunt arc (Saffron's Script 22 writes 0x612E/F/130 as a contiguous trio), and in my case it was already 2 from Saffron. The door grunts persist purely on the flag, not the trigger.

Save-level workaround (if you're stuck)
  • Set 0x3FDF, 0x3FE0, 0x3FE3, 0x3FE4, 0x3FE5, 0x3FE6, 0x3FE8. Leave 0x3FE7 clear. Recompute the P1 general-block checksum: CRC16-CCITT-FALSE over [0x40000, 0x4F618), stored u16 LE at 0x4F626.
  • PKHeX can't reach the 0x3FE_ range flags in HGSS — it caps the flag spinner below that — so this needs a small Node or Python script, not the editor UI.
  • Restoring the whole 0x3FE_ region as a blanket fix (~57 flags) causes a black-screen crash on Safari-area load. The fix has to be targeted to the seven flags above.

What's actually wrong (best guess)
  • Some event during my playthrough cleared all seven of these flags as a group. I can't pinpoint the trigger — possibly a scripted reset elsewhere, possibly an emulator/save-sync issue on my end.
  • Whatever the cause, the in-game Olivine flag-fixer NPC's restore list does not cover this arc (it didn't repair any of the seven for me). Lowest-risk ROM-side patch would be to add this seven-flag set to the fixer's restore list, gated on 0x3FFF being set so it only re-applies after the arc was supposed to be complete.

Happy to share the Node save-editor / DSPRE .ev parser scripts I wrote if useful.
CC: @DeadSkullzJr @Drayano
 
Last edited by TwistedMaro,
Well I have been down a bit of a rabbit hole since fixing my Safari Zone bug leading to my working on a full reverse engineering of Sacred Gold and Soul Silver. I am currently working on a tool which breaks out as much as possible into an entirely data-driven, composable and layered pipeline that injects maximally minimal code hooks.

I believe I have found a number of bugs in the 1.1.2 patches here by doing this because I am doing a full baseline data extraction including scripts and maps and events and flags. This data gives me baseline HGSS in a fundamentally different form because I've designed it to be agnostic to bytes in the ROMs. Instead like stated above I just have hooks for every type of edit and a data driven build pipeline that compiles down and in that compile process I can make sure that flags and basically all data is non-colliding and going into a safe space for that type of edit.

So with full HGSS extracted to data and then full SacredGold/StormSilver extracted to data I can do a diff and see the full semantic edit set that makes up SGSS. Then running the validation over this and against vanilla baseline I can already see many flag collisions or instances where for example the two grunts blocking the door in the Safari Zone seem to by copy pasted and not unique or where flags are used by multiple scripts or events.

The good news:
A - I can statically detect a bunch of bugs or potential bugs in the current versions (including what is likely causing them to work poorly on flash carts)
B - The rebuild pipeline uses highly-abstracted concepts instead of being tied directly to ROM bytes or concepts so flags get symbol-named etc
C - Due to the way re-assembly is working I am able to rebuild SGSS avoiding those classes of bugs entirely

I will keep ya'll posted as this progresses and share more if I have something concrete.


EDIT:
Oh yeah the way I am building this tool/pipeline is not SPECIFIC to this hack but I am using this hack as my dogfooding subject. In reality it will mean that you could edit a bunch of JSON/images/audio files and build whole new hacks AND use the extraction pipeline to reverse engineer any hack built on HGSS into abstract data layers.

EDIT 2:
This is fundamentally different from decomp work which I would have considered trying to tackle but my research lead me to the realization that the effort/vision there is too grand for what I actually am hoping to get out of this so instead this is more of a generalized code patching with minimal hook injection and an intelligent data entity build system which doesn't rely on ROM specifics to augment the systems which have been hooked and cataloged.
 
Last edited by TwistedMaro,

Site & Scene News

Popular threads in this forum