Thursday, June 20, 2013

Step 10: new graphics found

As you know CUE is helping me to romhack this game, and he found these new hidden graphics. Nobody has translated them before, so now it's time to do it once and for all.

These graphics were not in TIM format so that's why I couldn't find them. You need to open the game with a software called Tile Molester.

Open the big file called PE.IMG using Tile Molester. Then do the following:

Navigate > Go to > Offset: 0004E814
View > Codec > 4bpp linear, reverse-order
View > Mode > 2-dimensional
Image > Canvas size > 32 x 32

And voilà:






As you can see this is not the real color palette, but at least we have found what we were looking for. Now let me show you how to change the color palette. The palettes are stored just below the graphics (thanks Lyan for letting me know). Go to Palette > Import from... > This file

Then do this:




Click OK. The first 128 palettes will be loaded. 2048 / 16 colors = 128 palettes
Now you can change the palette using the arrows:



For instance, this palette is the number 7, and it's the palette used by the yellow letters in the menu.I recommend you to save this palette in the bookmarks (Palette > Add to palettes).


Here you have the result:




Now you will have to edit and translate those words very carefully. There's a lot of things to translate in here, so be patient. You will need a lot of zoom to finish all these details. Here you have the final result:



Now it's time to translate the other texts, icons, etc. Change the palette using the arrows until you find the real colors of each icon, translate what needs to be translated, and then save the file.

For instance, the palette number 25 shows you the proper colors of the "Game Over" graphic:





Palette number 26 shows you the proper color of these icons:




And so on, and so on.

Here you have the final result:





Wednesday, June 19, 2013

Step 9: width of the new characters



As I said before, the width of the dialog characters are stored in the SLUS file.
In order to change them we need a tool called ARMIPS.

Thanks to the assembler programming language, we are allowed to modify certain things in the SLUS. So let me show you how it's done. CUE developed a little tool which allow us to modify the width of our new characters, because their default width is always 12 pixels and that's too much:





In the picture above you can see what I'm talking about. The letter "é" has a 12 pixel width where it should be 7, and the letter "ó" also has a 12 pixel width where it should be 7 as well, so let's change that.


First of all, download this: armips (slus width).zip

Unzip those files and keep them in the same folder.

Now open the file "width.asm" with any text editor, I recommend you Notepad++.

Go to the end of the file, where you will see this:





After "db" you have to insert the width of your new characters. For your information they are expressed in pixels, so the Á has 8 pixels, É has 7 pixels, and so on and so on. Obviously each character has its own width, so add them very carefully. You can see the original width of each character in the same document, just above the new ones. On the last column you can add the new characters after their corresponding hex code, just as I have done in the picture above.


When you are done save this document. Now double click the Magic.bat file. Congratulations, now you have added the new characters width into the SLUS file.

What we have done allowed us to change the width of our new characters regarding ingame dialogs, but not the texts that appear in the menu. We will see that in the next episode.

Friday, June 7, 2013

Step 8: understand hexadecimal codes

Before extracting and translating the texts we have to understand something: the PSX is a computer, and computers don't understand nor read our language. It uses binary systems, so that means that all texts are stored in binary format.

There are tools that allow us to read those binary files and convert them to hexadecimal code. But we cannot read hexademical codes either, we need to convert those hex codes to our alphabet. Let's focus on our Parasite Eve project. You may remember the character set that we have extracted earlier:

Each one of these characters that you are seeing have assigned a unique hex code. How can we know which hex code belongs to each character? Well, in this case it's very easy, let's see an hex code table:

You get the idea, right? The position of each character in the matrix tells us which code it has assigned. In Parasite Eve, the equivalence is the following:

00=0
01=1
02=2
03=3
04=4
05=5
06=6
07=7
08=8
09=9
0A=+
0B=-
0C==
0D=*
0E=%
0F= 
10=A
11=B
12=C
13=D
14=E
15=F
16=G
17=H
18=I
19=J
1A=K
1B=L
1C=M
1D=N
1E=O
1F=P
20=Q
21=R
22=S
23=T
24=U
25=V
26=W
27=X
28=Y
29=Z
2A=&
2B=!
2C=?
2D="
2E='
2F=.
30=a
31=b
32=c
33=d
34=e
35=f
36=g
37=h
38=i
39=j
3A=k
3B=l
3C=m
3D=n
3E=o
3F=p
40=q
41=r
42=s
43=t
44=u
45=v
46=w
47=x
48=y
49=z
4A=:
4B=,
4C=/

By the way, 0F is a blank space in case you didn't notice. Additionally we added new Spanish characters:





So their equivalence will be the following:

4D=Á
4E=É
4F=Í
50=Ó
51=Ú
52=á
53=é
54=í
55=ó
56=ú
57=¿
58=¡
59=ñ
5A=Ñ
5B=ü
5C=Ü

So now that we understand hex codes, we can continue our translation project. In the next episode we will focus on how to change the width of these new characters, as their default widht is 12 pixels and that's too much.

Step 7: be careful with TIM files

This is what happened when I loaded the city map:






As you can see the translation is there but the background textures are not properly loaded.









This is how the textures should look like:






I think I know why is this happening. Let's talk about TIM files. A TIM file is a picture file used by the PSX system. It could be an indexed picture, that means that it is possible that a particular TIM file has its own color palette or CLUT (color look-up table). Most of the TIM files that I have translated only have one CLUT, but in this case this background have 3 different CLUTS:




First CLUT, as you can see there is a palette consisting of 16 different bluish colors.



Second CLUT, yellowish colors.




Third CLUT with redish colors.





As I said before, I'm using Photoshop + the TIM plugin to edit these files. When Photoshop saves the file for the first time, a little window shows up:


As I said before, you have to keep all the original information and do not modify certain things, otherwise that will cause problems. As you can see in the picture above, there are certain things that we have to keep in mind, specially the CLUT section. The width is 16 ( the 16 color palette that I've showed you before), but the height is only 1, where it should be 3 (3 different CLUTs, so 3 different rows). So when you save this file, you have to delete the 1 and put a 3 instead, otherwise you will lose the 2 remaining CLUTs and that will cause the problem that you see in the city map.


There is a second picture that has several CLUTs, which is this one:






This picture has 8 different CLUTs, so you will have to delete the 1 and put an 8 instead when saving the file:




So this is what happens when I save the file properly:





It looks like the first and third CLUTS are mixed up.









Let's compare the original file VS the modified files in order to see where the problem is:

In these pictures the CLUT colors are the same, but the size of the pixels have changed, so I suspect that this is causing the problems.









In this picture the CLUT is ok in both files.















And here we have the same problem as before, the CLUT colors are ok but the size of the pixels have changed.











I don't know how to fix this so if you have a suggestion please let me know. For your information, the letters should look like this:


Update: I managed to fix this somehow. I discovered that the first CLUT controls the colors of the characters when they are not selected, so they show in blue color. The second CLUT controls the colors of the characters when they are in fact selected, so they show in yellow color.

Finally the third CLUT controls the background behind the letters and also shows again the characters, and that's why the characters were showing duplicated in here:





So the solution was quite easy: we need to have the same CLUT colors both in CLUT 1 and 3, that way the background will show up correctly. One last thing, I didn't like the duplicated characters, so I removed the letters in CLUT 3 by assigning them the black color.

Here you have the final result:


Not bad, huh?

Thursday, June 6, 2013

Step 6: check the pictures in game

After updating the PE.IMG file, it's time to re-insert the file in the ISO game and run the game with an emulator. It looks like the pictures were properly applied:






Step 5: insert the pictures in the game

Open tim2view and open the big file (PE.IMG). Then click on the picture that you want to replace and press Ctrl+R to replace the TIM file. Remember that the character set is duplicated (#3 and #27). That's it, no need to save the file, the pictures are already inserted.

Step 4: translate the pictures

This is quite easy, just open the pictures one by one and carefully translate the texts. Always keep the same BPP (bits per pixel) in each file:




Step 3: add new characters

There are'n many TIM editors, so I recomend you to use Photoshop and install the TIM plugin, which allows you to open, edit and save TIM files very easily, keeping its palette, BPP information, etc. Extract those zipped files into the "plugin" folder which you will find in the Photoshop installation folder.

Let's open the character set:





As you can see there are only English characters. If we pretend to translate the game, we have to add all those non-English characters that are missing. In this case I'm going to translate this game into Spanish, so we need to add the following 16 characters: á, é, í, ó, ú, Á, É, Í, Ó, Ú, ¿, ¡, ñ, Ñ, ü and Ü.









 If you open the image with Photoshop and zoom-in to the max, you will notice that each character is allocated in a 12 x 12 pixel matrix, so that's the maximum size of a single character. I recommend you to create a grid in Photoshop in order to work more confortably. Edit > Preferences > Guides, Grids & Slices. Gridline every 12 pixels, Subdivisions: 1.
Add each character carefully, always respect the 12 x 12 matrix for each character. Here you have the final result:



Beautiful, huh? As you can see I changed the fonts a litte bit since I don't like serif fonts in games. One last thing: each font has a shadow in order to see the texts when the screen goes lighter, so you will have to add that shadow to the new characters too:


I've changed the shadow color so you can see it, but you must keep the same colors that the original file uses. Be careful when saving this file, you must select 4 BPP which is the original pixel depth, otherwise you will change the file size and that will cause future problems.

Each TIM file has its own CLUT and its own VRAM, so you must keep that information, otherwise that will cause problemas. In this case be careful when saving this file, the proper data is as follows: