Another improvement to Gen 2 save glitch.
The strategy for this run is to get out of bounds to map 0xFF00, similar to my previous Crystal save glitch TAS. This is done by resetting right after the player's coordinates are written but before the visible map cache is saved, resulting in a desynchronized map state, allowing for the map to be exited in unintentional ways. Map 0xFF00's corruption gives us access to a highly corrupted inventory and thus a seemingly easy vector for ACE.
However, this run opts to do this very early, before even talking to Mom. This poses a grave problem: you can't use wrong pocket TMs/HMs without a Pokemon in the party (as the game prevents item effects for items needing a Pokemon. Granted this is strange for wrong pocket TMs/HMs since separate code handles the correct TMs/HMs pocket). There is also the minor problem of not being able to actually use Mail to setup an ACE payload.
So without a Pokemon, it seems like this route is impossible. However, I discovered a saving grace: registered items. Registered items are not subject to the Pokemon in a party limitation (as Game Freak didn't add such code to registered item handling). So we can freely use a wrong pocket TM/HM by "registering" a wrong pocket TM/HM. An extra saving grace is HM03, which runs the daycare withdraw code, thus allowing us to get a Pokemon!
Another change here is a different wrong pocket TM is now used. TM33 is used, which has its effect pointer at F418. This ends up sliding down wReceiveCallDelay_StartTime (which appears to just be a copy of the current time, and eventually our trainer ID. This gives us enough tools to jump to the temp Mail buffer.
BytesInstructionComment
3ald a,(hl-)Current minute, a = 0
62ld h,dHigh byte of TID, h = d0
f7rst $30Low byte of TID, acts as jp ha, jump to d000 (a little before temp mail buffer)
The mail payload has also changed, it now is able to handle subframe inputs, allowing for a much faster final ACE section.
BytesInstructionComment
97sub a,aa is variable at this point, so 0 it out
f6 f0or a,$F0a = $F0, f = $00
f5push afpush $F000 (a little before temp mail buffer)
d6 f6sub a,$F6
d6 f1sub a,$F1a = $09, f = $40
f5push afpush $0940 (middle of UpdateJoypad, the latest before it doesn't poll input correctly)
f6 d0or a,$D0a = $D9
e0 a5ldh ($FFA5),awrite a reti to hJoypadSum
d2 a4 ffjp nc,$FFA4jump to hJoypadDown
The general idea in this routine is it pushes af values to act as return addresses, first to UpdateJoypad (to update joypad variables), then back to the mail payload (effectively acting as a loop). hJoypadDown is jump to to execute what was pressed down, then the planted reti lets the payload loop. UpdateJoypad trashes most registers, except HL, so HL is purely used for the input opcode payload.
The input opcode payload performs the following operations.
AddressMemory change
wPlayerLastMapY ($d4e9)$0A -> $49
wPartyCount ($dcd7)$01 -> $00
wSouthConnectionStripXOffset ($d1be)$cf -> $06
wSouthConnectionStripYOffset ($d1bd)$94 -> $09
wSouthConnectedMapNumber ($d1b6)$10 -> $4c
wSouthConnectedMapGroup ($d1b5)$78 -> $03
Red event flag ($db5e)$44 -> $43
wInputType ($e2c7)$00 -> $ff
Corrupted stack ($e0f0)$ff -> $5e
Corrupted stack ($e0ef)$00 -> $76
The stack pointer is set to $e0df in the end, finishing the payload.
So with these in place, the plan is follows:
  1. Perform save corruption to misalign the visible map cache and the player's Y coord.
  2. Step down to get OOB.
  3. Create Mail.
  4. Create TM33.
  5. Fake "register" HM03.
  6. Use Select in the overworld to use "HM03" and thus get a Pokemon.
  7. Use Mail to write payload.
  8. Use TM33.
  9. Win!

DrD2k9: Claiming for judging.
DrD2k9: Obviously a well planned and executed run. Since the method of performing the save glitch is different than it is in the Gold/Silver versions, Accepting as a kinda new branch.
NOTE TO PUBLISHER: Once this is published we need to update the obsoletion chains to separate the Gold and Crystal runs of the "save glitch" branch. I don't mind doing it if you don't want to.

Spikestuff: Processing...
DrD2k9: Updating movie file with improvement. No change to judgement.
DrD2k9: Again, updating movie file with an improvement.


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15542
Location: 127.0.0.1
Patashu
He/Him
Joined: 10/2/2005
Posts: 4042
The glitch music is SO perfect. I take it it just happened when you optimized for speed?
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Emulator Coder, Judge, Experienced player (699)
Joined: 2/26/2020
Posts: 772
Location: California
Patashu wrote:
The glitch music is SO perfect. I take it it just happened when you optimized for speed?
The glitch music is just the result of map 0xFF00 corruption (a lot gets corrupted in this map, it's a miracle the game doesn't just crash in this map here).
Dimon12321
He/Him
Editor, Reviewer, Experienced player (595)
Joined: 4/5/2014
Posts: 1217
Location: Romania
Sync verified. ROM:
Pokemon - Crystal Version (USA, Europe) (Rev A).gbc SHA1:F2F52230B536214EF7C9924F483392993E226CFB MD5:301899B8087289A6436B0A241FBBB474 Core reported Header Name: PM_CRYSTAL
BIOS:
2304 sha1:1293D68BF9643BC4F36954C1E80E38F39864528D cgb.bin Game Boy Color Boot Rom
TASing is like making a film: only the best takes are shown in the final movie.
Emulator Coder, Judge, Experienced player (699)
Joined: 2/26/2020
Posts: 772
Location: California
I have improved this TAS: https://tasvideos.org/UserFiles/Info/638627273997305585 I'll update submission text later.
Emulator Coder, Judge, Experienced player (699)
Joined: 2/26/2020
Posts: 772
Location: California
Editor, Expert player (2071)
Joined: 6/15/2005
Posts: 3282
Link to video Sorry for the low-effort encode. I also threw in video of the previous version just for comparison purposes.
Emulator Coder, Judge, Experienced player (699)
Joined: 2/26/2020
Posts: 772
Location: California
I have improved this TAS (again (again)): https://tasvideos.org/UserFiles/Info/638639542167036814
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15542
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [6237] GBC Pokémon: Crystal Version "save glitch" by CasualPokePlayer in 02:10.82

1731069050