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

Nintendo Multi-Cell Resource (.NMCR) layout mapping parser. More...

#include "common.h"
#include "nanr.h"
#include "ncer.h"

Go to the source code of this file.

Data Structures

struct  NmcrRecord
 Represents a reference linking a sub-animation timeline to cell layout transforms. More...
 
struct  NmcrMap
 Multi-cell layout composition group containing multiple records. More...
 
struct  NmcrFile
 Unpacked representation of a complete .NMCR resource. More...
 

Typedefs

typedef struct NmcrRecord NmcrRecord
 Represents a reference linking a sub-animation timeline to cell layout transforms. More...
 
typedef struct NmcrMap NmcrMap
 Multi-cell layout composition group containing multiple records. More...
 
typedef struct NmcrFile NmcrFile
 Unpacked representation of a complete .NMCR resource. More...
 

Functions

int Nmcr_Parse (const u8 *data, size_t size, NmcrFile *out_nmcr)
 Parses an unpacked .NMCR layout mapping resource block from raw bytes. More...
 
void Nmcr_Free (NmcrFile *nmcr)
 Deallocates all resources held inside an NmcrFile structure. More...
 
int Nmcr_MaxFrameCount (const NmcrMap *map, const NanrFile *nanr)
 Computes maximum frames required to play a composite layout. More...
 
int Nmcr_CountValidRecords (const NmcrMap *map, const NanrFile *nanr, const NcerFile *ncer, int frame_index)
 Counts valid active cell records inside layout mapping for specified frame index. More...
 
int Nmcr_ComputeBreakScore (const NmcrMap *idle_map, const NmcrMap *candidate_map, const NanrFile *nanr, const NcerFile *ncer)
 Measures similarity index difference scores to identify rare break animation map candidate. More...
 
void Nmcr_PrintInfo (const NmcrFile *nmcr)
 Debug prints NMCR layout stats to stdout. More...
 

Detailed Description

Nintendo Multi-Cell Resource (.NMCR) layout mapping parser.

Typedef Documentation

◆ NmcrFile

typedef struct NmcrFile NmcrFile

Unpacked representation of a complete .NMCR resource.

◆ NmcrMap

typedef struct NmcrMap NmcrMap

Multi-cell layout composition group containing multiple records.

◆ NmcrRecord

typedef struct NmcrRecord NmcrRecord

Represents a reference linking a sub-animation timeline to cell layout transforms.

Function Documentation

◆ Nmcr_ComputeBreakScore()

int Nmcr_ComputeBreakScore ( const NmcrMap idle_map,
const NmcrMap candidate_map,
const NanrFile nanr,
const NcerFile ncer 
)

Measures similarity index difference scores to identify rare break animation map candidate.

Parameters
idle_mapBase idle layout map.
candidate_mapAlternative layout candidate.
nanrPointer to parsed .NANR timeline.
ncerPointer to parsed .NCER cells.
Returns
Score difference value (lower score implies higher layout similarity).

◆ Nmcr_CountValidRecords()

int Nmcr_CountValidRecords ( const NmcrMap map,
const NanrFile nanr,
const NcerFile ncer,
int  frame_index 
)

Counts valid active cell records inside layout mapping for specified frame index.

Parameters
mapPointer to cell layout map.
nanrPointer to parsed .NANR timeline.
ncerPointer to parsed .NCER cells.
frame_indexFrame index request.
Returns
Number of active drawing sub-cells.

◆ Nmcr_Free()

void Nmcr_Free ( NmcrFile nmcr)

Deallocates all resources held inside an NmcrFile structure.

Parameters
nmcrPointer to structure.

◆ Nmcr_MaxFrameCount()

int Nmcr_MaxFrameCount ( const NmcrMap map,
const NanrFile nanr 
)

Computes maximum frames required to play a composite layout.

Parameters
mapPointer to cell layout map.
nanrPointer to parsed .NANR timeline sequences.
Returns
Total frame duration count.

◆ Nmcr_Parse()

int Nmcr_Parse ( const u8 data,
size_t  size,
NmcrFile out_nmcr 
)

Parses an unpacked .NMCR layout mapping resource block from raw bytes.

Parameters
dataRaw binary input buffer.
sizeInput stream size in bytes.
out_nmcrDestination NmcrFile structure.
Returns
0 on success; negative value on formatting or invalid signature errors.

◆ Nmcr_PrintInfo()

void Nmcr_PrintInfo ( const NmcrFile nmcr)

Debug prints NMCR layout stats to stdout.

Parameters
nmcrPointer to parsed NMCR.