• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 29, 2024, 02:22:50 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


Deconstructing BATTLE.BIN

Started by FFMaster, October 18, 2014, 08:33:12 am

FFMaster

THIS IS A WORK IN PROGRESS. IF YOU CAN CONTRIBUTE ANYTHING SUCH AS TESTING THE INFORMATION IT WILL BE APPRECIATED.

The goal of this project is to deconstruct the data table at 0x676a8, which is the entire backbone of BATTLE.BIN. Knowing which routines are loaded will improve speed and knowledge of hacking, meaning we can do even more wondrous things. FDC believes hacks such as being able to cancel Move commands will be easily achieved if this information is decoded.

These are my own notes that I put together in about 3 hours of breakpointing with Write command only. I only hope it's readable for those who need to understand.

0x960e4 change patterns
- this data location seems to be important for some reason. i personally suspect that this number tells
which routine to load to make FFT battles function. Things such as music, menus and all that.

CURRENTLY KNOWN LOAD SPOTS
-0x79c00(BATTLE.BIN)
- This is the area which uses 0x960e4 to set r2 = predetermined location in a data table, which the game then jumps to.
The data table starts at 0x676a8

CURRENTLY KNOWN WRITE SPOTS (STARTS AT THE ORI [unless otherwise noted], WHICH IS THE VALUE STORED)
NOTES: It is currently unknown why 0x960e4 is loaded and saved as a word, instead of a byte.
   So far, all write spots have been observed to be single bytes.

0x8c36c - This happened after I accepted a team at Formation. Music had not started yet.
ori r2,r0,0x3a

0x71144 - This happened after music started. I believe the map had not been shown yet. Was in mid-rotation of map if i remember correctly. Please test.
ori r2,r0,0x27

0x70c44 - Pressed confirm while not highlighting any unit, also happens after completing move
ori r2,r0,0x03

0x713d0  - selecting the active unit.
ori r2,r0,0x04

0x71478 - every time you select a unit, and there are choices. For example, selecting one of your own non active units, or checking enemy unit status. Number does not change if you go deeper into the menus
ori r2,r0,0x04

0x715b8 - pressing select to read further information on an action command or status screen. Basically any time while the above is true
ori r2,r0,0x06


0x715f8 - Pressing Cancel on a unit to check how far they can move.
ori r2,r0,0x07

0x71678 - Pressing Triangle to bring up the AT, Unit list and Options. Does not change if you go deeper into the menus unless you select a unit in AT list.
ori r2,r0,0x08

0x716ec - pressing select while in the AT, Unit list and Options. Pressing Select while in Unit List does not change number.
ori r2,r0,0x09

0x71738 - Selecting a unit in the AT list.
ori r2,r0,0x0a

0x717e0 - Pressed "Move" Command
ori r2,r0,0x0c

0x718f4 - Pressed Circle to remove the reminder on how to move a unit, also after removing "Select within movable range" box
ori r2,r0,0x0d

0x7193c - "select within movable range" box appeared. selected tree (unpathable) as movement location. works for spaces outside of range as well
ori r2,r0,0x0f

0x71994 - selected a spot within legal distance (blue square)
ori r2,r0,0x10

0x71ac8 - blue squares disappeared, unit walks to location
ori r2,r0,0x11

0x71b60 - unit finishes walking to location "are you sure you want to move here?" box appears
ori r2,r0,0x12

0x72484 - begin choosing facing for Wait
ori r3,r0,0x13

0x725e8 - Choose Wait action, or Move/Act used up
ori r2,r0,0x14

0x71f30 - confirm move command
ori r2,r0,0x15

0x72b60 - chose "Attack" command
ori r2,r0,0x16

0x74518 - happens right before red boxes appear for targetting
ori r2,r0,0x17

0x74480 - choosing out of range target location
ori r2,r0,0x18

0x743d4 - choosing valid location (red box)
ori r2,r0,0x19

0x745bc - confirming location, "Executing action" box appears
ori r2,r0,0x1b

0x73ff4 - Execute action chosen
ori r2,r0,0x1c

0x74214 - ????happened during Mimic
ori r2,r0,0x1e

0x74b0b - Something about Mimic
sw r17,0x60e4(r1) r17 = 0x1d    //(My complete guess is that it's a right hand attack data store)

0x7418c - happens right after choosing Execute
ori r2,r0,0x1e

0x71c9c - happens right after confirming move command, attack command
ori r2,r0,0x25

0x72ae0 - also happens after confirming move command or attack command, happens after 0x71c9c
ori r2,r0,0x26

0x71144 - ???? happened for me before and after Mimic action
ori r2,r0,0x27

0x734d0 - finish Attack command, happened 3x in a row
ori r2,r0,0x28

0x73a78 - ???? Something about Mimic
sw r19,0x60e4(r1) r19 - 0x29

0x73a78 - also happens after executing command, happens after 0x7418c
sw r19,0x60e4(r1) - r19 = 0x29 at the time

0x73fc4 - happens after 0x73a78, unit status at bottom of screen almost completely disappeared. Means one of the previous menus was to hide the unit status
ori r2,r0,0x2a

0x73f74 - ???? Only during Mimic
ori r2,r0,0x2b

0x73bac - unit status compltely gone, unit is about to attack, this section will happen twice for 2 swords attacks
ori r2,r0,0x2c

0x72bf4 - happens right after 0x73bac, unit attacks, this section will happen twice for 2 swords attacks
ori r2,r0, 0x2d

0x732cc - attack finishes, this section will happen twice for 2 swords attacks
ori r2,r0,0x2e

0x72cec - unit stands straight, break happened twice in a row, goes back to 0x73bac for 2 swords
ori r2,r0,0x2f
  • Modding version: Other/Unknown
☢ CAUTION CAUTION ☢ CAUTION CAUTION ☢

Choto

Here's what I've found looking into it in the past. It does seem to tell the game what to do next and would probably let us do some cool stuff if we figured it out. However I take that word "easily" with a grain of salt.

This file was made using my jalfinder program, it lists all the jal's that the routines have in them. That way you can (hopefully) get a better idea of what the routine does without annotating the entire thing.

here's some other data you may have already:
800960e4 - (set to 0x28 after prepping earned Exp/JP) (Word)
         set to 0x2b after prepping ability effect?
         Type of display - Has something to do with what display function is happening

         0x2b - ability Effect
         0x29 - Action being taken?
         0x28 - Exp/JP
         0x1b - Action confirmation
         0x19 - Targeting, Target selected
         0x18 - Select within firing range
         0x17 - Targeting, no target selected
         0x16 - Specify target with cursor message (pre-targeting) / Can't execute action, no targets from panel
         0x14 - Specify Direction for wait message
         0x13 - Selecting direction for wait
         0x08 - AT / Unit list / Options
         0x04 - All menus + status screen
         0x00 - Moving around battleground with cursor (Free cursor)

800960e8 - value of 800960e4 stored here         


btw, at least upload routine descriptions onto the wiki when you figure them out. I really don't understand why I'm the only one that uses it... it makes things a billion times easier.

also, the compiler is likely the reason why it's stored and loaded as a word. I've seen this done with other data too.. they may have just declared it as a word instead of a byte or something like that.