Main Menu

Databases

Major Glitches

Other Glitch Categories

References

Useful Tools

Affiliates

Search Wiki

Toolbox

Glitch City RAM manipulation
 Page | Discussion | View source | History

From Glitch City Laboratories

(Redirected from Glitch City RAM Manipulation)
Jump to: navigation, search
Major glitches of the Pokémon series

Arbitrary code execution (template, remote, cart-swap) | 2x2 block encounter glitches (Left-facing shore tile glitch (in-game trade shore encounter trick, old man trick, Trade link up shore encounter trick, Fight Safari Zone Pokémon trick)) | 99 item stack glitch | Bad clone glitch (????? party overloading (????? map corruption, | Celebi trick, Celebi Egg trick, Shiny Celebi trick, glitch move map corruption, overloaded party map corruption, Glitch Unown (Glitch Unown map corruption) Duplicate key items glitch (infinite items and item creation, expanded Balls pocket (TM/HMs outside of the TM/HM pocket, Glitch Pokédex categories)) | Berry glitch | Bug-Catching Contest data copy glitch (Japan only) | Cloning | Ditto DV manipulation | Elite Four door glitch (Japan only) | Generation IV item cloning glitch (Japan only) | Glitch City (Safari Zone exit glitch, RAM manipulation) | Infinite Master Balls (Colosseum) | Large storage box byte shift glitch (storage box remaining HP glitch, maximum stat glitch) | Item duplication glitch | Item stack duplication glitch (Generation I expanded items pack (Glitch Rocket HQ maps, Map FE (English and non-English European Yellow), Map script pointer manipulation (arbitrary code execution, map script pointer item ball manipulation), Text pointer manipulation (arbitrary code execution, item ball manipulation, mart buffer overflow), Trainerless instant encounter glitch) | Mimic glitch (Japan only) | Out of bounds Glitch City (Generation II) (Slowpoke Well out of bounds corruption (French version)) Lumiose City save glitch | Pikachu off-screen glitch (Trainer corruption glitch) | Pokémon merge glitch | Pomeg glitch (Pomeg corruption glitch) | Roaming Pokémon encounter glitch | (Mimic) Transform Rage glitch | Select glitches (Japan only) (Closed menu: Dokokashira door glitch (international), Fossil conversion glitch (international), Second type glitch, Skip to Level 100 glitch, Trainer mutation glitch, walk through walls (international) Special menu: Lift glitch, Badge describer glitch) | Sketch glitch | SRAM glitch (Generation I) (255 Pokémon glitch, send party Pokémon to a new game) | Surf down glitch (Grass/rock Surfing glitch (Spanish/Italian only) (English)) | Time Capsule exploit | SRAM glitches (Generation II) (Mailbox glitches, Mystery Gift item corruption, Trainer House glitches) | Tweaking | Trainer escape glitch (Death-warp, Mew Trick, Ditto Trick, Experience underflow glitch) | Buffer overflow techniques (Japanese unterminated name glitch item instant encounter glitch, LOL glitch, Rival LOL glitch, Instant LOL glitch, RAM LOL glitch, oobLG, blockoobLG, Instant encounter infinite chain glitch (LGFly)), Super Glitch (Generation I) (party remaining HP glitch), Super Glitch (Generation III), Text pointer manipulation mart buffer overflow glitch, CoolTrainer♀-type move, Double distort CoolTrainer♀ corruption, Yami Shop glitch) | Walk through walls (ledge method, museum guy method, Rival's effect, Select glitch method (international), Brock Through Walls) | Zapdos LV68 glitch | ZZAZZ glitch (party Pokémon box data shift glitch)

(view, talk, edit)
PRAMA Initiative a également une page sur Glitch City RAM manipulation.

Glitch City RAM manipulation is a glitch that allows the player to edit RAM by cutting trees in a specific Glitch City, named RAM City. This allows the player to change a value in RAM from a specific set to another specific value.

Uses

Using this glitch, the player is able to edit arbitrary bytes in RAM. However, there are restrictions :

  • Only a few fixed values can be changed.
  • Each of these values change to another fixed value.
  • Not every byte can be changed this way.

General pattern

The glitch is essentially three steps :

  1. Accessing the RAM City
  2. Finding the correct place
  3. Cutting the tree.

The only true requirement is the ability to CUT. The current methods of accessing the Glitch City currently require the player to access Fuchsia City, but a method only requiring Pewter City will maybe be developed.

Accessing the Glitch City

TheZZAZZGlitch's method

This method is simple to perform, and only requires the player to have enough money to access the Safari Zone and the ability to SURF. Its downsides are that the player has less options when it comes to choosing their RAM address, and also has to have beaten Koga and found the Secret House.

  1. The player must perform the Safari Zone exit glitch, being called by the PA on Sea Route 20 (the place the player is when being recalled does not matter).
  2. Upon exiting the Safari Zone gate, the player should be standing in the Sea Route 20 Glitch City.
  3. The player should step south once, the go left until they are two steps above a cave. Going any further left will trap the player in a glitched area.
  4. The player should be stuck. If so, press Up to face north.
  5. Then, open the START menu. If done correctly, the map should be flooded with water.
  6. The player should SURF, then move right.
  7. The player will be in the RAM City, at coordinates ($6C ; $63)

Krys' method

This method offers a wide range of manipulable addresses, but it requires the player to perform Walk through walls.

  1. Perform any method of Walk through walls.
  2. The player should stand here :
    GCRM entry point.png
  3. The RAM City can be accessed by walking left until the player is standing on water ; the player will be at coordinates ($DC ; $63).

Reaching the correct place

Each method place the player at different coordinates ; any coordinates correspond to a 2x2 tiles block, which correspond to a byte in RAM. Here is the formula :

Target address = $C721 + $38 * (floor(Vpos / 2) + 2) + (floor(Hpos / 2) + 2)

Note that the same address is targeted by moving 1 step up or 38 steps left !

Coordinates are given like so : (Vpos ; Hpos).

To get the optimal coordinates of address A, do the following :

  1. Subtract $C721 from A ; call that B.
  2. Divide B by $38, rounding down ; call that C.
  3. Multiply C by $38 ; call that D.
  4. Subtract D from B ; call that E.
  5. Your destination coordinates are (C*2 ; E*2) !
Actually, these aren't the optimal coordinates... you can sometimes save some walking left by going one less time up. Oh well.

Here is a relative map of data in the Glitch City : (each square is a 2x2 tile block)

Ram-grid.png

Cutting the tree

The player should find a cuttable tree in one of the following coordinates : (C*2 ; E*2), (C*2+1 ; E*2), (C*2 ; E*2+1) and (C*2+1 ; E*2+1). Cutting it will change the byte in RAM, and that's it !

Side note : the player may find, instead of a cuttable tree, a patch of wild encounter grass. Did you know this grass can be CUT in Gen 1 ? Now you do.

Possible values

Obviously, we need the value of the byte we want to change to spawn a cuttable tree. Good news, there is a few values that do just that.

Here is a conversion table for hex value <-> 2x2 tile block, called the TileBlockDex :

TileBlockDex.png

You can see that a few blocks have CUTtable trees on them ; they are summarized in the tables below.

Hexadecimal conversion table :

Value... 0B 32 33 34 35 60
will become... 0A 6D 6C 6F 4C 6E

Refer to The Big HEX List for corresponding Pokémon, Items and Attacks.

Decimal conversion table :

Value... 11 50 51 52 53 96
will become... 10 109 108 111 76 110

Applications

WARNING : here, a $ prefixed to a number means hex:(that number). So $99 is not 99 dollars, it is hex:99.

Earning money

This is the simplest thing to do, and yet there is a quirk. Money isn't stored the same way most other numbers are : it's stored in a BCD way : each hexadecimal digit corresponds to a decimal digit : basically, $63 <=> 63 ($3F), $99 <=> 99.

To say it in another way : an amount of $999999 corresponds to one million minus one.

Let's say you have 123456 money ; the game stores this internally as $123456, that is, the three following bytes : $12, then $34, then $56. You can "cut" the $34 to turn it into a $6F. You now have $126F56 money internally. How much is that ?

Strangely, emulators (at least VBA) and console seem to exhibit different behavior : VBA considers this as 126956 money (that's still a nice gain), but consoles consider this as 127556 money (1 * 100000 + 2 * 10000 + 6 * 1000 + 15 * 100 + 5 * 10 + 6 * 1), which should be the correct behavior. See this topic for more.

Capturing Pokémon

This one is more intricate, as you don't directly see the values you're going to manipulate.

See, Pokédex flags are grouped by 8 and stored as bytes. Thus, you can "trade" some flags for others.

Example : have Ivysaur and Venusaur captured, but not Bulbasaur, Charmander, Charmeleon, Charizard, Squirtle and Wartortle. This way, the first byte in the Pokédex will be $60. Cut the corresponding map block, and it will turn into a $6E, which means you will have "captured" Ivysaur, Venusaur, Charizard, Squirtle and Wartortle, but not Bulbasaur, Charmander and Charmeleon.

The method to get a conversion pattern is simple if you know a bit of the RAM map and Pokédex order. It won't be described here.

Manipulating items

Accessing the pack : 34 left (36 in Pokémon Yellow), 115 steps up. Accessing the item PC : 60 left (62 in Yellow), 95 steps up.

When at this position, you will be facing a tile block that corresponds to the number of slots you can access in the corresponding item list.

The block to its right corresponds to the ID of the first item in that list, then there is the quantity, then the second item's ID then its quantity, and so forth.

Item mutations

This is not as interesting as you might imagine : items with ID 6C, 6D, 6E and 6F are glitch items that haven't been found a use yet (even though one of them executes code depending on tile data).

You can also turn a Revive into an Old Rod (side note : you can have multiple Old Rods in one stack this way, which won't work well with the PC), or Antidotes into Moon Stones.

Item duplications

Cutting a tree corresponding to a quantity will change it according to the above tables ; however, item underflow cannot be achieved this way. You can still turn your 50 X Accuracies into 109, then sell 59 of them, and repeat.

Pack / PC length manipulation

There are two applications : one usually useless, and one that was groundbreaking when it was found out.

The useless one :
If you have exactly 11 items in your pack / PC, you will find some CUTtable grass. Cut it and the last item in your inventory / PC will disappear.

The useful one :
If you have exactly 50 items in your PC (you filled it), you will find a tree. Cut it... and you will be allowed to access 109 slots in your item PC, which is a partial expanded item pack. You can then retrieve a stack of 255 items (Casino Chips are good for this) to perform a full expanded pack with your inventory.

Beware : depositing items has very high chances to corrupt some game data.

To fix the number of items in the PC, you can either retrieve 59 items from your PC (difficult) or use Arbitrary code execution (longer but 100% safe).

Manipulating Pokémon

Ready for genetics ? Prof Oak will be mind-blown.

You can change about everything in a Pokémon's structure. Boy is it useful ! But you'll have to walk.

Changing species

This is more complicated than it seems, because you're going to create an unstable hybrid Pokémon, with the original Pokémon as the donor, and the new Pokémon as the recipient. (Read the article if you don't understand these terms, as well as a method to fully obtain the desired Pokémon)

To change the species of your 5th party Pokémon, go 90 steps left (92 in Yellow) and 123 up. Refer to The Big HEX List to find out who can be converted into who. (Example : Lickitung into Exeggutor)

Changing attacks

Now it's time to reconfigure your beloved Pokémon's brains. Yup.

(Note : that may actually be between 14 and 16 steps. Testing required.) To access the region representing your Pokémon's attacks, do 8 steps right.

Example of modification : turn Flamethrower into Solarbeam ! Gives a Fire Pokémon a good defense against Water-type Pokémon.

Changing EXP

Go 66 steps left (68 in Yellow) and 123 steps up to reach the first byte of your 5th Pokémon's EXP. They are stored in a big-endian order ($01, $00, $00 equates to $10000 = 65536 EXP)

Right of EXP are EVs, followed by IVs, in this order : HP EV, ATK EV, DEF EV, SPD EV, SPE EV, ATK/DEF IV, and SPD/SPE IV. If you cannot edit them, at least you can visualize them, using the TileBlockDex.

If you modify IVs or EVs, the stats won't be re-calculated ; you must either deposit the Pokémon in the PC for the stats to be recalculated, or level up.

Changing stats

Due to the way out of bounds works in this game, it is not possible to change your 5th Pokémon's stats.

But it is possible to change your 6th Pokémon's stats !

Simply go 36 steps left and 121 steps up, and you'll have reached the Max HP stat. All attacks are 2 bytes (2 blocks) wide, stored in a big-endian order, and the attacks are stored in the following order : Max HP, ATK, DEF, SPD, SPE.

Note that you don't affect your IVs nor your EVs ths way, so having the game recalculate the Pokémon's stats (see end of previous section) will have your changes reverted.

Note that it is perfectly fine to switch Pokémon while in the Glitch City ; but the screen won't be refreshed, so you will have to either open the START menu (temporary) or move away, then back (permanent).

External links

YouTube video by TheZZAZZGlitch
YouTube video by ChickasaurusGL