MAX DUO Pokémon Toolkit GitHub

Home / Library

Five new Action Replay codes for Ruby and Sapphire

Rendered from docs/RUBY_CODES.md in the repository.

These five codes came out of mapping the MAX DUO and Datel's code engine, using pret's decompilation for the exact addresses. The big public code lists have Day-Care codes, and ROM hacks change the weather, but we haven't found these particular codes published: the gender-and-ability egg, the battle-weather trick, the new day on demand and the roamer pin. Each one is tested against the game's own code. They're ordinary Action Replay memory writes, so any AR MAX or AR V3 for the GBA can use them, not only the DUO. They work on every English Ruby and Sapphire: v1.0, v1.1 and v1.2. pret's symbol maps show the addresses are the same in all six versions, and so is the master code's hook.

Snow falling in Littleroot Town
Snow in Littleroot Town: Ruby running the weather code through Datel's own engine (Virtual DUO).

The codes

Enter the master code, then the codes you want. Use one weather code at a time, and one egg code at a time.

Code Enter this What it does
Master code (must be on) DE00AAFD 2EBD05D0 Hooks the game where it reads the buttons (0x08000430).
Weather: snow 6D8C247E 19864429 Snow falls outdoors on every map.
Weather: volcanic ash E56AE096 495960EE Ash falls everywhere, as on Route 113.
Weather: sandstorm 36ED3BBE 8EE336DA Sandstorm everywhere, and a permanent sandstorm in every battle.
Weather: downpour 1D1C83F6 4E59B881 Heavy rain everywhere, and permanent rain in every battle.
Weather: drought F270F9F4 2411AE18 Harsh sun everywhere, and permanent sun in every battle.
Weather: thick fog 9A5291D3 A9F9F35A Fog everywhere.
New day on demand AD079B7C E460F818 Each time the game checks the clock (going through a door, for example), it starts a new day.
Instant egg: male, first ability 73074786 05F5DD69 The Day-Care Man always has an egg ready, male, with the species' first ability.
Instant egg: male, second ability ECB5D73A CD72D136 The same, second ability.
Instant egg: female, first ability 43AA81F2 063BEA18 The same, female.
Instant egg: female, second ability 8F12A8CA 81967F07 The same, female, second ability.
Day-Care to Lv 100 4D106990 BCF20C55 13B7BE26 88EBDDE8 Both Day-Care Pokémon come out at Lv 100, learning their moves on the way.
Latios/Latias on Route 101 BB774561 B5CD2DFD The roaming legendary stays on Route 101.

What the new day gives you

The code holds the game's day counter at zero. So whenever the game compares it with the clock, a new day has begun and all of Ruby's daily events run again:

  • a new lottery number, and you can draw another ticket;
  • a new Mirage Island roll;
  • the Shoal Cave items come back;
  • the daily berry gifts can be collected again;
  • the TV and Dewford trends move on.

Some things to know:

  • It needs a working clock (the game must think at least a day has passed since you started). Carts with a dry clock battery won't benefit.
  • Each "new day" counts the full time since the start. Pokérus wears off, though its stat boost stays.
  • Leave it off when you don't need it, because it keeps rerolling.

The egg codes

The game builds an egg's personality value from a pending number in the Day-Care, plus a random upper half. The code sets that pending number, which does two things:

  • The egg is waiting at once, and again every time you collect one.
  • The low byte fixes the gender (0xFE: male for every species that can be male; 0x00: female for every species that can be female). Bit 0 picks the ability.

Nature and shininess depend on the random half, so the code can't fix them. You need two compatible Pokémon in the Day-Care.

Day-Care to Lv 100

The code sets the Day-Care's step counters to 1,640,000, which is the most experience any Pokémon needs for Lv 100. When you take a Pokémon back, the game adds those steps as experience. On the way up it teaches the moves it would have learned and recalculates its stats. The Day-Care charges for the levels gained: about ¥9,600 from Lv 5.

Latios/Latias on Route 101

After the Elite Four, the roaming Latios (Ruby) or Latias (Sapphire) moves to a new route each time you change maps. The code keeps its location on Route 101. That route is small and full of grass, so it turns up in about one wild encounter in four there. It must already be roaming (after the TV news report).

How they were tested

The tests used English Ruby v1.1 (the same RAM layout as v1.0 and v1.2), with every code encrypted exactly as you'd type it in:

  1. Through Datel's own engine. The Virtual DUO launched the game with the codes using Datel's real start-with-codes routine. After 40 seconds of play, every address held its code's value. Weather switched to snow, shown above.
  2. Against the game's own code. On a snapshot of the running game's memory, the game's own functions were run with and without each code:
  3. GiveEggFromDaycare gave a male Zigzagoon egg with personality xxxx01FE and a valid checksum.
  4. TakeSelectedPokemonFromDaycare returned a Lv 5 Zigzagoon at Lv 100; without the code, it stayed at Lv 5.
  5. The day-change routine (UpdatePerDay) did these things. Without the code, it did nothing.
    • cleared the lottery-ticket flag;
    • drew a new lottery number;
    • rolled Mirage Island again.
  6. IsRoamerAt(Route 101) returned TRUE; without the code, FALSE.
  7. The battle weather comes from the game's source: battles start rain, sandstorm or sun from the overworld weather (AbilityBattleEffects, "weather from overworld"). Snow, ash and fog are visual only.
  8. On a real DUO: Ruby v1.2 started from the PC with codes on 28 November, and the money code showed ¥999,999. The new codes are next on hardware.

The scripts are in the repository: tools/codes/codes_rehearsal.py and tools/codes/validate_ruby_codes.py. The codes are also in codes/ruby_sapphire_novel.txt. With a DUO, python duo_codes.py launch codes.txt --write-block starts the game with them from the PC.

Bonus: Professor Birch's aide becomes an IV Checker

The IV Checker in 30 seconds: three demos and how to set it up.

Talk to the scientist in Professor Birch's lab and he tells you your first Pokémon's IVs and their total: the hidden stats the game never shows.

Birch's aide introduces the IV check
Birch's aide, in his lab.
He lists the six IVs
Your lead's six IVs, read from the game.
And the total out of 186
And the total out of 186.

It's 108 lines with the master code, in codes/ruby_sapphire_iv_checker.txt. That's long to type in, but easy to paste or send from the PC with duo_codes.py. How it works:

  1. The aide. The game keeps the current map's characters in a list in memory: sprite, position and the script that runs when you talk to them. One "if" code checks you're in the lab, and one more line points the aide at a new script. His sprite, movement and everything else stay the game's own. While the codes are on, he gives the IV check instead of his usual lines.
  2. The script, in a part of memory the game never uses (the end of EWRAM), is 14 bytes: callnative (run native code), then the game's own message box.
  3. The native code decrypts your lead's IV word itself, using the game's own scheme. The key is personality XOR OT ID, and personality mod 24 says where the IVs sit. It writes the six numbers and the total into the message. It calls nothing in the ROM, so it works on every English version.

python3 tools/codes/iv_npc.py --town makes the other version: a new scientist standing outside in Littleroot Town, on the moving truck's old spot.

How it was tested:

  • The decoder: checked against 24 test Pokémon, one for each data order.
  • The aide: run in the Virtual DUO through Datel's engine. The numbers he gave matched the lead Treecko's real IVs: 10/1/12/9/28/15, total 75.
  • A bug the testing caught: the first build had three instructions the GBA's CPU can't run. The game stalled, and a check now rejects any such instruction.