In the first Harry Potter game for the Game Boy Color, the story of Harry's first year at Hogwarts School of Witchcraft and Wizardry is told in the form of a traditional role-playing game. Harry realizes the power of
Game objectives
- Emulator used: BizHawk 2.8 (Syncs on 2.9.1 as well)
- Fastest time
- All glitches are allowed
Comments
Sanqui discovered that holding Right while using the "Chocolate Frog" item lead to the game jumping to WRAM, but at the cost of messing up the stack.
I realized it jumped to 0xCABB, which changes based on your X position. However, I wasn't able to figure out how to reach items, since when I checked, items were never loaded as it was located in bank 6 in WRAM. Earlier this month, Sanqui was investigating this glitch again, and realized in the middle of the frame, the game does swap to bank 6 of WRAM, so items are indeed able to be executed as code. They made the following payload
LD A, $05
LDH [$F0D2], A
LD SP, $CFF9
RET
This is the following values:
3E 05
E0 D2
31 F9 CF
C9
This needed 2 items right next to each other, followed by another 2 items next to each other, followed by 3 items next to each other.
This gave:
Antidote, Wiggenweld Potion: LD A, $05
Collapsible Cauldron, Copper Cauldron: LDH [$F0D2], A
Best Blowing Gum, Pumpkin Pasties, Cauldron Cakes: LD SP, $CFF9
Licorice Wands: RET
Corresponds to:
Amount | Item | Cost in Sickles |
---|---|---|
Antidotes | 62 | 9,300 |
Wiggenweld Potions | 5 | 750 |
Collapsible Cauldron | 224 | 11,424 |
Copper Cauldron | 210 | 21,210 |
Best Blowing Gum | 49 | 196 |
Pumpkin Pasties | 249 | 2,490 |
Licorice Wands | 201 | 402 |
Cauldron Cakes | 207 | 1656 |
For a total of 47,428 sickles. This was basically inpractical without an hour of grinding at the start for sickles. You could get 57K sickles at the train area, but then you be away from the stores unless you used "yes" item to reset the game, maintaining your sickles.
Sanqui then tried to reduce the amount of sickles needed with the following:
LD A, $05
LD C, $D2
LDH [$F0D2], A
LD SP, $CFF9
RET
Where it now corresponds to:
3E 05
01 D2
E2
31 F9 CF
C9
This allowed E2 to be a much cheaper item, since it does not need to be next to another item in WRAM. Then we can just skip buying the expensive cauldrons, and instead buy 226 Every Flavor Beans for 1,356 sickles. Unfortunatly, between the cauldrons and the candy are story related items that you are forced to obtain. Mainly:
- Spellbook
- School Books
- Folio Triplicus
- Folio Magi
- Harry's Wand
You obtain 1 of each, which means the opcode LD BC, _ _ _ _ is unavoidable. If this had worked, it would bring the amount of sickles needed down to ~28k.
I then went and made a trace log of the game when you used the chocolate frog at X position 61,462 to see if there's anything else that was useable.
This was the trace log:
CAB7: 00 nop A:ff F:c0 B:00 C:00 D:41 E:fe H:d1 L:05 LY:3b SP:3630 Cy:1305888464
CAB8: 01 7C 71 ld bc, $717C A:ff F:c0 B:00 C:00 D:41 E:fe H:d1 L:05 LY:3b SP:3630 Cy:1305888465
CABB: C3 0A F0 jp $F00A A:ff F:c0 B:71 C:7c D:41 E:fe H:d1 L:05 LY:3b SP:3630 Cy:1305888468
F00A: 00 nop A:ff F:c0 B:71 C:7c D:41 E:fe H:d1 L:05 LY:3b SP:3630 Cy:1305888472
Here register D has $41, H has $D1, L has $05
These are already values we need. So the payload was changed to reflect that:
LD A, D
LD C, H
INC BC
LDH [$F0D2], A
LD SP, $CFF9
RET
For the values:
7A
4C
03
E2
31 F9 CF
C9
Since there's now 4 independent values to choose from, we could then use the cheaper cloth items as well for payload. The payload now became
122 Leather Belt (366 sickles)
76 Plain Boots (380 sickles)
3 Pack of Name Tags (30 sickles)
226 Potion Kit Bags (2,260 sickles)
49 Best Blowing Gum (196 sickles)
249 Pumpkin Pasties (2,490 sickles)
201 Licorice Wands (402 sickles)
207 Cauldron Cakes (1656 sickles)
We couldn't use Chocolate Frog as part of the payload, since it gets used during the glitch, so 226 potion kits was chosen since we needed it anyways.
This reduced the amount of sickles needed to 7,780, which made it viable for RTA. The time for this game dropped from 2 hours, to 20 minutes real time.
When I actually tried this payload, I ran into a problem. To skip the train section, you must use cards. If I used a card, it would give me 3 more items. In this case, 3 Hardened Boots from the first giant rat boss. I couldn't use 1 name tag, since it would mess up register C, so I bought 25 instead, taking 1 extra frame.
After resyncing everything, I ran across another problem. It appeared whenever I tried to use the "yes" item to bring up the menu to skip the lake, it would always give me 1 pair of Superlative Boots. This caused me to modify the what I needed again to the following:
122 Leather Belt (366 sickles)
3 Superior Boots (Free, required to get off train)
1 Superlative Boots (Free, required to get out of battle using Yes)
76 Pack of Name Tags (760 sickles)
3 Antidotes (450 sickles)
226 Potion Kit Bags (2,260 sickles)
49 Best Blowing Gum (196 sickles)
249 Pumpkin Pasties (2,490 sickles)
201 Licorice Wands (402 sickles)
207 Cauldron Cakes (1656 sickles)
I also needed to take account into the school items
1 Dragonskin Gloves (62 sickles)
1 Pointed Hat (58 sickles)
3 Plain Work Robe (240 sickles)
1 Winter Cloak (150 sickles)
1 Collapsible Cauldron (51 sickles)
1 School Books (143 sickles)
26 Chocolate Frogs (260 sickles)
For a total of 9,554 sickles. I actually ran out of money on the way to Cauldron shop, so I duped once more to get enough. This also gave me 3 more pair of boots, but it doesn't mess with the payload.
Unfortunatly again, after I bought all this and resynced to the lake, the game refuses to actually bring up the menu during a fight with the dragonflies. I actually wanted to skip using the frog, and just play the lake and beat the knight as normal, but
1. Setting up lake skip just barely faster than doing it normally, ignoring the frog.
2. Knight using 3 turns took 1700 frames.
3. Beating the frog, but doing the lake normally completely loses all time.
I realized the lake was a huge problem to overcome, so I thought of a different way to get to 0,0.
There was an idea to use the 1st giant rat encounter to get to 0,0, but Sanqui tried, it turns out 0xCABB isn't X position. From discord:
This also made the OoB bug from pressing Start near the purple cloaked npc at Diagon Alley worthless.
However, I remembered that the train also had a warp to Forbidden Forest. It is completely useless in most cases, since it does not update the story progress counter, so it just softlocks you. However, the map itself is completely empty of other NPCs. Additionally, it also has NPC layouts that would let the "yes" item bring up the menu. So I tried using the Forbidden Forest to warp to the credits, and it worked.
This saved 6k frames over using the lake, without using frog during lake.
This is what gets run when I use chocolate frog:
Item | Amount | Cost | Hex | Opcode |
---|---|---|---|---|
Leather Belt | 122 | 366 | 7A | LD A,D |
Hardened Boots | 3 | 0 | 03 | INC BC |
Superlative Boots | 01 | 0 | 01 | LD BC, 0000 |
Bulwark Boots | 0 | 0 | 00 | - |
Optimum Boots | 0 | 0 | 00 | - |
Pack of Name Tags | 76 | 760 | 4C | LD C, H |
Antidote | 3 | 450 | 03 | INC BC |
Potion Kit Bag | 226 | 2260 | E2 | LD (FF00 + C), A |
Collapsible Cauldron | 01 | 51 | 01 | LD BC, 0000 |
Copper Cauldron | 0 | 0 | 00 | - |
Brass Cauldron | 0 | 0 | 00 | - |
Spellbook | 01 | 0 | 01 | LD BC, 0101 |
School Books | 1 | 143 | 00 | - |
Folio Triplicus | 1 | 0 | 00 | - |
Folio Magi | 01 | 0 | 01 | LD BC, 0000 |
Notebook | 0 | 0 | 00 | - |
Curse Book | 0 | 0 | 00 | - |
Harry's Wand | 01 | 0 | 01 | LD BC, 0000 |
Ordinary Broom | 0 | 0 | 00 | - |
Comet 260 | 0 | 0 | 00 | - |
Best Blowing Gum | 49 | 196 | 31 | LD SP, CFF9 |
Pumpkin Pasties | 249 | 2,490 | F9 | - |
Cauldron Cakes | 207 | 1656 | CF | - |
Licorice Wands | 201 | 402 | C9 | RET |
Possible improvement:
- The blue deck, "Gulliver Pokeby" Deck, has Sickle Seek. This quadruples the amount of sickles gained after battle. The flag only gets reset at the start of the next fight, so it should be possible to use it for duping. However, I'm not sure how to get enough cards for it before the giant rat fight to make a difference.
- The RNG can be improved. Right now, there's some delay to make sure the following:
- The giant rat fight results in 2 critical hits from me.
- The giant rat fight results in a drop of 1 pair of hardened boots only
- NPCs wont move in to my way
- The next time I used cards, there will be no drop, to prevent crashing
- The frog fight needs to have at least 1 critical
- The frog fight needs to drop item 127, "Yes" to get OoB later
- The last encounter must have a layout that doesn't result in HALT, or invalid opcode in C000 area.
I do not understand the RNG enough to manipulate it outside delaying. There might be a way to get better RNG.
- The "Yes" item actually jumps to C000 when used. That's where battle sprites are stored. I don't understand the game enough to make it jump to inventory, but if that was possible that bypasses the need to move OoB entirely.
- The final payload can be changed from C9 (201, for RET), to C8 (200, for RET Z) for Licorice Wands. This would save 48 frames from having to buy a single Licorice Wand at the end, but I was not able to get "Yes" to leave the battle when I tried resyncing it. If anyone wants to try, here's the wip up to the fight at the end: https://tasvideos.org/UserFiles/Info/638317929758634206
- The final opcode before return is LD SP, $CFF9. This is needed, since the game crashes due to corrupted stack. If a lower value for SP can be found, or a function that magically fixes the stack appears, it can potentially save time from having to buy over 200 candies twice.
arkiandruski: Claiming for judging.
arkiandruski: Looks good. Accepting as a fastest completion
despoa: Processing...