News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: FF5 GBA ~ Expanding for Size?  (Read 1593 times)

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
FF5 GBA ~ Expanding for Size?
« on: March 20, 2018, 12:19:04 pm »
Is it possible to expand FF5's GBA rom to allow for more enemy sprites, as well as palettes?

Bregalad

  • Hero Member
  • *****
  • Posts: 2536
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #1 on: March 20, 2018, 01:21:47 pm »
Yes. The (E) version is already expanded as opposed to the (J) and (U) versions. (32 MB instead of 16 if I remember well), because they had to fit the script in 5 languages.

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #2 on: March 20, 2018, 02:15:42 pm »
Thank you. It's too bad that Greiga Master's "Final Fantasy V Editor" can't use the E version and take advantage of all that extra space. I am pretty sure it has to do with the editor looking for the (U) version's offsets, based on this error I get upon opening it:



Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: srcOffset
   at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
   at FFVEditor.MonsterEditor.openToolStripMenuItem_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8825 (WinRelRS3.050727-8800)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
FFVEditor
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Graham/Desktop/FF5A%20editor/FFVEditor.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8825 (WinRelRS3.050727-8800)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8825 (WinRelRS3.050727-8800)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8825 (WinRelRS3.050727-8800)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8827 (WinRelRS3.050727-8800)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.



KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6481
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #3 on: March 20, 2018, 02:58:08 pm »
As I understand EXPANDING a GBA ROM is dead simple: just add more space to the ROM but USING that extra space would not be.
I assume the game's programming would have to be modified to direct it to read from expanded space.
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #4 on: March 20, 2018, 07:47:14 pm »
It's too bad that Greiga Master's "Final Fantasy V Editor" can't use the E version and take advantage of all that extra space. I am pretty sure it has to do with the editor looking for the (U) version's offsets
Yes only (U) version.

What do you try to accomplish, Zeemis? I have some experience with (e) version and extended with monster graphics in (u).

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #5 on: March 20, 2018, 07:57:03 pm »
Yes only (U) version.

What do you try to accomplish, Zeemis? I have some experience with (e) version and extended with monster graphics in (u).

I haven't created a project thread yet, mainly because I'm still doing some research and learning what's possible and what's not; however, I'm working on replacing all enemies and bosses in FF5 GBA with monsters from past Final Fantasy games. I'm using graphics from Pictologica Final Fantasy, Final Fantasy: Record Keeper, as well as the various graphics from past games that already have sprites. The idea is to have not only new enemies, but also enemies that follow a theme per environment. As an example, the boss "Hein" from FF3 is the boss you encounter Ship Graveyard, following the theme of undead.

Here's an example of a boss I finalized, it's Schizo from FF7:



Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #6 on: March 20, 2018, 08:36:57 pm »
I've seen Record Keeper, but haven't try it. I play FF Brave Exvius, they have some shared events with Record Keeper :)

So you try to replace, not add. That's probably easier. You will need to change graphics, AI scripts and couple of lookup tables.

Graphics is fairly easy - you must compress the tiles (keep in mind aligning), add the palette. The (u) pack together both, but since you have separate pointers for both, they could be hold in separate regions. Keep in mind that Square adds a small header of 8 bytes to before compression. First 4 bytes are kind of Type of resource .... 1 is for tiles, 2 - palette, 3 - tile map.

AI ... I don't know a tool to do it. As for the LUT, you will probably do it on hand. Keep in mind that FF5 holds LUT on 2 places. I have no clue what for  ::)

You may use use my Viewer to check the results. It is using (u) version for GBA.

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #7 on: March 20, 2018, 11:08:02 pm »
Maybe I'm entirely wrong; however, doesn't Greiga Master's FFV GBA editor allow me to replace graphics from existing or new offsets?


Wouldn't this mean I could simply expand the rom and the editor can point the game to the new graphic location of where I store it?

------------------
So I don't know if it's working as intended yet, further testing is needed; although, I have successfully added 10,000 bytes to the end of the (U) version with Hex Workshop and cross checked to see if I got the error on this new version with the non-expanded version. I can confirm that after opening both the expanded version and non-expanded version into the same editor on two separate instances and replacing the same monster on both version with the same graphic, the expanded version did not give me that error I showed above in this post.

As said although, I'll have to test further to see if it shows up in-game.
« Last Edit: March 20, 2018, 11:44:19 pm by Zeemis »

Bregalad

  • Hero Member
  • *****
  • Posts: 2536
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #8 on: March 21, 2018, 03:43:31 am »
As I understand EXPANDING a GBA ROM is dead simple: just add more space to the ROM but USING that extra space would not be.
I assume the game's programming would have to be modified to direct it to read from expanded space.

Both expanding and using extra space in GBA ROMs are dead simple. Just make pointers point past the previous end of the ROM and it'll work. It's really dead simple compared to NES for instance.

Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #9 on: March 21, 2018, 04:21:22 am »
Maybe I'm entirely wrong; however, doesn't Greiga Master's FFV GBA editor allow me to replace graphics from existing or new offsets?
Wouldn't this mean I could simply expand the rom and the editor can point the game to the new graphic location of where I store it?
TBH I have never used the tool for editing. I hope it recalculate the LUT. However I doubt it adds the 8 byte headers. As I said these headers are added at the beginning of uncompressed part to both Tiles and Palettes.
That mean, that you must get Tiles for a monster, add an 8 byte header, compress the result and then store the result in the ROM.
Similar is with Palettes: get the Palette of a monster, add 8 byte header and store the result in the ROM (no compression)


Keep in Mind that the header is not a constant. As I said the first 4 bytes hold some kind of TypeID, but second 4 bytes have specific info:
 - For Tiles (1): the number of tiles.
 - For Palette (2): the number of palette entries.

Let me illustrate it with Gobin:

The Tiles data starts after the orange box. The header has 1 (tiles) followed by $14 = 20 tiles (a Goblin image is 4x5 tiles)
That is the reason that in most tools you will see the Goblin image distorted. That is one of the reasons to start my own tool - Visual SAK  :beer:
« Last Edit: March 21, 2018, 04:35:42 am by Squall_FF8 »

FAST6191

  • Hero Member
  • *****
  • Posts: 2326
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #10 on: March 21, 2018, 07:13:03 am »
As I understand EXPANDING a GBA ROM is dead simple: just add more space to the ROM but USING that extra space would not be.
I assume the game's programming would have to be modified to direct it to read from expanded space.

As Bregalad said it is almost trivial.
The GBA has 32 megabytes of space mapped directly to the the pretty damn fast memory (such that most things don't copy it to RAM to use), no size indicators, mapper types or the like to worry about. Most ROMs are 16 megabytes or less, and even those in the 32 megabyte range (256Mbit if you want to use the GBA scene's preferred parlance) usually still have a lot to play with (Mother 3 being the exception).
If you understand pointers (and most of those will be direct pointers right there in the ROM, no calculated/relative/inferred/offset to speak of really, in the form of 08XXXXXX, and 09XXXXXX for the upper 16 megs -- http://problemkaputt.de/gbatek.htm#gbamemorymap and technically http://problemkaputt.de/gbatek.htm#gbasystemcontrol as well) then you can point things wherever you like.

Technically there are bankswitching options for homebrew/flash carts and a handful of commercial videos https://mgba.io/2015/10/20/dumping-the-undumped/ but nothing any hacker is likely to encounter or really want to use.

Now whether the premade tools referenced in this thread handle it properly is a different matter. Some of the pokemon tools did not handle adding to the end of the ROM so well but do it yourself and their "free space finders" would do what needed doing.

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #11 on: March 21, 2018, 12:52:55 pm »
Really wish Greiga Master's editor could REMOVE enemies from a battle! Unfortunately, you cannot simply select the enemy drop down box and click "None", or untick "Visible". You also can't select the monster and click "Delete" or "Backspace" on your keyboard, really hoping I'm missing something here lol. Still trying to figure out what makes an enemy have the aerial shadowing effect because it's not related to the "Aerial" tickable box under Statuses lol.
« Last Edit: March 21, 2018, 01:17:00 pm by Zeemis »

Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #12 on: March 21, 2018, 02:23:23 pm »
Quote
Battle editing lets a player changes battles by changing enemies or increase the amount of enemies in a fight and more so long as they pay attention to some rules.
Maybe there is no 'reducing' coded, at all  :laugh:

But seriously I don't know did somebody actually used the tool for editing at the time of developing, but it misses plenty of things to be actually used for a hack  :(

BTW did you try your changes in an emulator? Did you get the header thingy? Does the AI editing actually work? I've always wondered if I had to do an AI edit, what interface it will need ...
Anyway if you have any questions I will gladly help  :beer:

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #13 on: March 21, 2018, 02:36:56 pm »
Maybe there is no 'reducing' coded, at all  :laugh:

But seriously I don't know did somebody actually used the tool for editing at the time of developing, but it misses plenty of things to be actually used for a hack  :(

BTW did you try your changes in an emulator? Did you get the header thingy? Does the AI editing actually work? I've always wondered if I had to do an AI edit, what interface it will need ...
Anyway if you have any questions I will gladly help  :beer:


So my workflow is a bit tedious, but is showing results. I'll add and make changes in the editor, then load up the game in the emulator from a save and test out each enemy's AI, battle formation, and anything else. The editor is unfortunately pretty limited, and pretty incomplete. I cannot change dialog, which I'm sure is easy, but the editor doesn't support it unfortunately. What this means is some bosses have cinematic dialog before you get into battle, like the Siren whom I turned into "Hein".

I haven't done anything with the header, no problems yet. The editor may account for that, but I don't really know. I know that I inserted 10,000 additional bytes and the editor is now placing my enemy sprites there and not spitting out fatal errors or whatever lol.

AI editing works fine; however, you can definitely tell it's not as complex as Final Fantasy 6's. What it does support that FF6 doesn't really is multiple boss forms.

I wish Greiga Master or someone else would continue working on this editor like Lord J did for FF3usME. What I want to ultimately do is create a patch for FF5 Steam so friends can play it. I also plan to add in all the final bosses from FF1~FF10 into the Seal Temple at the end.

Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #14 on: March 21, 2018, 02:59:25 pm »
What I want to ultimately do is create a patch for FF5 Steam so friends can play it. I also plan to add in all the final bosses from FF1~FF10 into the Seal Temple at the end.
Steam ... now that is an interesting thing. I have no interest in SNES/GBA editing, but Steam is completely different story. :laugh:

I assume its true that Steam hold GBA ROM inside ... so after you do the changes in an actual GBA ROM, you will transfer all changes there?  ::)

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #15 on: March 21, 2018, 03:00:44 pm »
Steam ... now that is an interesting thing. I have no interest in SNES/GBA editing, but Steam is completely different story. :laugh:

I assume its true that Steam hold GBA ROM inside ... so after you do the changes in an actual GBA ROM, you will transfer all changes there?  ::)

Exactly. The Steam version of FF5 supposably is just a glorified FF5 GBA rom with fancy graphics programmed to overlay the GBA graphics. It does use a rom from what I understand.

Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #16 on: March 21, 2018, 03:24:32 pm »
I've heard that tale many times, and I sure hope its true ...
Unfortunately I have never seen a proof, something like: in this file at that address is the ROM (or parts of it).

I wish you luck!!! if you can pull this, that will be the best thing done for with FF5.

On Topic:
Adding a new battle message could be a challenge. FF5a uses an interesting text hub - all the text in the game is put in one place and is accesses by index. When I say all, I mean ALL. Spell names, weapon names, battle message,... everything that is not per-rendered as GFX. In order to add, you might have to move the whole hub in the resized part, changes number of ASM,...
It might be easier to replace existing battle messages with what you need. You just need to keep the new message not longer then older ...

Check 'Text' tab in my Viewer. The is a '5' in the bottom. That is the index trough which you might see all messages.

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #17 on: March 22, 2018, 12:21:29 am »
I figured out how to remove enemies FINALLY from battle formations, you have to select the enemy you want and change it to the "None/(Null Enemy)".... I never would have figured this out if I hadn't been looking through the enemies at the lower end of the list lol.


Squall_FF8

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #18 on: March 22, 2018, 04:12:22 am »
I figured out how to remove enemies FINALLY from battle formations, you have to select the enemy you want and change it to the "None/(Null Enemy)".... I never would have figured this out if I hadn't been looking through the enemies at the lower end of the list lol.
Good finding, thanks for sharing it!  :laugh:

Actually I searched for None, because I know entry 0 is already used by Monsters. Unfortunately I made the noob mistake to search at beginning or the end of the list. Who would think it will be $FF :(

BTW if you prefer to Add monsters rather replacing existing ones, you may use the ones with entry numbers: $270-$27F, $29A-$29F

Zeemis

  • Sr. Member
  • ****
  • Posts: 306
  • ジーミス
    • View Profile
Re: FF5 GBA ~ Expanding for Size?
« Reply #19 on: March 22, 2018, 10:16:46 am »
Good finding, thanks for sharing it!  :laugh:

Actually I searched for None, because I know entry 0 is already used by Monsters. Unfortunately I made the noob mistake to search at beginning or the end of the list. Who would think it will be $FF :(

BTW if you prefer to Add monsters rather replacing existing ones, you may use the ones with entry numbers: $270-$27F, $29A-$29F

I am mostly replacing existing monsters, but adding new sprites. You should join the Romhacking discord btw, on the main page click "Chat" and we can talk more there. :)

March 24, 2018, 12:46:47 am - (Auto Merged - Double Posts are not allowed before 7 days.)
So I'm working on the water crystal boss replacement for Garula, I'm implementing Cagnazzo from FFIV to replace it. Using the boss "Liquid Flame" as a template and expanding upon it, I did manage to get it to change form while it's in it's raised water shield phase when attacked with Lightning magic. I am struggling to figure out how to make it counter all magic and silence, and then counter all physical damage with Encircle although, I'm using the documentation found on Slickproduction's Wiki.

Take a look at the Ai so far, it's not entirely right. The first bit at the top just says that Cagnazzo will either use "Fight", "Specality" or "Ice" while in this form. The next part states that after a certain amount of damage is done, or time elapsed, he'll change forms to the raised water form. The third part should be countering all magic with Silence (mute in the editor), and the last bit counters all physical damage with Encircle.

Code: [Select]
Conditions:06 01 2B F0
Uninterrupted:
   Mute
   ENDFF

From what I understand:
06 = React
00 = to or no operation?
2B = Element Type
04 = Lightning

What I'm trying to figure out is how to make it react to all Magic and all Physical damage instead of just an element (2B). I've been heavily reading over Jorgur's documents, and looking through his "Common List", I've found the information for reacting to elements (lightning being bit 04). What I also found was the reaction bit for Action Types:
Code: [Select]
80 Physical
40 Aerial (weapons)
20 Song
10 Summon
08 Dimen
04 Black
02 White
01 Blue

I that by looking at the Frost Bull's AI script, the bit 2B means "element"; however, I have no idea what the bit for "action type" is. It unfortunately isn't documented. :/
« Last Edit: March 24, 2018, 12:46:47 am by Zeemis »