Sorry if I suck at searching (NDS rom file structure)

Discussion in 'NDS - ROM Hacking and Translations' started by aginor37, Jul 19, 2009.

  1. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    So I saw the DQ9 menu translation thread, and it got me interested in the whole process. Not so much hacking a rom, but being able to find and replace the various image files (in DQ9's case, the files for Japanese chars and names).

    I am reasonably familiar with the hex-editing stuff, but the files in the /data folder, .spr, .chr extensions, I am having trouble getting a good look at what's in them. Is the hex editor not enough, or am I just rustier than I remember at this? LAst major nod I did was working with the rest of the Co* team for the unofficial ToEE PC game.

    Sorry if this is the wrong spot for this or if the info is already there and I just didn't see it, and thanks for any potential help.
     
  2. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,748
    Country:
    United Kingdom
    I like to have a tile editor as a graphical representation of things sometimes reveals things I might not have noticed (even on things that are not 2d graphics). The DS and GBA use the same 2d formats so any tile editor made for the GBA should also work for the DS, note that a few GBA editors skipped over the 8 bits per pixel (8bpp) which the GBA did not use all that often (until later in the life of the system at least) but the DS makes extensive use of.
    Crystaltile2 and tiled 2002 are my main two but a tile editor is somewhat of a personal choice like a hex editor really.
    http://www.romhacking.net/ has a bunch and I am sure a request for some would net a bunch more.

    Your main problem though is probably compression, the DS has a fast enough processor to handle basic huffman, LZ variants, RLE and the like and developers do like to use them (LZ is most common, Huffman and RLE probably equal and everything else next).
    You have basic BIOS compression which most things are compatible with even if they do not use them (they are designed to be acceptable and small rather than fast), even if they are not compatible chances are it is only a minor variation on the idea.
    http://nocash.emubase.de/gbatek.htm#biosde...essionfunctions (that it the page for everything DS hardware related)
    http://www.cs.rit.edu/~tjh8300/CowBite/Cow...20Interrupts%29 (good for GBA and has some stuff that is good for the DS)
    http://www.coranac.com/tonc/text/toc.htm Programming for the GBA but well worth a look.
    Crystaltile2 has decent decompression features, we also have http://www.gbadev.org/tools.php?showinfo=56 and whatever is at http://www.romhacking.net/
    Compression is generally crystaltile2, gbacrusher http://members.iinet.net.au/~freeaxs/gbacomp/ or write your own.

    Back on topic as it were the nitroSDK provides enough file formats for developers to make just about any game but developers still like to make their own custom formats instead (no judgement on my part as the nitroSDK does lack some features that are useful) which you are probably dealing with here, still DS file formats tend to be slight variations on the nitroSDK theme, have a read of the following sites to get the idea:
    http://tahaxan.arcnor.com/index.php?option...=36&lang=en
    http://www.pipian.com/ierukana/hacking/ds_narc.html
    http://kiwi.ds.googlepages.com/sdat.html
    http://kiwi.ds.googlepages.com/nsbmd.html
    http://gbatemp.net/index.php?showtopic=105060
    http://llref.emutalk.net/nds_formats.htm
     
  3. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Thank you for all the reference material, looks like I have some reading to do.
     
  4. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Well, after doing a lot of reading and doing a little tinkering, I am starting to get a few things figured out... but like everything else, every question answered leads to 3 more to ask.

    For example (and I would love anyone who worked on the menu translation patch to chime in here) I found that by hex editing Itemname.nat and using some previous DQ knowledge plus http://www.eudict.com/ for translation of basic stuff (copper sword, rapier, medical herb, etc.) I could plug in the english names for quite a few items and have them show up... but only in the context of monster drops. So Killing a skeleton and getting a chest says "...copper sword", but in inventory and shops, it is still untranslated. But it also shows as english in the bestiary under what the monster drops.

    (BTW, I am using MadEdit for my hex editor, the Japanese text encoding option is vital for my relative lack of knowledge, and Nitro Explorer to inject the altered file so I can test as I go)

    So for items at least, I am theorizing that the same item name must be stored in at least 3 (or possibly 4 for equippables) separate files.... one for the shop menu, one for the item screen displaying the item itself (where you see the stats, who can equip and so on), map treasure chest messages (although that might share the monster drop file) and the single line on equiped items on the character screen.

    So I guess at this point, if anyone has a little better idea of what the various file extensions are for (for example .nat seems to be used for listings, like a database or table file) I would love a little direction, as looking around online I haven't been able to find much beyond font and sound file format explanations. I know that most people are just planning on waiting on a Us release or going with what is in the patch already, but this is more a learning experience for me, I won't even pretend that I expect to have anything productive to show as a reult for a good while.

    Edit: The names used in Itemname.nat also apply to the alchemy pot, which could be very useful if I could get a good portion of them all translated
     
  5. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,748
    Country:
    United Kingdom
    3 versions of the same thing would be my theory too. It need not be distinct files though; I have seen repeats in the same file before.

    Also I would not read too much into file extensions or even file formats especially where text is concerned, it is useful at first but as the NARC format showed things can change or otherwise not be reverse engineered properly.

    If I have time later I will see about pulling the game apart.
     
  6. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Just did a little test this morning, and I can confirm this, the repeating in the same file, and the purpose. I took the entry for "medicinal herb" (won't fir in english that way on screen, but i digress) and found 4 entries of it in the above .nat file. So I changed each instance to 1,2,3 and 4 respectively, and they showed in game as world map chest = 1, monster chest = 2, bestiary item = 3, alchemy pot recipe calling for it = 4.

    I really am enjoying this, and do appreciate all the input you have given me to think about and read. It reminds me of doing old PC game hack/mod/ etc like when I worked on the ToEE PC game for the unofficial patch, and working on Diablo 2 mods. The difference here is, I can't find an editing program to load the files in a format more sortable than a hex editor, for the obvious reasons. Still, I feel like I am getting pretty close to figuring out at least the structure of at least this particular file, which may or may not bear fruit when looking at the other files in the /prm subdirectory, which I am about 70% convinced contains a majority of the name strings the game calls for.

    But I do think you are right in that there is some file compression going on that is going to be a large hurdle to get over.
     
  7. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Progress!! iteminfo.gp2 in the same directory (/prm) handles (at least some) item info within the item display screen where stats and such are shown. I was able to change 剣 to SW (sword) and have it show as the weapon category for sword weapons. Although the font issue means it does overrun a bit on some swords that I have, but I have no clue where to begin addressing that part.

    edit: Although, I am still having a pain of a time getting the names of items to show up in the equip menu or shop menu, or even the item use menu(not the item page, just the list that each character is carrying and the bag). I feel like I am overlooking something simple, yet it just won;t come to me.

    I had thought that for the items themselves, there would be a series of files containing pertinent info by type (and looking in the dir seems to support this, with names like itemdata_acc3.cn, itemdata_arm3.cn, itemdata_wea3.cn, and so forth) but none of the names I know I have translated properly (Found n other files by searching the kanji names) are appearing in any of them.

    Quite confusing.
     
  8. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    I am hoping this isn't breaking any forum rules, but I am using this thread as kind of an online diary of what I am trying, so I can look back as I go and see what I have already tried and what not.

    I managed to dump the entire Japanese item list from itemname.nat, but it is a non-stop block of text and I am having a hard time telling where one word ends and the next begins. Not to mention the fact that the game seems to read said list completely sequentially, so any but the most careful alterations moves the offsets to where when the game looks at an address for a name, a garbled mix of what was before/after the alteration is there. and I have no idea how to combat that.

    I am really hoping I can figure it out, because I think if I can get it all translated and fixed where the item names are in the proper places, then that would be patch-worthy... it would make using the alchemy pot totally usable without guesswork or ability to read Japanese.

    I dumped it to a .doc file, so if anyone wants to take a crack at the translating/separating of words aspect, I would be happy to email or upload it somewhere. Meanwhile, I wil continue to beat my head against the "text push" issue, I am thinking maybe padding at some point i the file to restore the offsets for the item name to their proper places.

    Any input is welcome, although cried of "give up noob!" will probably go unheeded [​IMG]
     
  9. warbird

    Member warbird GBAtemp Regular

    Joined:
    May 25, 2007
    Messages:
    290
    Country:
    Japan
    Good luck with the hacking. Hope you can figure it out [​IMG]

    Multiple consecutive posts by the same poster is usually considered bad forum etiquette. You should probably just edit your own post with any additional information. That way you avoid the wrath of any moderators passing by [​IMG]
     
  10. Samurai Goomba

    Member Samurai Goomba GBAtemp Regular

    Joined:
    Mar 14, 2009
    Messages:
    139
    Country:
    United Kingdom
    After seeing the DQIX translation patch, I found myself very interested in the proccess of creation also.

    But only after reading your posts have I really been inspired to do the same as you (only problem is: I, unlike yourself, have absolutely NO experience in the field whatsoever).

    Happy patching/hacking. [​IMG]
     
  11. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Will do, numbering my edits to keep track will be just as easy. Tanks or the tip.

    Update: Oh lord, what have I done? I just extracted the LZSS of the file I have been working on, and now I have no idea what I am looking at. I think I am starting to see why the menu trans patch people stuck to just the menus.
     
  12. Samurai Goomba

    Member Samurai Goomba GBAtemp Regular

    Joined:
    Mar 14, 2009
    Messages:
    139
    Country:
    United Kingdom
    Forgive me for my Newbishness, but are MadEdit and Nitro Explorer all you need to edit text (can MadEdit do the jobs of Table Maker, or other programs)?
     
  13. aginor37
    OP

    Newcomer aginor37 Member

    Joined:
    Jul 19, 2009
    Messages:
    13
    Country:
    United States
    Those are the two I have been using. I haven't worked out how to make the tile editor useful in workig with text, which may be part of my problem. But for about all I have done, it has been nitro and mad edit.
     
  14. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,748
    Country:
    United Kingdom
    You can do anything in rom hacking with a hex editor alone, it will just be very very difficult at times. If you want a nice tool to play with and get to grips with the basics can I suggest crystaltile2: it has extensive table support, support for many DS file formats obviously including the file system, one of the best tile editors out there, good compression support, assembly support, text editors, hex editor with shiftJIS and many other encoding formats inbuilt and much more. It is not perfect as some of the areas are a bit basic for really low level work but it is a great tool.
    Homepage seems to be out of action right now but it should not be too hard to find a recent version and there are a bunch of threads around here.
     
  15. Samurai Goomba

    Member Samurai Goomba GBAtemp Regular

    Joined:
    Mar 14, 2009
    Messages:
    139
    Country:
    United Kingdom
    Thanks for the tip.
     

Share This Page