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

Author Topic: Am I understanding this correctly or not?!  (Read 1351 times)

sh4d0w

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Am I understanding this correctly or not?!
« on: April 08, 2016, 10:03:57 am »
I do have a question when it comes to translating a game from Japanese and it's with the steps of doing it.
Now let's suppose I've already extracted all the files and folders of the .ISO and that I know which files have text in it. I do need to translate the text using a Hex Editor right? Ok so,I decide I'll open the first file using 010 Editor and find out three Kana characters that form the phrase "Hi there" but then what's next? How do I edit it!? I just type over it
as a normal text?(let's consider the string length limitation not a problem so repointing isn't necessary).I'm asking this question since alot of people told me to use MadEdit as a simple text editor ( !? )

Or do I have to extract the text and edit it on notepad for then later dump it inside the file?!
Or both of these options achieve the result wanted?!

FAST6191

  • Hero Member
  • *****
  • Posts: 3008
    • View Profile
Re: Am I understanding this correctly or not?!
« Reply #1 on: April 08, 2016, 11:10:30 am »
So yeah get the ROM/iso and if it is one you can unpack then do so, if not then the next step is much the same as you need to find where the data is and what the hex there represents. That is one sentence but can still represent a great many hours of work.

If you want to translate a game you have to know what you want to translate it into. This is mainly as the original devs might not have thought to program it in such a way that you can easily do that -- in general the text might be longer, it might be read from right to left, it might have characters of all sorts of widths and it might not even have the pictorial representations of the language in question (not everybody uses the Roman character set after all, and many have weird and wonderful additions to it). It is not mandatory to sort all this at this point but it is highly advised you at least have things in place to go for it as and when. Hopefully said changes are just changes but if you face space issues (can still happen on iso files as things get transferred to memory or have to fit on screen) then you also get to put something in place to sort those.

Anyway you can use a hex editor to edit text as a hex editor will edit any data in a file -- it is what it is there for after all. However for anything more than a menu or minor typo fixes it is a nightmare so you instead get to figure out how you want to edit the script.
So I assume you are versed in table files, if not then they are small files that hackers make that list how a game changes hexadecimal into text, they need not bear any relation to anything used elsewhere in computing (things like ASCII, unicode, ShiftJIS, euc-jp and so on)
Your translator is typically not going to be as versed in computer encoding and file formats as you so they will be very happy with a nice plain text file to edit. A nice plain text file is a nightmare to put back into a ROM* so we have to find some kind of middle ground, or make a program that can view the text but still allow you to fiddle with the thing as it will likely end up looking in the ROM (the right screen placement, colours, line size...). Said program can be an awful lot of work to make though so few do that if they can help it, indeed it is probably the main barometer of when a game turns from a game people know a bit about to having its own dedicated hacking fanbase and about the only thing I would rate there without serious text editing capability is fire pro wrestling or something like megaman which has no text most of the time for the older entries.
To help with this though a variety of ROM hackers have various means of dumping and insertion. In the English speaking world and among those that know ROM hacking from here, whirlpool, zophars and such sites then most will look to things like Atlas and Cartographer. If you came up through China then you will probably be aware of crystalscript (from the same original author of the crystaltile2 program which inherited a lot of the functionality, though nothing I care to use for anything more than rough search and fiddle), know some Russian and it will probably be kruptar and oriton (though these have some folllowing outside there). As text is a hugely variable affair then any generic program probably has lots of functionality, or is near useless for anything but the original game/format  the hacker made it for. Atlas and Cartographer being a good example of the former (they are hard to use but once you get it then they are great, until they meet something really really custom) and kruptar and oriton doing worse but being far easier to pick up. In any case both of those are quite complex so if you have a vague clue about programming you will probably want to seriously consider your own custom program to handle it as well.

*a nice plain text file probably uses 0d0a to signal a new line, very few games will do that so first you get to fix that. So far so boring, now add in variables (it costs ?? a night to stay at this inn), character name placeholders, any binary that might start to indicate what character is speaking and you have yourself a nightmare if you are doing it by hand to restore a plain windows compatible text file into something you can use (though if you thought ahead then you would hopefully have made said problems into XML tags or something so you can easily convert back). This is also why most we do not point people at places like gamefaqs that have loads of game script dumps as they are all pretty much useless for ROM hacking purposes.

Oh and even with all that you probably still have pointers to solve -- games do not tend to know when something ends and will have to be told everything, possibly even when to start a new line. This is probably the biggest annoyance in text (and many other types) or hacking. As the pointers the game reads will tell it to go fetch this many bytes at this address then it will, however if you have shuffled everything forward by 10 bytes as you made the last  line longer the game is going to come unstuck. OK so you fix that, however everything following it is also 10 bytes out so you get to sort all of that. You are not necessarily going to edit one line though so everything is now plus or minus however much you change it by plus the differences of everything before it.
This is probably the chief problem with using a hex editor to edit text, and why people will try to make things the same length, or make it short and pad it out to the same length.

sh4d0w

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Am I understanding this correctly or not?!
« Reply #2 on: April 08, 2016, 12:02:47 pm »
Wow,thnx for the explanation! When it comes to the part of the pointers I guess I could adress the starting/ending of a pointer using the empty spaces also,right?!
And also,many files start in hex an English alphabet (as a table).Can I use that as a .tbl file for editing the text?! Or do I have to figure out on my own what are the hex values of the kanji's used in the game for later adressing to them Western characters?!

FAST6191

  • Hero Member
  • *****
  • Posts: 3008
    • View Profile
Re: Am I understanding this correctly or not?!
« Reply #3 on: April 08, 2016, 05:16:14 pm »
Yeah empty space is good for editing things. Certainly beats trying to keep it all the same size, even if you can still edit pointers within that. I should say so though some file system using consoles will copy things to memory so you might not have unlimited space.

I am not quite following the hex values of kanjis part.

If you find the kanji values (for this hypothetical they are the same as shiftJIS http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml ), put them in your table, later find the font in the game and change a few of the kanji pictograms in the font to instead be English characters then yeah you can use all the kanji values of the thing you changed to now input English text, or change those kanji values to instead be English characters in the table and not have to type the original kanji.
Tables are nothing to do with the ROM, the final game or anything. They are just a way to allow hackers to convey the method of how the game encodes the text. I should also say people usually have a table to decode the text and another to insert it, many times they will be very similar but if a game has two ways of encoding the letter A then you probably only want one for the final game, plus you can work around some of the placeholder stuff I mentioned earlier if you do it right -- you know the game will never use the ~ character so you tell your insertion table to replace ~ with some value that the game wants for something.

If you mean the game supports the Roman alphabet out of the box but you can not be bothered to figure out all the kanji (and there are often thousands of them so I do not blame you there) then yeah you can forget about it and just use the Roman character set stuff to edit and forget about all the kanji. Obviously the editor you are using will not be displaying the kanji for you so you will want to have the game playing in the background, or something similar, so you know what it should be at that point and do not edit the wrong thing but there is no problem editing that way. Indeed some hackers might change the font more radically than just changing some tiles and change how the thing decodes entirely (the classic one being converting a 16 bit Japanese character set to an 8 bit one as that is all the Roman alphabet needs, usually this is done to save space but there can be other reasons).