AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Data Structures | Typedefs | Functions
narc.h File Reference

Nintendo Archive Resource (.NARC) file format reading and unpacking. More...

#include "common.h"

Go to the source code of this file.

Data Structures

struct  NarcArchive
 Structure containing offsets and metadata representing an active .NARC archive file. More...
 
struct  NarcMemberRange
 Offset and size boundaries of an individual member file within the NARC database. More...
 

Typedefs

typedef struct NarcArchive NarcArchive
 Structure containing offsets and metadata representing an active .NARC archive file. More...
 
typedef struct NarcMemberRange NarcMemberRange
 Offset and size boundaries of an individual member file within the NARC database. More...
 

Functions

int Narc_Init (NarcArchive *narc, const u8 *data, size_t size)
 Initializes and validates a NarcArchive from raw binary data. More...
 
int Narc_GetMemberRange (const NarcArchive *narc, int member_id, NarcMemberRange *out_range)
 Resolves the file offset boundaries of an archived member index. More...
 
int Narc_ExtractMember (const NarcArchive *narc, int member_id, u8 **out_data, size_t *out_size)
 Copies/extracts an archived member from NARC into a separate buffer. More...
 
void Narc_PrintInfo (const NarcArchive *narc)
 Debug printer function writing NARC layout stats to console stdout. More...
 

Detailed Description

Nintendo Archive Resource (.NARC) file format reading and unpacking.

Typedef Documentation

◆ NarcArchive

typedef struct NarcArchive NarcArchive

Structure containing offsets and metadata representing an active .NARC archive file.

◆ NarcMemberRange

Offset and size boundaries of an individual member file within the NARC database.

Function Documentation

◆ Narc_ExtractMember()

int Narc_ExtractMember ( const NarcArchive narc,
int  member_id,
u8 **  out_data,
size_t *  out_size 
)

Copies/extracts an archived member from NARC into a separate buffer.

Parameters
narcPointer to initialized archive.
member_idID offset of target file.
out_dataPointer to the destination buffer pointer, allocated inside this function.
out_sizePointer to store the size of the extracted member file.
Returns
0 on success; negative value if extraction fails.

◆ Narc_GetMemberRange()

int Narc_GetMemberRange ( const NarcArchive narc,
int  member_id,
NarcMemberRange out_range 
)

Resolves the file offset boundaries of an archived member index.

Parameters
narcPointer to initialized archive.
member_idID offset of target file.
out_rangeDestination container to write boundary coordinates.
Returns
0 on success; negative value if member index is out of bounds.

◆ Narc_Init()

int Narc_Init ( NarcArchive narc,
const u8 data,
size_t  size 
)

Initializes and validates a NarcArchive from raw binary data.

Parameters
narcDestination structure to populate.
dataPointer to raw file data.
sizeFile size in bytes.
Returns
0 on success; negative value on formatting or invalid signature errors.

◆ Narc_PrintInfo()

void Narc_PrintInfo ( const NarcArchive narc)

Debug printer function writing NARC layout stats to console stdout.

Parameters
narcPointer to archive.