PDA

View Full Version : NDS icon format?


Demonen
11-17-2006, 03:40 PM
Does anyone know what format the .nds icons are?
I've been making a Perl module to get information about .nds files for my own personal-use homebrew database, and all I'm missing now is the icon.

I can extract the data (including the palette), but I have no way to display it or convert it to something I can display.

I'm basing my efforts on this documentation:
http://www.bottledlight.com/ds/index.php/FileFormats/NDSFormat
The icon I'm talking about is in the banner, offset 32, length 512.

Does anyone know?

thehive
11-17-2006, 04:06 PM
It's 32x32, 4bits per pixel, which works out at 512 bytes of data.

Demonen
11-17-2006, 05:14 PM
Yeah, but how does the palette work?
I'm rather new to the whole graphics management thing, I usually only do text...

thehive
11-17-2006, 05:28 PM
Each byte of gfx data refers to two consecutive pixels.
So, each pixel is described by 4 bits. Thos 4 bits refer to an offet within the palette.
The palette contains the color information. Each word (double-byte) within the palette describes the color (16 double word in total = 16 colors max), in the format TRRRRRGGGGGBBBBB, where RGB contains the 15 bit color information. T would normally refer to transparancy, but i'm not sure it's used in the icon, so just set it to 1.

So say we read byte 1 of gfx data;
00001111. This refers to two pixels thus;
0000 = 15 bit color comes from palette offset 0
1111 = 15 bit color comes from pallette offet 15

Demonen
11-17-2006, 06:37 PM
Thanks a bunch, that makes stuff a whole lot clearer.

I'm still very much in the dark as to how I take the bitmask (16 bits per color) and turn it into an RGB value, but I'll do some research on my own if you're opposed to spoonfeeding.

[Edit]
Nope.
I've got it to load the colors (I think), but without knowing my image is correct I can't know if the colors are correct.
Alternatively, I've got it loading the image correctly, but without knowing that my palette is correct I can't know for sure.

Output is garbled, and does not at all look like the DSOrganize icon... :P

Anyone got any code that actually does this stuff? My C is rather weak, but I should be able to read Perl rather well.

[Edit yet again]
I've got this color palette for the DSOrganize Gray icon, from 0 to 15, #RRGGBB:
#1F373F
#1E2F3F
#1C1F3E
#183F3D
#103F3B
#003E37
#003C2F
#00381F
#00303F
#00203F
#01003E
#02003C
#040038
#080030
#100120
#010200

Are these values correct?

tomten
01-13-2007, 12:46 PM
Does anyone know what format the .nds icons are?
I've been making a Perl module to get information about .nds files for my own personal-use homebrew database, and all I'm missing now is the icon.

I can extract the data (including the palette), but I have no way to display it or convert it to something I can display.

I'm basing my efforts on this documentation:
http://www.bottledlight.com/ds/index.php/FileFormats/NDSFormat
The icon I'm talking about is in the banner, offset 32, length 512.

Does anyone know?

Show us the code!

ShortFuse
01-14-2007, 06:09 AM
C# and VB.NET code is somewhere in the long DS-X Manager thread

tomten
01-14-2007, 01:43 PM
C# and VB.NET code is somewhere in the long DS-X Manager thread

I meant the Perl module code =]