Page 3 of 3

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Sun Jun 21, 2015 10:19 am
by ChrisX930
I still need help with this files (extractor AND repacker) :(
I've uploaded a XBB-File from another Game (should be the same format?)
The only difference: This game is japanese.
Title: Dragon Quest Monsters 2


please help us with this x-x

I've uploaded some of the xbb-files (they're a bit different than the Harvest Moon -xbb files.
http://puu.sh/ix5ZX/e1411f8444.rar

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Thu Sep 03, 2015 6:34 am
by ubergeek77
So is this dead now? Is there nothing else we can do go figure this format out? From my testing, so long as you don't change the file size of the contents of the archive, everything works fine and nothing is broken. This must mean that the beginning and end offsets for each individual file are contained somewhere. And if we can find it and modify it, I think we should be able to get this working.

Sorry Chris. I remember trying to help with this months back and neither one of us had any luck. I hope you haven't given up yet, because there's a lot I'd like to do with this game.

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Sat Sep 05, 2015 6:06 pm
by ChrisX930
ubergeek77 wrote:So is this dead now? Is there nothing else we can do go figure this format out? From my testing, so long as you don't change the file size of the contents of the archive, everything works fine and nothing is broken. This must mean that the beginning and end offsets for each individual file are contained somewhere. And if we can find it and modify it, I think we should be able to get this working.

Sorry Chris. I remember trying to help with this months back and neither one of us had any luck. I hope you haven't given up yet, because there's a lot I'd like to do with this game.
It isn't "dead", but I'm focusing a game translation at the moment.
I still need help with the xbb-format because GovanifY never finished it.

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Fri Sep 11, 2015 5:07 am
by Z6n4
Looks like you guys are working on Dragon Quest Monsters 2 3DS? I think we should talk.
I dont use this forum often (at all, I signed up just to speak with you 2).

Check this out, post and we'll go from there.
Trying to keep this on the DL.
https://gbatemp.net/threads/partial-tra ... nd.393956/

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Fri Sep 11, 2015 10:14 pm
by ChrisX930
Z6n4 wrote:Looks like you guys are working on Dragon Quest Monsters 2 3DS? I think we should talk.
I dont use this forum often (at all, I signed up just to speak with you 2).

Check this out, post and we'll go from there.
Trying to keep this on the DL.
https://gbatemp.net/threads/partial-tra ... nd.393956/
nope,
at the moment, we're working on Fire Emblem If :D

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Mon Sep 14, 2015 11:18 pm
by Z6n4
Well we basically have it all done except repack in the SRC Files and im struggling. Help would be greatly appreciated

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Wed Sep 16, 2015 10:05 am
by NewZealandSolid
Katai wrote:Thanks a whole ton for the XBB extractor. It's been a huge boon in trying to modify Harvest Moon DS: Sunshine Islands. Unfortunately, I'm not sure if the repacking is working as designed. The rom itself seems to not like the replaced XBB file at all. It's a pack of sprites, and the game simply doesn't render them (as if the files were missing). I haven't even modified any of the files in the folder, and the rom won't take it.

Basically all I did was unpack the xbb, immediately repack the xbb, then copy the file into the rom data. It looks like some of the headers before the data is different in the new xbb compared to the original, but I'll have to look up the xbb specifications to see what specifically got changed.
Did you find out how to repack the files into Sunshine Islands again ? If so, please share.

I really need help with this, because the game just wont take the .xbb files again after extracting and repacking.

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Mon Sep 21, 2015 11:07 pm
by ubergeek77
This post got pretty lengthy (we REALLY need spoiler tags, admins!!!), soooo:

TL;DR: The XBB extractor and repacker created by ekanspt both work well, you can change the file sizes of any of the resulting files so long as you don't add new ones. As for the PAPA files, I have the format fully figured out and I've attached example ones that I've created from scratch. At this time, we basically have everything we need to add/remove game text as we please, but a PAPA editor is almost necessary due to the sheer size of the default game ones. I hope someone can use my example files to create something like that.

My original post, plus edits:

As soon as we can repack .xbb files, we should all be on our way, as I've gained an understanding of PAPA (pp) files such that I can create my own from scratch rather easily without ruining the format of it. The last hurdle is the .xbb archive itself, and while it is somewhat similar in structure to the PAPA files it contains, it's more complicated, and there are checksums in place which is something I haven't completely figured out yet. As far as adding new text strings to a PAPA file, or a new PAPA file to an XBB, it isn't as simple as tacking something new at the end; both formats have offsets of where each file/string is located. So if you add something to the end, you'd need to add an offset for it, which will shift the location of each file by 4 bytes, which means you would need to add 4 bytes to every offset in the archive. Same goes for just modifying existing text string PAPA files - the offsets would have to be updated to reflect that change. Because archives can contain hundreds/thousands of files, this isn't an easy task to do by hand in a hex editor. A program could probably do it simply enough, but creating one is out of my skillset.

Here is documentation (it's been posted on this thread before as a link, but I'll include it for good measure), roughly Google Translated from Indonesian: http://pastebin.com/kw5En1Tt
I've added some of my own notes to it so that it is easier to understand. I also forgot to note in the pastebin that filesizes are in little-endian (so 14 01 -> 01 14 -> 0x0140), offsets are not.

(I would have posted it inline, but for some strange reason Xentax doesn't support the spoiler tag).

Here are two example PAPA files that I made from scratch, using the documentation, that contain a single "Hello World"-like text string. There are two because the format between Harvest Moon ANB and Story of Seasons differs ever so slightly. In ANB, the variable name for the text string comes after the text string itself, whereas in Story of Seasons, it comes before the string, which is more logical. Note that I have no way to test these in game, so I have no way of knowing if I've made any errors, but I believe I've followed the documentation well enough to get these right:

https://mega.nz/#!Kc4E0RIB!AM4UV-Ums2Dh ... pIJSZsWH18

I hope this helps, especially the documentation - it's very informative. I'll take a look at the format of an xbb archive when I have more free time, but for now this is all I've got.

EDIT:
It seems we already have an extractor:
ekanspt wrote:I was a little busy in this week, but i made an extractor for xbb files and i'm working on a repacker.

https://mega.co.nz/#!bBxUEQYQ!3yuo36RtD ... saxSawXJoU
As well as a repacker:
ekanspt wrote:Here it is, i think that it does the trick.

Just drag and drop the extracted folder in the executable. Please note that it needs the _loading order file to exist and you can't change the number of files. Please take care with your original xbb file.

If you have the time, please confirm if it's all ok.

https://mega.co.nz/#!nQJGWAzY!Pgz_zJtQs ... FNzXmj2ync
And ChrisX930 confirms repacking is functional:
ChrisX930 wrote:
ekanspt wrote:Here it is, i think that it does the trick.

Just drag and drop the extracted folder in the executable. Please note that it needs the _loading order file to exist and you can't change the number of files. Please take care with your original xbb file.

If you have the time, please confirm if it's all ok.

https://mega.co.nz/#!nQJGWAzY!Pgz_zJtQs ... FNzXmj2ync
Exported all files of Msg.xbb, changed something with Hex-Editor in one pp-file, repacked Msg.xbb.

All works! Changed things are visible ingame <3
Now I need a pp-encrypter (decrypter that works on all files, not only msg)
So now the question is - even if I don't change the number of files in the .xbb (which isn't necessary, because you can add text strings to the individual PAPA files), is changing the filesize by a significant amount alright so long as you modify the offsets/filesize information in the PAPA file accordingly? I'll try and test this myself, but that may be a very daunting task, as changing the offsets for each string won't be easy. I might need to find the smallest PAPA file and add a new string to that, and then modify a .nut script and call it from there.

If all that works, and I have a good feeling about it, then all we're really missing is a utility that will automate the process of creating PAPA files by changing the offsets of each file depending on how much you add/remove. Because the structure of a PAPA file isn't all that complex, I don't think making such a utility will be all that complicated.

EDIT2: I have great news! The xbb repacker seems to be working fine with files that are larger than the original, as I was able to overwrite a basically useless PAPA file (Event_SYSTEM_ITEMNAME, from Story of Seasons) with a copy of the intro story PAPA file, with some modifications so that I know it was actually changed, and then I changed the reference to the PAPA file in the .nut script accordingly. This is a relatively significant change in file size, as the new Msg.xbb is about 18kb larger than the original, and it still functions in-game. The next step is seeing if we can get it working with even bigger PAPA files, but since this is plenty large enough of a size increase to knock a pointer or two out of the way if the tool were hardcoded to a specific size, I'm pretty confident the .xbb repacker is working properly.

I did try throwing in my example PAPA file for good measure, but oddly I couldn't get it to load correctly. The text became an odd ".......○" when called from the .nut script. It may be because it doesn't have all/as many variables that the story script needs, but I'll keep working on making an example PAPA file that I can call in game.
I fixed this. I've updated the link above with fully working from-scratch PAPA files. (I made the text tiny because Xentax doesn't have strikethrough tags, either. They should really fix that)

At least for now, so long as we can create valid PAPA files, it's great to know that we can add stuff to Msg.xbb as we please!

EDIT3:
There was an issue with my original example PAPA files. Turns out that, even if you have only 1 file, you need to specify that you have TWO files inside the PAPA, and then point to an 8-byte block at the end with all zeroes. I think this is so that the game knows where the string ends. Anyway, my new, made-from-scratch example PAPA file works in Story of Seasons, so I'll update the original link to the archive. I'll make the same change to the A New Beginning PAPA file, but I'm not set up to test it yet, so someone else will have to do that.

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Wed Sep 30, 2015 12:01 pm
by ChrisX930
Finally I got my Internet back :D
Will try to rebuild AND use the pp-file creator the next few days <3 :)

Re: decompress xbb file from "Harvest Moon A new Beginning 3

Posted: Thu Oct 01, 2015 9:57 pm
by ubergeek77
ChrisX930 wrote:Finally I got my Internet back :D
Will try to rebuild AND use the pp-file creator the next few days <3 :)
Just a quick note - I've been working on something too, and if you take a look at the examples I posted, I think there is an extra set of zeroes (0x00000000) that don't need to be there. They were there on the Story of Seasons one, but I can't remember if they were on the ANB one. Don't let that trip you up.