Author Topic: FFIX - A question about locating data for weapons and abilities  (Read 15557 times)

LandonRayW

  • *
  • Posts: 37
    • View Profile
I recently started working on FFIX.  I was able to locate and figure out how to alter enemy stats.  Second, I began working on the Directory, which I botched a bit at first.  However, thanks to some very informative posts by Tonberry, Cyberman, Zidane, and Zande, I was able to figure out what I was doing wrong.  I moved on to looking for statistical data for weapons and abilities (attack power, etc.).  This is where I ran into some major problems.  I assumed the data would be stored in the kernel.  I assumed the kernel would be store in Directory 00.  I've looked threw most of Directory 00 and have not found anything resembling a kernel.  If anyone has any information about where or how this data is stored, I would greatly appreciate assistance.
« Last Edit: 2011-12-17 21:48:33 by LandonRayW »

Chev

  • *
  • Posts: 35
    • View Profile
It's most certainly in directory 8, the one with the weapon models, each weapon chunk has 2 files (types 8 and 20) that don't contain graphical data. Would make sense since stuff like monster stats also isn't in the kernel but in the monster directories.

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
I'll give you some general hints;
FF9 splits the user memory into four main parts: two parts for the main execute (SLPS_020.00/SLES-02965 or whatever version/disc), one part that acts like a code segment and one that acts as a data segment, these two parts are always avalible. The other two parts may be switched at any time, the first part is larger and acts as engines or whatnot, the last part is a smaller and may be seen as sub to the engines (though they are independant) and they are all (but one) menu based.
The enigne and submodule parts are what's stored in Directory 0, and this is what they contain:
Code: [Select]
Engines:
 0 = Dummy
 1 = Field
 2 = Battle
 3 = Worldmap
 4 = Tetra Master
 5 = Title
 6 = Blackjack

Submodules/Menusystem:
 7 = Chocobo Hot & Cold
 8 = Equip & Abilities
 9 = Config
10 = Card
11 = Item
12 = Status
13 = Save & Load
14 = Name Input
15 = Party Select
16 = Shop
17 = Dummy
18 = Disc Change
19 = *Movie Module
20 = Victory

Now to go back to the original question. Things like attack power values for all weapons are used by several engine/modules (like battle, shop, equip etc.) so therefore they are usually stored in the main execute so it's always avalible. Though this isn't always the case, the data in FF9 is abit of a mess and sometimes stored in strange ways. Like the enemy data, it's not stored per enemy, but per formation (so changing the values for one enemy doesn't change all occurences of that enemy, only within that particular encounter formation). Also there are other things, like images and strings, that are duplicated several times, like the small character portraits are stored in several submodules (like in the save/load, name input, shop modules).
I'm not sure if I have a pointer for the attack power values in the execute, but even if do have it'd be from the japanese version and different from what version you use probably...

« Last Edit: 2011-12-18 17:10:29 by Zande »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Thank you for the information!  Given problems re-imaging the disc I've been working with the image directly instead of extracting FF9.IMG (930h sectors instead of 800h).  I've noticed that SLUS xxx.xx (whatever it is) is stored before the Root Directory.  I've also noticed that it holds the names for weapons around hexadecimal address 75000.  Ability names seem to be stored at various places in Directory 00.  The first place is in the Battle Module, the second and third are under the Equipment and Abilities section, the fourth seems to be in the Status section, the fifth is some of the last data stored in Directory 00.  These are for Quina's abilities, I haven't check the other character's abilities yet.  So, I am assuming weapon data like attack power is held in the SLUS file.  Where would you think spell power or similar data is stored?  SLUS file or in multiple modules?  Given that the names are held in multiple modules, I'd assume that spell power and the like is also held in multiple modules.
« Last Edit: 2011-12-18 19:00:52 by LandonRayW »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Where would you think spell power or similar data is stored?  SLUS file or in multiple modules?
For PC's, in the SLUS file I would assume, yes. For enemies it's stored within the enemy formation data (directory 5 I think it is).

LandonRayW

  • *
  • Posts: 37
    • View Profile
Yeah, for enemies it is in Directory 05.  Directory 05 works in a similar manner to FFVII's Scene File.  As for PC's, why would ability names be held in multiple modules instead of SLUS file, if the rest of the ability data (except graphical data) was held in the SLUS file?  Then again, Square does like to confuse us.  I guess I might have just answered my own question.
« Last Edit: 2011-12-18 19:21:31 by LandonRayW »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Beats me, though I think ability names are also stored in the SLUS file?
It's abit strange like that, the prices for items are stored in the execute aswell, but the synthesis data and shop inventories are stored in the shop module.

LandonRayW

  • *
  • Posts: 37
    • View Profile
Wow, I guess I've got my work cut out for me.  Thanks again for all the information.  This is going to be a huge help!

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
In the japanese execute (SLPS_020.00) there's a collection of data for all weapons stored from address 0x5E38C. There's 12 bytes for each weapon, and the 6th byte is the attack power value (I don't know what the other values are for, I tried messing around with them alittle, but I didn't notice any changes yet, oh well). The pointer is most likely not the same for the US version (but probably close) and I don't have a copy of so I can't check, but I'll provide the value for the first weapons, should be able to find it by searching for the values...

Code: [Select]
weapon 0 (Cinna's Hammer) = 01 00 25 00 05 0C 00 00 00 00 00 00
weapon 1 (Dagger)         = 05 00 DC 01 01 0C 00 00 11 00 C8 00
« Last Edit: 2011-12-23 13:05:07 by Zande »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Thank you, that's wonderful!  You know what's funny?  I was in the process of altering some enemies, when I noticed that occasionally some of the enemy data is store in the SLUS and Directory 00.  Not much data, just names from what I can tell, and so far only for character based enemies like Steiner and Baku.

Edit: Excellent!  The data is right around 7A600 (around 5E900 in the SLUS file).  Now all that's left is Ability data.  I'm particularly interested in Dragon's Crest, Thievery, Shock, Spare Change, and Frog Drop.  I should be able to track it down, but if you're up to it, I'm sure you could locate it much faster.
« Last Edit: 2011-12-23 20:59:03 by LandonRayW »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Here's next piece of junk/chunk... At 0x5CDCC starts a block of 768 bytes which holds all the AP needed for all action & support abilities. Each ability uses 2 bytes, the second byte is the number of AP needed to master/learn, the first one I think is ID for the ability. Every class (I rather call it, as opposed to character) have 48 abilities each and there are 8 classes stored in this order: Theif, Black Mage, Summoner/White Mage, Knight, Dragon Knight, Blue Mage, White Mage/Summoner, Monk/Ninja.
The 16 first byte of this block (and the data for Zidane's first 8 abilities), looks like this:

Code: [Select]
65 28 66 28 67 28 68 23 69 32 6A 37 6B 55 6C 64

Edit: This block of data may actually be larger, and include temporary/guest character classes, I don't know yet but the other is still correct.

Another Edit: So I tried to use the code form the ability screen to get the MP cost for abilities, and allthough I found them, the MP cost display under the ability screen are stored locally within the ability/equip module, and the MP cost actually used in battle is most likely read from somewhere else... -_-
But I think I've pretty much managed to track down where the battle data is stored aswell...




Ok, so the data for abilities when they are used in battle are read from file 22 in directory 1, @0xBB2B. Each ability uses 16 bytes and there's 192 abilities listed, for a total of 3072 bytes. An identical copy of this data is also stored in the ability/equip module ( 8 ) in directory 0.
The things I found so far:
Code: [Select]
; Target (Bits ???)

; Sub-Dialog (Bits 6-8)
; 0 = None
; 1 = HP MAX
; 2 = MP MAX
; 3 = Status Bad
; 4 = Status Good
; 5 = (illegal)
; 6 = (illegal)
; 7 = (illegal)
0x0000: byte    Target/Sub-Dialog

0x0004: byte    Command ID
0x0005: byte    Coefficient

0x000A: byte    MP Cost

0x000C: word    Animation Pointer
0x000E: word    String Pointer

The data for the first two abilities looks like this:

Code: [Select]
Ability 0 (Void) 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00
Ability 1 (Cure) 33 09 00 20 0A 10 00 00 47 00 06 01 08 00 03 00
« Last Edit: 2011-12-27 14:15:13 by Zande »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Alright, found it.  Mine's not the exact same, but it is pretty close.  I'll play around with it a bit tonight.  Thank You!

Edit:  A couple more things I need to find, enemy resistances (elements and status) and armor data (defense and elemental resistance).  Armor data should be in the SLxx file after weapons, and enemy resists should be in directory 05.  I haven't spent too much time looking for them yet.
« Last Edit: 2012-01-03 11:44:57 by LandonRayW »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Also, I need to locate undead status.

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
I found some basic data for items, not really what you were looking for but you may be interested in it anyway... This block contains 18 bytes for each item, and this data is for all 256 items, for a total of 4608 bytes.
The data layout is something like this:
Code: [Select]
word Name Pointer
word Description Pointer
byte ?
byte ?
byte ?
byte ?
byte Icon ID (0-35 only)
byte Icon Palette ID (0-15 only)
byte ?
byte Base Stat Increase Flags?
byte Ability 1 (0 = None)
byte Ability 2 (0 = None)
byte Ability 3 (0 = None)
byte Flags {
  Bit 1 = Useable
  Bit 4 = Equipable (Add-on)
  Bit 5 = Equipable (Armour)
  Bit 6 = Equipable (Head gear)
  Bit 7 = Equipable (Arm gear)
  Bit 8 = Equipable (Weapon)
}
byte ?
byte ?

The first two items have this data:
Code: [Select]
00 00 00 00 FA 00 08 00 00 00 01 00 00 00 00 80 15 00
05 00 0F 00 40 01 00 08 01 00 01 00 65 00 00 80 16 00

The physical defence/evade and magical defence/evade for equpiment I know pretty much where it's stored but I have to look at it abit more... Atleast it's stored using 4 bytes for each item: physical defence, physical evade, magical defence, magical evade. You may be able to find where it's stored anyway if you know these four values for an item...

The elemental flags for equipment is abit tricky, it may be stored near the defence/evade data, but it's only ever used when in combat I think. It doesn't seems to be stored in the character data nor can you somewhere see if your characters absorbs or nullifies certain elements (except for the static description for items, but is just a text anyway), kinda stange.
« Last Edit: 2012-01-05 13:19:32 by Zande »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Actually, that information is very useful, I'm definitively interested.  I ran some four byte checks for armor, but haven't found anything yet.  Armor stats and elemental resistances would be nice, but locating them isn't really necessary.

Edit:  I'm a bit dumbfounded at my inability to find enemy elemental and status defenses.  The Scene Blocks really aren't that big.  I'm probably staring straight at it, but for some reason I just don't see it.
« Last Edit: 2012-01-06 20:18:27 by LandonRayW »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
I never spent too much time with the enemy data, but the actual enemy chunk looks something like this:

Code: [Select]
0x0010: word    HP
0x0012: word    MP
0x0014: word    Gil
0x0016: word    Experience
0x0018: byte    Drop Item (Slot 1)
0x0019: byte    Drop Item (Slot 2)
0x001A: byte    Drop Item (Slot 3)
0x001B: byte    Drop Item (Slot 4)
0x001C: byte    Steal Item (Slot 1)
0x001D: byte    Steal Item (Slot 2)
0x001E: byte    Steal Item (Slot 3)
0x001F: byte    Steal Item (Slot 4)

0x0022: word    Model ID
0x0024: word    Animation ID 1
0x0026: word    Animation ID 2
0x0028: word    Animation ID 3
0x002A: word    Animation ID 4
0x002C: word    Animation ID 5
0x002E: word    Animation ID 6

0x0036: word    Attack Power
0x0038: byte    Speed
0x0039: byte    Strength
0x003A: byte    Magic
0x003B: byte    Spirit

0x0040: byte    Elemental Guard
0x0041: byte    Elemental Absorb
0x0042: byte    Elemental Half
0x0043: byte    Elemental Weakness
0x0044: byte    Level
0x0045: byte    Class

0x0047: byte    Physical Defence
0x0048: byte    Physical Evade
0x0049: byte    Magical Defence
0x004A: byte    Magical Evade
0x004B: byte    Blue Magic (0x4D-0x64, or 0x00 for none)

Elemental Flags:
Bit 1 = Fire
Bit 2 = Ice
Bit 3 = Thunder
Bit 4 = Earth
Bit 5 = Water
Bit 6 = Wind
Bit 7 = Holy
Bit 8 = Shadow

Class Flags:
Bit 1 = Humanoid
Bit 2 = Beast
Bit 3 = Demon
Bit 4 = Dragon
Bit 5 = Undead
Bit 6 = Stone
Bit 7 = Insect
Bit 8 = Aerial
« Last Edit: 2012-01-09 14:16:42 by Zande »

LandonRayW

  • *
  • Posts: 37
    • View Profile
Excellent!  I didn't have Class, Drops, Steals, Blue Magic, or Elemental Defense.  Thanks, again.