Brandish 2 Renewal Translation Project

Information regarding a current English Translation project for Brandish 2: Renewal for the NEC PC-98 Computer. Brandish 2: The Planet Buster was given an English Translation for the Super Famicom version, however the PC-98 has many extra areas that were not included in the SFC port and generally has a much superior FM soundtrack.
Post Reply
User avatar
Gu4n
Posts: 128
Joined: Wed Jul 08, 2015 5:25 am

Brandish 2 Renewal Translation Project

Post by Gu4n » Wed Jul 08, 2015 11:28 am

Cross-post from the Ancient Land of Ys forums, from which SkyeWelse directed me here.

We're looking for a hacker to help out with the Brandish 2 Renewal for PC-9801 translation project. I know that many of you have experience with either deconstructing PC-9801 games or Falcom games, so I think this forums is our best bet to find someone willing to help out. SkyeWelse was even kind enough to create a board dedicated to Brandish 2.

If someone here would be interested and willing to help with the hacking aspect, we can finally get this project rolling. Project management and translation will be in ALOY member Veleskola and my hands, so once a script/tool has been creating to import/export text strings, we will work on the project independently.

flamethrower
Programmer
Posts: 935
Joined: Mon Mar 09, 2015 3:03 pm

Re: Brandish 2 Renewal Translation Project

Post by flamethrower » Wed Jul 08, 2015 8:38 pm

I think you or your partner Veleskola should attempt the hacking. Believe it or not, you'll be more likely to get the assistance you need to be successful if you attempt it than if you did nothing. This strategy worked beautifully for the Nayuta project. The exception was the .itv (video) files, which is just a very hard problem to solve, I think.

I probably can't help you. But there might be something I can help with, you never know. I don't know the basics of the PC-98 (or even Windows PC, but that's another story). That's why I can't help.

Anyway, you should try to follow this help guide: http://www.catb.org/esr/faqs/smart-ques ... tml#before
Since my knowledge is so low, I would want to know basically everything, including even what was interesting that you found while searching for answers on the internet.

PC-98 uses a 486 (80486) processor. That uses the x86 instruction set, so you'll need a way to decompile a program that uses that instruction set.
You'll also need information about how x86 programs are compiled or packaged.
I think PC-98 was capable of using CP932 (windows code page 932), so it's possible text was encoded using that.
That's about all I know.

User avatar
M_bot
Programmer
Posts: 98
Joined: Sun Apr 05, 2015 7:18 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by M_bot » Wed Jul 08, 2015 10:40 pm

I'm in the same boat as flame, I don't know anything about PC-98. If you do as flame suggested and do some of the hacking I or flame could then come and write a tool if you were able to explain what it needed to do and give resources that we might need to understand what you're talking about. Flame and I are basically the only programmers on the forums at the moment (unless Xal, Skye, or Zero have brushed up their skills). Flame has done more of this than I especially related to scripts, while I have done more on extracting and inserting images or other resources that would need to be changed.

If I remember right Xal has done some PC-98 hacking, maybe he could help you figure out the pointers and things and then we could try to write a tool based on what you discover. Edit: Xal is I believe really busy so I think trying hacking on your own might be the best route unless you find someone.

And this isn't that we don't want to help. We would love to help but we're not well-versed in PC-98 just yet so at least some guidance would be needed. For now I've put PC-98 as one the things I plan to learn and research.

User avatar
SkyeWelse
Graphics & Web Design
Posts: 485
Joined: Thu Mar 05, 2015 4:32 am
Location: Georgia
Contact:

Re: Brandish 2 Renewal Translation Project

Post by SkyeWelse » Wed Jul 08, 2015 11:12 pm

Also, I wanted to point out from my asking questions at Tokugawa Corporation forums (which is a big PC-98 community, but not always that active) that very few PC-98 projects seem to get hacked actually. I believe they dropped EsperKnight's name a few times as being someone who had some good knowledge of hacking PC-98 games. I never contacted EsperKnight though because I know he is usually pretty busy and if I were to contact him about something I'd want to know enough to ask him a specific question, but he might be able to tell you a process for how to begin.

PC-98 games are something that we plan to learn more on as we prepare for our Xak I and Aiza projects (or at least for Xalphenos, M_bot and myself) but from what I gathered above, we're not quite there yet as it is quite a different architecture. Also if anyone would like to know more about PC-98 architecture in general, I would recommend speaking with a user named Kobushi who frequents Tokugawa and also on NFG forums / PC-98 section, as he knows a lot about it and can probably shed some light on a few things.

-Thomas

User avatar
Xalphenos
Wanderer
Posts: 89
Joined: Fri Mar 06, 2015 12:24 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by Xalphenos » Thu Jul 09, 2015 3:56 am

Ok pointers for this game are simple. At the start of each dialogue file, Talk0X.BZH, Is a pointer table. Everything bracketed in green is the pointer table. The red underlined bytes 0x6409 is the pointer to the first dialogue string. Go down to offset 0x0964 and you will see the first string that starts with"ベルサドス島の".
Image

So writing a program to dump the text via the pointer table is a no-brainer. From there it seems to me that the best way would be a program that just repackages the text with a new pointer table pointing to new locations. Also should be a no-brainer.

The hardest part will be compression. But it may already be done. Esperknight wrote some programs for Xanadu I believe but they may very well work here. http://www.romhacking.net/forum/index.php?topic=17666.0 Falcom's used very similar compression in all their old games. Who knows it may even still be the one used in Nayuta?

Lastly you will need a way to repackage the files into a KLB and KHD file. I know the KLB file is an archive file and the KHD file is a list of files in the KLB. I'm not yet entirely sure how all the File offsets work though. And it seems like all the files in the KLB are compressed; not just text files.

flamethrower
Programmer
Posts: 935
Joined: Mon Mar 09, 2015 3:03 pm

Re: Brandish 2 Renewal Translation Project

Post by flamethrower » Thu Jul 09, 2015 5:03 am

My god the Nayuta compression looks really similar to that. Goodness gracious.

You can see on line 108 of the code the constant 0xE and this constant is also a magic number that's used in the Nayuta code.
He wrote a recompressor which I did not do for the Nayuta project - I just used fake compression.

User avatar
Gu4n
Posts: 128
Joined: Wed Jul 08, 2015 5:25 am

Re: Brandish 2 Renewal Translation Project

Post by Gu4n » Thu Jul 09, 2015 9:36 am

Thanks to your efforts of explaining pointers, Xalphenos, I think I'm starting to understand how they work. For example, in your screenshot I can see 0x7E00 referring to 0x007E. That also matches the first line of my export using the Korean tool I mentioned on ALOY, which reads "0000007E,32,そうかい。昨日、兵隊どもが大勢降". 0x0102 would then refer to "00000201,30,この奥の扉に合う鍵がなくてな。". Going through the pointer table with the export on my proverbial lap, I think I finally see how it works. Thanks a lot!

User avatar
M_bot
Programmer
Posts: 98
Joined: Sun Apr 05, 2015 7:18 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by M_bot » Thu Jul 09, 2015 1:53 pm

I started looking at KLB and KHD files to see if I could repackage them.

Code: Select all

This is for the KHD file.

Address     Data                Comment
0000        KLIB 0.1 + 0x00     Identity and version
0008        0x14                Number of files in archive

Repeated per file
0000        G_SYS04             8 char name space padded
0008        .BZH                4 char extension 
000C        0x0001 or 0x0000    Don't know
000E        0x0000              Always null, probably padding
0010        0xA0AB461E          This has to be related to compression
0014        0x80DA0400          Pointer to compressed file in KLB file
0018        0x7305              Compresssed size of file in KLB file
001A        0x5800              Block size - Padded compressed size / 16
001C        0x00000000          Always null, probably padding

Each pointer + size will not match up because the files are null padded to the next 0x10 address.
That as far as I've gotten. Don't know what the compression is but it seems that it'll probably be the same as the other games. That will definitely be the hardest part.

Edit: Discovered block size. Also address 0010 for each file has to be related to compression now. I've also noticed that it seems to at least be related somewhat to what type of file (image, text, music) is being compressed.

User avatar
SkyeWelse
Graphics & Web Design
Posts: 485
Joined: Thu Mar 05, 2015 4:32 am
Location: Georgia
Contact:

Re: Brandish 2 Renewal Translation Project

Post by SkyeWelse » Thu Jul 09, 2015 8:07 pm

M_bot, not sure if you've tried this already, but at KHD files can at least be unpacked using the Falcnvrt tool.

-Thomas

User avatar
M_bot
Programmer
Posts: 98
Joined: Sun Apr 05, 2015 7:18 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by M_bot » Thu Jul 09, 2015 8:11 pm

Yea, I've done that. Gu4n mentioned the same thing. It doesn't help me too much since it doesn't tell me anything about the compression used or what else the file might be doing. It does tell me uncompressed file size and what the uncompressed file should contain which is sorta helpful for figuring out the compression scheme.

Also you should get on IRC again.

flamethrower
Programmer
Posts: 935
Joined: Mon Mar 09, 2015 3:03 pm

Re: Brandish 2 Renewal Translation Project

Post by flamethrower » Thu Jul 09, 2015 11:29 pm

Is there a debugger available for PC-98?

User avatar
Xalphenos
Wanderer
Posts: 89
Joined: Fri Mar 06, 2015 12:24 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by Xalphenos » Fri Jul 10, 2015 12:50 am

There is a version of neko project that has a debugger. It could be vastly improved but it works well enough. Ida even the free one will work for disassembly since it's just x86.

It looks like mbot got as far as I did with the Klib format. Probably will require debugging to get further.

User avatar
Gu4n
Posts: 128
Joined: Wed Jul 08, 2015 5:25 am

Re: Brandish 2 Renewal Translation Project

Post by Gu4n » Sat Jul 11, 2015 6:42 am

Well, aforementioned Korean tool is of no use here. After having struggled with some sentences for a day, I discovered that the export doesn't print all lines or characters. As you can see in the shot below, the program forgot to export the entire fourth line, 「がない。そいうもんだ。」. I also found out that the sentences I was struggling with yesterday - I even had friends look at it - were completely mangled. No wonder I had the feeling something was off. That means I'll have to sit back patiently and wait for a professional export.

Game: そうかい。昨日、兵隊どもが大勢降てきたと思ったら、あんたを連れきたんだな。
Export: そうかい。昨日、兵隊どもが大勢降りてきたと思ったら、あんたを連れあいつらが危険を犯してここまで運んできたんだ。

Game: あんたには、よほど賭金がついているんだろうな。
Export: あんたには、よほどけのことも知らないのか?

Image

User avatar
Xalphenos
Wanderer
Posts: 89
Joined: Fri Mar 06, 2015 12:24 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by Xalphenos » Sat Jul 11, 2015 8:36 am

0x0D is a standard line break, carriage return actually. It is quite odd that the program would miss a sentence after one. The text files are so standard you can almost open one up in a text editor save for the pointer table at the beginning. I can't quite explain why the sentences are getting screwed up though.

For the purposes of writing a text dumper 0x08 seems to be wait for button press. I'll write you a basic text dumper/inserter this weekend if M_Bot doesn't beat me to it. There may be some additional control codes in there that will need to be figured out but I could easily get you something that can get you started. I actually already have a very generic text dumper written that I could adapt to these files. I would just need to write a program to rebuild the dialogue files.

On top of all the things that already had me busy my kids birthday was yesterday and tomorrow is his party. Actually it's after midnight so day before yesterday and today. Yay for waking up in 4 hours!

flamethrower
Programmer
Posts: 935
Joined: Mon Mar 09, 2015 3:03 pm

Re: Brandish 2 Renewal Translation Project

Post by flamethrower » Sun Jul 12, 2015 1:17 am

Wrote the dumper program:
http://pastebin.com/s1NSLU8Z

Tested working with TALK01, TALK02 and TALK03.

The hard part will be reverse engineering the compression.
1.PNG
1.PNG (29.52 KiB) Viewed 3092 times
How am I supposed to make sense of this?

You can see the compressed and uncompressed versions of TALK02 in RAM during the first scene, which is good, I guess.
3.png
3.png (45.05 KiB) Viewed 3092 times
This is the start of TALK02 in the packed file.
I tried breakpointing on the 6E2020C0 and it didn't. I tried breakpointing on the 7600 and it did. Not sure what those first bytes are for. Starting at the 7600, that's mostly plain text.

Figured one thing out. The C0 in the 6E2020C0 says how far to the next compressed field (and plain text until then).
2.png
2.png (38.51 KiB) Viewed 3092 times
This is showing a compressed section. The plain text looks like: 危険を犯してここまで運{0d}んできたんだ。あんたには、よほど{0d}の
The first one is E0336102. E0 I think introduces a compressed field. The next byte says how far to go back. The next byte I have no idea. This particular one copies きたんだ (8 bytes). How do they get that (8) from 0x61? And the 2 at the end says how far to the next compressed field.

The next compressed field is E04C209D. The same holds true. 0x4C says how far to go back. Seven bytes are copied: あんた and half of に 0x9D says how far it is to the next compression field. No idea about 0x20 or what it is doing.

User avatar
M_bot
Programmer
Posts: 98
Joined: Sun Apr 05, 2015 7:18 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by M_bot » Sun Jul 12, 2015 4:54 am

Edit: Bad news there is most definitely more than one type of compression in these files. I started looking at the compression flame was trying to figure out and it is way different than the one I was looking at below.

We should find all the files that need to be modified and see if they all have the same type of compression and then focus on cracking that compression.

For the flame's compression. The E0 denoting a compression is almost correct. It's not E0 but just E. You can see this in the compression field E1236218 where it looks back 0x123 and not 0x23

--- Actual post ---

Seeing as flame started looking at the compression as well I shall post what I've discovered. This is rather incomplete and I'm particularly struggling with my theory since it seems to only work for a certain amount of flags. I did mine on BR2.BZH file withing BR2DAT1.KLB. It is possible that the different files are compressed differently (I sure hope not).

The compression starts with a 2 byte something which does I have absolutely no clue.

Then there is the initial 2 byte flag in which the first byte is ignored. In this file it is 0000. Denoting that it should directly write the next 8 bytes. Normally this would denote to write 16 bytes, however the first byte of the flag is ignored.
The 8 bytes to be written follow.

The next flag is 00A0 which turns out to mean write 13 bytes and copy 2 bytes.
The 13 bytes to be written follow.
And then there's a single byte telling you how far to look back to copy the 2 bytes.

The way the above flag works is like so. You take the flag in BigEndian order. So 00A00 to A000.
For the purposes of this I'm going to do this visually rather than what it would be programming wise.
Take the flag convert it to binary and then reverse it. Starting with write go through the zeros until you hit a 1.
Upon a 1 switch to copy, when you hit a 1 again revert back to write.

Code: Select all

A0 00
1010 0000 0000 0000
0000 0000 0000 0101
WWWW WWWW WWWW WCCX
13W 2C
This almost works for the next flag.

Next flag is A814.

Code: Select all

A8 14
0001 0100 1010 1000
0001 0101 0010 1000
WWWC CXWC CCXW CCCC
3W 2C 1W 3C 1W 7C
In this flag the last instruction only has four C, however it actually copies seven. I believe flags might be continuous so the 3Cs would be in the next flag but that doesn't happen here.

Flags 640C and 2A08 make no sense to me. 640C somehow becomes 4C 8C and 2A08 becomes 6C 1W.

Later in the file my way works again.

Code: Select all

28 00
0000 0000 0010 1000
0001 0100 0000 0000
WWWC CXWW WWWW WWWW
3W 2C 10W

Code: Select all

09 85
1000 0101 0000 1001
1001 0000 1010 0001
CCCX WWWW CCXW WWWC
3C 4W 2C 4W
In this one there's a C at the end this joins up with the next flag to make a 2C. But then I have no way of knowing how many copies/writes there are in each flag. So not sure.

Code: Select all

02 00
0000 0000 0000 0010
0100 0000 0000 0000
CXWW WWWW WWWW WWWW
2C 14W
From what I understood in flame's post it seems that compression does look back and copy X amount, however how much is X and when it's supposed to be copy versus write not entirely sure.

User avatar
Gu4n
Posts: 128
Joined: Wed Jul 08, 2015 5:25 am

Re: Brandish 2 Renewal Translation Project

Post by Gu4n » Sun Jul 12, 2015 8:02 am

Thanks for the dumper program, flame. The dialogue divider will be very helpful. I should be able to make a start with the translation this way.
M_bot wrote:We should find all the files that need to be modified and see if they all have the same type of compression and then focus on cracking that compression.
Below is a list of files that need to be modified that I compiled earlier. Maybe I missed some strings here and there, though it should cover the majority of the compressed (KHB) files.

Code: Select all

BR_MAIN
+BIOS.SYS -- BIOS text
+UTY.BZH -- Main menu

BR2DAT1
+BR2.BZH -- System messages and items
+TALK0x.BZH (3 in total) -- Dialogues in the field 

BR2PRG2
+ALG21.MON -- Opening text

BR2PRG3
+MAPxx.SPG -- Additional dialogues

BR2PRG4
+MAPxx.SPG -- Additional dialogues

BR2PRG5
+ALG65.MON -- Stats and short menu items
+ALG68.MON -- Credits

BR2SDT1
+MAPxx.SDT -- Map-specific system dialogues

User avatar
Xalphenos
Wanderer
Posts: 89
Joined: Fri Mar 06, 2015 12:24 am
Location: Texas

Re: Brandish 2 Renewal Translation Project

Post by Xalphenos » Sun Jul 12, 2015 9:39 pm

I'm glad to see Flame wrote you a text program. The kid's birthday party lasted til 8pm and then we all crashed. I woke up today at 2 pm!

Anyway some good news. The game will happily print standard single byte english in the dialogue. So I'm not really sure what the last guy was talking about who said it would only use the two byte shift jis characters.

You get 31 characters per line before the dialogue auto line breaks or you can use the carriage return to force a line break. A 32nd character would print outside the box anyway.

The bad news: It does indeed use that font you complained about on ALoY. Lower case "h" "m" "n" are near indistinguishable.

User avatar
Gu4n
Posts: 128
Joined: Wed Jul 08, 2015 5:25 am

Re: Brandish 2 Renewal Translation Project

Post by Gu4n » Sun Jul 12, 2015 10:04 pm

Birthday parties can wear you out, especially kids' birthday parties. I hope he/she had fun, though!

Good to know there's a character limit of 31. That does mean I have to expand the dialogues with additional lines, since Japanese can be awfully short if it wants to. What would be the best way for me to indicate these additional lines?

User avatar
SkyeWelse
Graphics & Web Design
Posts: 485
Joined: Thu Mar 05, 2015 4:32 am
Location: Georgia
Contact:

Re: Brandish 2 Renewal Translation Project

Post by SkyeWelse » Sun Jul 12, 2015 10:34 pm

I'm interested in knowing more about this font if you guys don't mind explaining how the game is utilizing it currently. Is the font an image or is it something that could be edited and replaced?

Gu4n, there is probably an opcode for breaking a new line that you could insert manually before a dialogue box close opcode, if that is indeed how this works. But you'll likely only be able to put only as many 31 character lines as there is space in any one dialogue box. Perhaps though another dialogue box can also be manually inserted after the first one closes with a different opcode if you needed to extend the dialogue that way as well.

This is how it works for Wander Wonder at least, but it could be different here. I'll let the others answer that in more detail.

-Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest