Format:Nitro graphics files (NCGR, NCLR, NSCR)
| On this wiki | Facts · Code · Notes · Topics |
|---|
Nintendo DS tile graphics (NCGR, magic RGCN), palettes (NCLR, magic RLCN) and tile maps (NSCR, magic RCSN): each starts with the common 16-byte Nitro file header and holds tagged sections whose four-character tags are stored reversed.
Common header
All Nitro (NitroSystem) resource files read by Tinke's image plugin start with a 16-byte header: 4-character magic, u16 byte-order mark, u16 version constant, u32 file size, u16 header size, u16 section count (Fact:Nitro graphics files (NCGR, NCLR, NSCR)/struct/Nitro file header). The magic is stored as the reversed name (file type NCGR is the bytes RGCN) and so are the section tags (RAHC, TTLP, NRCS). Each section starts with its 4-character tag and a u32 section size. The same header is used by Format:NARC archive, Format:SDAT (Nitro sound archive) and Format:BTX0 and BMD0 (Nitro 3D) files.
The three files
- NCGR (tile data, magic
RGCN; Tinke also acceptsRBCN): sectionRAHCwith tile counts, colour depth, a tiled flag and the pixel data (Fact:Nitro graphics files (NCGR, NCLR, NSCR)/struct/NCGR RAHC section); an optional second sectionSOPC. - NCLR (palette, magic
RLCN): sectionTTLPwith the colour depth, palette size and BGR555 colours; an optionalPMCPpalette-map section (Fact:Nitro graphics files (NCGR, NCLR, NSCR)/struct/NCLR TTLP section). - NSCR (tile map, magic
RCSN): sectionNRCSwith width, height and an array of u16 map entries (Fact:Nitro graphics files (NCGR, NCLR, NSCR)/struct/NSCR NRCS section); each entry has tile number, flips and palette number (Fact:Nitro graphics files (NCGR, NCLR, NSCR)/struct/NSCR map entry). - Cells (NCER, magic
RECN) and animations (NANR, magicRNAN) are recognized by Tinke by those magics only; their layouts are not described here. Unverified: their section tags and field layouts (to test, read Tinke'sPlugins/Imagessources for the cell and animation readers).
Identification
Tinke's Get_Format classifies by the first 4 bytes read as ASCII, see Fact:Nitro graphics files (NCGR, NCLR, NSCR)/identification/Tinke format detection.
Code & repositories
- https://github.com/pleonex/tinke @
3263fc2baeea40c847e5267f826730210864fb8c· license: GPL-3.0
Tinke (GPL-3.0): DS file viewer; Plugins/Images/Images/NCGR.cs, NCLR.cs, NSCR.cs and Ekona/Actions.cs give the tile, palette and map layouts; Plugins/DSDecmp has LZ10, LZ11, Huffman and RLE codecs.
Tested on: source read, not run · checked 2026-10-19; archived; last activity 2022-11-26; Note: the latest release ships binaries; the wiki links only the source, never the binaries
Pitfalls
- Colours are BGR555; tile counts in the NCGR are stored in tiles but Tinke multiplies them by 8 to get pixels unless the width field is 0xFFFF.
- The byte-order mark: Tinke compares it with 0xFFFE after reading little endian and then calls
Reverse()on the id without storing the result, so that branch changes nothing. Files seen in games carry bytesFF FE(read as 0xFEFF) per the SDAT and NARC pages. Unverified: any file that really needs the 0xFFFE path.