Unterminated name glitch item

From Glitch City Wiki
Jump to navigation Jump to search
DHNhlT4 89 ゥ N (0x74), an unterminated name glitch item, as it appears in Yellow.

An unterminated name glitch item is a glitch item with a name that doesn't end with the terminator byte 0x50.

Depending on a copy of the game's screen data that is saved after actions such as when the items menu is opened, pressing A on the item will cause the corruption of bytes at memory address CF4B and onward. If there is no 0x50 sub-tile present on the screen the game will likely freeze due to the corruption being too long. (The game will attempt to continue reading the name of an item, attack, or other string of text until a terminator byte is found, and so unterminated name glitch items cause the game to keep reading input beyond where the item name would normally end. See wram.asm for more details.)

They are useful for multiple glitch techniques, such as LOL glitch, instant encounter infinite chain glitch, LGFly and Yami Shop glitch.

In Pokémon Red and Blue, normally when used in a battle with non-corrupted tiles these glitch items will cause the TMTRAINER effect. In Pokémon Yellow, normally when used in a battle with non-corrupted tiles these glitch items may cause the game to freeze.

Possible side effects in Red/Blue

  • Corruption of the player's sprite
  • Corruption of the player's walking animation
  • Encounter with The Hooked Metapod
  • May act like glitch item 8# 8 (hex:7C) is 0x50 sub-tile is past y=08, x=02 (a screen data saving glitch item)
  • May make music fade out (and) play a sound effect.
  • May make the Start menu invisible
  • Selection of an item may be forced
  • TMTRAINER effect in battle
  • Yami Shop glitch

Possible side effects in Yellow

  • May freeze the game in battle
  • Yami Shop glitch

Obtaining the effects with other types of items

This article is incomplete. Please feel free to add any missing information about the subject. It is missing: {{{1}}}.

WARNING: The method explained below poses the risk of save corruption in the Nintendo 3DS Virtual Console releases, since it requires being performed right after saving and resetting. Read further for methods for avoiding the save corruption.

It's possible to obtain the effects of pressing A on unterminated name glitch items with both normal items and non-unterminated glitch items.

For this, it's necessary to have glitch item 0xFF (CANCEL) at the beginning of the item pack, and the item to be used in the second or third slot, so that the item name is hidden by the CANCEL option and the screen does not scroll down when selecting them. Another requirement is to perform this right after saving and resetting, and not having opened any other menus (Pokémon, Pokédex, PC item/Pokémon boxes etc. - except for the trainer card, see below) before opening the item menu or the PC item box where the setup is performed.

By fulfilling these requirements, and pressing A on the item that's hidden by the CANCEL button, the same effects described earlier can be obtained without the use of an unterminated name glitch item.

NOTE: This method may not work for glitch item 0x00 or glitch items with high index numbers depending on the game state and the condition of the save file, since the game can end up landing on the actual table of item names for those by chance.

Avoiding save corruption

To avoid save corruption in Nintendo 3DS Virtual Console: before performing the glitch, open the trainer card screen to load the player's sprite, which will load SRAM bank 0 and avoid the save file from being corrupted without disrupting the glitch.

Another alternative to avoid save corruption in the 3DS VC is to view the sprite of one of the Museum fossils in Pewter City, which will also load SRAM bank 0.

Explanation

When the player selects the item in the item list using the A button, the game fetches the name of the item to be later copied to the internal buffer at memory address CF4B. For this, the game uses a routine called GetName, which is used not only for item names but also for names of Pokémon, moves and trainers. This routine uses a variable called wNameListType to distinguish which kind of name should be fetched (where valid values range from 1 to 7 - some values are unused).

It turns out that in this case, however, the game does not set the value of this variable before calling this function, because it would have already been set to the correct value when reading item names to draw to the screen when showing the item list. By having the CANCEL button at the beginning of the item list, however, no actual item names are drawn to the screen and this variable is left uninitialized, containing whatever value it had before the item list was brought up. After a reset, it holds the value 0, which is invalid and leads to the game trying to read item names from an invalid location, reading garbage data which results in the names copied afterwards being unterminated.

If the method is performed without first saving and resetting, but right after a battle, names of moves will be used. If the item below the CANCEL button is item 0x00, the move ID used will be for move 0x00, which will also cause the unterminated name effects.

This article or section is a stub. You can help Glitch City Wiki by expanding it.