Final Fantasy Hacktics

Projects => Works in Progress => Topic started by: Nax on July 15, 2018, 05:56:18 pm

Title: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on July 15, 2018, 05:56:18 pm
(https://i.lensdump.com/i/8bfMZZ.jpg)

Hello there,

We've been working on a War of the Lions ModLoader named Chantage for a few weeks now.
Chantage is a mod loader for FFT: WotL, as well as an API to make mods play together nicely.
Mods are loaded from the memory stick at runtime, instead of needing to be patched
Right now the API is in a very early stage and cannot be used by mods directly, but basic mod loading work!

Because chantage is language-agnostic, you can develop mods in other languages than assembly. Chantage itself is made in C, and it's also possible to make mods in C++, or any language that can interface with C. It is still possible to make pure-assembly mods or to mix languages if you need to for some reason.

Rationale
Because chantage can run mods off the memory stick, and because it offers a common API to write mods against, it will eventually be possible to create mods that were thought to be impossible to make, such as:

* Creating new items/jobs/...
* Interfacing these items/jobs with the ENTD
* Adding new maps
* etc.

Usage
Right now you must patch your ISO in order to load chantage itself. However, future versions will allow for alternative ways to load the mod loader, such as cheat codes (for cwcheats or similar) or a PSP plugin. This would make it possible to run chantage mods with an actual UMD.

To install chantage:
* Download and extract the zip file
* Apply chantage.ppf to a clean, EBOOT-Decrypted US iso.
* Copy the whole PSP folder from the zip file to your memory stick.

How to install mods
* Copy the mod's .prx file into /PSP/GAME/ULUS10297/mods
* Open /PSP/GAME/ULUS10297/mods.txt with a text editor of your choice
* Append the name of the mod's .prx file at the end of that file

For example, to install a mod named abc.prx, copy it inside /PSP/GAME/ULUS10297/mods, then append "abc.prx" without quotes to /PSP/GAME/ULUS10297/mods.txt, on it's own line.

The chantage .zip includes slowdown_fix.prx, a chantage-compatible version of the popular slowdown fix.

Creating mods
Will be updated once the API is ready.

Credits
Thanks a lot to Quantumpencil & dzhu.

Download
You can find chantage (pre-)releases on GitHub: https://github.com/FFT-Hackers/chantage/releases (https://github.com/FFT-Hackers/chantage/releases)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Quantumpencil on July 15, 2018, 06:11:41 pm
Magnificent work my dear friend! RIP PSX  :lol:

We've also done a fair bit of work reverse engineering the WotL ISO and will be documenting that, and soon we'll be creating C++ functions for overwriting specific sub-routines at run-time without needing to worry about memory constraints (well, within reason).

The age of WotL is beginning  :lol:
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Elric on July 16, 2018, 12:22:58 am
RIP PSX?

I kinda doubt it. Maybe when all existing tools and ASMs work on the PSP version locations, but even then...

Cool concept though
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Quantumpencil on July 16, 2018, 01:06:58 am
Obviously a bit of hyperbole there, but there are some considerable advantages of this approach(allocating new memory at run-time/loading functions there and relocating the games original routines) over any tool that patches the actual ISO

By allocating new memory for mods at run-time and re-pointing WotL's original routines, essentially any function in the game can be replaced without having to try and manually "fit" the ASM into the same space or jump around between subs to use the padding space.

It also means new weapons, enemies, items, or formulas etc can be added to the game without destroying old ones and without having to patch the ISO at all (other than the original patch needed to load chantage) as the in memory structs containing their associated data can be re-located at run-time and extended.

Moreover with a map of the original games routines (currently a WIP, but all of the formula routines and most of the one dealing with items I've disassembled, and Nax ahs hit a lot of the graphical/AI code) a high-level programming API can be built around this procedure; methods for doing things like adding an item or an enemy can be re-usable function calls depending on core chantage utils that accept their parameters, relocate the relevant struct inside memory and add the resulting items/formulas/enemies to the struct.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Angel on July 16, 2018, 12:28:59 pm
I'm all for people actually working on tools for WotL. You will never know the frustration of ten years worth of trying to explain to every single new user why their hopes and dreams for modding WotL can't come true with mouse clicks. Ten years of trying to explain that they would have a much easier time if they just used the PSX version. Ten years of them stubbornly refusing to touch PSX, and then disappearing when they realize we weren't lying.

I won't hate on this at all. Keep it up, and I hope it pans out.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on July 16, 2018, 05:43:05 pm
I understand the frustration. I've lurked over this forum for years before registering, and I've certainly seen a fair share of people wanting to do WotL, before being discouraged by the lack of proper tooling (except for patcher). That's part of why I joined :)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on July 19, 2018, 07:09:17 am
Got it to work on real hardware too!

(https://i.lensdump.com/i/8w9fHZ.png)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 17, 2018, 06:35:59 pm
We're working on a FFTPatcher-like tool compatible with Chantage too.
(https://lh3.googleusercontent.com/-1jwvkweWi-c/W3dM-ajmhOI/AAAAAAAAAHA/wPA_GbY2zO8HZQRlL_LS4nPvk9h9K9zOwCL0BGAYYCw/h886/2018-08-17.png)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Heisho on August 17, 2018, 07:54:28 pm
This is excellent news dude. I suppouse that the slowdown fix will also work along this. Now if only the sound could be just like thw psx version.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 17, 2018, 09:53:28 pm
Yes, we have a .prx version of the slowdown fix that is compatible already.
What's the problem with the sound in the PSP version? I'm not aware of that.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nyzer on August 18, 2018, 12:37:11 am
Keep up the good work there, Nax!
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 18, 2018, 09:02:50 am
(https://lh3.googleusercontent.com/-wfkkejxR9xk/W3gYuBOSETI/AAAAAAAAAHY/TYb_O3Qih4M-qEuUozapYv2AndtZPQKqQCL0BGAYYCw/h1015/2018-08-18.png)

It also works on macOS, albeit being quite ugly (yet).
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Argy on August 18, 2018, 11:46:12 am
Really well done Nax!! This is impressive. Can you make changes to the weapon flavour text as well?
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Heisho on August 18, 2018, 01:29:30 pm
Quote from: Nax on August 17, 2018, 09:53:28 pm
Yes, we have a .prx version of the slowdown fix that is compatible already.
What's the problem with the sound in the PSP version? I'm not aware of that.


The sound effects are suppoused to be the same although they sound a little different, like when you play the game on a PS2 with fast disc settings and smooth graphics. It's no a lot of change but is noticeable. Anyway this sounds excelent, if you guys make a way that the hacks of PSX (ASM, events, etc) can work with this it would be great.

Great job anyway. Keep it up!
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 18, 2018, 02:52:20 pm
@Argy: You mean the description, like it appears on the last screenshot? Eventually yes. Right now it does nothing.

@Heisho: I barely played the PSX version, so I never noticed about the sound. Will see what I can do but I have a metric fuckton of higher priority stuff to do before  :o
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Angel on August 19, 2018, 12:44:31 am
From my understanding, the sound is not realistically fixable. Sound emulation for PlayStation is about as far off the mark as video emulation is for Nintendo 64. Compare Queklain's transformation event on a real PlayStation to any emulator or port of the game for a particularly obvious example.

There was a small group taking a dedicated look at the sound inaccuracy of PlayStation emulators, and made some nice progress in a short period, but then they just went silent (no pun). Even then, it's not going to help the PSP any.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 29, 2018, 03:09:20 am
Ok, so from your responses and what I gathered on the internet, it looks like the core problem is that the sound effects are in MIDI, and the MIDI synthetiser on the PSP and the PSX are vastly different.

Maybe we could just load wav files from the memory stick instead, fixing this issue. Are there any accurate .wav versions of the sound effects somewhere? I've seen there are wav sound effects on the ffhacktics website itself, but are those accurate?
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Xifanie on August 29, 2018, 02:43:07 pm
No, they're not accurate.

I do have an adapter that allows me to record audio from my PSX to my computer, but it would still take a lot of time to rip everything, to the point that I feel this solution is a bit absurd... recording every song and every sound effect in the game? Ouch. We don't even know where the regular, non-ability sound effects are stored. Could you even make a wav file loop?

Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Valkirst on August 30, 2018, 08:42:41 pm
This may sound trite but I wish there was an up-vote or a like button on the forum but, really that's just a lazy facsimile to words of encouragement! Please keep at it, I love it when I see this forum popping full of life. 🤘
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on August 31, 2018, 03:44:51 am
Thanks a lot, much appreciated  :D

The project is still up and running, it just takes a lot of time. We are (still) working on custom items. It basically work but there is a lot of work to be done to adapt the animation code, inventory code and everything related to saving.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Atherus on September 04, 2018, 05:41:28 pm
Looking into the sound issue myself, lined up a few tests. Will post results.


Update: Have all my data and am currently sorting. If there are no problems with the audio replacement or the audio itself, then all this should take is a simple plugin.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Quantumpencil on September 08, 2018, 12:40:22 am
I've started work concurrently with Nax on a few other upcoming chantage capabilities including:

1: The ability to add extra bytes to unit BattleData structs and use them in new Formulas/Battle (masks  for new status ailments... or a stored unit ID for a working taunt mod =p)
2: The ability to add extra bytes to AbilityData and use them in Formulas/Battle (masks for new status ailments)
3: The ability to add new abilities to the game without deleting old ones.

Current approach is something similar to the games approach to dealing with items; existing abilities are still located in their current tables, new abilities are located elsewhere and extra fields for all abilities are located in yet a third place, which a helper function which handles fetching the correct pointers to each struct when it is given an offset. Quite a few routines will have to be re-written and replaced to get this working as currently ability data  and the like is generally accessed via offset to the relevant pointer table. This is three pointers  which is kind of annoying but it easier for PoC  without breaking the whole game. Eventually this will probably end up being a new relocated table with all direct access to it replaced with  the getter function, but that is gonna be harder.

I was wondering if anyone involved with FFTPatcher might have a big list of where all of the data assets patcher patches are located in WotL; currently we're finding all of those as we go but the patcher obviously already has this information. I attempted to source dive it but I'm unfamiliar with C# (more importantly, the code is complex and opaque to someone just trying to dive in) so was unable to locate the offsets. If anyone has them, it would greatly speed up our work =)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on December 16, 2018, 10:30:52 am
Quick update a few months in:

The project is still going on. We've reversed a good deal of WotL at this point, and started to patch more stuff.
I've dealt with item names and descriptions. We've made a dynamic system for item descriptions. For example, edits to weapon's WP will be reflected in the description, new, custom jobs will be listed and so on.
Support for arbitrary amount of new items is getting mostly done. Still need to fix a few issues regarding animations and some menus.
I also worked a bit into expanding support, so new items can be bought from stores or treasure hunted or poached, and so on. Working fine so far!

(https://i.postimg.cc/TPqFBn6Z/shop.png)

(Image uses PSP items instead of a custom item due to some difficulties rendering custom item names in shops, but am working on it)
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Heisho on December 17, 2018, 05:23:22 am
That's pretty awesome man!
Please keep up the good work!
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Zero Dozer on February 25, 2019, 08:33:17 pm
Hm... This Chantage stuff is getting me very interested.

Especially if this means WotL becomes easily moddable.
Title: Re: [WotL][PoC] Chantage, a War of the Lions ModLoader
Post by: Nax on May 21, 2021, 03:38:47 pm
This has been more or less replaced by TacticsCrafter (https://ffhacktics.com/smf/index.php?topic=12723.0), which can achieve the same things, and should be much easier to use.