• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
February 13, 2025, 10:13:03 am

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


How I customized an animation by modifying SEQ files

Started by mrgudenheim, December 22, 2024, 12:20:40 am

mrgudenheim

December 22, 2024, 12:20:40 am Last Edit: January 12, 2025, 06:30:50 pm by mrgudenheim Reason: typo fix
This process is greatly streamlined by the animation editor tool: https://ffhacktics.com/smf/index.php?topic=13263.0

This is the step by step process I used to change the shooting animation to have multiple muzzle flashes to look like burst-fire shooting.
While there are at least 12 shooting animations in the game (front facing and back facing for each of equal height, lower height, higher height, for each of wep1.seq and wep2.seq), this write up is only about changing a single one for simplicity - wep1, type1, equal height, front facing

burst_fire2.gif

Useful references:
SEQ File documentation - https://ffhacktics.com/wiki/SEQ_%26_Animation_info_page
Type1 Gun Attack Equal Height - https://ffhacktics.com/wiki/T1_Mid_Mod_Gun
Wep1 Gun Attack Equal Height - https://ffhacktics.com/wiki/W1_Mid_Mod_Gun

The general steps are the following:
1) Figure out what hex needs to be inserted or changed
2) Extract the SEQ files using CDmage
3) Use a hex editor (I used HxD) to overwrite and insert the new bytes
3.1) Put in the new bytes in wep.seq to call the eff animation (QueueSpriteAnim) multiple times and fix the timings to last long enough
3.2) Fix the section 3 size
3.3) Fix the seq section 2 references to all the later animations
3.4) Increase the timings in the type1.seq to last long enough to show the longer wep animation
4) If file size was not changed, import the new .seq file(s) to the .bin using CDmage, otherwise use a hex editor (or juravis?) to directly write your changes to the the .bin


Since I wanted to change the shooting animation I started by looking at the Type1 Gun Attack animations and the Wep1 Gun attack animations. Displaying multiple sequential muzzle flashes could probably be achieved at least two ways, adding frames to the eff.seq OR adding frames to the wep1.seq. I arbitrarily chose to modify the wep1.seq.
The W1 Mid Mod Gun attack animation spans memory 0x04F6 through 0x0512. I chose to duplicate the opcode that calls the eff.seq and a few of the frames after it:
QueueSpriteAnim(02,08)
LoadFrameWait(06,02)
LoadFrameWait(0c,02)
in the hex as
FF F2 02 08 06 02 0C 02
w1_01.png

I chose to increase the wait time on the last frame of this section to have a short time between the muzzle flashes to make it more noticable. This leads to the total 16 bytes of hex I needed to insert into wep1.seq to:
FF F2 02 08 06 02 0C 12 FF F2 02 08 06 02 0C 12
w1_02.png

Since I've inserted bytes the pointer references in section 2 of the SEQ needs to be updated and the size of section 3 (first 2 bytes of section 3) needs to be updated.
Since 16 bytes were added the size of section 3 is updated from 29 06 to 39 06
w1_03.png

Since the W1 Mid Mod Gun is animation 08, the pointer references for animation 09 through 0x5D need to have 16 added. I did the math and generated the text to paste in using a simple google spreadsheet (concatenating leading zeros where necessary).
w1_04.png

Now that frames have been added to the wep.seq, the type1.seq T1 Mid Mod Gun should be updated to stay in sync. To do this I changed the delay on a single frame from 02 to 2E. To improve the animation further the PlayAttackSound(01) could be duplicated, but I was too lazy to do this.
t1_01.png

With the needed hex known, it now needs to be put in the .bin. Since type1.seq did not change size, this is as easy as opening the .bin with CDmage, and right clicking type1.seq to import the modified file.
Since wep1.seq did change file size, unfortunately CDmage cannot be used. Instead I used HxD to directly write the hex to the .bin. Fortunately there lots of empty space after wep1.seq so the added bytes are not an issue. Unfortunately wep1.seq is spread across two CD sectors, so the modified seq file needs to be pasted in as two separate parts so the bytes between sectors (highlighted in blue) are not overwritten.
I find where to paste it in by using ctrl-F to find a string of hex from the wep1.seq. In the vanilla rom, wep1.seq starts at 0x08003D18.
As much of of the modified wep1.seq as possible goes before the sector change, and the rest gets pasted in after the highlighted section.
bin_01.png
  • Modding version: PSX