- 150
- Posts
- 18
- Years
- Netherlands
- Seen Nov 4, 2023
A while ago I set out to make a personal ROM hack that changes all the things I didn't like about Pokémon Emerald. This includes, but is not limited to, ASM hacks. One of the ASM hacks I did was putting back Mystery Event in the menu. I figured I'd write up a tutorial so other peopel can incorporate it in their hacks too, if they want. It's not really useful on its own but perhaps an ASM script can be built for it so it does something completely new, like a new game plus, or loading another GBA rom.
Mystery Event is a special feature only present in Ruby, Sapphire and the Japanese versions of Emerald. It allows you to connect to the e-Reader to download special event stuff like the Eon Ticket and the e-Reader Berries. This tutorial will show how to put it back in Pokémon Emerald (U).
Note: I'm using a random save file I found on Filetrip
When you press Start at the title screen, the game first checks if you have a save file. If you do, then it checks if the Mystery Gift flag has been set. Depending on if you have a save file/Mystery Gift unlocked, the game will load a specific menu value. It then uses that to decide which options will appear in the menu.
Anything higher than 3 returns menu 0. There's no menu with just MYSTERY EVENTS, without MYSTERY GIFT. So in order to unlock Mystery Event, we will have to make the game load Menu 3 instead of Menu 2 if it detects Mystery Gift has been unlocked.
Let's have a look at the routine that checks if Mystery Gift has been unlocked:
At 0x09D4C4 is a subroutine that checks if flag 8DB has been set. If it hasn't, then it returns 0 and the rest of the routine is skipped. If it has been set, the game loads the menu value, adds 1 to it and stores it again. This is what you get:
Remember how the menu with Continue and Mystery Gift came right after the menu with just Continue. So, all we have to do is make it add 2 instead. Now we get this:
(It says MYSTERY EVENTS instead of MYSTERY EVENT. That can be changed with a text hack.)
Try choosing MYSTERY EVENTS and you'll see that it works (it can connect to the e-Reader fine too, but there aren't any e-cards you can use, sadly):
This creates a new problem, though. Try choosing MYSTERY GIFT.
It appears the MYSTERY GIFT button now points to the wrong area. A simple pointer edit should fix that. This is the routine the game uses for finding out where to jump to after you choose an option.
That one is for menu 2. The game first determines which button was selected, then it uses that to figure out where it needs to jump to next.
The game uses a slightly different routine for menu 3.
Here, it first loads the starting address of a list of addresses, then multiplies the button value by 4 and uses it as an offset for the starting address in order to load the address it has to jump to.
If you look closely, you'll see that the two addresses used for Mystery Gift are slightly different. So all we have to do is subtract 0x40 from the second address and then it should be fixed:
Also, you can make it boot straight into the Mystery Gift menu (bypassing the Wireless Adapter check) by adding 0xEC to the address instead. When you try to receive any Wonder Cards/Wonder News, the game throws an error at you, though.
Once you've done all this, Mystery Event should be unlocked together with Mystery Gift since they share the same flag.
Mystery Event is a special feature only present in Ruby, Sapphire and the Japanese versions of Emerald. It allows you to connect to the e-Reader to download special event stuff like the Eon Ticket and the e-Reader Berries. This tutorial will show how to put it back in Pokémon Emerald (U).
![[PokeCommunity.com] Putting back Mystery Event in Emerald [PokeCommunity.com] Putting back Mystery Event in Emerald](https://img202.imageshack.us/img202/892/nomevent.png)
Note: I'm using a random save file I found on Filetrip
When you press Start at the title screen, the game first checks if you have a save file. If you do, then it checks if the Mystery Gift flag has been set. Depending on if you have a save file/Mystery Gift unlocked, the game will load a specific menu value. It then uses that to decide which options will appear in the menu.
Code:
Menu 0
NEW GAME
OPTION
Menu 1
CONTINUE
NEW GAME
OPTION
Menu 2
CONTINUE
NEW GAME
MYSTERY GIFT
OPTION
Menu 3
CONTINUE
NEW GAME
MYSTERY GIFT
MYSTERY EVENTS
OPTION
Let's have a look at the routine that checks if Mystery Gift has been unlocked:
Code:
0802f974 fda6f06d bl $0809d4c4
0802f978 2800 cmp r0, #0x0
0802f97a d002 beq $0802f982
0802f97c 8820 ldrh r0, [r4, #0x0]
0802f97e 3001 add r0, #0x1
0802f980 8020 strh r0, [r4, #0x0]
Remember how the menu with Continue and Mystery Gift came right after the menu with just Continue. So, all we have to do is make it add 2 instead. Now we get this:
![[PokeCommunity.com] Putting back Mystery Event in Emerald [PokeCommunity.com] Putting back Mystery Event in Emerald](https://img710.imageshack.us/img710/9166/meventunlocked.png)
(It says MYSTERY EVENTS instead of MYSTERY EVENT. That can be changed with a text hack.)
Try choosing MYSTERY EVENTS and you'll see that it works (it can connect to the e-Reader fine too, but there aren't any e-cards you can use, sadly):
![[PokeCommunity.com] Putting back Mystery Event in Emerald [PokeCommunity.com] Putting back Mystery Event in Emerald](https://img38.imageshack.us/img38/7450/itworksmaybe.png)
This creates a new problem, though. Try choosing MYSTERY GIFT.
![[PokeCommunity.com] Putting back Mystery Event in Emerald [PokeCommunity.com] Putting back Mystery Event in Emerald](https://img715.imageshack.us/img715/8902/wildproblemappears.png)
It appears the MYSTERY GIFT button now points to the wrong area. A simple pointer edit should fix that. This is the routine the game uses for finding out where to jump to after you choose an option.
Code:
08030338 5ee0 ldsh r0, [r4, r3]
0803033a 2801 cmp r0, #0x1
0803033c d024 beq $08030388 (New Game)
0803033e 2801 cmp r0, #0x1
08030340 dd20 ble $08030384 (Continue)
08030342 2802 cmo r0, #0x2
08030344 d002 beq $0803034c (Mystery Gift)
08030346 2803 cmp r0, #0x3
08030348 d046 beq $080303d8 (Option)
0803034a e01b b $08030384
The game uses a slightly different routine for menu 3.
Code:
08030360 0080 lsl r0, r0, #0x02
08030362 4902 ldr r1, [$0803036c] (=$08030370)
08030364 1840 add r0, r0, r1
08030366 6800 ldr r0, [r0, #0x0]
08030368 4687 mov pc, r0
0803036c 08030370 (start of data)
08030370 08030384 (Continue)
08030374 08030388 (New Game)
08030378 0803038c (Mystery Gift)
0803037c 080303bc (Mystery Events)
08030380 080303d8 (Option)
If you look closely, you'll see that the two addresses used for Mystery Gift are slightly different. So all we have to do is subtract 0x40 from the second address and then it should be fixed:
Also, you can make it boot straight into the Mystery Gift menu (bypassing the Wireless Adapter check) by adding 0xEC to the address instead. When you try to receive any Wonder Cards/Wonder News, the game throws an error at you, though.
Code:
Change the byte at 0x02F97E to 0x02
Subtract 0x40 from the value at 0x030378
Last edited: