Jump to content

Unterminated name glitch item: Difference between revisions

m
(Added section documenting findings on unterminated name effects without unterminated name items)
Line 34:
 
=== 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, that 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.
20

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.