Hacking How to use crystaltile2

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
<b>Introduction</b>
I know of no guides and while it is a very nice app it is still a very low level application however you slice it so a true guide would read more like a general hacking guide than how to use crystaltile2.
It is a Chinese application but there are translations, the English one was made by cory1492 and myself (apparently) but between high level technical language, a bit of machine translation at points and the volume of text that often repeats parts of it are a bit crude.
A note before we start- the basic application is easy enough on your machine but start playing with some of the even basic search methods and you will soon eat memory faster than any memory leak you have ever seen. The more advanced ones will be a true test of your machine.

I will not be covering emulator integration in much detail because frankly I do not know enough about it to say much other than it exists and as of the later versions it has rather nice support for things like nef files (about as close as we come to decompiling- think of it as ASM with awesome premade comments) and you select your emulator (while it is running/in memory from the file DS emulator options, No$gba is the main one) From there it can snatch the odd thing like a palette or some memory from it which can be useful for basic editing if your palette is dynamic, compressed or otherwise hard to get at in the rom.
I have however been looking to do this sort of thing since I first discovered the app so here we go:

<b>General usage/theory</b>
There are 5 main features of the application and several niceties associated with the whole application.

tile viewer, hex editor, disassembler, tile editor and text editor represented by the 5 icons on the right hand side of the icon list or the view pulldown menu. The pulldown menus do change depending on what one of these you have selected, they are however usually context relevant (no graphics in the text editor for instance) and the general tools menu should be there throughout (though that too changes). Good practice is to have the editor relevant to what you want open when doing things of that nature.
Each one is perhaps not as good as a more specific app and indeed the same applies to some of the other options but for breaking into a new rom I know of no better tools and while there are better sub apps most are perfectly functional.
Where it really comes into play is when you use the DS file system support and some of the extra features which I will cover in a few paragraphs.

DS file system support. First you need to click on the DS looking icon also on the right hand side.

This will open a sub window showing the DS file system. The pulldown menus have some good options that I encourage you to scan through.
Generally speaking though there are three things you want to be looking at on this page

The icons on the left of the files- these give clues as to what they are and rather nicely if they are compressed.
The file name for obvious reasons.
the sub file categorisation on the right hand side.
The number, address and size data is useful for hacking but here you are probably looking at a more specific hack if you are looking at this. On the other hand if you have opened the entire rom or a subfile in a hex editor it can be useful for tracking it down.

Basics here are a double click sets the start address of the file you just clicked on in the tile viewer, disassembler and hex editor.
Right click provides more options, most importantly is the sub file sort (f2 is also a shortcut) and compression support but extract and import are great too.
Format support in crystaltile2 is the second big strength after DS file system support. Many many file types are supported including most of the big SDK formats like SDAT, NARC and the graphics NCER, NCLR and so on.
SDAT, .bin (assuming it is something like utility.bin) and NARC will open new windows much like the one you were just working on although in the case of SDAT there is some somewhat broken playback options.
Right click on the graphics will allow you to do one of three things (more on graphics here: <a href="http://tahaxan.arcnor.com/index.php?option=com_content&view=section&id=7&Itemid=36&lang=en" target="_blank">http://tahaxan.arcnor.com/index.php?option...=36&lang=en</a> )
This is load the data, order the data (tiles can be in an order in the rom) and apply a palette.
This leads to stuff like <a href="http://pix.gbatemp.net/32303/gundam2.JPG" target="_blank">http://pix.gbatemp.net/32303/gundam2.JPG</a>

Compression support is another strength, for the longest time crystaltile2 had some of the best compression support in general rom hacking tools (indeed some of the new LZ flags were supported long before anything else). It works in much the same way as import and export files does but it can use compression algorithms at the same time.
More general compression options are available under the tools menu including a general compression app and rather nicely a compression search that rivals anything else I have seen.

After this you have a NFTR editor (a relatively common font type in DS roms) which includes font conversion abilities (as in you grab a PC font and it will spit out a NFTR font)
Multimedia editor- more aimed at animation than sound. Would probably get a call from Nintendo's legal types were it not in China.
Below that is a rather crude OCR app that in my version at least seems to have escaped translation but it is the only one I have ever met in rom hacking. I use them day in day out in video and images but for rom hacking...... wow.

Onto the main tools side of things. You have a tile viewer, hex editor, disassembler, tile editor and text editor.

<b>Tile viewer</b>
Assuming you have not wound DS formats into it the tile editor is a fairly full featured one. It is not as pretty as some others (indeed I still keep a copy of TilEd 2002 around for really crude work) but it has great features like nonstandard tile size (7x13- not a problem).
First thing to note is the keyboard shortcuts which do nice things like change starting offset which is nice for dodging headers and whatever else. Everything else is self explanatory aside from perhaps tile form(at) which allows you to chose between all the various image modes (and there are a lot) that crystaltile2 supports. Most useful are GBA 4bpp, GBA 8bpp (the modes used by the GBA and DS, note that most GBA stuff is 4bpp while 8bpp is very common in the DS) and nds1bpp (useful for a certain type of packing used sometimes in fonts) but play with it all.

If you higlight a selection of tiles you can export it to a more common format (word to wise, stick with lossless if you plan on dragging it back into the app), 1:1 is a "regular expression" style exporter.


<b>Hex editor</b>
A hex editor, rather basic but for the table support and inbuilt support for shiftJIS (back when it was one of the very few that did making it a very valuable tool)
Use of tables is chosen in the box on the left (same place as the tile editor before it) and more general codepages can be chosen by clicking on the section above the text decoding (probably saying Western European (Windows) at first).
In the box the options other than table support is choice of known codepages
choice of sort options (1 byte, 2 bytes or 4 bytes)
colour character- not as useful as it might be in other areas as it can be a bit hard to read at pace unlike tiles but to each their own.

Data to palette and palette to data do as they say on the tin and grab the hex and stick it in the palette and vice versa. A nice shortcut for some but probably not all that useful as most games I have ever tangled with tend to opt for the RAM to do things to the palette or in the case of the DS have it wrapped in some format.

<b>Disassembler</b>
Rather basic crude disassembly supporting ARM9 and ARM7 including THUMB for each. You force change between these modes in the same way you changed premade code tables (clicking where it says ARM? .
You can get base address at the top of the "effective address" list.
You can an offset (goto address) too in the box on the left

Assembly is a topic for coverage elsewhere but you have effective address, hex code for the instruction and the mnemonic and registers/addresses* it deals with.

*this is one of the things NEF files can sort for you- if a given address is a given thing the NEF file will make it change to an even more readable format.

<b>Tile editor</b>
Unless you have an image made up from DS format options it will just have the tile you have selected in tile viewer.
Fairly basic, you snatch colours from the palette by clicking on the button and choosing it,
left is char, right is BG.

usual warning about palette based graphics- a change of one thing can have effects on another if things are reused which they often are and likewise they are palette not bitmaps so changing a colour in the palette may not necessarily translate to the real game.
Much like the other palettes and the hardware itself you have 16 available (0 through F).

<b>Script editor</b>
Originally a standalone app from the same author, most useful is probably the table support and the script search (it is an upgraded version of the search strings option (namely table support) you may have seen in various hex editors), under the tools menu it is called Ambassador search.

If you already know text editing the rest is fairly obvious. Exit code= line end/new line sort of thing (0D0A in windows .txt for instance, 0000 in bmg files (a somewhat uncommon DS SDK text format))

Geared towards the GBA mainly but can be pushed towards the DS side of things.

In the translation I have in front of me "censorship" allows you to narrow down the broad/"crude"* search but it will require some tweaking/defining what you want.

*the methods/algorithms behind these techniques are anything but crude but the results they produce are far from "magic application" grade.

Annoyingly the relative search (I personally use monkey moore for such things: <a href="http://www.romhacking.net/utils/513/" target="_blank">http://www.romhacking.net/utils/513/</a> ) is back on the hex editor menu under the search or the tools pulldown menus for the version I have in front of me. It is a fine relative search with many options including 4 byte search which is insane (I have only ever heard of 4 byte fonts- 4294967296 possible characters, 16 bit is 65536 which is more than enough for pretty much every character in every commonly used language).
 

Gilberd

Well-Known Member
OP
Member
Joined
Jan 29, 2010
Messages
157
Trophies
0
XP
284
Country
Taiwan
When can I right click something?
This is still awfully confusing
how did you get the graphic to look like the gundam?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
When you have opened up the DS file viewer any of the sub files in it you can right click.

A lot of files you will only be able to import or export but some files which are known to the application you have extra options for or if it detects compression you have compression options.

That gundam image was the result of three files being there- NANR, NCER and NCLR if memory serves which do the layout, image and colouring respectively. If you look behind it you can see what it looked like before I applied the NCLR data.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
Yes in as much as you can do anything with a hex editor
No/not easily if you want something like editing a standard picture.

If the title screen is in a common format (I have seen quite a few in games I have pulled apart) then it is a simple matter*. A quick aside is that some (read quite a few- I do not know what it is about game devs but they do like to trick out a title screen) title screens are composite images of many different images- sprites over a background which itself could be scrolling.

Other than that you are back to "traditional" hacking methods. Look for useful names, do a compression search, scan through the rom for the images.

*a quick note- many games will reuse tiles and in title screens this can mean the black background is the same tile repeated many times- changing that will change all of the "repeat tiles". Changing the mapping is nothing too drastic if so but it is not that pleasant.
 

Gilberd

Well-Known Member
OP
Member
Joined
Jan 29, 2010
Messages
157
Trophies
0
XP
284
Country
Taiwan
i have a jpg of the picture i want to be the title
Is there a way to add it in or edit the tiles of the title to look like it?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    AncientBoi @ AncientBoi: I just Luv having CEX :)