3

I got my hands on a copy of Mystic Nights, a survival horror game for the PS2 realeased exclusively in Korea. The game's text is all in Hangeul (Korean writing system). I extracted the ISO and cracked it open in hopes of translating the game to English but I can't figure out where the text is stored. I've located graphic files (TIM2, .TM2) nested inside of .RES files (resource files?) and I was able to extract those TIM2 images with an executable I found on https://romhacking.net. I noticed that there are TIM2 images holding character tables for Hangeul. I can't really see any other pertinent files that may hold text besides two large binary files DATA1.BIN and DATA2.BIN (each about 500mb in size).

If this were a Japanese game, I would search the binary files for JIS encoded text... but unfortunately that is not the case.

Any ideas on how I could proceed?

1
  • Please add like 10 lines of instructions where you find the game printing the characters. That will help
    – Ricardo
    Commented May 31, 2019 at 20:32

2 Answers 2

2

This is what I got for you. I think if you going to translate this is going to be more complicated that you think because of the way the company programmed this game, but anyway...

I am using PCSX2 to execute the game and GameConqueror (alternative to Cheat Engine on Linux) to check the memory.

First I thought that the game was importing the text from a file and mapping the characters from the text file on the image to show it graphically so I got to the point in the game where it shows ASCII character like here:

enter image description here

With GameConqueror I searched for strings that contain 'R1' until I got to this address 0x202a3c00; then I checked the memory and I got this chunk of data:

enter image description here

By now I know that indeed they are using some ASCII and that they are importing it from a file so I extract the files inside of the ISO image, enter that folder and then I start searching in the files for those hex values with:

grep -rnw '.' -e $(echo -e '\x52\x31\x20\xb9')

I got:

Binary file ./RES/SUBSYS.RES matches

Great! Then I opened it with a hex editor and searched for the values. If you do that you will notice that they are using some type of syntax to tell the game what to show. In this case they show a text type 'TIP'

enter image description here

I think that by now you could start translating but I wanted to go beyond and disassemble the code to modify it because there is going to be a problem if you translate that file (I will address that later) so with PCSX2 debugger I added a breakpoint to 0x202a3c00 and I got two functions that access to this address:

z_un_0014bdf0 write
z_un_00155c70 read

I use Binary Ninja to disassemble it better (PSCX2 debugger sucks) but I had some problems... I wanted to use Hopper but I need to install some plugins and it's too annoying... If I use IDA Pro I have to buy it because it's mips.... So I guess there is not other option than translate that file. The problem with translating that file is that you would have to come with a translation with less bytes than it already contains. For example.

The text in the first image has 57 bytes. Meaning, if the translation is more than 57 ASCII characters then you would have to come with a slightly different translation. If it is less then that its easy because you can fill it with 0x20 (spaces).

enter image description here

So what encoder are they using? I'm not an expert on encoding formats but I'm pretty sure that they are not using any standard one and they decided to came with a custom one. I know this for 3 reasons:

  1. They have ASCII values that actually represent ASCII values but very limited.
  2. They are not using the Unicode block Hangul Syllables. The character in the game is 0xb9f6 but it should be 0xbc84, is in the game 0xc6b0 it should be 0xd2bc, etc.
  3. The images that you extracte. has no more than 500 Korean characters but the Unicode Hangul table has 11,172.

UPDATE: Thanks to @IgorSkochinsky to check the encoder with different method. It is EUC-KR

5
  • 1
    It seems 버 is B9 F6 in EUC-KR
    – Igor Skochinsky
    Commented Jun 2, 2019 at 11:03
  • You do have the link? I got it from here encoding.spec.whatwg.org/euc-kr.html and it does not look like it.
    – Ricardo
    Commented Jun 2, 2019 at 18:31
  • 1
    I saved a file in Notepad++ as EUC-KR and looked at the bytes
    – Igor Skochinsky
    Commented Jun 2, 2019 at 21:05
  • @IgorSkochinsky you are right. Okay I guess the link that I was using as a reference was wrong...This one match i18nl10n.com/korean/euckr.html
    – Ricardo
    Commented Jun 2, 2019 at 23:13
  • I just wanted to thank both of you very very much. I've made a tremendous amount of progress on the translation. Of course not being able to add more characters due to not being able to easily alter the number of bytes per text entry is quite annoying and handicapping at times, but it's better than nothing.
    – Shpack
    Commented Jun 17, 2019 at 18:56
4

I would try CP949. Of course, this assumes that text data is not packed or encoded, which can happen too. Maybe try dumping/searching the emulator process memory at runtime (add UTF-16 too in that case), then try to track down how it appears there.

EDIT I missed originally that the game is for PS2. In that case UTF-8 is unlikely, as well as plain text data in the emulator memory. In fact, they might compose glyphs manually without using a standard encoding, or just store all text as images (I noticed that this is quite common on Korean websites). Still, tracking and manipulating the game’s memory in the emulator process should allow you to find the data (be it text or graphical). For example, check out this write up on extracting 3D models via emulator process tracking:

https://suxin.space/notes/cw-reverse-engineering-models/

4
  • 1
    Indeed you were correct about the text being stored as images. These are some TIM2 image files i found when extracting data form the resources files. imgur.com/a/kSL6CJ0 There are several more pages to cover every possible Korean character. I'm guessing each character is drawn onto the screen by referencing a sub-array of pixels from the corresponding image containing that specific character? @Igor Skochinsky
    – Shpack
    Commented May 23, 2019 at 3:22
  • @Shpack You can use a debugger to find out where is using it. github.com/mlafeldt/ps2rd. Or use an ps2 emulator and debug the game. pcsx2 has a debugger
    – Ricardo
    Commented May 30, 2019 at 3:06
  • @Ricardo thanks for the reply. I attached cheat engine onto a pcsx2 process and found some addresses corresponding to text. I was able to change some text... however, I have no idea how to trace those addresses back to a file.
    – Shpack
    Commented May 31, 2019 at 4:17
  • @Shpack that is smart! also use the debugger. here are some debug shortcuts github.com/PCSX2/pcsx2/blob/master/bin/docs/debugger.txt I will give it a try tonight
    – Ricardo
    Commented May 31, 2019 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.