Red/Blue glitch stat data (StatDex) (work in progress)
Posted by: Torchickens
Date: 2017-12-19 19:47:18
As has been done countless times over the years here on Glitch City Labs, here is the start of another Dex project. :)
I'm unsure how to check the addresses for the user and foe stat modifiers for the relevant glitch stat, (an educated guess would say it is at CD19+(ID) for player stat mods and CD2D+(ID) for foe stat mods) though, nor where the stat is actually stored, so due to those complications I decided to simply look for methods of changing the stat name.
There are three different stat name databases in Red/Blue, as such:
1. [SOURCE: OFFSET $DF2E (03:5F2E). Used for vitamins like HP Up.]
HEALTH [0x50]
ATTACK [0x50]
DEFENSE [0x50]
SPEED [0x50]
SPECIAL [0x50]
;How to research: Set a BGB breakpoint to 3:5E46, change the a register to your desired index number. (Health is ID 01).
2. [SOURCE: OFFSET $12B3A (04:6B3A). Used on the status screen.]
ATTACK [0x4E]
DEFENSE [0x4E]
SPEED [0x4E]
SPECIAL [0x4E]
3. [SOURCE: OFFSET $3F69F (0F:769F). Used for X (STAT) items.]
ATTACK [0x50]
DEFENSE [0x50]
SPEED [0x50]
SPECIAL [0x50]
ACCURACY [0x50]
EVADE [0x50]
These allow for two different groups of glitch stat names. I don't know about source 2 though as it is just plain text stored one after the other.
How to look up the names for list 3 can be found here.
Set a breakpoint to 0F:768B and use the X item.
Register b will be equal to essentially the index number of the string in the third database (for example ATTACK is 01), and hl will be initially set to 769F (as the ATTACK string can be found at 0F:769F or offset $3F69F). In order to look up the stat name, it seems the game searches through the database until it finds a 0x50 character, decreasing register b by 1 each time until hl lands on the name of the string.
For example, the Defense stat is located at $3F6A6. By the time the game moves on to other tasks, hl is equal to 76A6 hence the game prints it and this is stored in buffer CF4B.
If you modify register b, you can look up the names for glitch stats.