• Welcome to Final Fantasy Hacktics. Please login or sign up.
 

Imported effects with headers in the middle of files

Started by CONMAN, November 21, 2020, 05:35:49 pm

CONMAN

November 21, 2020, 05:35:49 pm Last Edit: February 27, 2021, 01:54:24 pm by CONMAN Reason: topic solved
I recently started using Xifanie's ISO manager again (it's awesome).  I was importing some new effects and some would take while others wouldn't.  That was when I remembered that effects such as summons and draw outs (and apparently limits) simply don't seem to work.  I was a little disappointed that I couldn't use an Alexander summon that I created from Ifrit nor could I use "marsil" which was from Meteorain.  Granted, I could just replace the original files (they work fine in the original slots), but that sort of ruins the whole venture with the iso manager. 

I have successfully imported and used other effects before with no issue.  I was curious if anyone had ever figured this out?  Effect files seem to have a lot of unknowns and digging through the message board and wiki didn't solve it for me.
  • Modding version: PSX

3lric

Quote from: CONMAN on November 21, 2020, 05:35:49 pmI recently started using Xifanie's ISO manager again (it's awesome).  I was importing some new effects and some would take while others wouldn't.  That was when I remembered that effects such as summons and draw outs (and apparently limits) simply don't seem to work.  I was a little disappointed that I couldn't use an Alexander summon that I created from Ifrit nor could I use "marsil" which was from Meteorain.  Granted, I could just replace the original files (they work fine in the original slots), but that sort of ruins the whole venture with the iso manager. 

I have successfully imported and used other effects before with no issue.  I was curious if anyone had ever figured this out?  Effect files seem to have a lot of unknowns and digging through the message board and wiki didn't solve it for me.

Hey buddy, we gotta get ya onto Discord mang. Anyway, this is likely due to the sizes of the effects. We also have an alexander and phoenix summon for Jot5 that i had to make new files for. However its been like 5 years since i set that up and cant recall whether it was tested or not.

Unfortunately i think there is like maybe 2 people who have used that tool (both of us included, lol)
  • Modding version: PSX

CONMAN

Thanks for the quick reply Eric. I'm going to mess around some more.  Editing an effect is one thing,  making something new with choto's effect editor sounds rough!
  • Modding version: PSX

CONMAN

I'm renaming this topic because I have something of a partial solution to my problem posed in the initial question.  I kept digging because I want my boss villains to have badass, boss-looking spell effects to match them!

To my main point, many effects don't start with a header that would point to things like palette color, camera, sound, particle effects, etc.  Many spell effects that couldn't be moved around actually have a bunch of asm code at start and then in the FUCKING MIDDLE of the file is the actual header!  This includes many of my favorite effects like summons and limits. I had 2 solutions in mind to tackle this problem.  Either I edit the file to run properly or investigate to see if a table exist somewhere that points to the actual header location in the oddball spell effects.

Both of the spells in my original post contained asm before their headers.  I attempted to find a work around with "Marsil" (Meteorain edit.)  I started with two attempts.  First I attempted to cut out the start of the file (which I assumed was the blast of red stuff that emits from Cloud as a sort of pre-effect effect- idk what I was thinking.)  I then tried to remove the part of the effect script that I thought pointed there.  You can guess how that went.

Second I moved the effect file so that it started with header and I adjusted everything in there to point to the new locations for data.  I can pretty confidently say that all the location pointers were adjusted correctly but I believe I needed to find and edit another pointer to the now moved asm code and I failed there.  Glain seems to point this out in this topic: https://ffhacktics.com/smf/index.php?topic=8408.0  I failed here... Possibly more than one pointer is needed or just messed up.

Finally my partial solution was worked out!  I found an effect I didn't like and one that also had a header mid-file and simply added added enough 00 bytes to Marsil between the beginning asm code and the header to match the header location for carbuncle.  I replaced carbuncle and it runs just as it should!!

However, this is a partial solution and points to the real fix.  I have pre-school levels of using a debugger and understanding asm.  While some of you are writing code, I'm trying to cram graham crackers into the disk drive and crossing my finger (sort of a true story there.)  What I'm trying to say is that a table of header locations should be editable.  In the wiki-data/tables locations page, a couple of tables are listed.

801b48d0 - table of effect file start locations

801b53e8 - start of data (8 bytes each, by effect ID) (From what I've read this list lba location and then file size-but I'm not so sure about this.)

801b8ba4 - Start of some data (0x54 bytes each, by effect ID)
   0x00 - set to 0x03 when used?

I presume that one of these has a pointer to the actual header location and not just the start of the effect file.  I've looked at the second of these and scrambled my brains a little, but I think a pointer to the header locations can be found.  I might attempt to take a few more looks but I can't promise I'll figure it out.

 
  • Modding version: PSX

Glain

You might want to check out this topic where I write about some of the results of my own investigation into effects: https://ffhacktics.com/smf/index.php?topic=12226.0

It describes how to find the header data and where the sections are when the start of the file is program code.
  • Modding version: Other/Unknown

CONMAN

You're awesome Glain!  I looked through that thread before but clearly didn't look close enough.  I had poked in there looking at you're effect script info and totally missed how you got the header info from that table. While I had found the table with repeated hex reading:801c2500, it didn't jump out at me what that was.  With a little logic I should have inferred that the non-matching bytes accounted for the adjusted header of sets.

QuoteAt 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.

It's a shame that this wasn't understood back when there were a dozen or more people that were really interested in effect editing rather than being a little niche interest!

I try not to post help inquiries until I have hit a wall, but at least others can learn from my mistakes!  Totally made my day!
  • Modding version: PSX

RetroTypes

Hey, sometimes it only takes one really talented person to care enough to make an awesome new tool that does tons of stuff. Usually, that person is either Xif or Glain, but regardless  :p

Keep on documenting everything, continue to show interest, and I'm sure something good will come of it!
  • Modding version: PSX
  • Discord username: RetroTypes