NCER (NITRO-System Cell for Runtime) files store OBJ cell data for the 2D engine. It follows the NNS G2D Binary File Format. NCER files use file signature 'NCER'.

CEBK Block#

The CEBK (Cell Bank) block defines the set of cells in this file. The structure is as follows:

OffsetTypeMeaning
0x00 u16 Number of cells
0x02 u16 Bank attributes. If the cell bank stores bounding rectangle info for each cell, this will be 1. Otherwise, this will be 0.
0x04 void * Pointer to cell data. This is relative to the start of this structure and fixed up at load time.
0x08 u32 Mapping mode. This can be 1D 32K (0), 1D 64K (1), 1D 128K (2), or 1D 256K (3), or 2D (4).
0x0C void * VRAM transfer data pointer relative to the start of this structure. and fixed up at load time. If VRAM transfer characters are not used, this will be NULL.
0x10 void * Pointer to string bank (fixed up at load time). This can be NULL.
0x14 void * Pointer to user extended cell attribute data (fixed up at load time). This can be NULL.

The cell data in the cell bank is structured as:

OffsetTypeMeaning
0x00 u16 Number of OAM attributes in this cell.
0x02 u16 Cell attributes.
0x04 void * Pointer to OAM attribute data relative to the start of the OAM data. The OAM data starts immediately after the cell array.
0x08 s16 *Max X
0x0A s16 *Max Y
0x0C s16 *Min X
0x0E s16 *Min Y

Here * denotes fields only present when bounding rectangle is specified in the CEBK structure. This alters the size of the cell data, and needs to be taken into account when calculating the offset to OAM data.

The cell attributes is a bit field. The lowest 6 bits of these attributes represent the size of the circle of minimal radius centered at the center of this cell's bounding box that contains every OBJ (or opaque pixel) in the cell. This is divided by 4 and rounded up, with a maximum value representing a radius of 252 pixels. Bit 8 indicates if the cell uses H flip, bit 9 indicates if the cell uses V flip, bit 10 indicates if the cell uses both H and V flip, and bit 11 indicates if the cell has bounding box information.

Some cell files use VRAM transfer characters for animation. This involves transferring graphics to VRAM on the fly. This allows all graphics not to be loaded into VRAM at a time. For these kinds of animation, the VRAM transfer data pointer will be non-NULL. The structure of the data this points to is:

OffsetTypeMeaning
0x00 u32 Maximum VRAM transfer size
0x04 void * Pointer to VRAM transfer entries relative to the start of the CEBK block. There will be one entry for each cell in the bank.

Each VRAM transfer entry takes this structure:

OffsetTypeMeaning
0x00 u32 Transfer source address
0x04 u32 Transfer Size

A cell bank may wish to store additional data. This can be placed inside a user extended attributes block in the CEBK block. When present, it takes the form of a sequence of blocks (fully contained within the CEBK block) that take on the same structure as the containing blocks. There is no field indicating the number of blocks, however. The NCER format defines the following block here:

OffsetTypeMeaning
0x00 u16 Number of cells
0x02 u16 Number of attributes per cell (always 1)
0x04 void* Offset to attribute array relative to this struct

The attribute array consists of one pointer per each cell in the bank. These point to the extended attribute data, which is a single u32 per each cell.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 13-Nov-2024 22:21 by Garhoogin