I know this is a little out of the ordinary, but I want to try and find out how I can read the metadata of a Nintendo DS game? When on the computer, they have the .nds extension.
I'm trying to work with some homebrew games I have, and I want to make a library. C# is the language I'd prefer to use.
I've tried researching it on the internet, and the closest option I've found is reading the file header. However, considering the game file is supposed to have a title and an image, the closest I've come to it is just getting part of the title up.
I know this can be done, because there are some programs, written in c#, that have done it. So, does anyone know how? I'd muchly appreciate any help.
All the metadata (including the title/image) is stored in the ROM header, which is the first 512 bytes of the
.ndsfile. You'll have to read in the.ndsfile as a binary file and examine the values stored at certain offsets.For example, the 4 bytes starting at offset
0x68hcontain a 32-bit value that specifies the offset where the game's title/icon data is stored. The English title is stored in the 256 bytes (encoded in 16-bit Unicode) found at0x340hfrom that0x68offset.Similarly, the icon bitmap (32x32 pixels) is stored in the 512 bytes at
0x20hfrom the0x68hoffset, and the bitmap's palette is stored in the 32 bytes at0x220hfrom the0x86offset. The icon & its palette are encoded in the standard GBA color scheme/palette (see the Color Format section at http://www.cs.rit.edu/~tjh8300/CowBite/CowBiteSpec.htm#Graphics%20Hardware%20Overview).For more information about the
.ndsheader format, refer to http://nocash.emubase.de/gbatek.htm#dscartridgeheader.If in doubt, you can refer to
ndstool, which is a handy utility for viewing nds header data and extracting files from the DS filesystem. It's open-source and included as part of the devkitPro toolchain, available at http://sourceforge.net/projects/devkitpro/.