ROM Hack How to create tables for Japanese ds roms

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
You said you can also kind of tell files containing text by their size, right? Around what size are they? smaller or bigger compared to the others?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
They can be all bundled into a large archive file, though that is not so common.

It will also depend upon the type of game -- a 50 hour story driven RPG is going to be orders of magnitude larger than a puzzle game.

The type of text engine could also play into things -- many are not full markup but if I press ctrl+a on the previous page and save that in a text file it is some 40 kilobytes, the HTML file if I save the page (which does not count pictures or anything) is north of 200KB.

It is more that files measured in megabytes are more commonly graphics, sound, video, 3d models or something similar so if you are going through you can push those massive files to the back of the queue. Similarly anything that is only a few bytes is probably going to be an accessory file, little scrap of info that the game uses somewhere or something like that.

Size alone does not give me a full picture, when combined with file names, directory names, extensions, magic stamps (like extensions but the first few bytes of a file often indicate the file type) and then some further analysis that gives me things more quickly than I might if I have to go through each and every directory/file one at a time.

I also forgot to mention that the format Nintendo provides for text on the DS is BMG. Not that many games use it, even if they otherwise use the nftr font format, but it is worth knowing about.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
So I just noticed this "Code reverse" button in CrystalTile and when I use it, some parts become readable while others that were previously readable are now gibberish. Should I use this function or rather not?

Also, I found some English words in the game and I already have a table for the game that contains the English alphabet, so I thought that I should be able to fins the words by searching, but nothing
appeared. I am fairly certain that the English words aren't graphics, so what's wrong here?
 
Last edited by Bagira20,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
In the text/hex viewer? It probably starts the text from 8 bits on -- if you have 16 bit characters but 8 bit formatting or something then every other line will become unreadable. At least I assume that is what that does (there is a similar thing in the graphics window). Should I encounter that I tend to sort it another way. Alternatively it deals with endianness (for historical reasons there are two different ways to organise/read bytes, one called big endian and the other little endian, some formats play to this where others assume and then trouble the other endian type). The original one can also happen if compression gets involved, though more often it is because a section ends with a single 00 or something and the following section is then not aligned.


Generally you are not going to want to edit lots of text in a hex editor, even one as flexible as some aspects of CT2.

What do you mean by searching? So you figured out the English characters table for the section and then are trying to use that to search with? Could be another table is used for that part of the game, could be compression getting in the way, could be simple user/tool error (tables work but it might not search properly with them*, perhaps try figuring out what the hex should be and searching for that) or could be something else.

*also if there is a new line, or end of section then try to keep the search to just one line or one word or something. The tool will not automatically add new lines in, also make sure you have the space character defined in your table.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
"Generally you are not going to want to edit lots of text in a hex editor"

What type of program should I use then? I thought that a hex editor is all I need to edit the text once I figured out the table.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Some will turn around and code a program specifically for the game. You may well have seen such a tool made by someone else for a specific game when learning the basics here.

Others will use tools like atlas and cartographer
http://www.romhacking.net/utilities/647/
http://www.romhacking.net/utilities/224/

A simpler take on the above two would be oriton and kruptar (a bunch of Russian ROM hackers made these, I don't know whether as a direct competitor to them or just as their own implementation of the concept but they exist)
http://www.romhacking.net/utilities/709/
http://www.romhacking.net/utilities/612/

Crystaltile2 itself is sort of based on an older program called crystalscript. It retains much of the functionality in one of the other program sections, and has some pretty nice search features actually.

There are further simple hex editors that are more focused on text editing. I list a few in the documents I linked earlier. They are more text focused than something like crystaltile2's hex window or a general hex editor like hex workshop or something but still lack a lot of functionality.

The trouble with all the non game specific tools is games can use all manner of things on top of plain text to make the text do fancy things, to that end the tools either become really complex and almost programming languages unto themselves or become somewhat limited in what they can do. On top of this, and as mentioned before, is pointers -- you are never going to match sentence length between languages so you have to edit these and a plain hex editor is not a good place for this. You can do it (I I have certainly rewritten a bunch of strings, used a line marker and some maths to in turn generate a pointer list in the past) but it is not nice.

So yes you can do it all in a hex editor, it is akin to writing a whole novel or reference book in plain old windows notepad though.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
New Problem: I tried to create a 16-bit table with TaBuLar and everything was fine until I tried entering values that started with an 8 (for example 8140h) and suddenly, it writes it as FFFFh, so the maximum. Should I just create the table in a text file or can I fix this?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
There are a few other programs for table making, and yes you can always open a text editor and do what you need there.
Offhand I can't remember exactly what is required but I should say crystaltile2's tables end with a blank line that has to be there for CT2 to work properly. If you are editing by hand make sure it is still there at the end.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
  • OK I'm about to cry. So I settled on a game I'm trying to translate (Another Time, Another Leaf) and it even has a NFTR file, so I found out the values in no time. The thing is, I checked the values and realized that it was the Shift JIS table, completely one to one, only that it's not the whole table, it stops at EAA4. So I thought "Well, in that case I should be able to see the text in Crystaltile without a table since it has Shift JIS already implemented". But I can't read anything! Did I misunderstand something? What am I doing wrong?
 
Last edited by Bagira20,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
The text could be compressed (are there no readable characters at all? Compression usually starts off sort of OK but goes rapidly downhill), it could be offset (if the section starts in the whole ROM on an 8 bit point where CT2 is trying to start on 0 or 16 it is going to display garbage), it could be offset by some 8 bit markup in the text file (though in that case you would probably see alternating lines of readable and not), it could be that though there is nftr the game only uses that for a few parts and the rest is something else, theoretically it could be encrypted or obfuscated but I have never seen that on the DS or it could be something else. The most likely are compression and offset text though. Compression is usually standard formats on the DS, indeed crystaltile2 itself will possibly give you the option to uncompress the files you want in the DS file system window (right click and where you have extract and insert you also have some compression stuff, if not there are loads of programs to handle it like Cue's compression tools).
 

jjjewel

Well-Known Member
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
Another time another leaf uses normal shift-jis table. No compression. No need to build table. Just use CT2's built-in table and normal word search and you should be able to find in-game text.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
Yeah your right I finally got everything working.

Thanks to everyone for taking the time to babysit me through everything here. Now, time to get some translating done!
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
Real quick question: Can you add and remove code from Crystaltile? Because normally, you just rewrite or overwrite the code that is already there, but I would like to add code, so that the code afterwards is still there. (Like when you write a normal text in word, you can go back and add something you missed and the text that follows is just pushed back) Is that possible?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Most hex editors will have that functionality which tends to be indicated by ovr in the bottom right corner or the program/status bar and can be turned on and off by pressing the insert key (above the arrow keys), and you tend to see something similar in word processors and notepad type programs. At the same time most general purpose editors will not have shiftJIS so there is that.
A lot of ROM hacking editors will skip this though as it messes with pointers, or indeed the entire ROM, and anybody that wants to edit such things will have another means. When you insert you shift everything following by however many bytes you insert or remove. If something else expects something to be there and it is now 50 bytes before or after it does strange things. This is bad enough for text, let alone when you have every other file following it.
This is the pointers thing I mentioned earlier. For DS games it is not so bad as you have programs that can rebuild and sort files, thus (mostly*) leaving you with the pointers in, or dealing with**, individual files. That said bad pointers in text can still lead to crashing and other things worse than just garbled text. Classically this is also part of why many ROM hackers seek free space at the end of the ROM/bank and put things there rather than redoing text.

*there are a select few games, most notably new super mario brothers that expect an order of files as well so not all rebuild programs will work with that game.

**some games have their pointers in separate files, usually named similarly to the file you want to edit or in the same directory.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
So I should rather overwrite the text and in turn write into an area that was previously empty? Because that is my current situation.




example.JPG



As you can see, If I just translate, I would reach this empty area, because English takes more space than Japanese. So There are two options:

1. There is a way to decrease the size of the English letters, which makes no sense., since they have to be 2-byte encoded or else they don't show up in the game (I tried)
2. It doesn't matter if I write into this empty area.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Is that blank stuff within the file that makes it up? Crystaltile2 should tell you down the bottom left somewhere. If the game reads the file location and supposed size from the file table in the ROM it will skip things outside it. If it is in the file it is most likely fair game. Nothing stopping you from extracting the file, increasing the file size and rebuilding the ROM either (it is one of the nice things about working with DS ROMs compared even to the GBA where you can still get extra but it might be more tricky)

Theoretically the blank space, given what I said above, could be used for something (back on the GBA we had some problems with ROM trimmers that trimmed what looked like blank at the end of a file but was actually a 00 the game used) but more likely it is just padding to make file locations easier on certain numbers and operations, at a cost of a bit of storage space which was probably always going to be there.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
Sorry but I have to ask again because I get the feeling that I'm doing something wrong. First of, this is what I changed so far:



example2.JPG





What I did was that I replaced the NUMBERS, not the letters, because when I tried to type the sentences in the text viewer, Nothing would show up in the game.So I replaced value by value by following the Shift JIS table. However, now, and I don't really know why, both of my sentences get repeated in the game, but the second time, they are incomplete. I'm guessing it's because they are longer than the original sentences, but I can't change that, because like I said, English takes more space. I guess I need a crash course in changing text so that it appears as it should in the game.

PS: I'd also like to make the text smaller, as it appears quite big in the game, but that's not that important right now.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
If you made it longer then in most games you will need to change the pointers at the start of the file to tell the game where the text is now located. This is why using a hex editor is not a good way of editing more than typos or simple things.

See all those numbers just before the text? They likely say where and how long each line or section is. At a glance they look like they are 2 bytes and will need to be flipped (before the line starting Today there is F602 1103 1703 2403 which looks like gibberish until you reverse it and it says 02F6 0311 0317 0324 which are all about the size of lines of text, all bigger than what came before and all reasonably in line with file sizes typically seen). Without pulling it apart I can't tell whether they start counting from the start of the file or something else but that is where I would start.

Equally while typical English may be longer those lines could just as easily read
Today is my first day
My mother went to this school

Still has all the same info, give or take noting it is a boarding school.
 

Bagira20

Member
OP
Newcomer
Joined
Feb 23, 2017
Messages
19
Trophies
0
Age
25
XP
54
Country
Gambia, The
In that case, sorry to ask that of you, but I'll be needing some more hand-holding on this. If you could do one of the following:

1. Direct me to a program that's better for this task that even I can understand without asking someone every 5 seconds
2. Explain to me how I can identify the pointers, how to read them and how to change them. (Yes, I already know what pointers are, I just don't know how to work with them)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
I covered various styles of pointers I had seen in DS games with pictures and everything in the documents I linked earlier
http://gbatemp.net/threads/gbatemp-rom-hacking-documentation-project-new-2016-edition-out.73394/

1) Can't be done. You can make simple programs for text editing, however as there are a million different ways of doing things you miss out on things if you do. To take care of all the different scenarios it is likely to be means you end up with something complex, almost to the point where it is easier for the hacker to code their own tool instead. Personally I work with spreadsheets a lot if I am just doing something for me -- in your case every line appears to be ended with 0000 so do a search in a hex editor for that, that gives you a list of locations, the pointers may in fact be for the next sentence but as it is right next to it that does not matter (you just add something to every value).

To go through the pointers for this game I would have to look at it myself and I am not up for that right now. Once you have the list of 0000 locations and the values of the pointers you can try to make them line up, or see how far they are out each time.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Sup