øAslickproductions.org/forum/index.php?PHPSESSID=a93jpvqe9jutne9agvqo8ht1r1&topic=2043.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe427-4.htmlslickproductions.org/forum/index.php?board=17.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe427-4.html.zxË8h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °V…(OKtext/htmlISO-8859-1gzip8:Ö…(ÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:19:30 GMT0ó°° ®0®P®€§²ð®É8h^ÿÿÿÿÿÿÿÿº:…( FFVA research notes and projects

Author Topic: FFVA research notes and projects  (Read 6048 times)

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
FFVA research notes and projects
« on: May 09, 2015, 12:40:57 AM »
Slightly less than a year ago, I had the idea to hack and mess around with FFV to rebalance the game and make new content, but being more experienced with GBA assembly (and playing the advance version of the game) I did all my work on that version. I have a lot of notes, although not very well organized and a proof of concept patch for a new job (everything complete, i.e. abilities, descriptions, graphics, etc.) With the 2015 FJF looming around soon I'm hoping to get some renewed motivation with the project (although lots of other things keep me busy) so in the meantime I'll post the various things I've found about the game.

Credits: Pretty much all this research was kickstarted thanks to samurai goroh's GBA offset references, Greiga Master's FFV editor/this site's SNES notes for crossreferencing purposes and Jeff Ludwig's FFVA Custom Classes mod, which gave the inspiration for making new jobs and helped locate ROM tables (by crossreferencing patch data.)

Notes
Pointer tables
Berserk notes
Magic level notes
Regen status notes

Unprocessed notes

These notes are various work in progress research I've done; I'm uploading it to give an idea of what I'm aware of regarding the inner workings of FFVA. The notes are in general very brief and will probably confuse you if you don't have prior experience hacking FFVA; Honestly I wouldn't be surprised if they are confusing even if you have hacked FFVA before.

If you have any questions about them feel free to ask about it, I'll try to explain whatever I can remember (some of this stuff I haven't touched in over a year...!!!)

https://www.dropbox.com/sh/7rg03umyeilivuf/AAAaQr-aFw-bQqnK6-mdUtMKa?dl=0

Projects

All patches (just one for now haha) can be patched with this patcher.

Hero Job + misc.

The main feature of this patch is the addition of a new job, the Hero. It currently replaces Gladiator, and borrows ability slots from Cannoneer and Oracle, so those two jobs can't level up. The Hero is a primary weapons user, specializing in esoteric forms of weaponry, but unable to use any form of swords. Their basic ability is !Power Up, which improves their combat prowess in an unpredictable way, and as they level up they can unlock special abilities: Super Strength, Super Armor, Super Speed, and even... !Heat Vision and !Ice Breath?!

The patch also includes various changes to the main engine and gameplay, listed in this changelog.
« Last Edit: December 21, 2017, 02:13:18 AM by x0_000 »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #1 on: May 09, 2015, 12:52:42 AM »
Pointers

Monsters

Monster Table - 0x14d228
Stores most enemy stats. I believe the data should be similar the SNES version, although it might be rearranged differently. Each entry is 36 bytes long.
Monster Item Table - 0x147fbc
Stores the items you get from stealing/drops. Each item is a halfword, and the order is rare steal, common steal, rare drop, common drop.
Monster Release Table - 0x147D14
Determines what spell is cast when a monster is released. Uses a byte ID for spells.

Jobs

Skill Stat Table - 0x155fac
Determines the stats that get passed for !Skills. This does not cover Equip skills, where are in a different table. The stat order is Strength, Agility, Vitality, and Magic, making each entry 4 bytes.
Equip Stat Table - 0x155e10
The table for Equip skills (i.e. any skill that doesn't have !) Order is the same as above.
Job Stat Table - 0x156e04
Determines the stats for a given job. The order is the same as above.
Skill List Table - 0x155484
Determines the skill progression of a job. Each entry is a pointer, pointing to a list. The list is of the form <ABP requirement>,<Skill gained>, each one is represented by a halfword. There is no terminator needed, because the number of skills is determined by...
Skill Count Table - 0x14b1fc
Determines the number of skills are in a job's skill progression. Each entry is a byte.
Job Base Skills Table - 0x15616c
Determines the ! skills that the job can use initially. Four bytes representing skills, with 0 representing an empty slot. Note that this does not affect how many skills you can equip; you can do things like put a skill in slot 3 and then the job can temporarily overwrite it, or remove !Item from slot 4 and then the job can never get a 4th skill.
Job Innates Table - 0x156138
A table that determines what innate abilities a job can learn. Each entry takes two bytes, for a total of 16 possible innate skills. (which can be mixed and matched!)
Job Equipment Table - 0x156E6C
Determines what items a job can equip. Each entry is a word bitflag (4 bytes), with the flags being:
Code: [Select]
0x00000001 - knives
0x00000002 - ninja knives
0x00000004 - swords
0x00000008 - knight swords
0x00000010 - lance
0x00000020 - axe
0x00000040 - hammer
0x00000080 - katanas
0x00000100 - rods
0x00000200 - staves
0x00000400 - ? unused?
0x00000800 - bows
0x00001000 - harps
0x00002000 - whips
0x00004000 - bells
0x00008000 - ? unused?
0x00010000 - shields
0x00020000 - heavy helmets
0x00040000 - light helmets
0x00080000 - dancer helmets
0x00100000 - heavy armor
0x00200000 - light armor
0x00400000 - mage armor
0x00800000 - general armor
0x01000000 - heavy accessories
0x02000000 - diamond/power/silver
0x04000000 - thief gloves
0x08000000 - angel robe
0x10000000 - mage helmets
0x20000000 - not used?
0x40000000 - not used?
0x80000000 - not used?

Items

Weapon Table - 0x155810
Basic stats of weapons. Each entry is 12 bytes long, and the data mostly matches the SNES notes (although the order is changed.) Weapons *must* have ID < 128. The new byte order is 8 9 A B 0 1 4 2 3 5 6 7 (See this doc for the meaning of each index.)
Accessory Table - 0x1468d0
Basic stats of any equippables that aren't weapons. Each entry is 12 bytes long, and I think (need to double check) that the order is the same as weapons. Accessories *must* have ID between 129 and 223.
Item Table - 0x148fbc
Basic stats of consumable items. Unlike the previous two, each entry is 8 bytes long. Consumables can have any ID above 224.

Miscellaneous

Shop Table - 0x1572fc
Determines what shops sell. I don't have what entry corresponds to what shop documented yet, but a person can eventually figure it out with crossreferences. I think they are listed in order of appearance in the game? Each entry is 20 bytes, with 10 halfword entries. The first entry is the shop type. 0 = Spells, 1 = Weapons, 2 = Accessories, 3 = Consumables, 4-7 are not fully documented yet. 4 is used by both Flame/Coral/Angel Ring shops (the one in World 1 and the Mirage Village one that sells additional stuff), 5 is used by the Ninja supply shop (in Lix?) and 6 is used by the Chemist Drink shops. There is also one shop that uses ID 0x83, it seems to be a copy of the basic comsumables shop (selling potions/ethers/status cures and so forth.) I think the 8 part is actually a flag, but I don't know what it does if it is.

The remaining entries are just what the shop sells, with 0 being an empty slot. I'm don't remember if the last entry *has* to be 0 as a terminator, but none of the shops seem to have a 9th item for sale.

Note that there are 5 empty shop entries (they don't sell anything.)
RNG Seed Table - 0x141ab8
This is a array of 256 bytes (all values between 0 and 255 in a randomized order) that is used by at least one of the RNGs (the game uses at least 2 RNGs, one for battles and one for map events.) The basic idea is the game gets a number and looks it up in this table. I vaguely recall looking in a few other Final Fantasy ROMs for this table, and found the bytes in the same order but it's a very vague recollection so it might be incorrect, but it's easy to check.
Gaia Spell Table - 0x1497dc
Determines what spells get used by !Gaia for each possible terrain. Each entry is 4 bytes, one for each possible spell.
Text Pointer Table - 0x36DD54
Points to text data in the ROM. This table is formatted unusually, each entry is a word long which indicates how far (relative to the offset 36dd54) the text begins. Note that the word at 36dd60 is the size of the combined text data. Editing text is very annoying; the next entry indicates when the first entry ends, so editing a text to be longer than the original entry would require repointing everything after, and then fixing all the offsets.
Level Up Table - 0x145A28
Determines the base HP/MP (before modifiers) a character gets, along with EXP requirements for each level. Each entry is 8 bytes long. The first 4 bytes is the amount of EXP required to get to that level, and the next 4 bytes are the HP and MP you get for the level, with 2 bytes for each.
Item Cost Table - 0x1561d4
Determines how much an item sells for at a shop. Each entry is 12 bytes long. I haven't documented this yet, but if you take a glance at it you can determine where the data is located exactly. It's mostly 0s, although there's some nonzero data too?
AI Routine Table - 0x241384
Determines where to find AI Routine blocks. Like the Text table, each entry points to a location relative to an offset (in this case, the offset is 0x241edc.) I don't remember if the next ID is also a terminator for the previous.
Chest Event Table - 0x142000
Determines when you can examine a chest. 8 bytes per entry, the first 2 are the X/Y position of the chest on the map. The 3rd byte determines what kind of reward you get from the chest: 0x0 is Z gold, 0x1 is 50*Z gold, 0x2 is 100*Z gold, 0x3 is 1000*Z gold, 0x4 is 10000*Z gold, 0x20, 0x30 is magic, 0x40 is an item, and values above 0x60 indicate the chest is trapped.

Trapped chests are handled as follows: The encounter from the chest  is a value from 0x0 to 0x3f, and then either 0x60, 0x80, 0xa0, 0xc0, 0xe0 can  be added to indicate if you get an item or magic from the chest. I don't remember which is which, but 0x60, 0xc0, 0xe0 should give the same type and 0x80, 0xa0 should give the other type.

The 5th byte is the ID/value that determines what you get; if the chests gives money it's the Z value, otherwise it's the ID of the spell/item. I haven't determined what the other bytes do yet, if anything.
Trapped Chest Encounter Table - 0x13a474
Determines what fights you get from a trapped chest. Each entry  is 4 bytes, 2 halfword (2 bytes) per chest encounter ID. The two bytes are just the encounter ID that's used for battles.
Chest Location Table - 0x141bb8
Determines which rooms each chest in the Chest Event Table appears in. Each entry is 2 bytes long, and indicates which chest entry to start at. The starting point of the following room determines when to stop, similar to how text is formatted. If the starting point of the following room doesn't appear after the current starting point, no chests will appear (e.g. if room 1 has starting point 2 and room 2 also has starting point 2, room 1 will have no chests.)
Gold Multiplier Table - 0x13c912
Determines the multipliers used for chest gold; the default values are 1, 10, 100, 1000, 10000 (see Chest Events above.) Each entry is 2 bytes long.
« Last Edit: November 08, 2015, 11:39:29 PM by x0_000 »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFVA research notes and projects
« Reply #2 on: May 09, 2015, 08:06:58 AM »
Welcome to our forums! :happy:

I vaguely remember your hack from before. The hero job is interesting, but for the most part the changes are a bit too radical for my taste.

A lot of good information here. You might want to consider using the wiki, as it is more suitable for storing and displaying information.
http://slickproductions.org/slickwiki/index.php/Final_Fantasy_V_Hacking

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #3 on: May 09, 2015, 02:58:53 PM »
Alright, I copied all the pointer data so far into the wiki! I'll keep posting things here too for redundancy.

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FFVA research notes and projects
« Reply #4 on: May 10, 2015, 07:54:21 AM »
Hi there x0_000, I remember you from WWN forums :)

It's always a pleasure for me when people find useful my codes, albeit that the GBA ones are a little lackluster compared to the SNES ones... I think I remember seeing that image with the characters dressed as super heroes, although I've never tried the patch before.

It's always nice to see new faces working in this game, welcome aboard :)
I'm the best in the universe! Just remember! [F-zero X]

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #5 on: May 10, 2015, 11:57:11 PM »
Hopefully as my patch evolves I can encourage more people to try it :o

Berserk notes

There are two ATBs used by the game, one for controlled characters and one for uncontrolled characters. According to my notes, the ATB data for uncontrolled characters starts at 02020a2f.

080ED40A - sets the ATB at the start of the fight for uncontrolled characters. (Primarily berserked, but I suspect Zombified characters also go here.) Defaults to 60 ticks, which is why Berserkers seem to take so long before they act. I guess the developers didn't want zombified hasted characters to murder your party.

080e5f2e - the assembly code around this area sets the ATB when a character gets berserked.

080F1DC0 - sets the action ID for a berserked unit. This is 5 by default, better known as !Fight. If you change this, berserked units do different things, e.g. setting it to !Rapidfire's ID makes berserked units !Rapidfire constantly(!!!) This notably means with enough assembly one can teach berserked units to use !Command skills...
« Last Edit: May 11, 2015, 12:05:48 PM by x0_000 »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FFVA research notes and projects
« Reply #6 on: May 11, 2015, 08:19:19 AM »
There are two ATBs used by the game, one for controlled characters and one for uncontrolled characters.
Ah, so that's why the Berserker slots patch has this problem.
http://slickproductions.org/forum/index.php?topic=1222.msg23050#msg23050
Quote
Agility/Footwork doesn't seem to do anything, as if the job is locked to a low Agility setting.

This notably means with enough assembly one can teach berserked units to use !Command skills...
That would be awesome indeed.
« Last Edit: May 11, 2015, 08:26:42 AM by Jorgur »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #7 on: May 11, 2015, 12:07:38 PM »
I should be a bit more specific and mention that the 60 tick ATB is only set at the start of a fight, after the first action the ATB's value is what it should be. For example, if you give a Berserker Running Shoes/Hermes Sandals (so it starts the fight hasted) it still takes at least as much time as a non-hasted character before the Berserker takes an action, but afterwards the Berserker will take twice as many actions.

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #8 on: May 11, 2015, 08:20:39 PM »
Magic levels

The game records what level of magic mastery a character has when the job and/or secondary skills are picked. The main assembly routine that handles this is at 080FE180; it's a very basic case-by-case check. The only flexibility available without some assembly coding is a table located at 0x157855. This dictates what school and level each skill gives (starting from 0x2c, which is Spellblade.) Each byte records information in halfbytes, i.e. XY means the skill gives level Y in school X. The schools are 0 = Spellblade, 1 = White, 2 = Black, 3 = Time, 4 = Summon.

Red, Dualcast and Dark Arts are hardcoded in the assembly routine.

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #9 on: May 18, 2015, 08:54:54 PM »
Did an update to my Hero job patch, download here or in the first post! The full changelog is in the first post; the additions are:
  • !Dance is affected differently by Dancer specific equipment:
    • The Lamia's Tiara replaces Mystery Waltz with Sword Dance.
    • The Rainbow Dress replaces Jitterbug with Sword Dance.
    • The Red Slippers replaces Tempting Tango with Sword Dance.
    That's right, Dancers can now guarantee Sword Dance by equipping a full wardrobe!
  • HP +10% is now HP +500, i.e. a straight +500 increase to your current HP. Similarly, MP +10% is now MP +100. Helpful for low level runs!
  • Whips now deal critical damage (2x base damage, enemy defense reduced to 0) when then enemy is asleep, paralyzed, slowed or stopped.
  • Stray Cats cast Hastega on !Release.
  • Black Goblins cast Megaflare on !Release. Beware their power!!!

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #10 on: May 25, 2015, 02:22:01 PM »
Another patch update, although mainly to fix a bug I accidentally introduced that messed up Mind Blast... I took the oppurtunity to add some new stuff though! The additions in this version are:

  • The Osafune casts Quick when used as an item, and breaks if you do this. (The Osafune is a Katana available at Surgate Castle in World 2.)
  • The Magus Rod boosts the Water element.
  • Berserkers (and berserked characters) are capable of using certain !Commands in battle if they have them equipped. The valid !Commands they can use are:
    • !Focus
    • !Mug
    • !Jump
    • !Lance
    • !Aim
    • !Rapidfire
    • !Dance
    • !Mineuchi
    Now they can use slightly more abilities!
  • Carbuncle is guaranteed to drop a Reflect Ring.
  • Monks now counter 90% of the time, up from 50%.
  • Monks have a x1.5 damage multiplier at full health (This multiplier should be calculated before defense is subtracted.)
  • Monks have innate Regen. (Both this and the previous monk changes were actually in 0.3 but not documented. Whoops!)

I also updated the byte order for weapon data after sitting down and figuring it out.
« Last Edit: May 25, 2015, 02:28:22 PM by x0_000 »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #11 on: June 26, 2015, 09:01:01 PM »
Some notes about the Regen status:

080E1AA4 - sets the ATB for Regen (possibly other time based status effects too?) At 0xe1aac there is a 0x6e (110), this value minus magic is the ATB for Regen for the character (so high magic characters regenerate HP faster than low magic characters.) At 0xe1ab0 and 0xe1ab4 there are 0x1e values (30), this is the minimum ATB allowed, so even if you have more than 80 magic the game will limit your regen rate to 30 ticks.

080E12A4 - the game calculates the amount of HP to heal every time the regen ATB hits 0 here.

0xe1266 - the value here is 1 less than the min regen ATB value (so 0x1d in the game.)
0xe126a - the value to set if the regen ATB is less than or equal to the value at 0xe1266.

0201fbd1 - Holds the regen ATB for the character in position 1.
0201fc55 - Holds the value to set regen ATB after it reaches 0 for the character in position 1.

Zanerus

  • FF5 Hacker
  • *
  • Posts: 38
    • View Profile
Re: FFVA research notes and projects
« Reply #12 on: August 21, 2015, 05:58:38 PM »
Just looking at these notes is making me want to get back into hacking.

Well i was messing around with some of the offsets to see how your notes worked, and while i learned nothing useful from the Jobs or skill notes I did learn that treasure has a pool of around 64 fights, 60-9F with each version rewarding either an item or spell, and the other version A0-FF rewarding the other. I will admit to not being the best at finding pointer lists however.
« Last Edit: August 22, 2015, 07:04:05 AM by Zanerus »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #13 on: August 23, 2015, 11:07:02 PM »
The game handles the byte data starting at 080AFA3A; It's a branch table that uses the upper 7 bytes to determine what happens. I started disassembling it (I pasted my notes here, the relevant code starts at line 186) but I haven't looked into the trapped section yet.

Edit: After doing some debugging, it looks like the exact format is that you use 0x6,0x8,0xa,0xc or 0xe to indicate if it's trapped, and then the lower 6 bits (a value from 0x0 to 0x3f) determines the encounter you get. The game does a branch depending on whether 0x40 is a raised bitflag (i.e. it separates 0x6, 0xc and 0xe from 0x8 and 0xa), which I would guess is the item in the chest. If I recall correctly there aren't any trapped money chests so it probably determines if the chest gives magic or an item.

Each chest can have at most 2 encounters, with 190/256 odds separating the two. I haven't confirmed it yet, but it's likely that 0x13A374 is the table for the encounter IDs (4 bytes per entry, 2 bytes per encounter.)

Edit 2: Confirmed, 0x13a374 is indeed a table for encounters. The game adds 0x40 to chest encounter IDs, so if the ID in the table is 0x4, the game would consider it 0x44, so the encounter data for chests starts at 0x13a474.

For reference purposes, 0x13a504 are the 2 encounters for the Greenhorn trapped chest in Tule (Fight against a single Goblin.)
« Last Edit: August 23, 2015, 11:26:56 PM by x0_000 »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FFVA research notes and projects
« Reply #14 on: August 24, 2015, 05:48:42 PM »
Added the location where the game stores job equipment restrictions (as well as the corresponding flags) and updated yesterday's notes to the pointer post.