Hacking Problem triying to translate Steins;Gate to Spanish

i4v

Member
Newcomer
Joined
Apr 26, 2018
Messages
14
Trophies
0
Location
Chita
XP
80
Country
Russia
Someone related (probably Riku) has been speaking about problems with too many characters in too small dialogue box....
Yes, there are such problems. I think we may fix them in some cases by adding some adjectives into... forgot the name, the tiny hirogana symbols under difficult kanji used to pronounce them correctly. For example, in the first sentence at related screenshot we have a "middle school girl". Middle is not a such important word to get the meaning of the sentence, so we may put it under the school. Looks strange, but it's better then just kicking out some words.
In case someone will need, to add one word under the other one we have to use {main word}[word above] syntax. That's how the sentence from screenshot looks like in my .txt:
Code:
#WRITE(PTR, $0000117A)
Her facial expression holds the innocence of a {school}[middle] girl.She doesn't seem to understand that we're wading into enemy territory,nor does she sense even a bit of the tension in the air.
<END>
Yes, we have to replace middle and school in that case. There shouldn't be space between { } and [] - on screenshot you may see there's two space symbols before girl.
Also more compact => better in our case so I've also reduced spaces after dots and commas.
Снимок экрана от 2018-09-18 14-11-45.png

Also it's possible to get all the words which went out of the box under the first line; so the reader have to read the big letters on lines, and then rest of the text under lines. Like this:
Снимок экрана от 2018-09-18 14-34-51.png

(dot after air became む for some reason)
.txt:
Code:
#WRITE(PTR, $0000117A)
Her facia{l}[nsion in the air.] expression holds the innocence of a middle school girl. She doesn't seem to understand that we're wading into enemy territory, nor does she sense even a bit of the te
<END>
Both ideas are not perfect, but we have to deal with symbols anyway, so why not. I like first idea the most.
UPD:
but in Russian I am able to get in the box, missing only middle, even which is harmless:
Снимок экрана от 2018-09-18 14-44-59.png
 
Last edited by i4v,

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
I like you too. The rikku-san tool left really does not work at all. I tried it but OMG was disappointed. The instructions you said above are a nightmare for me (゚Д゚)ノ. Really quite a hassle (Computer I can not even use astlat). But I finished the part of Plogue and a little bit of chapter 1, without it. That's a bit of a basic trick from me. I will guide you fully, when I solve Toukiden. Im so tireddddd.
(;´∀`)
 
  • Like
Reactions: RY0M43CH1Z3N

i4v

Member
Newcomer
Joined
Apr 26, 2018
Messages
14
Trophies
0
Location
Chita
XP
80
Country
Russia
I like you too. The rikku-san tool left really does not work at all. I tried it but OMG was disappointed. The instructions you said above are a nightmare for me (゚Д゚)ノ. Really quite a hassle (Computer I can not even use astlat). But I finished the part of Plogue and a little bit of chapter 1, without it. That's a bit of a basic trick from me. I will guide you fully, when I solve Toukiden. Im so tireddddd.
(;´∀`)
Thank you soo much~
 

HaselLoyance

New Member
Newbie
Joined
Sep 28, 2018
Messages
4
Trophies
0
Age
23
XP
80
Country
Canada
Hey people!

So I've been interested in making an English patch for the PSP version of the game.

With the currently available tools and Atlas scripts (the ones in the GitHub repo you all know of) I was able to patch the first chapter in the game.

I've noticed that you have a problem with this part?
In AFS package every file has its own space. It's a little bit bigger then the file is. For SG00_01.BIN the max size, according to AFSExplorer, is 61440 bites. BIN in Japanese with only one line translated to Russian weights 60510 bites; there are still some free space left. But if we build the BIN out of SG00_01_en.txt, the file size is 62,8 KB! That's about 1,4 KB of data that can't fit in. Yeah, the English script weights A LOT more then the JP one.
One of the ways to fix it is to repack AFS with more space. But there is a problem - the ISO and AFS inside is protected, and we can't do that. If we repack ISO, that would cause problems as we already had before (but I hope we'll find a way to do it normally)

Yeah it is correct, Japanese SG00_01.BIN takes up 60500 bytes, and full English translation takes up 62804 bytes, while the maximum allowed size for the SG00_01.BIN in the DATA0.AFS/SCENE00.AFS is 61440. I managed to increase it from to 61440 to 63488 (+2048 bytes, 1 entire block) and still have a working game without crashes.

I got the working ISO with this method:
  1. Extract DATA0.AFS from the game's ISO (PSP_GAME/USRDIR/DATA0.AFS)
  2. Using AFSExplorer go to Advanced->Modify reserved space. Increase the size of the SG00_01.BIN in DATA0.AFS/SCENE00.AFS by 2048 bytes (1 block) from 61440 to 63488 bytes
  3. Save newly adjusted DATA0.AFS when prompted
  4. Open adjusted DATA0.AFS and replace with the English SG00_01.BIN, it will fit perfectly and will even have some bytes to spare
  5. Using AFSExplorer go to File->Insert AFS file into CD image
  6. Navigate the menu to replace the original DATA0.AFS in the ISO file with the adjusted DATA0.AFS
Congrats, you have a modified game ISO that works without blackscreens/crashes.

I think the problem with adjusting size is that game breaks when there are empty blocks in the AFS (suppose you increased the size from 61440 to 61440+2*2048, the English SG00_01.BIN would fit in, but there would be more than a block of free space left). That's just my theory though.

I truly hope this is helpful and I didn't waste time doing something that might have been already discovered!

___________________

Though I still don't understand how in the heck do pointer tables work. I understand the Atlas scripts that are in the GitHub repo, but I'm really blind as to how to get the pointer values, since they seem so random. Yeah, the usually have 4/6/8 bytes between each address, but sometimes those addresses skip over several hundred bytes at once. And as far as I can tell, there is no real format to the pointer table in the BIN file. I'm really confused on that part

UPD1: So after some more exploring around the BIN file I've noticed that 4-byte pointers occur after the following "control sequences" of bytes:
  • D9 18
  • 24 06
  • 70 06
  • 71 06
  • FF FF
I'm gonna look into this more, because I have a feeling these are not the only "control sequences"

UPD2: Oh my god I think I just figured the entire pointer thing out. I feel very dumb right now.
Lets divide the entire BIN file into two logical sections:
  • Section 1: Pointer table
  • Section 2: Strings
At the end of the Section 1 there are 4 magic bytes in format "FF/FE ** 0D 02" (not totally confirmed, but it seems to be this way) which can be used as a separation between two sections.
So we have original BIN file and strings in Section 2 are separated by the 00 character (aka null-terminated strings). We can get the address of the starting position of every string

For example, in SG00_01.BIN the first string (according to Atlas scripts in the GitHub repo) is "%L1" + 0x00, with the starting position at 0x73FC
Now, we do some endian magic, and represent that address as a sequence of bytes "FC 73" (basically bytes in the reverse order)
The best part: if we search for this sequence of bytes in Section 1 we will find it at 0xBEE
WHICH IS EXACTLY THE SAME ADDRESS AS IN ATLAS SCRIPTS POINTERS IN THE GITHUB REPO

So we can get the addresses of pointers from the original BIN, and then just replace pointers at those addresses to the ones we need in the translation (that is, after we embed the Section 2 and adjust the entire endiannes encoding thing)

I think I have figured it out. I THINK
 
Last edited by HaselLoyance,

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
Hey people!

So I've been interested in making an English patch for the PSP version of the game.

With the currently available tools and Atlas scripts (the ones in the GitHub repo you all know of) I was able to patch the first chapter in the game.

I've noticed that you have a problem with this part?


Yeah it is correct, Japanese SG00_01.BIN takes up 60500 bytes, and full English translation takes up 62804 bytes, while the maximum allowed size for the SG00_01.BIN in the DATA0.AFS/SCENE00.AFS is 61440. I managed to increase it from to 61440 to 63488 (+2048 bytes, 1 entire block) and still have a working game without crashes.

I got the working ISO in the end with two different methods, which start out pretty much the same.
  1. Extract DATA0.AFS from the game's ISO (PSP_GAME/USRDIR/DATA0.AFS)
  2. Using AFSExplorer go to Advanced->Modify reserved space. Increase the size of the SG00_01.BIN in DATA0.AFS/SCENE00.AFS by 2048 bytes (1 block) from 61440 to 63488 bytes
  3. Save newly adjusted DATA0.AFS when prompted
  4. Open adjusted DATA0.AFS and replace with the English SG00_01.BIN, it will fit perfectly and will even have some bytes to spare

Now there are two ways you can proceed from here:

Method 1
  1. Using AFSExplorer go to File->Insert AFS file into CD image
  2. Navigate the menu to replace the original DATA0.AFS in the ISO file with the adjusted DATA0.AFS
  3. NOTE: This will change the actual ISO file you specify, it will not prompt you to save the changes as a new one, so have a backup at hand
Method 2
  1. Open the game ISO in UMDGen and navigate to PSP_GAME/USRDIR
  2. Delete existing DATA0.AFS and place the adjusted DATA0.AFS (Right click->Add->Existing file)
  3. Save as an uncompressed ISO
Congrats, you have a modified game ISO that works without blackscreens/crashes.

I think the problem with adjusting size is that game breaks when there are empty blocks in the AFS (suppose you increased the size from 61440 to 61440+2*2048, the English SG00_01.BIN would fit in, but there would be more than a block of free space left). That's just my theory though.

I truly hope this is helpful and I didn't waste time doing something that might have been already discovered!

___________________

Though I still don't understand how in the heck do pointer tables work. I understand the Atlas scripts that are in the GitHub repo, but I'm really blind as to how to get the pointer values, since they seem so random. Yeah, the usually have 4/6/8 bytes between each address, but sometimes those addresses skip over several hundred bytes at once. And as far as I can tell, there is no real format to the pointer table in the BIN file. I'm really confused on that part

UPD1: So after some more exploring around the BIN file I've noticed that 4-byte pointers occur after the following "control sequences" of bytes:
  • D9 18
  • 24 06
  • 70 06
  • 71 06
  • FF FF
I'm gonna look into this more, because I have a feeling these are not the only "control sequences"

UPD2: Oh my god I think I just figured the entire pointer thing out. I feel very dumb right now.
Lets divide the entire BIN file into two logical sections:
  • Section 1: Pointer table
  • Section 2: Strings
At the end of the Section 1 there are 4 magic bytes in format "FF/FE ** 0D 02" (not totally confirmed, but it seems to be this way) which can be used as a separation between two sections.
So we have original BIN file and strings in Section 2 are separated by the 00 character (aka null-terminated strings). We can get the address of the starting position of every string

For example, in SG00_01.BIN the first string (according to Atlas scripts in the GitHub repo) is "%L1" + 0x00, with the starting position at 0x73FC
Now, we do some endian magic, and represent that address as a sequence of bytes "FC 73" (basically bytes in the reverse order)
The best part: if we search for this sequence of bytes in Section 1 we will find it at 0xBEE
WHICH IS EXACTLY THE SAME ADDRESS AS IN ATLAS SCRIPTS POINTERS IN THE GITHUB REPO

So we can get the addresses of pointers from the original BIN, and then just replace pointers at those addresses to the ones we need in the translation (that is, after we embed the Section 2 and adjust the entire endiannes encoding thing)

I think I have figured it out. I THINK
Mm, Interesting. If you can add as many bytes as yours, then perhaps things can be resolved. (´▽`*)
 

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
But I still think adding bytes can move the other pointer. For example pointer of chapter 1 at 0xB0 but since you added 4 bytes to the Polugue it would go down to 0xB4. By default it stays at 0xB0. So you have to fix a lot of pointer. As you say it works perfectly but maybe it will crash into chapter 1 or somewhere soon. The solution is that we need to etract all of them and package it completely, but unfortunately puyo tool can not package them again. This is only a comment from my experience, if there is a mistake please comment below (゚ ∀ ゚)
 

HaselLoyance

New Member
Newbie
Joined
Sep 28, 2018
Messages
4
Trophies
0
Age
23
XP
80
Country
Canada
But I still think adding bytes can move the other pointer. For example pointer of chapter 1 at 0xB0 but since you added 4 bytes to the Polugue it would go down to 0xB4. By default it stays at 0xB0. So you have to fix a lot of pointer. As you say it works perfectly but maybe it will crash into chapter 1 or somewhere soon. The solution is that we need to etract all of them and package it completely, but unfortunately puyo tool can not package them again. This is only a comment from my experience, if there is a mistake please comment below (゚ ∀ ゚)

I'm not sure that the game files inside the ISO/AFS are mapped to specific addresses, they just seem to behave like a normal filesystem. I should elaborate though, I didn't use Puyo because it didn't seem practical. Using AFSExplorer/UMDGen worked perfectly well, since the game runs smoothly during and after the prologue. I should've mentioned it beforehand, my bad. In a way, this is repacking game files. The only way to know if it'll work 100% is to take it to the extreme - make translations of other BIN files.

--------------------- MERGED ---------------------------

But in order to make translations we need Atlas script files right? And to get the properly formatted Atlas scripts we need Cartographer scripts. And it is a mess really. Good thing I have it figured out.

Check it out: github(.)com/HaselLoyance/steins-gate-psp-patch
(ugh annoying thing that doesn't allow me to post links)

Yes, this is where you'll find all Atlas scripts for every BIN file. They work and compile perfectly back into original BIN files too. Took me some time to make my own parser instead of Cartographer, because I have no clue how to use it. Oh well, topographer to the rescue.
Please read README and code comments to understand what and how.

Now we just need a way to map translated strings to original strings and we'll have the translated game.

Have some screenshots, I guess, they don't explain a lot though (again, no links allowed, ugh)
  • i.imgur(.)com/lRfND9o.png
  • i.imgur(.)com/L5qXAJJ.png
  • i.imgur(.)com/CFBQjxc.png
 
  • Like
Reactions: Malckyor

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
I'm not sure that the game files inside the ISO/AFS are mapped to specific addresses, they just seem to behave like a normal filesystem. I should elaborate though, I didn't use Puyo because it didn't seem practical. Using AFSExplorer/UMDGen worked perfectly well, since the game runs smoothly during and after the prologue. I should've mentioned it beforehand, my bad. In a way, this is repacking game files. The only way to know if it'll work 100% is to take it to the extreme - make translations of other BIN files.

--------------------- MERGED ---------------------------

But in order to make translations we need Atlas script files right? And to get the properly formatted Atlas scripts we need Cartographer scripts. And it is a mess really. Good thing I have it figured out.

Check it out: github(.)com/HaselLoyance/steins-gate-psp-patch
(ugh annoying thing that doesn't allow me to post links)

Yes, this is where you'll find all Atlas scripts for every BIN file. They work and compile perfectly back into original BIN files too. Took me some time to make my own parser instead of Cartographer, because I have no clue how to use it. Oh well, topographer to the rescue.
Please read README and code comments to understand what and how.

Now we just need a way to map translated strings to original strings and we'll have the translated game.

Have some screenshots, I guess, they don't explain a lot though (again, no links allowed, ugh)
  • i.imgur(.)com/lRfND9o.png
  • i.imgur(.)com/L5qXAJJ.png
  • i.imgur(.)com/CFBQjxc.png
Great! I will try it on the window.
Ps: When I use Atslat or Cartographer, they would collapse as soon as I ran it. Have you met such a case? help me. (≧▽≦)
 

HaselLoyance

New Member
Newbie
Joined
Sep 28, 2018
Messages
4
Trophies
0
Age
23
XP
80
Country
Canada
Hmm I've noticed that UMDGen doesn't work as smoothly for repacking ISO as AFSExplorer. Stick to the latter one would be my suggestions


Great! I will try it on the window.
Ps: When I use Atslat or Cartographer, they would collapse as soon as I ran it. Have you met such a case? help me. (≧▽≦)
Are you trying to launch it is a normal executable? They are supposed to be launched from the command line
 

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
Hmm I've noticed that UMDGen doesn't work as smoothly for repacking ISO as AFSExplorer. Stick to the latter one would be my suggestions



Are you trying to launch it is a normal executable? They are supposed to be launched from the command line
1.Yeah! UMD only replaces the original file, it can not be packaged perfectly as you say. (´▽`*)
2. They Crash as soon as I click them. It is heartbreaking to not be able to test them. (;´∀`)
 
  • Like
Reactions: RY0M43CH1Z3N

HaselLoyance

New Member
Newbie
Joined
Sep 28, 2018
Messages
4
Trophies
0
Age
23
XP
80
Country
Canada
2. They Crash as soon as I click them. It is heartbreaking to not be able to test them. (;´∀`)
Don't click them.
  1. Press WIN+R
  2. Type cmd.exe
  3. In the command line write the command 'cd <path to the folder where Atlas.exe is located>'
  4. Then write 'Atlas.exe'
That's how you execute this thing.

I also made some progress, and it seems like translation will be possible after all. I manually replaced Japanese strings in SG01_01.txt Atlas script with English strings from SG01_01.src (see my repo to find it). And hey, it works on the PSP, here is a photo of SG01_01 in game: i.imgur(.)com/2UAofij.jpg
 
Last edited by HaselLoyance,

HoaiTrung97

Hikikomori-Senpai
Member
Joined
Aug 15, 2018
Messages
398
Trophies
0
Location
Shibuya New Generation
XP
11,288
Country
Japan
Don't click them.
  1. Press WIN+R
  2. Type cmd.exe
  3. In the command line write the command 'cd <path to the folder where Atlas.exe is located>'
  4. Then write 'Atlas.exe'
That's how you execute this thing.

I also made some progress, and it seems like translation will be possible after all. I manually replaced Japanese strings in SG01_01.txt Atlas script with English strings from SG01_01.src (see my repo to find it). And hey, it works on the PSP, here is a photo of SG01_01 in game: i.imgur(.)com/2UAofij.jpg
It looks like it was working, I saw the introduction about who wrote it on cmd. But I do not know how to continue use it, You can guide me to use it? (゚∀゚)
 

i4v

Member
Newcomer
Joined
Apr 26, 2018
Messages
14
Trophies
0
Location
Chita
XP
80
Country
Russia
This conversation is going for too long...
So, I came back as I wanted to find out what was the problem about my Russian translation. I followed all the instructions but it didn't fit the memory it's supposed to even if it's less then 40% translated.
Today I made a quick research and found out that Shift_JIS encoding do have Russian alphabet along with Japanese and English, but 1 latin character is 1 byte, and 1 cyrillic character is 2 bytes. So full chapter translation weights as two chapters.
Also, HoaiTrung97 asked me for help as he had issues with Vietnamese characters unsupported.
There comes the question: is it possible to dig a bit deeper into the engine and change the default encoding to, let's say, UTF-8, without huge damage?
UPD: just an example though, I need KOI-8 for actual compact 8-bit Cyrillic.
 
Last edited by i4v,
  • Like
Reactions: RY0M43CH1Z3N

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Sicklyboy @ Sicklyboy:
    I'm not familiar with the technicalities of the differences between the two versions, but I'm wondering if at least some of those differences are things that you could port over to the US version in your patch without having to include copyrighted assets from the EU version
  • TwoSpikedHands @ TwoSpikedHands:
    @Sicklyboy I am wanting to fully change the game and bend it to my will lol. I would like to eventually have the ability to add more characters, enemies, even have a completely different story if i wanted. I already have the ability to change the tilemaps in the US version, so I can basically make my own map and warp to it in game - so I'm pretty far into it!
  • TwoSpikedHands @ TwoSpikedHands:
    I really would like to make a hack that I would enjoy playing, and maybe other people would too. swapping to the EU version would also mean my US friends could not legally play it
  • TwoSpikedHands @ TwoSpikedHands:
    I am definitely considering porting over some of the EU features without using the actual ROM itself, tbh that would probably be the best way to go about it... but i'm sad that the voice acting is so.... not good on the US version. May not be a way around that though
  • TwoSpikedHands @ TwoSpikedHands:
    I appreciate the insight!
  • The Real Jdbye @ The Real Jdbye:
    @TwoSpikedHands just switch, all the knowledge you learned still applies and most of the code and assets should be the same anyway
  • The Real Jdbye @ The Real Jdbye:
    and realistically they wouldn't

    be able to play it legally anyway since they need a ROM and they probably don't have the means to dump it themselves
  • The Real Jdbye @ The Real Jdbye:
    why the shit does the shitbox randomly insert newlines in my messages
  • Veho @ Veho:
    It does that when I edit a post.
  • Veho @ Veho:
    It inserts a newline in a random spot.
  • The Real Jdbye @ The Real Jdbye:
    never had that i don't think
  • Karma177 @ Karma177:
    do y'all think having an sd card that has a write speed of 700kb/s is a bad idea?
    trying to restore emunand rn but it's taking ages... (also when I finished the first time hekate decided to delete all my fucking files :wacko:)
  • The Real Jdbye @ The Real Jdbye:
    @Karma177 that sd card is 100% faulty so yes, its a bad idea
  • The Real Jdbye @ The Real Jdbye:
    even the slowest non-sdhc sd cards are a few MB/s
  • Karma177 @ Karma177:
    @The Real Jdbye it hasn't given me any error trying to write things on it so I don't really think it's faulty (pasted 40/50gb+ folders and no write errors)
  • DinohScene @ DinohScene:
    run h2testw on it
    +1
  • DinohScene @ DinohScene:
    when SD cards/microSD write speeds drop below a meg a sec, they're usually on the verge of dying
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Samsung SD format can sometimes fix them too
  • Purple_Heart @ Purple_Heart:
    yes looks like an faulty sd
  • Purple_Heart @ Purple_Heart:
    @Psionic Roshambo i may try that with my dead sd cards
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    It's always worth a shot
  • TwoSpikedHands @ TwoSpikedHands:
    @The Real Jdbye, I considered that, but i'll have to wait until i can get the eu version in the mail lol
  • I @ I-need-help-with-wup-wiiu:
    i need help with nusspli failed downloads, can someone respond to my thread? pretty please:wub: