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

Nintendo Multi-Animation Resource (.NMAR) file parser. More...

#include "common.h"

Go to the source code of this file.

Data Structures

struct  NmarEntry
 Represents an individual layout mapping metadata entry record. More...
 
struct  NmarFrame
 Represents a single keyframe configuration block in a multi-animation sequence. More...
 
struct  NmarAnimation
 Represents an individual animation timeline sequence block. More...
 
struct  NmarFile
 Unpacked representation of a complete .NMAR resource. More...
 

Typedefs

typedef struct NmarEntry NmarEntry
 Represents an individual layout mapping metadata entry record. More...
 
typedef struct NmarFrame NmarFrame
 Represents a single keyframe configuration block in a multi-animation sequence. More...
 
typedef struct NmarAnimation NmarAnimation
 Represents an individual animation timeline sequence block. More...
 
typedef struct NmarFile NmarFile
 Unpacked representation of a complete .NMAR resource. More...
 

Functions

int Nmar_Parse (const u8 *data, size_t size, NmarFile *out_nmar)
 Parses an unpacked .NMAR animation resource block from raw bytes. More...
 
int Nmar_GetIdleMapIndex (const NmarFile *nmar)
 Resolves default idle layout map index. More...
 
int Nmar_GetIdleBreakMapIndex (const NmarFile *nmar, int idle_map, int map_count)
 Resolves rare idle break candidate layout map index. More...
 
int Nmar_GetFrameAtTick (const NmarFile *nmar, int animation_index, int tick, NmarFrame *out_frame)
 Resolves keyframe attributes at a specific tick timing step. More...
 
int Nmar_GetTotalDuration (const NmarFile *nmar, int animation_index)
 Calculates total duration of a timeline sequence in ticks. More...
 
void Nmar_Free (NmarFile *nmar)
 Deallocates all resources held inside an NmarFile structure. More...
 
void Nmar_PrintInfo (const NmarFile *nmar)
 Debug prints NMAR layout stats to stdout. More...
 

Detailed Description

Nintendo Multi-Animation Resource (.NMAR) file parser.

Typedef Documentation

◆ NmarAnimation

typedef struct NmarAnimation NmarAnimation

Represents an individual animation timeline sequence block.

◆ NmarEntry

typedef struct NmarEntry NmarEntry

Represents an individual layout mapping metadata entry record.

◆ NmarFile

typedef struct NmarFile NmarFile

Unpacked representation of a complete .NMAR resource.

◆ NmarFrame

typedef struct NmarFrame NmarFrame

Represents a single keyframe configuration block in a multi-animation sequence.

Function Documentation

◆ Nmar_Free()

void Nmar_Free ( NmarFile nmar)

Deallocates all resources held inside an NmarFile structure.

Parameters
nmarPointer to structure.

◆ Nmar_GetFrameAtTick()

int Nmar_GetFrameAtTick ( const NmarFile nmar,
int  animation_index,
int  tick,
NmarFrame out_frame 
)

Resolves keyframe attributes at a specific tick timing step.

Parameters
nmarPointer to parsed NMAR structure.
animation_indexAnimation timeline index.
tickTarget timing step.
out_frameDestination frame structure.
Returns
0 on success; negative value on index errors.

◆ Nmar_GetIdleBreakMapIndex()

int Nmar_GetIdleBreakMapIndex ( const NmarFile nmar,
int  idle_map,
int  map_count 
)

Resolves rare idle break candidate layout map index.

Parameters
nmarPointer to parsed NMAR structure.
idle_mapBase idle map index.
map_countTotal number of maps available.
Returns
Alternative idle map index candidate, or base idle index if none.

◆ Nmar_GetIdleMapIndex()

int Nmar_GetIdleMapIndex ( const NmarFile nmar)

Resolves default idle layout map index.

Parameters
nmarPointer to parsed NMAR structure.
Returns
Map index, or 0 if not found.

◆ Nmar_GetTotalDuration()

int Nmar_GetTotalDuration ( const NmarFile nmar,
int  animation_index 
)

Calculates total duration of a timeline sequence in ticks.

Parameters
nmarPointer to parsed NMAR structure.
animation_indexTarget animation sequence.
Returns
Total tick duration length.

◆ Nmar_Parse()

int Nmar_Parse ( const u8 data,
size_t  size,
NmarFile out_nmar 
)

Parses an unpacked .NMAR animation resource block from raw bytes.

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

◆ Nmar_PrintInfo()

void Nmar_PrintInfo ( const NmarFile nmar)

Debug prints NMAR layout stats to stdout.

Parameters
nmarPointer to parsed NMAR file.