Difference between revisions of "Effect Files"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(add description of the file format based on Glain's forum post)
 
(68 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Follow [[Effects|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.  
+
Effect files are within the Effect directory in an extracted ROM.
  
A thorough reading of this topic will provide information on editing these: {{flink|t=116&postdays=0&postorder=asc&start=260}}
+
FFTPatcher's ability tab will show which effect file is used by which ability.
  
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.
+
[[Effects|Effect Images]] can be found within [[Shishi Sprite Editor]]'s more recent versions, in the Other images tab.  
  
A video compilation of all effects can be found here: {{flink|t=4830.0}} 
+
A video compilation of all effects can be found here: [https://ffhacktics.com/smf/index.php?topic=4830.0|FFT Special Effects Compilation Video Directory]
  
There is a bunch of translated information about effect files in this thread: {{flink|t=6979.0}}
+
Data related to Effects: [[Effect Data]]
  
Example of effect data: https://ffhacktics.com/smf/index.php?topic=12226.msg226345
 
  
<!-- Obsolete section? -->
+
== Effect File Format ==
----
+
Info on this page is based on the following:
PSX name / PSP name
 
----
 
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E000_0000.gif ??? / ???]
 
  
[http://s256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E001_Cure.gif Cure / Cure]
+
Glain's [https://ffhacktics.com/smf/index.php?topic=12226| forum post] on modifying effect data
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E002_Cure2.gif Cure 2 / Cura]
+
Choto's [https://ffhacktics.com/smf/index.php?topic=9897.0| Effect Editor] and [https://ffhacktics.com/smf/index.php?topic=10473.msg199210#msg199210| notes].
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E003_Cure3.gif Cure 3 / Curaga]
+
[https://ffhacktics.com/smf/index.php?topic=6979.0| St4rw4k3r's post]
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E004_Cure4.gif Cure 4 / Curaja]
+
Related Routines: [[Effect_Graphics]] and [[Emitter_Control_Routine]]
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E005_Raise.gif Raise / Raise]
+
== 3D Model ASM Subroutine Section (Optional) ==
 +
List of routines: [[EFFECT Routines]]
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E006_Raise2.gif Raise 2 / Arise]
+
These routines seem to deal with drawing 3D models and/or 3D rotations. Some effects have multiple routines.
  
[http://i256.photobucket.com/albums/hh189/koala_knight/FFTEffects/E007_Reraise.gif Reraise / Reraise]
+
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
  
Pickle Girl Fanboy here. All of the above image links are dead.  I recommend someone resubmit images to an image hosting service which will hold images indefinitely.  I recommend the following service:
+
== Header Section ==
http://www.myupload.dk/
+
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.
 
 
http://www.myupload.dk/faq/
 
^Their FAQ says, "There is no time limit or life time of an uploaded file. However, we do recommend that you sign up for a private upload folder to keep track of your uploads."
 
 
 
Again, this is NOT a bot.  It's me, PGF.  The two links above are valid.
 
[[User:PGF|PGF]] 23:51, 15 February 2012 (CET)
 
  
 +
BATTLE.BIN contains a table of offsets to where the section is in the effect file.
  
==Effect File Format==
+
RAM offset to header = BATTLE.BIN location [0x0014D8D0 + (effect_id * 4)] (as uint32)
Based on Glain's forum post and Choto's Effect Editor [https://ffhacktics.com/smf/index.php?topic=12226] [https://ffhacktics.com/smf/index.php?topic=9897.0]
 
  
==ASM Subroutine Section (Optional)==
+
Local file offset for each effect file = RAM offset - 0x081c2500
  
==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
 
For ID 0x155, the table location is: 0x155 * 4 + 0x801b48d0 = 0x801b4e24
Line 58: Line 48:
  
  
0x00 Frames Section? (Always 0x28)
+
{| class="wikitable sortable"
 +
! Offset !! Section
 +
|-
 +
| 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 Image Section
 +
|}
 +
 
 +
== Frames Section ==
 +
Section 1: List of Frame Set Offsets
 +
 
 +
First 4 bytes: Number of half-words before frame offsets start. First of these half words is always(?) this number * 2, ex. the first 6 bytes are frequency 01 00 00 00 02 00
 +
 
 +
After that first word and half-words, each halfword (uint16) + 4 is an offset to each frame set. A frame set may have multiple frames.
  
0x04 Animations Section?
 
  
0x08 Effect Script Section
+
Section 2: Frame Data, repeated for each frame
 +
 
 +
Each frame data section is 0x18 bytes long, except the first frame of each frame set which has an extra 4 bytes at the beginning relating to VRAM (ie. the first frame is 0x1c bytes long).
  
0x0C Emitter Control Section
+
1st Frame first 4 bytes - VRAM 1 (Only exists for first frame of frame set) - If the leftmost bit (0x80) of the first byte is 0, the image color depth is 4bpp, otherwise the image is 8bpp.
 +
  VRAM 1 byte 0x02 - how many frames in the frame set
 +
   
 +
  VRAM byte 0x00 bitflags:
 +
    0x0F - Palette for 4bpp images?
 +
    0x60 - semi-transparency mode? (see [https://ffhacktics.com/wiki/P00_GetTpage P00 GetTPage])
 +
    0x80 - image color depth: 1 = 8bpp, 0 = 4bpp?
 +
   
 +
  VRAM byte 0x01 bitflags:
 +
    0x02 - semi-transparency mode on/off for whole quad/polygon? Only off for some frames for Summons, meteor, a few geomancy (pitfall, carve model, local quake), small bomb, and empty 8x8 black squares on others
 +
    0x10 - frame width is a signed value?
 +
    0x20 - frame height is a signed value?
  
0x10 Effect Timing/Control Section?
+
{| class="wikitable sortable"
 +
! Offset !! Data
 +
|-
 +
| 0x00 || VRAM 2
 +
|-
 +
| 0x04 || Load Location Top Left X (unsigned)
 +
|-
 +
| 0x05 || Load Location Top Left Y (unsigned)
 +
|-
 +
| 0x06 || UV Width (pixels) (signed or unsigned) - A negative value will result in image being flipped left/right?
 +
|-
 +
| 0x07 || UV Height (pixels) (signed or unsigned) - A negative value will result in image being flipped up/down?
 +
|-
 +
| 0x08 || Display Top Left X (signed)
 +
|-
 +
| 0x0a || Display Top Left Y (signed)
 +
|-
 +
| 0x0c || Display Top Right X (signed)
 +
|-
 +
| 0x0e || Display Top Right Y (signed)
 +
|-
 +
| 0x10 || Display Bottom Left X (signed)
 +
|-
 +
| 0x12 || Display Bottom Left Y (signed)
 +
|-
 +
| 0x14 || Display Bottom Right X (signed)
 +
|-
 +
| 0x16 || Display Bottom Right Y (signed)
 +
|}
  
0x14 ? (Optional)
+
Choto's Effect Editor calculates rotation based on display top_left to top_right
  
0x18 ?
+
== Animation/Motion Section ==
 +
Includes composite frame selection, density/number, and duration.
  
0x1C Camera Section
+
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.
  
0x20 ?
+
This section starts with a unint32 defining How many parameter sets there are 'N'.
  
0x24 Palette offset
+
Followed by N offsets (unit16 each) to each paramter set.
  
 +
=== Animation Parameter Sets ===
 +
Each parameter set begins with "82"
  
==Frames Section==
+
Followed by X and Y screen space offset (uint16 each).
Section 1: List of Frame Sets? Unknown about first 6 bytes, then each halfword (uint16) + 4 is related to offset to each frame
 
  
Section 2: Frame Data, repeated for each frame
+
Followed by M sets of 3 bytes
  
0x00 VRAM 1
+
first byte - composite frame number taken from Frame Data
  
0x04 VRAM 2
+
second byte - Duration in frames
  
0x08 Load Location Top Left X
+
third byte - seemingly irrelevant (palette?)
  
0x09 Load Location Top Left Y
+
Last set of 3 bytes is frequently (always?) 00 00 01
  
0x0A Width (pixels)
+
Ends with "81".
  
0x0B Height (pixels)
 
  
0x0C Display Top Left X (unsigned)
+
Palette is decided by parameter set.
  
0x0E Display Top Left Y (unsigned)
 
  
0x10 Display Top Right X (unsigned)
 
  
0x12 Display Top Right Y (unsigned)
+
The following data is an example of one of the parameter sets from Cure: E001.bin
  
0x14 Display Bottom Left X (unsigned)
+
Effects moving around spiral:
  
0x16 Display Bottom Left Y (unsigned)
+
0x08 (0x1fc)
  
0x18 Display Bottom Right X (unsigned)
+
82 00 00 00 00 - XX XX and YY YY offset
  
0x1A Display Bottom Right Y (unsigned)
+
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.
  
Stretch values (top, bottom, left, right)?
+
00 00 01 81
Rotation?
 
  
  
  
==Effect Script Section==
+
== Effect Script Section ==
 
A series of instructions that tell the effect how to animate.
 
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.
 
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
 
Script instructions are defined by 1 ID byte + additional bytes for data/parameters
  
 +
See [[BATTLE.BIN_Routines#Effect.2C_Projectile.2C_.26_Particle_Handling]] starting at 001a2238 for routines.
  
ID         Bytes       Desc
+
{| class="wikitable sortable"
 +
! ID Byte !! Total Bytes !! Description
 +
|-
 +
| 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?
 +
|}
  
0x00        4          Jump (unconditional)
+
== Emitter Motion and Control Section ==
 +
=== Emitter Control Section Header ===
 +
20 (0x14) bytes long
  
0x04       2          End Effect
+
0x02: Number of emitters
 +
0x04: ?
  
0x05        2          Begin Effect
+
=== Emitter Motion and Control Section ===
 +
Each emitter has 196 (0xC4) bytes of data
  
0x06       4          Setup Custom Routine Pointer
+
0x00 always 0?
 +
0x01 number of parameter set, animation index?
 +
0x02 Type of motion?
 +
  0x00 - ??
 +
  0x02 - ?? (used in Chakra)
 +
  0x60 - affects emitter moving to/from caster/target??
 +
  0x80 - ??
 +
0x03 Flag for animation target:
 +
  0x02 - targeted panel
 +
  0x04 - on/over source unit
 +
  0x06 - each target unit?
 +
  0x07 - each target unit?? (used in Throw Spirit)
 +
  0x08 - somewhere very low?? (used in Throw Spirit)
 +
0x04 ? Crashed game?
 +
0x06 Color masking/motion flags?
 +
  0x04 - flag to show particle trail during movement? (used in Throw Spirit)
 +
  0x10 - particles move radially?
 +
  0x20 - ??
 +
  0x40 - sets color?
 +
  0x80 - ??
 +
0x07 ??
 +
  0x01 end emitter at target position? (used in Throw Spirit)
 +
0x08 through 0x0f Special Functions that use below data
  
0x16        6          Decision branch?
+
=== Coordinate Data Section ===
 +
Coordinate stuff for main motion tweens?
  
0x1d        4          Conditional branch (Timing, duration?)
+
goes by each nibble. each nibble corresponds to different additional data in the emitter's section)
  
0x1e        4          Conditional branch (multi-target?)
+
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; for radial movement can accept negative values for opposite direction?
 +
0x22 - vertical spread
 +
0x24 - upper right/lower left spread; for radial movement can accept negative values for opposite direction?
 +
0x26 - horizontal spread; for radial movement can accept negative values for opposite direction?
 +
 +
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
  
0x1f        4          Conditional branch (based on hit counter)?
+
== Coordinate/Direction Data ==
 +
Each section controls a direction for the effect?
 +
Starts with 0F 00 00 00. Always 0x964 total length?
  
0x25        2          Effect processing (advance frame)?
+
0xf sections, each 0xA0 long. Some sections may not be used and will only be 0s.
  
0x27        2          Store motion data?
+
1st subsection: 0x3c long, controls horizontal movement
 +
2nd subsection: 0x3c long, ????
 +
3rd subsection: 0x28 long, ????
 +
4th section: 0x2a-?? long, controls vertical movement
  
0x28        2          Graphics (timing?)
+
not sure what the other sections control. I'm assuming it controls movement of the other sets of frames.
  
0x29        4          Graphics (multi-target?), can branch
+
== Misc Timer Data and Camera Section ==
 +
Section is 0x18a0 long
  
0x2a        2          Clear temp data?
+
=== Misc Timer Data and Camera Section Header ===
 +
0x18 long
 +
0x00 - effect type?
 +
0x04 - effect type? frequently 00 00 00 00
 +
0x08 - effect type? frequently 00 01 00 00
 +
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)
  
==Emitter Control Section==
+
  0x18 - ?
Emitter Control Section Header (20 bytes)
+
  0x1C - Time taken before effect display
 +
  0x1E - Time in between target switching
 +
  0x20 - ?
 +
  0x22 - Effect duration? (cuts effect off if set too low)
  
0x02: Number of emitters
+
Start of individual sections (0x80 each for tween sections), always 5 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
 +
      0x7e - ??
  
Emitter Section: 196 (0xC4) bytes long
+
0x34 long for sound effect sections?
 +
0x00 - Start time of sound effect
  
0x03: Flag for animation target: 0x02 - targeted panel, 0x04 - on/over source unit, 0x06 - each target unit?
 
  
 +
0xC8 long section for forground color tinting and recovery or sprite flash?
 +
0x130 long section for background tint/flash section?
  
  
==Camera 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
 
bitwise-and with 0x01e0 with each value (2 bytes) at the following offsets
  
Line 172: Line 448:
  
 
0x168a - 2 values (after the first 2 bytes that are zero)
 
0x168a - 2 values (after the first 2 bytes that are zero)
 +
 
0x185a - 2 values (after the first 2 bytes that are zero)
 
0x185a - 2 values (after the first 2 bytes that are zero)
  
Line 184: Line 461:
  
  
==Palette Section==
 
512 colors, 2 bytes per color. Either 16 or 256 colors per palette depending of image data format (4bpp or 8bpp)
 
  
 +
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 ===
 +
0x00 - ?
 +
0x04 - length of sound effect section starting from previous line
 +
 +
== Palette Section and Image Data ==
 +
512 colors, 2 bytes per color.
 +
 +
If the image is 8bpp, the first set of 256 colors is used.
 +
 +
If the image is 4bpp, the second set of 256 colors is used (16 palettes of 16 colors each).
 +
 +
The unused color data will be all zeros.
 +
 +
The image format is defined within the Frames section of the file.
 +
 +
 +
 +
=== Image data ===
 +
Starts 1024 bytes after the start of palette data. The first 4 bytes identify the dimensions of the image. 4bpp images are 256 pixels wide while 8bpp images are 128 pixels wide (unless it is identified as a full 256 x 256 sheet)
 +
 +
0x01 Height of image / 2, unless the image is a full 8bpp 256 x 256 sheet.
 +
 +
Examples of dimensions:
 +
 +
E001 - 00 80 00 00 - 8bpp - 128 x 256
 +
 +
E004 - 00 00 01 01 - 8bpp - 256 x 256
 +
 +
E016 - 00 3c 00 00 - 8bpp - 128 x 120
 +
 +
E341 - 00 40 00 00 - 8bpp - 128 x 128
 +
 +
E343 - 00 40 00 00 - 4bpp - 256 x 128
 +
 +
E356 - 00 20 00 00 - 4bpp - 256 x 64
 +
 +
E398 - 00 80 00 00 - 4bpp - 256 x 256
 +
 +
 +
 +
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)
 +
 +
 +
== Related Routines ==
 +
https://ffhacktics.com/wiki/BATTLE.BIN_Routines#Effect.2C_Projectile.2C_.26_Particle_Handling
 +
 +
[[Effect_Graphics]]
  
==Image data==
+
[[Effect_Related_(0x1a4000)]]
Starts 1024 + 4 bytes after the start of the palette data. May be 8bpp format (each full byte is index to palette), or 4bpp Multi-CLUT.
 

Latest revision as of 21:41, 19 April 2025

Effect files are within the Effect directory in an extracted ROM.

FFTPatcher's ability tab will show which effect file is used by which ability.

Effect Images can be found within Shishi Sprite Editor's more recent versions, in the Other images tab.

A video compilation of all effects can be found here: Special Effects Compilation Video Directory

Data related to Effects: Effect Data


Effect File Format

Info on this page is based on the following:

Glain's forum post on modifying effect data

Choto's Effect Editor and notes.

St4rw4k3r's post

Related Routines: Effect_Graphics and Emitter_Control_Routine

3D Model ASM Subroutine Section (Optional)

List of routines: EFFECT Routines

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.

BATTLE.BIN contains a table of offsets to where the section is in the effect file.

RAM offset to header = BATTLE.BIN location [0x0014D8D0 + (effect_id * 4)] (as uint32)

Local file offset for each effect file = RAM offset - 0x081c2500


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.


Offset Section
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 Image Section

Frames Section

Section 1: List of Frame Set Offsets

First 4 bytes: Number of half-words before frame offsets start. First of these half words is always(?) this number * 2, ex. the first 6 bytes are frequency 01 00 00 00 02 00

After that first word and half-words, each halfword (uint16) + 4 is an offset to each frame set. A frame set may have multiple frames.


Section 2: Frame Data, repeated for each frame

Each frame data section is 0x18 bytes long, except the first frame of each frame set which has an extra 4 bytes at the beginning relating to VRAM (ie. the first frame is 0x1c bytes long).

1st Frame first 4 bytes - VRAM 1 (Only exists for first frame of frame set) - If the leftmost bit (0x80) of the first byte is 0, the image color depth is 4bpp, otherwise the image is 8bpp.

 VRAM 1 byte 0x02 - how many frames in the frame set
   
 VRAM byte 0x00 bitflags:
   0x0F - Palette for 4bpp images?
   0x60 - semi-transparency mode? (see P00 GetTPage)
   0x80 - image color depth: 1 = 8bpp, 0 = 4bpp?
   
 VRAM byte 0x01 bitflags:
   0x02 - semi-transparency mode on/off for whole quad/polygon? Only off for some frames for Summons, meteor, a few geomancy (pitfall, carve model, local quake), small bomb, and empty 8x8 black squares on others
   0x10 - frame width is a signed value?
   0x20 - frame height is a signed value?
Offset Data
0x00 VRAM 2
0x04 Load Location Top Left X (unsigned)
0x05 Load Location Top Left Y (unsigned)
0x06 UV Width (pixels) (signed or unsigned) - A negative value will result in image being flipped left/right?
0x07 UV Height (pixels) (signed or unsigned) - A negative value will result in image being flipped up/down?
0x08 Display Top Left X (signed)
0x0a Display Top Left Y (signed)
0x0c Display Top Right X (signed)
0x0e Display Top Right Y (signed)
0x10 Display Bottom Left X (signed)
0x12 Display Bottom Left Y (signed)
0x14 Display Bottom Right X (signed)
0x16 Display Bottom Right Y (signed)

Choto's Effect Editor calculates rotation based on display top_left to top_right

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

See BATTLE.BIN_Routines#Effect.2C_Projectile.2C_.26_Particle_Handling starting at 001a2238 for routines.

ID Byte Total Bytes Description
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 (0x14) bytes long

0x02: Number of emitters
0x04: ?

Emitter Motion and Control Section

Each emitter has 196 (0xC4) bytes of data

0x00 always 0?
0x01 number of parameter set, animation index?
0x02 Type of motion?
  0x00 - ??
  0x02 - ?? (used in Chakra)
  0x60 - affects emitter moving to/from caster/target??
  0x80 - ??
0x03 Flag for animation target:
  0x02 - targeted panel
  0x04 - on/over source unit
  0x06 - each target unit?
  0x07 - each target unit?? (used in Throw Spirit)
  0x08 - somewhere very low?? (used in Throw Spirit)
0x04 ? Crashed game?
0x06 Color masking/motion flags?
  0x04 - flag to show particle trail during movement? (used in Throw Spirit)
  0x10 - particles move radially?
  0x20 - ??
  0x40 - sets color?
  0x80 - ??
0x07 ??
  0x01 end emitter at target position? (used in Throw Spirit)
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; for radial movement can accept negative values for opposite direction?
0x22 - vertical spread
0x24 - upper right/lower left spread; for radial movement can accept negative values for opposite direction?
0x26 - horizontal spread; for radial movement can accept negative values for opposite direction?

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. Always 0x964 total length?

0xf sections, each 0xA0 long. Some sections may not be used and will only be 0s.

1st subsection: 0x3c long, controls horizontal movement
2nd subsection: 0x3c long, ????
3rd subsection: 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? frequently 00 00 00 00
0x08 - effect type? frequently 00 01 00 00
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), always 5 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
     0x7e - ??

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

0x00 - ?
0x04 - length of sound effect section starting from previous line

Palette Section and Image Data

512 colors, 2 bytes per color.

If the image is 8bpp, the first set of 256 colors is used.

If the image is 4bpp, the second set of 256 colors is used (16 palettes of 16 colors each).

The unused color data will be all zeros.

The image format is defined within the Frames section of the file.


Image data

Starts 1024 bytes after the start of palette data. The first 4 bytes identify the dimensions of the image. 4bpp images are 256 pixels wide while 8bpp images are 128 pixels wide (unless it is identified as a full 256 x 256 sheet)

0x01 Height of image / 2, unless the image is a full 8bpp 256 x 256 sheet.

Examples of dimensions:

E001 - 00 80 00 00 - 8bpp - 128 x 256

E004 - 00 00 01 01 - 8bpp - 256 x 256

E016 - 00 3c 00 00 - 8bpp - 128 x 120

E341 - 00 40 00 00 - 8bpp - 128 x 128

E343 - 00 40 00 00 - 4bpp - 256 x 128

E356 - 00 20 00 00 - 4bpp - 256 x 64

E398 - 00 80 00 00 - 4bpp - 256 x 256


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)


Related Routines

https://ffhacktics.com/wiki/BATTLE.BIN_Routines#Effect.2C_Projectile.2C_.26_Particle_Handling

Effect_Graphics

Effect_Related_(0x1a4000)