Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Sega Chief on 2016-08-26 15:46:47

Title: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 15:46:47
Got two questions that are sorta linked to each other:

1) I want to change the items/quantity that Cards refine into; are these stored in the .EXE and, if so, what address do they start from? Info on their format would also be handy (so I can tell where data for one card ends and the next one begins).

2) When using Doomtrain, I noticed that changing the values given for abilities like Spr+20% are updated correctly but their in-menu text remains the same. I'm assuming this would also be the case for any changes made to the items given by Card Refinement. Can these be changed with a hex editor as well or are they static icons?
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 16:32:19
1. in m004.bin entries 0-109 (this is shown in Doomtrain in Abilities->Menu->Card Mod)
The entries are 8 bytes each, which covers the entire file.
The entries are in the format:
2 bytes - probably text offset (little-endian format)
1 byte - items received
2 bytes - unknown (always seems to be 00 01)
1 byte - card id?
1 byte - card amount needed
1 byte - item id

2. Doomtrain can't yet edit text for ability names but they are in kernel.bin (see this post (http://forums.qhimm.com/index.php?topic=16923.msg240609#msg240609)). Card refinement text is in m004.msg, not sure which parts are in there, it might pull the item name/amounts dynamically.

EDIT:
if that doesn't work, you might need to edit the duplicated versions of the files in mngrp.bin - see this post (http://forums.qhimm.com/index.php?topic=17099.0)
Title: Re: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 17:37:55
Cheers, bud; I'll pop m004.bin open with a hex editor and see if I can make a test change. Hopefully the text will be updated dynamically for the menu; I've not changed text using hex before.
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 17:44:09
The text in FF8 is roughly in this format (https://sourceforge.net/p/ifrit/code-0/HEAD/tree/trunk%20ifrit-code-0/Resources/textformat.ifr).

There are also some 2-byte characters e.g. I think 0x0C signifies the next byte is a magic id and pulls the magic name and I think 0x03 is another special character.
Basically anything that's not listed in that file is probably 2 bytes instead of 1.
The main issue you'll have with editing text is if you increase the size - since it'd have a knock-on effect on the offsets later in the file.
If you decrease the string length, you can just pad with 00 to terminate it earlier.
Title: Re: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 17:51:22
I think I've got it-

[Geezard]
00 00 - Text offset
05 - no. of item
00 01 - the static value you mentioned
00 - presumed to be card ID (geezard, first card)
01 - amount of card needed
76 - Item ID (matches to item 'Screw' presumably)

Then it goes into Funguar with what looks to match up with the refinement reqs + M-Stone Piece given by that card. But this made me realise that a lot of items aren't listed in the kernel editor, like Screw. Is there a list of Item IDs anywhere?

That character list will be handy; I'll try to avoid using longer names and pad shorter ones out. Thanks for this :3
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 17:55:23
There's a list of item IDs in this post (http://forums.qhimm.com/index.php?topic=17034.msg242332#msg242332)
Only the battle items are listed in Doomtrain at present, the non-battle items are edited differently (see this post (http://forums.qhimm.com/index.php?topic=17098.msg243376#msg243376)) and only the text is in kernel.bin - which Doomtrain can't edit - which is why they're not listed.
Title: Re: FF8 - Cards & Menu Text
Post by: Callisto on 2016-08-26 18:01:52
You can also edit Card Mod results in mngrp.bin, starting at offset 0x221000.

As for changing the corresponding text, there is a nice mngrp.bin translation tool available, created by Nightshade:

http://forums.qhimm.com/index.php?topic=15967.0

Might save you some time and effort.
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 18:15:00
hmmm, might be different for different versions then - either that or you're not including the first text offset.
According to my post here (http://forums.qhimm.com/index.php?topic=17099.0)
I've got the card data starting at:
0x221000 m004.bin

I'm not sure which is actually used by FF8 - the standalone file or mngrp.bin.
Title: Re: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 18:19:05
Okay, so I tried changing the no. of items given in m004.bin from 05 to 0A but in-game I was still getting 5 screws; so I tried changing the mgrp.bin address that Callisto gave and that seemed to do the trick (text wasn't dynamically updated in either case unfortunately, but the result of the refinement was calculated correctly).

Format-wise, it looks to be identical to the m004.bin; but why are there two identical sets of data for cards in two separate files? Is one set dummied? There's a 00 00 before the 05 which I'm assuming is the text offset for this card.
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 18:22:16
they might've pulled the file out during development to make it easier to work with and then not deleted the redundant version after they got all the mngrp.bin code up and running.
Either that or they planned to have stuff as individual files and then decided it'd be easier to use the archive.
Title: Re: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 18:32:47
they might've pulled the file out during development to make it easier to work with and then not deleted the redundant version after they got all the mngrp.bin code up and running.
Either that or they planned to have stuff as individual files and then decided it'd be easier to use the archive.

Seems odd that they'd leave it in; are all the m00X files dummies or are the others used?

I'm going to give text editing a go; thanks for the info and the tool link, Callisto, and cheers for that item ID list, JWP.

Edit: Seems to be the same issue, changing the text in mnrgp.bin doesn't reflect in-game. I'll try the other files like m00.msg.

Edit2: I've tried editing card refinement text in mngrp.bin and m004.bin +m004.msg using the tool but neither seem to update the text in-game; unless I'm using the tool incorrectly, but reopening the files after extraction shows the changes are still there.
Title: Re: FF8 - Cards & Menu Text
Post by: Callisto on 2016-08-26 19:28:34
Sega Chief, after making a change with the translation tool, first select "Save string", then "Save Section". After that, click on the respective Card again in the menu to the left. I know it sounds weird, but now that you say it, I had the exact same problem at the beginning and that was the only thing that helped.

Also, if that's not the problem, try moving the mngrp.bin back to menu.fs twice in a row. That's what I have to do with pretty much all the menu.fs files in order to make changes work, at least when using Deling Field editor.
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-26 19:32:55
I changed mngrp.bin manually and the text updated fine, so it's probably an issue with the tool.
Title: Re: FF8 - Cards & Menu Text
Post by: Sega Chief on 2016-08-26 19:43:00
Sega Chief, after making a change with the translation tool, first select "Save string", then "Save Section". After that, click on the respective Card again in the menu to the left. I know it sounds weird, but now that you say it, I had the exact same problem at the beginning and that was the only thing that helped.

Also, if that's not the problem, try moving the mngrp.bin back to menu.fs twice in a row. That's what I have to do with pretty much all the menu.fs files in order to make changes work, at least when using Deling Field editor.

I changed mngrp.bin manually and the text updated fine, so it's probably an issue with the tool.

I'll give that a go; if all else fails, I'll make the changes manually.
Title: Re: FF8 - Cards & Menu Text
Post by: Girl next door on 2016-08-27 21:54:18
Hum, there's still a thing that I don't understand. For example I've changed the Squall card, it gives now only one Three Stars but:

(http://image.noelshack.com/fichiers/2016/34/1472334744-ff8-fr-2016-08-27-23-51-08-76.png)

How can I change the 3 to 1 ? I don't understand the text offsets...
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-08-28 00:33:27
So the data for the Squall card is:
Code: [Select]
25 15 03 00 01 6D 01 63
this gives a text offset of 0x1525 (it's little-endian, so you reverse the byte order)

The text data for the cards starts in mngrp.bin at 0x226000, so the string you want to change is at 0x227525 in the English version (you'd have to work out the offset for yourself).
At 0x227525 is the following data:
Code: [Select]
57 6F 73 5F 6A 6A 20 47 5F 70 62 2D 02 22 20 75 67 6A 6A 20 70 63 64 67 6C 63 20 02 67 6C 72 6D 20 24 20 58 66 70 63 63 20 57 72 5F 70 71

Using this data (https://sourceforge.net/p/ifrit/code-0/HEAD/tree/trunk%20ifrit-code-0/Resources/textformat.ifr) I can translate it into "Squall Card:{NewLine}1 will refine{NewLine}
into 3 Three Stars"

if I wanted to change 3 to 1, I'd change the 24 to 22
Title: Re: FF8 - Cards & Menu Text
Post by: Girl next door on 2016-08-28 15:56:01
Thanks, that's clear now. :)
Title: Re: FF8 - Cards & Menu Text
Post by: evilmog6 on 2016-10-08 04:56:00
Hi, I'm replying in this topic because I'm trying to do the exact same thing here, but I can't seem to get any effect from editing either m004.bin or mngrp.bin at the offset. As a test, just like Sega Chief, I tried m004.bin first, but then I also tried mngrp.bin... and then I tried editing them both at the same time. After replacing the edited files with Deling, no effect after booting up a save. Do these changes only work on a new game? I thought that was just init.out changes?

Specifically, I tried editing this, which should be the first card "Geezard": 00 00 05 00 01 00 01 76 to 00 00 05 00 01 00 01 7D, which should have, I think, changed the item to Steel Orb. It didn't change to anything, however. I know this doesn't change the text, but it should change the resulted item that ends up in the inventory when the ability use is complete. Instead, I still get 5 screws, not 5 Steel Orbs. I also tried just changing the number of screws to 1, but I still get 5. Any help?
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-10-08 10:48:55
I've found that Deling can be a bit flaky with replacing files, try writing mngrp.bin multiple times or using ff8AC to write the file.
Title: Re: FF8 - Cards & Menu Text
Post by: evilmog6 on 2016-10-08 13:06:02
Thank you JWP, and M4v3R. Also, Deling is a good program, I guess it just doesn't "like" replacing mngrp.bin but I've been replacing dat files, scene.out and kernel.bin for months with it. I didn't even know about ff8ac because I didn't see a thread for it in tools, it was buried in a one or two line statement in a thread about translations. In any case, ff8ac did the trick! I messed up which item I thought I put the ID in for, got a life ring not a steel orb, but that's not important for now this was just a test to see if I could even make a change at all. Thank you very much!
Title: Re: FF8 - Cards & Menu Text
Post by: JWP on 2016-10-08 15:42:23
There's an item reference list here (http://forums.qhimm.com/index.php?topic=17034.msg242332#msg242332) which should help.
Title: Re: FF8 - Cards & Menu Text
Post by: evilmog6 on 2016-10-08 22:15:48
Oh, nice, thank you for that reference, my searching terms didn't yield the results. :)