entrpntr

[Gold Any%] Notes for Checksum Collision route

Oct 3rd, 2021 (edited)
507
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.47 KB | None | 0 0
  1. TODO:
  2. - TID manip video w/inputs (and more info on adjacent TIDs)
  3. - GBP/GSR offsets in addition to the GBI ones
  4.  
  5. More detailed guide (most things still apply, except for things I explicitly mention here):
  6. - https://pokemon-speedrunning.github.io/speedrun-routes/#/gen-2/gold-silver/main-any/gold-silver-backup-collision-route/
  7.  
  8. My PB video for reference: https://www.youtube.com/watch?v=oaLXa2GWNZo
  9.  
  10.  
  11.  
  12.  
  13.  
  14. --- GENERAL NOTES ---
  15.  
  16.  
  17. FlowTimer offsets (GBI):
  18. - TID: 20263
  19. - Collision: 2506
  20. - Corruption: 2712
  21.  
  22.  
  23. TID Manip for 09705 (0x25e9):
  24. > gold_reset1_gfskip_backout2_wait114(setopt)_backout5_newgame, Offset (wait): 20.824, Offset (NG): 28.98
  25.  
  26. - 1 framerule early: 40977
  27. - 1 framerule late: 12052
  28.  
  29.  
  30. Box Names (name them in reverse order to minimize lag):
  31.  
  32. > BOX1-BOX3
  33. E é [ 'd é H 'd ; note: you can't add a final 'd at the end here like you can w/other box names
  34. F é 'v 2 H é ] 'd
  35. a é d 2 é é 4 'd ; note: 6th character can be anything (it's a placeholder overwritten during ACE)
  36.  
  37. > BOX12
  38. Q D é g 'd 'm v 2
  39.  
  40.  
  41. Turnframes saved:
  42. - Save facing up before Potion pickup (buffer down while game is saving to turn towards Potion, timing is easy)
  43. > incurs 2 total turnframes instead of 3
  44. - Do final menu immediately after second Mr. Pokémon cutscene
  45. > opening menu mid-movement is unnecessary and incurs a turnframe
  46.  
  47.  
  48. Final menu (balls pocket):
  49. - Yoloscroll this; it's faster and there's a big enough window (8? frames) to hit it by visual cue and feel
  50. - I found it easiest to swap slot 2 with the item you'll register
  51. > count cursor blinks once you see question marks, you should get it very consistently w/enough practice
  52. - If you registered the correct slot, CANCEL will be 2 down when you start the long scroll to the bottom
  53. > if you notice it's not, you can scroll back up to 2 above CANCEL and register to fix it
  54. - Emergency backup (for if you royally screw up like I somehow did and bottom quantity isn't 75 when you get there)
  55. > count 9 down from where the ? x75 should be, and register that item as a backup to fix it
  56.  
  57.  
  58. Other notes:
  59. - You can determine if collision succeeded or failed without needing to open the Start menu to check
  60. > If Pokédex appears on the file info screen (between Badges/Time) and your save loads on r30, it succeeded
  61. > Otherwise, it's your old uncorrupted save
  62. - Alternative TID Manip (slightly "faster", but 2 soft resets isn't as dead simple to time as just 1 is)
  63. > gold_reset2_gfskip_backout2_wait156(setopt)_backout2_newgame, Offset (wait): 24.393, Offset (NG): 28.40
  64. - Don't know if this is worth it, but to possibly avoid things outspeeding you (to the extent possible)
  65. > 9:00am clockset for morning: 5 extra frames = only 10% for L4 Pidgey on r30 (instead of 20% for day)
  66. - If you are a gaming god who can consistently scroll to slot $6c, you can register that slot and save a swap
  67. > Swap ? x0 with ? x[]8 (using the slots you normally do the final swap with)
  68.  
  69.  
  70.  
  71.  
  72.  
  73. --- RESOURCES AND SUGGESTIONS ---
  74.  
  75.  
  76. Practice ROMs (especially useful for console runners with flashcarts):
  77. - Use RomPatcher.js site to apply one of the patches below to your Gold ROM
  78. > https://www.marcrobledo.com/RomPatcher.js/
  79. - Normal Gold practice ROM w/embedded save files for Any% practice
  80. > https://cdn.discordapp.com/attachments/878020788303851560/894297030074183690/goldany-practice.bps
  81. - Altered practice ROM with extremely condensed New Game and Mr. Pokémon cutscenes
  82. > https://cdn.discordapp.com/attachments/878020788303851560/894296996293259337/goldany-practice-efficient.bps
  83. > Makes it much more efficient to tune FlowTimer offsets for TID manip and/or collision
  84. - Press Down+Select+B on title screen to load the save selection menu, then press A to load a given save
  85. - Note: I included saves that were useful for my practice purposes; some may or may not be useful to other runners
  86.  
  87.  
  88. How to name boxes quickly:
  89. - (Optional, but highly recommended) Don't use GBA SP (Start and Select buttons will greatly limit you imo)
  90. - Memorize names, not inputs
  91. > find fastest input sequences obv, but going by feel removes hesitation and you can quickly notice/correct mistakes
  92. - To start, practice each box name individually and gradually improve speed, then move to naming all boxes in sequence
  93. - After learning, use LiveSplit and do dedicated practice; easier to take it seriously and progressively push your limits
  94. - Takes a daily practice session or two over a few days to build muscle memory to do them with speed and consistency
  95.  
  96.  
  97.  
  98.  
  99.  
  100. --- CHECKSUM COLLISION AND SAVE CORRUPTION INFO ---
  101.  
  102.  
  103. NOTE: I use technical terms in this section, but they aren't terribly important to understand; the outcomes and
  104. percentages are the more important things to note. There's a technical explainer at the end of this section.
  105. Runners don't need to understand the mechanics, but they may help make sense of things for anyone who's curious.
  106.  
  107.  
  108. If necessary, this is a simple method for tuning your collision offset:
  109. - Follow the collision steps from the main guide, but Continue into the overworld instead of selecting New Game
  110. - After pressing Continue, there are a couple possible results:
  111. (1) If primary checksum didn't get saved, the backup save on r30 will be loaded
  112. (2) Otherwise, the save in Mr. Pokémon's house gets loaded
  113. - With a good offset, the r30 save should load ~40% of the time, and the Mr. Pokémon save should load ~60% of the time
  114. > Around 1/4 of a frame between saving the primary checksum and middle of the collision window, so not quite 50/50
  115.  
  116.  
  117. Troubleshooting collision attempts:
  118. - Follow the collision & corruption steps from the main github guide
  119. - After pressing Continue, the game will attempt to load your backup save and there are a few possible results:
  120. 1: "The save file is corrupted!"
  121. > You reset during the backup save but missed the window (no easy way to tell if reset was early or late)
  122. 2: The game loads your backup save on r30; then you can tell based on whether or not you have a Pokédex
  123. (a) No Pokédex means you reset before the backup save started to be written, i.e. your reset was early
  124. (b) If you have a Pokédex, you successfully hit the collision window!
  125. 3: The game loads a backup save inside Mr. Pokémon's house
  126. > This means the backup checksum was saved, i.e. your reset was very, very late (7+ frames)
  127. - With a good offset, results should be something like the following (depends on how precise you are):
  128. 1: ~47% of the time
  129. 2a: ~40% of the time
  130. 2b: ~13% of the time (!)
  131. 3: Never
  132.  
  133.  
  134. Other general notes:
  135. - Must follow steps exactly (especially ones involving items) for the above troubleshooting advice to fully apply
  136. > If you did anything important wrong, you'll see "The save file is corrupted!" even if you hit the window
  137. - The window for hitting primary save corruption is large (9+ frames) and you should never miss with a good offset
  138.  
  139.  
  140. Technical explainer:
  141. - Gen 2 games use a "checksum" of game data to determine if a save is valid or corrupt; they also store "backup saves"
  142. - When pressing Continue on the main menu:
  143. > If the primary save is valid, it is written to the backup save prior to loading the file info screen
  144. > If the primary save is corrupt, the backup save is then checked
  145. : if the backup save is valid, it overwrites the primary save prior to loading the file info screen
  146. : if the backup save is also corrupt, you'll get a message that says "The save file is corrupted!"
  147. - Rough order of operations in Gold/Silver when performing a normal save:
  148. (1) Save primary game data in normal order
  149. (2) Calculate and store primary save checksum
  150. (3) Save 3rd part of backup player data (some relevant stuff: pokédex flag, items, which "script" to run on each map)
  151. (4) Save remainder of backup save in the otherwise normal order
  152. (5) Calculate and store backup save checksum
  153. - This particular route works by abusing the above mechanics:
  154. > First, the backup save is corrupted such that only a small chunk of static game data is relevant between 2 saves
  155. > After the backup save is corrupted, New Game is selected (pressing Continue would overwrite the backup save)
  156. > Once in the overworld, the primary save is then corrupted without touching the backup save
  157. > If all is done successfully, pressing Continue will load a corrupt backup save (since it has the correct checksum)
  158. : The player will have a Pokédex and a Mystery Egg, but the normal Mr. Pokémon cutscene will still play
  159. : After getting a second Mystery Egg, key item underflow can be performed, which unlocks other useful glitches
  160.  
  161.  
  162.  
  163.  
  164.  
  165. --- MISCELLANEOUS STUFF DEFINITELY NOT WORTH READING UNLESS UR A BIG DUMB NERD ---
  166.  
  167.  
  168. Routine for saving game data in Gold/Silver:
  169. - https://github.com/pret/pokegold/blob/e315a38db4c9a13f70d662fc40bb2a948415e47e/engine/menus/save.asm#L273-L292
  170.  
  171.  
  172. Gold/Silver SRAM addresses (in order they are saved):
  173. options: [1:a000-a007]
  174. playerdata1: [1:a009-a226]
  175. playerdata2: [1:a227-a3d8]
  176. playerdata3: [1:a3d9-a855]
  177. curmapdata: [1:a856-a889]
  178. pokemondata: [1:a88a-ad68]
  179. box: [1:ad6c-b1b9]
  180. checksum: [1:ad69-ad6a]
  181. b.options: [3:be30-be37]
  182. b.playerdata3: [0:ac6b-b0e7]*
  183. b.playerdata1: [0:b5c7-b7ec]
  184. b.playerdata2: [1:bd96-bf3f]
  185. b.curmapdata: [3:be39-be6c]
  186. b.pokemondata: [0:b0e8-b5c6]
  187. b.checksum: [3:be6d-be6e]
  188.  
  189. * collision window = [0:acde-adc9]
  190. > After the key items terminator byte is saved, but before the Mr. Pokémon House "scene ID" is saved
  191.  
  192.  
  193.  
  194.  
  195. Box source code & notes
  196.  
  197. ; BOX 1-3
  198. ; E é [ 'd é H 'd
  199. ; F é 'v 2 H é ] 'd
  200. ; a é d 2 é é 4 'd
  201.  
  202. ; BOX 12
  203. ; Q D é g 'd 'm v 2
  204.  
  205.  
  206. ; Registers
  207. ; af = 0040 ; (c=0)
  208. ; bc = ff9e ; (0000 after jump in box 12)
  209. ; de = 0009
  210. ; hl = f91f ; [hl] = 00
  211. ; sp = dfcb
  212. ; pc = f922
  213.  
  214.  
  215. ; BOX 12 (d922-d92a) :: Q D é g 'd 'm v 2
  216.  
  217. sub b ; a=$01, c=1
  218. add e ; a=$0a, c=0
  219. ld [$d0a6], a ; y displacement
  220. jp nc, $f8b5 ; jumps into safe code just before box 1 name
  221.  
  222. ; ld bc, $0000 (at f8b8)
  223.  
  224. ; BOX 1 (d8bf-d8c7) :: E é [ 'd é H 'd
  225.  
  226. add h ; a=$03, c=1
  227. ld [$d09e], a ; map group
  228. ld [$d087], a ; map height for connection warp
  229. ; ld d, b
  230.  
  231. ; BOX 2 (d8c8-d8d0) :: F é 'v 2 H é ] 'd
  232.  
  233. add l ; a=$22, c=0
  234. ld [$f8d6], a ; self-modify for party count (6th char of box 3)
  235. add a ; a=$44
  236. ld [$d09f], a ; map number
  237. ; ld d, b
  238.  
  239. ; BOX 3 (d8d1-d8d9) :: a é d 2 é é 4 'd
  240.  
  241. and b ; $a=00
  242. ld [$f8a3], a ; make red appear
  243. ld [$fa22], a ; party count ($faea is modified to $fa22 above)
  244. ret nc
  245.  
  246.  
  247.  
  248. For posterity, 09719 (0x25f7) as a TID is an alternative
  249. > Only have to scroll to BOX9 instead of BOX12, but the box names are more inputs, so it's slower overall
  250. > TID Manip: gold_reset2_gfskip_backout1_wait102(setopt)_backout4_newgame, Offset (wait): 19.400, Offset (NG): 26.16
  251.  
  252. ; BOX 1-3
  253. ; E é [ 'd é H 'd [
  254. ; d é 'v 2 H é ] 'd
  255. ; a é d 2 é é 4 'd
  256.  
  257. ; BOX 9
  258. ; ( H é g 'd 'm v 2
Comments
Add Comment
Please, Sign In to add comment