Effect Files

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Follow this link to view the graphics used by the actual effect files. They can be also be found within the Effect directory in an extracted iso or in Shishi Sprite Editor's more recent versions, in the Other images tab.

A thorough reading of this topic will provide information on editing these: http://ffhacktics.com/smf/index.php?topic=116&postdays=0&postorder=asc&start=260

By converting the hexadecimal value assigned to the effect in the FFTPatcher's ability tab you can pinpoint which effect file is which within the directory.

A video compilation of all effects can be found here: http://ffhacktics.com/smf/index.php?topic=4830.0

There is a bunch of translated information about effect files in this thread: http://ffhacktics.com/smf/index.php?topic=6979.0

Example of effect data: https://ffhacktics.com/smf/index.php?topic=12226.msg226345


Effect File Format

Based on Glain's forum post [1] and Choto's Effect Editor and notes. [2] [3]

3D Model ASM Subroutine Section (Optional)

List of routines: [4] These routines seem to deal with drawing 3D models and/or 3D rotations. Some effects have multiple routines.

I'm not sure what data the models draw from, but they tend to be calculated rather than stated. Ex. rather than having every polygon and their position relative to the field, they have like, "here's 1 polygon, repeat this 128 times and curve it by this much going this way, and this much going this way" Unsure if effect 4's model is rotation around a single point, or rotation around another polygon's vertex each time -Talcall

Header Section

This section contains a list of 10 offsets (4 bytes each). Offsets are from the start of this section, not the start of the file.

0x801b48d0 in RAM is a table of data that defines where the effect file header is stored (in RAM) for each effect ID.

For ID 0x155, the table location is: 0x155 * 4 + 0x801b48d0 = 0x801b4e24

The value at 0x801b4e24 is 0x801c3cfc, the RAM location where the header data starts.

Effect files are loaded into RAM at 0x801c2500, so this results in a file offset of 0x801c3cfc - 0x801c2500 = 0x17FC.


0x00 Frames Section (Always 0x28)

0x04 Animation/Motion Section

0x08 Effect Script Section

0x0C Emitter Motion and Control Section

0x10 Coordinate/Direction Data? Section

0x14 ? (Optional) In some effects its the same number repeated

0x18 Misc Timer Data and Camera Section Header

0x1C Misc Timer Data and Camera Section

0x20 Sound Effect Section

0x24 Palette and Texture Section


Frames Section

Section 1: List of Frame Sets?

Unknown purpose of first 6 bytes. They are frequently (always?) 01 00 00 00 02 00 After the first 6 bytes, each halfword (uint16) + 4 is related to offset to each frame

Section 2: Frame Data, repeated for each frame

0x00 VRAM 1

0x04 VRAM 2

0x08 Load Location Top Left X (unsigned)

0x09 Load Location Top Left Y (unsigned)

0x0A Width (pixels) (signed) - A negative value will result in image being flipped left/right?

0x0B Height (pixels) (signed) - A negative value will result in image being flipped up/down?

0x0C Display Top Left X (signed)

0x0E Display Top Left Y (signed)

0x10 Display Top Right X (signed)

0x12 Display Top Right Y (signed)

0x14 Display Bottom Left X (signed)

0x16 Display Bottom Left Y (signed)

0x18 Display Bottom Right X (signed)

0x1A Display Bottom Right Y (signed)

Rotation?


Animation/Motion Section

Includes composite frame selection, density/number, and duration.

There will be multiple paremeters in between, but most seem to have the same function. Each different "motion" of an effect will have its own set.

This section starts with a unint32 defining How many parameter sets there are 'N'.

Followed by N offsets (unit16 each) to each paramter set.

Animation Parameter Sets

Each parameter set begins with "82"

Followed by X and Y screen space offset (uint16 each).

Followed by M sets of 3 bytes

first byte - composite frame number taken from Frame Data

second byte - Duration in frames

third byte - seemingly irrelevant (palette?)

Last set of 3 bytes is frequently (always?) 00 00 01

Ends with "81".


Palette is decided by parameter set.


The following data is an example of one of the parameter sets from Cure: E001.bin

Effects moving around spiral:

0x08 (0x1fc)

82 00 00 00 00 - XX XX and YY YY offset

00 14 01 ---- the second byte of these two parameters seems to have a big control on the effect

01 02 01 ----- This is the big sparkle in cure that doesn't go away till the end.

00 00 01 81


Effect Script Section

A series of instructions that tell the effect how to animate.

Has 3 types of sections: Starting Section, Loop Section, and Ending Section. There may be a second Loop Section and Ending Section if effect is multi-target.

Script instructions are defined by 1 ID byte + additional bytes for data/parameters


ID Total Bytes Desc

0x00 4 Jump (unconditional)

0x04 2 End Effect

0x05 2 Begin Effect

0x06 4 Setup Custom Routine Pointer

0x16 6 Decision branch?

0x1d 4 Conditional branch (Timing, duration?)

0x1e 4 Conditional branch (multi-target?)

0x1f 4 Conditional branch (based on hit counter)?

0x25 2 Effect processing (advance frame)?

0x27 2 Store motion data?

0x28 2 Graphics (timing?)

0x29 4 Graphics (multi-target?), can branch

0x2a 2 Clear temp data?


Emitter Motion and Control Section

Emitter Control Section Header

20 bytes long

0x02: Number of emitters


Emitter Motion and Control Section

Each emitter has 196 (0xC4) bytes of data

0x01 number of parameter set 0x02 Type of motion? 0x03 Flag for animation target: 0x02 - targeted panel, 0x04 - on/over source unit, 0x06 - each target unit? 0x04 ? Crashed game? 0x06 Color masking/motion flags? 0x08 through 0x0f Special Functions that use below data


Coordinate Data Section

Coordinate stuff for main motion tweens?

goes by each nibble. each nibble corresponds to different additional data in the emitter's section)

0x10 - color masking?

0x14 - X coordinate to start effect 0x16 - Y coordinate to start effect 0x18 - upper right/lower left displacement

0x1A - Target Z? coordinate for end of effect 0x1C - Target Y coordinate for end of effect (spot it moves to ) 0x1E - Target X? coordinate for end of effect

0x20 - upper left/lower right spread 0x22 - vertical spread 0x24 - upper right/lower left spread 0x26 - horizontal spread

0x2D - 0x0F - direction of motion ( follows like a clock, 00 is 6 o clock, 08 is 12 o clock, 04 is 3 o clock)

0x2c - 0x30 - direction of motion? tied to

0x32 - 0x36

0x34 - Randomness? 0x36 - Randomness? 0x38 - Randomness? 0x3A - Randomness?

Linked (0x0a) 0x44 0x46 0x48 0x4a


0x4c 0x4e 0x50 0x52

Linked (0x0b) 0x54 - 0x56 0x58 0x5a

0x5C - controlled vertical motion upward 0x5E - also controleed vertical motion upward

0x0C linked - low nibble 64 66 68 6a 6c 6e 70 72 74 76 78 7a

0x0c linked - high nibble 7c 7e 80 82 84 86 88 8a 8c 8e 90 92


Fade of effect? - each half based on time (0x0c dependent) 0x94 - fade of effect? 0x96 - 0x98 - 0x9a -

0x0c dependent 0x9c - directional deviation from target (?? direction) 0x9e - directional deviation from target (Z direction?) 0xa0 - directional deviation from target (?? direction) 0xa2

0xb0 - controlled number of particles 0xb2

dependent on 0x0f (halves) 0xb4 - also controlled number of particles (multiplied by a ton for 1, then tapered out with higher values) 0xb6 - b6-b4

0x0c dependent 0xb8 - controls speed of propogation for motion effect (early) 0xba 0xbC - controls speed of propogation for motion effect (late) 0xbe

0xc0

Coordinate/Direction Data

Each section controls a direction for the effect? Starts with 0F 00 00 00

0xA0 long sections, 0x0f sections


1st section: 0x3c long, controls horizontal movement 2nd section: 0x3c long, ???? 3rd section: 0x28 long, ???? 4th section: 0x2a-?? long, controls vertical movement

not sure what the other sections control. I'm assuming it controls movement of the other sets of frames.


Misc Timer Data and Camera Section

Section is 0x18a0 long

Misc Timer Data and Camera Section Header

0x18 long 0x00 - effect type? 0x04 - effect type? 0x08 - effect type? 0x0c - ? 00 02 00 00 in every effect 0x10 - ? 00 03 00 00 in every effect 0x14 - ? 00 04 00 00 in every effect

Misc Timer Data and Camera Sections

(Offsets are from start of Misc Timed Data Header)

0x18 - ? 0x1C - Time taken before effect display 0x1E - Time in between target switching 0x20 - ? 0x22 - Effect duration? (cuts effect off if set too low)

Start of individual sections (0x80 each for tween sections)

0x24 - ??: Emmitter timing sections 0x00 - Time until start of tween 0x02 - time until end of tween

0x32 - Tween to display

0x4c\ Control display timing for damage/status/transformation/target animation 0x50/ 0x0000 - none 0x0007 - ??? 0x0010 - runs post action display 0x0020 - sprite/transformation/status 0x0040 - set target animation based on attack 0xFF00 - store animation/facing


0x34 long for sound effect sections? 0x00 - Start time of sound effect


0xC8 long section for forground color tinting and recovery or sprite flash? 0x130 long section for background tint/flash section?


Camera Control Sections

0x00 - 0x20? - timing for each camera script

0x26 - vertical tilt 0x2a - camera face tilt left

0x48 - vertical map rotation 0x4a - horizontal map rotation

0xF2 - parameters for zoom functions start?

0xF8 - Zoom Parameters - X, Y, and Z parameters 0x00 - 0x02 - 0x04 -


0x154 - 0x174? - Camera control scripts 0xC704 - stop camera rotation? 0x4404 - zoom change? 0x2104 - change tilt? 0x0304 - focus on target 0x0204 - focus on target 0x0104 - rotate battlefield

bitwise-and with 0x01e0 with each value (2 bytes) at the following offsets

0x0806 - 1 value

0x168a - 2 values (after the first 2 bytes that are zero)

0x185a - 2 values (after the first 2 bytes that are zero)


Command based on result:

0x01c0 Rotate (or center) toward target panel?

0x0140 Rotate (or center) toward source unit?

0x0100 Rotate (or center) back to original point?


0x1e long for each section - Global Sound Effects?

Sound Effect Section

0x00 - word of some header 0x04 - Length of sound effect section 0x08 - number of ?? bytes before first sound? 0x0a - ??? 0x0C - ??? 0x10 - ???

0x18 - start of offsets (uint16 each) to each sound effect section

3 bytes - 50 54 54

Sound Effect Sections

??

Palette Section and Image Data

512 colors, 2 bytes per color. Either 16 or 256 colors per palette depending of image data format (4bpp or 8bpp). For 4bpp files, the first 16 palettes are generally all zero and ignored.


Image data

Starts 1024 bytes after the start of palette data.

0x02 Identifies if image is 4bpp or 8bpp

0x04 Start of pixel color data. May be 8bpp format (each full byte is color index in palette), or 4bpp Multi-CLUT (each half-byte is color index in palette)