Help unpacking/repacking SCR text files for JP translation

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Habanero
Posts: 55
Joined: Sat Jun 15, 2019 9:14 am

Help unpacking/repacking SCR text files for JP translation

Post by Habanero »

Hello. I've been stumbling through this game's files with the help of this forum. I have no experience in this, so when I saw "map0001.scr" etc I thought they would just be scripts that control the enemy, map file generation, etc. However, simply opening them in Notepad reveals that they contain the dialogue too! Man I'm dumb.

https://puu.sh/F0Ksr/543b50a003.png

This is probably a proprietary format? I've attached all the files. I've tried simply replacing the text even though it obviously wouldn't work, and as expected it crashed (with both half-width and full-width text).

Thanks for any help! This will probably be the last thread I have to annoy you with about this game, I feel bad about asking so many questions. I wasn't sure if I should post this here or in the localization forum, so I chose the one that seems to get more traffic.

https://mega.nz/#!B05nkIaK!AryQfPaoQHbW ... 9RszgOIrNg

P.S. If anyone can point me in the general direction of how I'd go about learning to examine these files myself, it'd be appreciated. I wouldn't want to constantly ask questions.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Habanero wrote:Hello. I've been stumbling through this game's files with the help of this forum. I have no experience in this, so when I saw "map0001.scr" etc I thought they would just be scripts that control the enemy, map file generation, etc. However, simply opening them in Notepad reveals that they contain the dialogue too! Man I'm dumb.

https://puu.sh/F0Ksr/543b50a003.png

This is probably a proprietary format? I've attached all the files. I've tried simply replacing the text even though it obviously wouldn't work, and as expected it crashed (with both half-width and full-width text).

Thanks for any help! This will probably be the last thread I have to annoy you with about this game, I feel bad about asking so many questions. I wasn't sure if I should post this here or in the localization forum, so I chose the one that seems to get more traffic.

https://mega.nz/#!B05nkIaK!AryQfPaoQHbW ... 9RszgOIrNg

P.S. If anyone can point me in the general direction of how I'd go about learning to examine these files myself, it'd be appreciated. I wouldn't want to constantly ask questions.


So before I attempt to do this just want to clarify something first. As you can see the Japanese in these files I'm assuming you have the locale of your system set to Japanese. As the files aren't encoded to a standard that allows it to work with anything other than the system locale the only language this could be translated to that works well on any system is really only English and without any character that has accents etc. i.e. a-z A-Z 0-9 is that your intention? Anything other than that would require potentially editing font files etc. included with the game as well. Also depending on rendering even English might display were (kind of block like with some spacing between the characters)

I'll start looking over the file in the mean time.

Edit: Small note, looking at it briefly the file is full of offsets, so if you tried to change anything without keeping it the original length it would break the entire file and sadly it's not as simple as editing just a few either. Here is one file with the offset for the first 2 entries and some data in the first entry. Best I can tell thus far this format doesn't really use lengths it uses end positions and null termination for string values, because of that to be able to edit anything you need to have a fairly good understanding of how to at least be able to read all data structures in the file to replace the string data to update all of offsets as everything will shift throughout the entire thing.

Code: Select all

15 00 //count entries
56 00 00 00 //entry offsets
4F 01 00 00
...
//Start of First Entry
01 00 //id
01 00 //id
24 00
1D 00
02 00 //count offset values
   68 00 00 00 //first position after array (Offset 1)
   2C 01 00 00 (Offset 2)
//Offset 1
01 84 00 01 00 01 00 00 00 00 00 01 00 00 00 01 00 04 03 00 03 03 01 03
01 00 //count offset values
   86 00 00 00 //first position after array (Offset 1 - 1)
00 F1 03 F0 03 01 00 08 00 00
AF 00 00 00 //offset to end of bytes
07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 04 04 04 04 04 //data
F0 03 E8 03 08 00 00
D4 00 00 00 //offset to end of bytes
1D 1D 1D 1D 1D 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 //data
F1 03 09 04 01 00 03 04 00 00 04 E8 03 //possibly saying the 3 entries
1A 01 00 00 //offset to end of bytes
82 A8 8F EC 97 6C 81 41 82 A8 8F EC 97 6C 82 CC 89 BA 96 6C 82 AA 00 82 DC 82 A2 82 E8 82 DC 82 B5 82 BD 81 42 00 8E B8 97 E7 92 76 82 B5 82 DC 82 B7 81 42 00 //data (looks like 3 strings here)
EB 03 00 88 00 88 00 00 EF 03 0A 00 13 00 22 00 EE EE
//Offset 2
01 88 00 01 00 01 00 00 00 00 00 01 00 00 00 00 00 00 03 00 03 03 00 03
01 00 //count offset values
4A 01 00 00 //offset to end of bytes
01 EE EE EE EE

//Start of Second Entry
02 00
02 00
Habanero
Posts: 55
Joined: Sat Jun 15, 2019 9:14 am

Re: Help unpacking/repacking SCR text files for JP translation

Post by Habanero »

Alas. I figured it wouldn't be that easy. What a hassle! Maybe I should just provide a separate script for people to read on the side.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Habanero wrote:Alas. I figured it wouldn't be that easy. What a hassle! Maybe I should just provide a separate script for people to read on the side.


I don't mind helping but I don't really have any way to test stuff was it available from somewhere still?
I've been able to add a fair amount of the Op Codes so far to parse the files for extracting the string data so it is possible for sure.

Added a couple examples of stuff so far.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Habanero wrote:Alas. I figured it wouldn't be that easy. What a hassle! Maybe I should just provide a separate script for people to read on the side.


So this should be all the unique text from those files with the exception of the file tscr\Map0008.scr for god knows whatever reason this is different, not sure if it was a bug on their side or this was intentional. It almost seems like some info at start is XOR'd and the rest of the data isn't ascii like the other versions of the files, I'll look at it a bit more once I start writing some of the repack stuff.

I'm thinking the easiest approach (what I usually do translating games) is to use that master list as a dictionary and then use it to update stuff. Mind you even the same text might have a different means depending on the scene so fine tuning it later is always good but to start should be enough to test with.

Edit: Attached what I have so far in regards to the program.
The Extract is run against any file in each directory, I just edited it to do all files in the directory as I got further.
For the Merge Text you need to pick a file in the top level directory because I was too lazy to add a folder browser and it will read all of the extracted text and consolidate it to one file with unique entries.

So if the main folder was "Main" and had the tscr ~ tscr6 directories in it just create a file in Main and select that.

It will be a bit more work for the repacking as I didn't really care what offset went with what when I was extracting I just needed to be able to read the data layout to pull out the info but shouldn't be too much work.
Habanero
Posts: 55
Joined: Sat Jun 15, 2019 9:14 am

Re: Help unpacking/repacking SCR text files for JP translation

Post by Habanero »

I didn't get a notification that you replied for some reason, sorry. In any case, here's the game if you want to test/play it yourself. I'll take a look at it with your files later this week. Thanks again for helping out.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Habanero wrote:I didn't get a notification that you replied for some reason, sorry. In any case, here's the game if you want to test/play it yourself. I'll take a look at it with your files later this week. Thanks again for helping out.

Thanks, it seems like the Map8 that was in your upload was corrupt. Getting the clean copy from the ISO works fine w/ the apps so that's good news and saves me the headache of trying to figure out what the hell happened haha. I'll work on writing the packer and test w/ some on the starter stuff to make sure it's working fine.
Habanero
Posts: 55
Joined: Sat Jun 15, 2019 9:14 am

Re: Help unpacking/repacking SCR text files for JP translation

Post by Habanero »

Corrupt? Weird, I don't think I touched any of the files and the game hasn't given me an error when playing. Well, whatever.

Edit: Judging by the modified date, I must've messed with it. My bad.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Habanero wrote:Corrupt? Weird, I don't think I touched any of the files and the game hasn't given me an error when playing. Well, whatever.

Edit: Judging by the modified date, I must've messed with it. My bad.


So good news and bad news.

Good news is that translations are possible to a certain extent though depending it gets to be fun/ difficult.
So ... lets start with the good:
1) I did a quick test with the cow as it just says Moo ~ Moo ~ (モ~モ~) and it was easy to edit without writing the repacking program being written etc.
A) While it worked it seems like the font pack used for the game doesn't treat Latin characters as well as we'd like, or put another way they're fixed block (See the pic below)
B) Regardless a long as you don't mind the spaced out letters you'll be able understand the game
2) The files marked as pic in the bmp folder are just bmp images with the first 2 bytes edited.
A) Because they're standard bmp it is possible to edit them easily without special software so for the Menus that rely on drawing etc. (there are quite a few) you can translate them (fairly*) easily.
3) I was able to find some of the data in the Exe itself, and it is possible to edit it with proper knowledge**
And now the cons:
1) Because there is data in the Exe for certain things it will require either patching the game in memory or modifying the exe as well. Short term for testing I suggest the former while for distribution it's a matter of preference.
2) I did find in order to get everything working properly (show Japanese and get voices to work) I needed to run Locale Emulator on DXWnd to start the game, while niche for a 2002 game and this being a project aimed at fans this is nothing unexpected of such a project. I'd also note with some Exe patching I could probably fix this requirement assuming it was fully translated. (Only the Locale requirement, for newer OS DirectX emulation will still be required)
3) Similar the block spacing issue with the Moo you're going to hit some size limitations. While the in game text is more forgiving since you have a large dialog box you can take advantage of for the text in the exe that is usually rendered into a fix width area, because of this your translations will need to be picky (reduced)
A) An example of this is exiting the game, the original options are Return to game (ゲームに戻る) and Quit the game (ゲームを終了) using the full length translations results in cropping, while it might be possible to find the box rendering and adjust this without doing so will result like the 2nd Picture. So you can either shorten such things to Quit & Return or you just added to the workload (if it's even possible)

Also 3rd Picture attached is an example of the bmp that would need to be edited to do all of the nameplates ingame

*This require moderate skill with editing if you want it to be pretty but otherwise completely doable.
** If the data fits in the same space you can just replace the bytes, otherwise it gets more tricky

ImageImageImage
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Help unpacking/repacking SCR text files for JP translation

Post by LokiReborn »

Figured I'd also show with the edited nameplate for the Cow, and give an example doing a quick search for what I found in the exe for string data. From looking quickly it seems like most everything that isn't the dialog for the pop-ups

If you want to add me on discord happy to talk through some of it, my id is LokiReborn#4170

ImageImage
Habanero
Posts: 55
Joined: Sat Jun 15, 2019 9:14 am

Re: Help unpacking/repacking SCR text files for JP translation

Post by Habanero »

Thanks for the explanations. I did manage to dump the BMP not too long ago with a Noesis script that was provided by another user. I'll probably reach out when I'm ready to move forward with the TL, as I'm gonna be busy for a bit (plus I'm still playing through the game).

I'm a bit more optimistic about working on this now, I thought I'd have to track down some old software to even have a chance. Thanks for all the help.