AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Functions
narc.c File Reference
#include "narc.h"
#include "file_util.h"
#include "nitro_util.h"

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...
 

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.