Map 0xFF (summary)

From Glitch City Wiki
Revision as of 17:13, 3 January 2023 by glitchcitywiki>Bbbbbbbbba (Fixed the address of wLastMap in Y.)
Jump to navigation Jump to search
This article is a summary page for different variations of a glitches, etc. when talked about as a whole.
Town Map name: (Blank)

Identifier (HEX) FF
Identifier (DEC) 255
Default track Unknown
Tileset Unknown
Size Unknown
Map type Special map handler,
Freeze glitch map

Map 0xFF is an indoor-outside map handler in Pokémon Red, Blue, and Yellow. When the game locates it, it does not load map 0xFF itself; rather upon following the warp, the actual map loaded is replaced with wLastMap (D365 in R/B and D364 in Y). This handler is stored as a map in wWarpEntries (D3AF onward (D3AE onward in Yellow) and each entry is stored as Y coordinate, X coordinate, exit index, map (or FF handler)).

The coordinates typically pertain to the exit mats in buildings when the player bumps into the wall to leave the map (the way for instance, leaving a Pokémon Center returns the player to the 'last town'). The exit index is a single byte as an index number.

When the game finds it, it is copied into wDestinationWarpID (D42F in R/B and D42E in Y), as well as hWarpDestinationMap (FF8B). The exit index is then used as a basis for loading relevant data (such as coordinates and wCurrentTileBlockMapViewPointer (D35F-60 in R/B and D35E-F in Y)) pertaining to the new map (while the map number is leftover from wLastMap) that the player is going to enter after they leave the old map. (In order to do this, the game also needs to locate the map header from LoadMapHeader using the pointer table at MapHeaderPointers; this function also loads much of the data pertaining to any map).

For example, exit index 0 can be seen as 'position to place the player in the new map #0', index 1 as 'position to place the player in the new map #1' and so on. This is the reason why different exit warps each make the player step down from different buildings, and the cause of Safari Zone exit glitch when wLastMap is no longer Fuchsia City and wWarpEntries still pertains to the Safari Zone gate.

In order for an indoor-outside map to work, W_CURMAPTILESET (D367 in R/B and D366 in Y) must be greater than 0 (overworld tileset); hence indoor-outside warps will be ignored in maps (such as towns themselves) with overworld tilesets.

As a glitch map

As a glitch map, it is a common freeze glitch map that the game attempts to put the player in for stepping out of bounds when a certain connection (North, West, South or East) doesn't exist, usually resulting in a freeze. This is because the game typically loads any unused connection entries as map 0xFF.

It is a reliable way of causing the bar freeze in all versions later than Japanese Yellow v1.0. Namely, Japanese Yellow v1.1-1.3, English, French, German, Italian and Spanish Red/Blue/Yellow.

However, in Pokémon Red and Green (both v1.0 and v1.1), Japanese Blue, and Pokémon Yellow (Japanese) v1.0, it can result in an out of bounds Glitch Hell though more specifically involves an exploitable jump to jp F080 (Echo RAM for D080) (arbitrary code execution).

When D365 or D364 is also set to 0xFF, exiting through an indoor exit may cause the game to simply freeze with a white screen. In Spanish Yellow, map 0x0B may warp the player to a map 0xFF that may either serve as a freeze glitch map or redirection glitch map to Team Rocket Hideout B1F (map 0xC7) valid source map Glitch City.

If map 0xFF typically freezes the game, it may still be possible to 'access' map 0xFF by locking/changing any attributes which contribute to its freezes (i.e. its map height/width to not be too large, its sound bank to be one of the valid values 02, 08, 1F, 20 (28 in Japanese Yellow), W_MAPSCRIPTPTR (D36E-F (D36D-E in Yellow) to point to a script which doesn't freeze the game, etc.).