News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Help! Decrypt or Decode Language in Hex  (Read 1071 times)

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Help! Decrypt or Decode Language in Hex
« on: June 27, 2019, 10:48:16 am »
All I want to do that I need help with here is to turn this gibberish code into the language it is which is Japanese and English so that I can translate it  :banghead:

https://imgur.com/gallery/h3r5gfl


This is for the game Hatsune Miku Project Diva 2nd# on the PSP in ISO format. I already have the files extracted from it. I'm aware that I'll have to go through more than just the eboot. And as you can see from the pic I use Hex Editor Neo. So if someone could please help me out I'd really appreciate it. Thanx  :)

Psyklax

  • Hero Member
  • *****
  • Posts: 1030
    • View Profile
    • Psyklax Translations
Re: Help! Decrypt or Decode Language in Hex
« Reply #1 on: June 27, 2019, 06:04:56 pm »
Hello! I'll try to point you in the right direction, but I can't promise that what I will say will be useful. :)

So the imgur pic you shared is just a shot of the first few bytes from an EBOOT.BIN in a hex editor. It doesn't tell us anything, really. The 'gibberish code' that you're looking at there is more than likely not any readable language, since the vast majority of stuff you find in a hex editor is not text, especially in a PSP game. I don't know how much you know about how games store their data, but you'll need to do some more work if you're going to get anywhere.

One thing you can try is check for any known text encoding schemes such as Shift-JIS. If there are any other PSP hackers on here then they can tell you, but I don't know if PSP games tend to use Shift-JIS, but it might be worth searching. A simple start is SJIS Dump:

http://www.romhacking.net/utilities/645/

Just put your files in the same folder as this program then make a batch file with this:

Code: [Select]
SJIS_Dump.exe [INSERT FILE NAME] dump.txt 5 0

This takes the file you insert, checks for a minimum of five potential Shift-JIS characters in a row, then dumps what it finds to a text file. You can change 5 to something higher or lower if you like. The 0 at the end is for ASCII characters, which you can turn on or off.

This should be a good start. If there's uncompressed Shift-JIS in the ISO somewhere, this will find it and you can go from there. If it finds nothing, things are gonna get a bit trickier. :)

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #2 on: July 05, 2019, 06:34:17 am »
First of all, I am so sorry for the late response. I had a lot of things going for me this past week  :(

Anyways, I tried doing what you said about using Shift-JIS and the hex editor I use doesn't have it. I even tried other encodings my hex has and won't work for being the 'free' type.

https://imgur.com/gallery/gbTSYim

And I'm afraid the simple start you suggested didn't work either. So now I'm asking what other hex editors have this Shift-JIS? That what other hex editors people use for Shift-JIS?

Cyneprepou4uk

  • Full Member
  • ***
  • Posts: 113
  • Самый лысый ромхакер
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #3 on: July 05, 2019, 09:04:53 am »
010 editor
I am the baldest romhacker
NES Romhacking Guide

Psyklax

  • Hero Member
  • *****
  • Posts: 1030
    • View Profile
    • Psyklax Translations
Re: Help! Decrypt or Decode Language in Hex
« Reply #4 on: July 05, 2019, 10:38:20 am »
I tried doing what you said about using Shift-JIS and the hex editor I use doesn't have it

Well I looked at the screenshot you posted and you're looking at "Other". Did you look at "Asian"? Since Shift-JIS is Japanese, which is Asian? :)

Anyway, it wouldn't be surprising if your editor didn't support Shift-JIS, but you didn't do the other thing I suggested first: searching the files for any Shift-JIS text. 99% of the file will NOT be text, so you might as well use that tool I suggested to search and see if any text exists. Unless you can't get the program to work on your system (I just assume you're using Windows).

Most people hacking will use something like WH32EX to do the hex editing when text is involved, because it has support for table files. That's another topic though. I suggested step one, which is using that program to see if any Shift-JIS text exists. So, give it a shot. ;)

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #5 on: July 10, 2019, 05:10:21 am »
Sorry for only showing you 'other' so these 3 show the others. And yes I use Windows 10.

https://imgur.com/gallery/ihItrNJ
https://imgur.com/gallery/GV8zSEw
https://imgur.com/gallery/9IGweLB

But when I picked one to see how it would help, I got this instead. And we all know it's because it's not bought, like not 'official'. So having it bought could be a little problem solver.

https://imgur.com/gallery/Boe4wqw

And I did try the tool you suggested, but no didn't work I'm afraid. Because for all I knew, I dragged the file I'm trying to edit, dropped it on the tool, and there's nothing happening. Or it's because I am on windows  :-\

Psyklax

  • Hero Member
  • *****
  • Posts: 1030
    • View Profile
    • Psyklax Translations
Re: Help! Decrypt or Decode Language in Hex
« Reply #6 on: July 10, 2019, 11:13:32 am »
we all know it's because it's not bought, like not 'official'. So having it bought could be a little problem solver

You can hack anything without resorting to paid programs, so I wouldn't bother.

And I did try the tool you suggested, but no didn't work I'm afraid. Because for all I knew, I dragged the file I'm trying to edit, dropped it on the tool, and there's nothing happening.

That's because you can't drag and drop on everything. I gave clear instructions on what to do, which involves making a batch file because it's a command line program. If all that makes no sense to you, then ROM hacking might prove a little bit too much. :) My advice is to find someone who can do the hacking part, while you focus on the translation.

I'd have a look myself but it's a PSP game, meaning I'd have to go and find the game myself... a little much for me. ;)

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #7 on: July 11, 2019, 04:50:02 am »
I'm sorry but it's not that it doesn't make any sense to me, because it does. It's just happens be my first time making a batch file. So I need some instructions for that I'm afraid. Sorry for how silly this post may sound  :-[

And if there's any PSP hackers here, please help me  :banghead:

Jorpho

  • Hero Member
  • *****
  • Posts: 4118
  • The cat screams with the voice of a man.
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #8 on: July 11, 2019, 09:30:14 am »
It's just happens be my first time making a batch file. So I need some instructions for that I'm afraid. Sorry for how silly this post may sound  :-[
It is a little silly because making a batch file is a fairly trivial operation and it shouldn't be difficult to find instructions with Google.

But in this case it's even easier because you can use the FORFILES command, which not everyone knows about.

Just put your files in the same folder as this program then make a batch file with this:

Code: [Select]
SJIS_Dump.exe [INSERT FILE NAME] dump.txt 5 0

So, in this case you need to copy SJIS_Dump.exe to the folder with the files you want to check.  Then you have to open a command prompt in that folder. (I think the fastest way to do that is to hold down Shift on your keyboard, right-click the folder in Windows Explorer, and then select "Open command window here".)

Then type
Code: [Select]
forfiles /c "sjis_dump @file @fname.txt 5 0"
This assumes that none of the files in the directory already end in .txt.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #9 on: July 23, 2019, 08:47:00 am »
I apologize for it being this long since the last posting, but that doesn't mean I've given up or don't have time for any of this. Because I really do want to learn these things since it's possible to do things like this, there's just many other important matters happening too.

Anyways, I tried following your directions but where I get stuck at is opening a command prompt. You see, I'm in the file with the SJIS_Dump (SJIS_Dump.exe & SJIS_Dump.ccp) and my game file, open a command prompt from the start menu, and that's where I'm stuck at. I don't understand 'right-click the folder in Windows Explorer' because how do you get it in Windows Explorer or are you referring to something else? And I did try to look up instructions & information on Google but no luck I'm afraid.

Again, I'm sorry for all of this but I'm still trying to learn here  ;)

Jorpho

  • Hero Member
  • *****
  • Posts: 4118
  • The cat screams with the voice of a man.
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #10 on: July 23, 2019, 09:30:59 am »
And I did try to look up instructions & information on Google but no luck I'm afraid.
This is the first Google hit for "open command window here" (with quotes).
https://www.youtube.com/watch?v=bgSSJQolR0E
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Psyklax

  • Hero Member
  • *****
  • Posts: 1030
    • View Profile
    • Psyklax Translations
Re: Help! Decrypt or Decode Language in Hex
« Reply #11 on: July 23, 2019, 10:08:52 am »
I will repeat my suggestion that if dealing with the command prompt is difficult, you might want to think twice about getting into ROM hacking. It's not as simple as finding a text file where you replace the words with new words.

But I'll try. At the moment, you have no idea where any text exists in the files on the UMD, so what we're trying to do is run a simple test to see if there is any Shift-JIS text anywhere in any of the files. So here's a step-by-step process.

1. Put SJIS_Dump.exe, SJIS_Dump.cpp and the files you're analysing in the same folder
2. In Explorer, right-click->New->Text Document
3. Rename the new text document "sjisdump.bat" (if you haven't turned on file extensions in Explorer... do it :) )
4. Open sjisdump.bat in Notepad (right-click->Edit)
5. Paste this into it and save:
Code: [Select]
SJIS_Dump.exe "file" dump.txt 5 0Make sure you change "file" to whatever the file is that you want to search, so if it's EBOOT.BIN then replace "file" with "EBOOT.BIN" (include the quotes)
6. Double-click sjisdump.bat
7. Read dump.txt to see what you found

There you are. If even this is too much then I highly recommend finding a competent hacker. :) I'd try myself but as I said, I need to find the game.

EDIT: okay, I got a bit frustrated with all this and tracked down my own copy of the game. :D

So the first file I tackled was Diva2Script.cpk, since it has "script" in the title. :) There's clearly some Shift-JIS text in there: for example, at $7FB097 there's 株式会社セガ, meaning Sega Corporation. Plus what looks like some staff credits. Next I tried Diva2Data.cpk, but the text file was 10MB and most of what I could see was junk data.

I'll have a look through the other files to see if something comes up, maybe there's more in the script file that I missed.

EDIT2: alas, we're unlucky. That script file is the only one with Shift-JIS text in it. A search of the entire ISO for リズム brings nothing, and that should appear somewhere. I'm currently doing a relative search to see if something comes up there, but I have my doubts. It's possible that it uses a different coding standard for some strange reason. Curiously, starting from $76800 in Diva2Data.cpk, there's a list of every possible Shift-JIS and ASCII character that the game could use, so there must surely be a reason for it to be there.

Hmm... looking through the list of Shift-JIS characters there, they come in sets. 32 characters, followed by 0D 0A, then another 32 characters. Maybe it's a lookup table, and each 0D 0A is a break that the game searches for. But I can't see why they would bother doing this when Shift-JIS takes two bytes and this system would also need two bytes for each character. Makes no sense. Hmm...

EDIT3: huh, whaddaya know, HMPD2nd got a translation already, and it looks almost the same as this one:
http://www.romhacking.net/translations/2641/
Maybe looking at that will give me some clues...

EDIT4: SUCCESS! :D
See, I've never hacked the PSP before, so I had no idea that there was something specific about it... the EBOOT.BIN file is encrypted, and the PSP decrypts it. That's why searching for Shift-JIS text gave me nothing. But thankfully, the PPSSPP emulator has an option to dump the decrypted EBOOT.BIN after booting the game, so I did that, and all the text is there! I guess I should've gone with your initial suggestion to check out the EBOOT.BIN file, but I had to try patching the HMPD2nd translation before I realised what had happened. :)

As you can see, it was quite easy:


So all you need to do is find the Shift-JIS text in the game and change it to ASCII standard text, and it just works. You can type the ASCII text in any hex editor, but finding the Shift-JIS text will require the use of that tool I mentioned. Phew, I'm glad I figured this out. :D
« Last Edit: July 23, 2019, 07:57:38 pm by Psyklax »

Sakura Sumisu

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #12 on: July 25, 2019, 09:46:19 am »
Wow, thanks for all the help and info you gave me this time :o And believe me, I know what you mean about thinking twice and that this isn't simple stuff. But it's not that dealing with the command prompt is difficult, I just rather needed things to be 'spelled out' like those step-by-step instructions in order to understand and do it right. Know what I mean?

And when I was following your instructions a couple days ago, I kept getting this after step 5.
https://imgur.com/gallery/yKvclia

In response to your EDIT3, I was playing the translation that the link goes to. But then some months ago I switched from playing 2nd to 2nd#. The last 3 dots at the bottom of this page explains why.
https://projectdiva.wiki/wiki/New_Features_in_2nd

About your EDIT4, I spent last night and tonight researching 'PPSSPP emulator' about the decrypted EBOOT.BIN. So if you would, please explain how you did it and what you used for it. I do understand what you're explaining, I just ask to make sure I do it right. Such as how did you find the option to dump the decrypted EBOOT.BIN after booting the game? I'd greatly appreciate it  :)

And as for your screenshot, yeah you rule man!  :thumbsup:

Psyklax

  • Hero Member
  • *****
  • Posts: 1030
    • View Profile
    • Psyklax Translations
Re: Help! Decrypt or Decode Language in Hex
« Reply #13 on: July 25, 2019, 11:21:19 am »
when I was following your instructions a couple days ago, I kept getting this after step 5

Did you put sjis_dump in the right place? I didn't say to even enter the command prompt at all, I gave very clear instructions that you just need to make a text file, that's it. If you don't understand how the command prompt works, no big deal, just follow my instructions and you never even have to go there. Jorpho mentioned going into the command prompt but I never did. If you're too young to remember MS-DOS then the command prompt will be a bit alien, so just do what I suggested and you won't have any issues.

I switched from playing 2nd to 2nd#. The last 3 dots at the bottom of this page explains why

Sooo... you want to translate a game from scratch that already has a practically complete translation because it has a few bugfixes? :) Forgive me, but this really isn't a great candidate for a translation. If you must, you'd be better off simply copying everything from the other translation - which I could do, of course. Not sure it's worth it, but there you go. Frankly the guys translating 2nd should've translated 2nd# at the same time, it's ridiculous that they didn't.

I spent last night and tonight researching 'PPSSPP emulator' about the decrypted EBOOT.BIN. So if you would, please explain how you did it and what you used for it. I do understand what you're explaining, I just ask to make sure I do it right. Such as how did you find the option to dump the decrypted EBOOT.BIN after booting the game? I'd greatly appreciate it  :)

First of all, I'm going to assume that you know what an emulator is - the quotes you put around 'emulator' make me a little worried. :D I really don't have to hold your hand here: if you download and run PPSSPP, just go through all the menus and eventually you'll find the one you want - using the wording that you just used in your post. :) Hint: it's in the System settings, I think. And it dumps it to a file in the PSP folder inside the emulator's folder.

I just rather needed things to be 'spelled out' like those step-by-step instructions in order to understand and do it right. Know what I mean?

I do, but I'm afraid that's the worst possible thing to say on a ROM hacking forum. :) People who get into ROM hacking don't need their hand held the whole way through, and other ROM hackers have little time for those that do. Allow me to link to a wonderful old post that summarises this succinctly:
https://docs.google.com/document/d/1VTyOyRk4OL8Oay0CqXHGS8FIse-4wsFmLNPQjT58Hgk/edit

Anyway, if the two games are similar enough, I might well bother to copy-paste the text from one to the other, but I dunno. Still seems like more trouble than it's worth. :)

Jorpho

  • Hero Member
  • *****
  • Posts: 4118
  • The cat screams with the voice of a man.
    • View Profile
Re: Help! Decrypt or Decode Language in Hex
« Reply #14 on: July 25, 2019, 11:13:55 pm »
And when I was following your instructions a couple days ago, I kept getting this after step 5.
Both Psyklax and I have mentioned Explorer.  Do you understand what that means..?

Press and hold the Windows key on your keyboard, and then press "E". That opens what is referred to as Windows Explorer.  (Do you call it something else..?)
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!