GBATemp ROM hacking documentation project (new 2016 edition out)

Discussion in 'NDS - ROM Hacking and Translations' started by FAST6191, Jan 28, 2008.

  1. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    @IlDucci sorry for not getting back to you sooner, I was under the impression a fair bit of work was done on TWEWY (certainly audio and text work). If not it might be like the animation for phoenix wright- each part of the would be body (which is probably why you have tile sizes) had a few stages and animation was there to build up the image and animate it. Very similar to how you might animate in 3d. Not directly related to what you want but the later pages of http://www.romhacking.net/forum/index.php/topic,8407.html might give you an idea of how some things work on some of the more exotic tile formats the DS developers have access to.


    Also I am probably not the first to try it in a game but thinking about it I might have cooked up a new table finding method that I have not seen mentioned elsewhere- it is similar to the partial chosen plaintext attack in cryptograpy which is nice so nothing new there.
    Try altering names of characters should you get the chance- it probably uses the same encoding (certainly all the saves I have ever tried do although I tend not to look at names when I edit saves) and do it correctly and you can make for some nice statistical analysis for instance typing azazazazazaz as a name and relative search will probably home right in on that and once you have that you can also home in on some of the extra characters quite easily.
     
  2. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    Rather than finish some reviews I am supposed to be working on I started tidying up this thread a bit.

    It is still a mess, it still has broken links (one of the main aims of this project is to help lessen that) and probably helps very little but it is now my mess, has some semblance of order and can start to be used to finish things.
    A link to my current "offline" version has been available in the first post for a while and has a lot of info not on this thread (indeed in some areas this thread is lacking very much compared to the docs and other posts on the forum- I noticed I often allude to such things in the odd sentence dotted randomly about the place).


    I still need to sort the following sections and make the others into something other than info dumps from random posts I made over the years but it is a start.

    Core hacking and file format reversing.
    Compression (I have done a lot of work on this the last few weeks for people). Equally I have been looking at some of the old GBA tools with an eye to the formats we are now seeing on the DS (not to mention I finally gained a bit of high level programming skill in languages people actually use)
    Coding for rom hacking (we had a nice discussion of this on the thread already)
    Advanced techniques not necessarily covered elsewhere (mainly stuff being pioneered by myself and others these last few months/brought back for modern hacking)

    Known file formats and niceties. Various things exist
     
  3. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Ok then

    I'm trying to find a way to put the ost from dragon quest viii in to dragon quest ix

    First off would this be possible?
     
  4. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    Yeah it would be possible.

    DS roms typically use SDAT type audio. If it is another type then it usually is even easier (most in this case are single files which can just be replaced- see something like TWEWY or N+ or basic packing- see something like the ongoing inazuma eleven project). I have it in my head that Dragon Quest did not use SDAT but I am far too lazy right now to go and find a rom to look at.

    There are no tools I rate to put SDAT files back together so it is by hand or not at all. The big thing to remember here is the header file size bytes- the rest is easy enough but you have to remember to change these as well.

    I guess the music is "midi" like which in the SDAT filetype means SSEQ. Unlike midi there is no predetermined instrument library beyond what might exist in the SDK and that means nothing about what actually hits the street. These instrument libraries go by the name Bank (as in bank of instruments).

    Your job as hacker is to take the SSEQ files from the DQ 8 game and find their equivalents in DQ9 (battle theme to battle theme or any other similarities or simply hacker's choice). You then get to point the DQ9 sseq files to wherever you ended up sticking the DQ8 stuff.
    Rinse and repeat for any banks associated with the new SSEQ files.

    The other file types are more likely to be sound effects, you can replace them too if you want.

    Such a hack was done before for a couple of the later phoenix wright games (indeed I am supposed to be polishing said hack when I get the time) and some people have similar hacks in the works for undubs.

    Some threads, not explicitly dealing with the hack you want to do but if basic file location hacks (pretty much what you will be doing), file insertion hacks (for music changing purposes but the main difference is your hack you will have the SSEQ files already available for) and the general background of SDAT do not sort it then some more reading on hacking is probably good to do.

    http://gbatemp.net/index.php?showtopic=122534
    http://jul.rustedlogic.net/thread.php?id=7518
    http://llref.emutalk.net/nds_formats.htm#SDAT http://www.romhacking.net/docs/%5B469%5Dnds_formats.htm
    http://kiwi.ds.googlepages.com/sdat.html
     
  5. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Well I managed to open it and extract the sdat

    But I can't find VGMTrans or play the wav files to figure out what song it is
    They're named 000-BG-001 etc
    Also any tool you can recommend me to open up a ps2 iso?
     
  6. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    NDSSDNext
    http://filetrip.net/nds-downloads/utilities/download-nds-sound-extractor-0-4-f28818.html

    Vgmtrans
    http://gbatemp.net/threads/new-vgmtrans-github-and-loveemu.354869/
    http://hcs64.com/mboard/forum.php?showthre...&showpage=1 (also an older version on my site somewhere)

    Those two programs can usually allow you to figure out what it what at least. Crystaltile2 ( http://filetrip.net/f23649-CrystalTile2-2010-09-06.html ) has some playback but it is somewhat broken. Nice for getting offsets and everything though.
    Also http://filetrip.net/f5658-NDS-Editor-0-1.html can be of some use but I would not count on it for much.

    As for PS2 isos I believe you can fiddle with them as a normal iso most of the time, some isos have hidden files (mainly square enix stuff- you can pull them apart manually though) and there is the usual packing formats and wrappers to deal with- most ps2 tools scan for files.
    Still there is a tool called xpert2 that is quite liked among PS2 (and PSP) hackers.
    Equally we have decent emulation (from a hacker perspective anyway) if you come unstuck.
    I have not done much in the way of PS2 hacking though so I am not going to be very helpful on the odd cases.
     
  7. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    That vgmtrans link 404'd and I couldn't find it on your site

    But I did find out what song is what in the SDAT now all that's left is ripping the songs from the ps2 iso and replacing them into the rom

    Do you know if the music in the ps2 iso is in SSEQ and banks?

    EDIT: I tried xpert2 but didn't a tool to explore the iso or anything of the like just some conversion tools
    I can explore the iso the normal way, put ito n a drive and open it, but don't know the bgm format
     
  8. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    My bad, I should have tested the link
    http://www.mediafire.com/?nzniwmyngg1 (from the first page in the thread)

    Also whoa I appeared to have not been paying attention (and it was only 2am when I wrote that)- I missed DQ8 was a PS2 title (for some reason i thought it was one of the ones ported to the DS). This makes things a lot more troublesome and indeed we are venturing into areas I do not know about. In theory at least the SDAT music player coupled with the DS hardware allows anything at any point but I have not experimented much with turning one form of audio into another (most people replace like with like).

    PS2 music. Looking around they appear to use the the PSF2 format like many other PS2 titles. There are even winamp plugins for it so conversion/extraction should be easy enough.

    Wave to midi conversion does not exist in practical terms so I am not even going to suggest it.
    This means you are going to have to get the game to play wave audio. SDAT has the facilities in the likes of STRM (see http://gbatemp.net/t243430-swav-to-swar-converter if going manual does not float your boat- they are little more than simple PCM audio streams mind) and maybe SWAR/SWAV (I have not pushed this format so I have no idea here).

    The audio does have something of a header/lookup option (it is why the simple pointer hacks work) and is fairly resilient (see all the quick and dirty hacks to the format over the years) so you stand a chance. It will however be one of those hacks that breaks new ground in a fairly big way.
     
  9. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Well this is gonna be trickier than I thought mind if I ask for your help through msn?
     
  10. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    Assuming I still had an MSN account I am not sure how my being able to chat at once is any better than forums. In fact it might even be worse as I can spend 5 minutes (I have certainly pondered replies to hacking related posts for that long if not longer) knocking together a picture for a forum post and nothing is lost from that but a 5 minute break in a conversation is not so good.

    I shall revise my earlier statement as well- it is still new and untested but in theory at least it should be no harder than a conventional inject and repoint. I shall have to have a look at some of the roms that lost things in translation (the first megaman platformer, maybe castlevania and almost certainly Spectral Genesis) as they will give clues as to what goes and what can be done. Worst case scenario- we go looking to see how the DS works with SDAT files at a code level (something I have not seen done yet or tried my own hand at).
     
  11. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Well since I couldn't figure out how to rip the music from the iso, I tried just switching some music in the game for the meantime

    But when I try to import it back into the rom it says file size incorrect
    I've checked and the file size is actually the same
     
  12. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    Very odd. Perhaps rebuild the rom with your hacked SDAT file instead. Equally I have heard of things including padding 00's that come between files in the past- is that the case here perhaps.

    As for the PSF format I did some digging and apparently it supports sequenced music as well.
    Likewise I found a PSF pack for dragon quest 8 and they were all some 800k each for tracks lasting several minutes (at the quality they played back they can not have been heavily compressed/badly sampled PCM). I am not necessarily calling sequenced audio but it raises an eyebrow not to mention we barely have a working midi2SSEQ converter let alone something more exotic.
    One player than can convert/dump to wave
    http://www.bannister.org/software/ao.htm
     
  13. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Problem is I can't seem to find the PSF files in the disc (I am doing this by just popping it in my disk tray and opening it with windows explorer so maybe I'm doing something wrong there)

    Also, unless I missed the post, how do I rebuild the rom from the hacked SDAT?
     
  14. FAST6191
    OP

    FAST6191 Techromancer

    pip Reporter
    23,713
    9,583
    Nov 21, 2005
    United Kingdom
    Yeah apparently a lot of square enix games use "protection"- part of the disc structure uses the standard iso file sectors but other parts might simply read the data from the raw disc (LBA reads). Most games stuck with the simple method but SE games are well known to use LBA stuff apparently- several tools even are geared towards scanning the iso (made by ripping every single sector) for them. There might be a guide to tell you where the sound sits, you can use an emulator and monitor read commands or just find a pack someone released (there are a few it seems).

    There are several ways to replace files although as I very much doubt you will have a hacked file as big or smaller than the original some methods like NDSTS are off the table-
    the easiest is ndstool (what DSLazy and DSBuff use) but that breaks some roms (mainly first party Nintendo games but it is not limited to them) and is not very clean.
    http://gbatemp.net/t73394-gbatemp-rom-hack...p;#entry1799596 has some on the basic theory behind that

    Crystaltile2 (general wonder hacking tool) http://filetrip.net/f23649-CrystalTile2-2010-09-06.html has the option to rebuild an entire DS file as well (others reading be warned it is not compatible with the standard ndstool rebuild method).
    Open the rom, click on the little DS icon and under the first pulldown menu should be the options to extract and rebuild roms.

    Nitroexplorer (a tool built to replace ndstool) can also do it. http://treeki.shacknet.nu/

    Lastly you can also rebuild by hand- change the rom length in the header, change the location of the SDAT to the blank space at the end of the rom and place your SDAT data in there. Space issues aside this is very clean and will generate nice patches.

    In general rebuilding can get a bit tricky if you want to release conventional patches (IPS, BSDiff, PPF and Xdelta being the big 4) as it has a habit of changing file locations and that does not play well with more traditional patching methods (Deufeufeu did a fair bit of work with this for Jump Ultimate stars and others release batch files that extract, change individual files and rebuild the iso or methods to do it (this is mainly for the wii though)). As the sound is copyrighted you probably are not going to have problems with this- you can not post/share such a patch anywhere that handles DS hacks really.
     
  15. SparkFenix

    SparkFenix GBAtemp Fan

    Member
    334
    15
    Jul 6, 2010
    Okay so I used the first link you gave me along with nitroexplorer and was able to switch songs inside the game

    But the song that plays isn't complete, it's only the tune withotu the effects which should be the SBNK

    Also I got winamp and the plugin for PSF2 but it fails to convert to wav
    Can I use mp3 music instead of the PSF2?

    EDIT: I fixed the sound swap and replaced all the files, now the sound is glitchy in the DS but plays fine in VGMTrans

    EDIT2: Fixed now it plays normally all that's left is to replace the music in the sdat with the music from DQ VIII
     
  16. AsPika2219

    AsPika2219 Pikachu going beach!

    Member
    1,210
    221
    Jun 17, 2010
    Malaysia
    Cats City
    Thanks for the nice tools! Is time to learning ASM codes right now.
     
  17. YamiHoshi.nl

    YamiHoshi.nl I'm MKGirlism.

    Member
    671
    274
    May 23, 2011
    Tokyo
    Sorry for the bump, and late reply.
    I was sure I deleted the fake DLL file, after Frozen Cartridge from DSHack Forums told me it's fake, so I'm surprised it was still available.
    Well, now I've deleted the MagicSSEQ non-sense for sure.
     
  18. loco365

    loco365 GBAtemp Guru

    Member
    5,458
    2,674
    Sep 1, 2010
    Well, what would be cool is if someone did create a MagicSSEQ plugin. Doubt it highly though.
     
  19. polu178

    polu178 Newbie

    Newcomer
    3
    0
    Nov 2, 2011
    Hi everyone! I'm translating Rune Factory 3(US) into my language. But it not have font.bin file, so i can't edit that font. Please help me to find font of Rune Factory 3(US)
    Thank Everyone!
    Sorry my bad english!
     
  20. loco365

    loco365 GBAtemp Guru

    Member
    5,458
    2,674
    Sep 1, 2010
    UPDATE: I found a YouTube video on this and it does look legit. It's possibly real, but I'm taking it with a grain of salt.

    And, a question that has been pondering me for a while- Is it possible to insert NEW soundbanks and wave archives, then point an SSEQ to play from them without replacing old ones? I'd like to try this as I'd like to add a song from Black and White into Diamond with the same banks and archives so I don't have to do any modifications.