AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
anima_backend.c File Reference
#include "anima_backend.h"
#include "common.h"
#include "file_util.h"
#include "nds_header.h"
#include "nds_fnt.h"
#include "nds_fat.h"
#include "narc.h"
#include "lz.h"
#include "nitro_guess.h"
#include "nitro_util.h"
#include "nclr.h"
#include "ncgr.h"
#include "ncer.h"
#include "nanr.h"
#include "nmcr.h"
#include "nmar.h"
#include "ppm.h"
#include "png_writer.h"
#include "png_pipeline.h"
#include "gif_writer.h"
#include "gif_pipeline.h"
#include "json_export.h"
#include "sprite_composer.h"
#include "coords.h"

Data Structures

struct  PokemonMemberSpec
 
struct  PreviewResourceSet
 

Macros

#define PATH_BUFFER_SIZE   ANIMA_PATH_BUFFER_SIZE
 
#define BW_TILE_STRIDE   ANIMA_BW_TILE_STRIDE
 
#define COMPOSITE_MARGIN   ANIMA_COMPOSITE_MARGIN
 
#define ANIMA_DIR_RAW_MEMBERS   "raw_narc_members"
 
#define ANIMA_DIR_NDS_FILES   "nds_files"
 
#define ANIMA_DIR_JSON   "reconstruction_json"
 
#define ANIMA_DIR_SPRITESHEETS   "spritesheet_png"
 
#define ANIMA_DIR_STATIC   "static_png"
 
#define ANIMA_DIR_IDLE_GIF   "animated_idle_gif"
 
#define ANIMA_DIR_BREAK_GIF   "idle_break_gif"
 
#define ANIMA_DIR_COMPOSED_GIF   "composed_gif"
 

Typedefs

typedef enum PokemonMemberRole PokemonMemberRole
 
typedef struct PokemonMemberSpec PokemonMemberSpec
 
typedef struct PreviewResourceSet PreviewResourceSet
 

Enumerations

enum  PokemonMemberRole {
  ROLE_FRONT_STATIC , ROLE_FRONT_STATIC_EMPTY , ROLE_FRONT_SHEET , ROLE_FRONT_SHEET_EMPTY ,
  ROLE_FRONT_CELLS , ROLE_FRONT_ANIM , ROLE_FRONT_MAP , ROLE_FRONT_TIMING ,
  ROLE_FRONT_COORDS , ROLE_BACK_STATIC , ROLE_BACK_STATIC_EMPTY , ROLE_BACK_SHEET ,
  ROLE_BACK_SHEET_EMPTY , ROLE_BACK_CELLS , ROLE_BACK_ANIM , ROLE_BACK_MAP ,
  ROLE_BACK_TIMING , ROLE_BACK_COORDS , ROLE_PALETTE_NORMAL , ROLE_PALETTE_SHINY
}
 

Functions

static int ResolveBreakMapValidated (const NmarFile *nmar, int idle_map, const NmcrFile *nmcr, const NanrFile *nanr, const NcerFile *ncer)
 
static int FindIdleNmarAnimationIndex (const NmarFile *nmar)
 
static int FindBreakNmarAnimationIndex (const NmarFile *nmar, int idle_map, int break_map, const NmcrFile *nmcr, const NanrFile *nanr, const NcerFile *ncer)
 
static int RenderComposedAnimationSmart (const NcerFile *ncer, const NanrFile *nanr, const NmcrFile *nmcr, const NmarFile *nmar, int idle_map, int break_map, int preferred_break_animation_index, const NcgrImage *ncgr, const NclrPalette *palette, int idle_repetitions, int tile_stride, int margin, u8 **out_frames, int *out_frame_count, int *out_width, int *out_height, const CoordFile *coords, int delay_cs)
 
static void PrintFirstFourBytes (const u8 *data, size_t size)
 
static int ExtractDecodedMember (const NarcArchive *narc, int member_id, const PokemonMemberSpec *spec, u8 **out_data, size_t *out_size)
 
static int AnimaBackend_GetFormBlockIndex (int species, int form_index)
 
static PokemonMemberRole ResolveMemberRole (PokemonMemberRole role, const AnimaPreviewOptions *opts)
 
static int ExtractDecodedPokemonRoleExt (const NarcArchive *narc, int species, PokemonMemberRole role, const AnimaPreviewOptions *opts, u8 **out_data, size_t *out_size)
 
static int ExtractDecodedPokemonRole (const NarcArchive *narc, int species, PokemonMemberRole role, u8 **out_data, size_t *out_size)
 
static int InitPokegraFromRom (const char *rom_path, u8 **out_rom, size_t *out_rom_size, NarcArchive *out_pokegra)
 
static int WritePokemonBlockMembers (const NarcArchive *narc, int species, int block_index, const char *out_dir)
 
static void GeneratePokemonTilePreviews (int species, const char *out_dir)
 
static void GeneratePokemonCellPreviews (int species, const char *out_dir)
 
static int GenerateAssembledStaticAndLeaves (const char *out_dir, const GifExportOptions *gif_options, int export_idle_break_gifs, int export_composed_gifs)
 
void AnimaExtractOptions_Init (AnimaExtractOptions *options)
 Initialises default options for extraction. More...
 
int AnimaBackend_BuildFrontNormalGifPath (const char *out_dir, char *buffer, size_t buffer_size)
 Helper to generate output path for front normal battle idle GIF. More...
 
int AnimaBackend_BuildFrontNormalIdleBreakGifPath (const char *out_dir, char *buffer, size_t buffer_size)
 Helper to generate output path for front normal idle break battle GIF. More...
 
int AnimaBackend_BuildFrontNormalStaticPath (const char *out_dir, char *buffer, size_t buffer_size)
 Helper to generate output path for static normal front static preview PNG. More...
 
static void RemoveChildDirectory (const char *out_dir, const char *child)
 
static int OptionsRequestOnlyDsFiles (const AnimaExtractOptions *options)
 
static int ResolveIdleMapIndex (const NmcrFile *nmcr, const NanrFile *nanr, const NcerFile *ncer, const NmarFile *nmar)
 
static void PreviewResources_Free (PreviewResourceSet *res)
 
static int PreviewResources_Load (const char *rom_path, int species, const AnimaPreviewOptions *opts, PreviewResourceSet *res)
 
static void ComposerTransformFromNmarFrame (const NmarFrame *frame, ComposerTransform *out_transform)
 
static int NmcrMapIsUsable (const NmcrFile *nmcr, const NanrFile *nanr, const NcerFile *ncer, int map_index)
 
static int NmarAnimationFirstMap (const NmarFile *nmar, int animation_index)
 
static int NmarAnimationIsUsable (const NmarFile *nmar, const NmcrFile *nmcr, const NanrFile *nanr, const NcerFile *ncer, int animation_index)
 
static int NmarAnimationReferencesMap (const NmarFile *nmar, int map_index)
 
static int NmarAnimationContainsMapOtherThan (const NmarFile *nmar, int animation_index, int map_index)
 
static int NmarAnimationFrameCountForPreview (const NmarFile *nmar, int animation_index, int delay_cs)
 
static int IsStrongBreakLabel (const char *label)
 
static int CopyIndexedFramesToPreview (const u8 *indices, int frame_count, int width, int height, const NclrPalette *palette, int delay_cs, AnimaIdlePreview *out_preview)
 
int AnimaBackend_LoadIdlePreview (const char *rom_path, int species, AnimaIdlePreview *out_preview)
 High-level loader to construct a basic idle preview (Base front normal). More...
 
int AnimaBackend_LoadSpritesheetPreview (const char *rom_path, int species, AnimaIdlePreview *out_preview)
 High-level loader to build the spritesheet PNG preview buffer (Base front normal). More...
 
int AnimaBackend_LoadIdleBreakPreview (const char *rom_path, int species, AnimaIdlePreview *out_preview)
 High-level loader to build the idle break variant preview buffer. More...
 
int AnimaBackend_LoadComposedPreview (const char *rom_path, int species, int idle_repetitions, AnimaIdlePreview *out_preview)
 High-level loader to build unified composed idle-to-break animation loop. More...
 
void AnimaIdlePreview_Free (AnimaIdlePreview *preview)
 Deallocates memory within an AnimaIdlePreview container. More...
 
static int RenderNmcrMapPreviewFromResources (const PreviewResourceSet *res, int map_index, AnimaIdlePreview *out_preview)
 
static int RenderNmarAnimationPreviewFromResources (const PreviewResourceSet *res, int animation_index, AnimaIdlePreview *out_preview)
 
static int WritePreviewGifFromPalette (const char *out_path, const AnimaIdlePreview *preview, const NclrPalette *palette)
 
int AnimaBackend_LoadNmarAnimationPreviewExt (const char *rom_path, int species, int animation_index, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Builds custom NMAR-selected animation preview from direct timeline records. More...
 
int AnimaBackend_LoadNmcrMapPreviewExt (const char *rom_path, int species, int map_index, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Builds direct static NMCR-selected composite layout preview frame. More...
 
static void FillAssetText (AnimaPreviewAssetInfo *asset, AnimaPreviewAssetType type, int animation_index, int map_index, int frame_count, const char *label, const char *display_name)
 
static int AddAsset (AnimaPreviewAssetInfo *assets, int max_assets, int *count, AnimaPreviewAssetType type, int animation_index, int map_index, int frame_count, const char *label, const char *display_name)
 
int AnimaBackend_ListPreviewAssets (const char *rom_path, int species, const AnimaPreviewOptions *opts, AnimaPreviewAssetInfo *out_assets, int max_assets, int *out_count)
 Scans active Nitro headers in Pokegra member block to discover and populate all available assets. More...
 
int AnimaBackend_ExtractPokemon (const char *rom_path, int species, const char *out_dir, const AnimaExtractOptions *options)
 Performs a full asset extraction pipeline for a specific Pokemon species. More...
 
int AnimaBackend_HasFemaleSprite (const char *rom_path, int species)
 Verifies whether the specified species contains dedicated gender variant graphics. More...
 
int AnimaBackend_LoadIdlePreviewExt (const char *rom_path, int species, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Extended loader for basic idle previews targeting custom shiny, perspective, or form variables. More...
 
int AnimaBackend_LoadSpritesheetPreviewExt (const char *rom_path, int species, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Extended spritesheet preview builder with complete variant option mappings. More...
 
int AnimaBackend_LoadIdleBreakPreviewExt (const char *rom_path, int species, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Extended idle break preview builder supporting shiny and perspective parameters. More...
 
int AnimaBackend_LoadComposedPreviewExt (const char *rom_path, int species, int idle_repetitions, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
 Extended composed idle-to-break preview builder supporting complete variant selections. More...
 
static int ResolvePreviewGifDelayCs (const AnimaPreviewOptions *opts)
 
int AnimaBackend_ExportCurrentAsset (const char *rom_path, int species, int preview_mode, const AnimaPreviewOptions *opts, const char *out_path)
 Renders and exports the active target preview buffer to a local file. More...
 

Variables

static int s_game_is_sequel = 0
 
static const PokemonMemberSpec g_member_specs [20]
 

Macro Definition Documentation

◆ ANIMA_DIR_BREAK_GIF

#define ANIMA_DIR_BREAK_GIF   "idle_break_gif"

◆ ANIMA_DIR_COMPOSED_GIF

#define ANIMA_DIR_COMPOSED_GIF   "composed_gif"

◆ ANIMA_DIR_IDLE_GIF

#define ANIMA_DIR_IDLE_GIF   "animated_idle_gif"

◆ ANIMA_DIR_JSON

#define ANIMA_DIR_JSON   "reconstruction_json"

◆ ANIMA_DIR_NDS_FILES

#define ANIMA_DIR_NDS_FILES   "nds_files"

◆ ANIMA_DIR_RAW_MEMBERS

#define ANIMA_DIR_RAW_MEMBERS   "raw_narc_members"

◆ ANIMA_DIR_SPRITESHEETS

#define ANIMA_DIR_SPRITESHEETS   "spritesheet_png"

◆ ANIMA_DIR_STATIC

#define ANIMA_DIR_STATIC   "static_png"

◆ BW_TILE_STRIDE

#define BW_TILE_STRIDE   ANIMA_BW_TILE_STRIDE

◆ COMPOSITE_MARGIN

#define COMPOSITE_MARGIN   ANIMA_COMPOSITE_MARGIN

◆ PATH_BUFFER_SIZE

#define PATH_BUFFER_SIZE   ANIMA_PATH_BUFFER_SIZE

Typedef Documentation

◆ PokemonMemberRole

◆ PokemonMemberSpec

◆ PreviewResourceSet

Enumeration Type Documentation

◆ PokemonMemberRole

Enumerator
ROLE_FRONT_STATIC 
ROLE_FRONT_STATIC_EMPTY 
ROLE_FRONT_SHEET 
ROLE_FRONT_SHEET_EMPTY 
ROLE_FRONT_CELLS 
ROLE_FRONT_ANIM 
ROLE_FRONT_MAP 
ROLE_FRONT_TIMING 
ROLE_FRONT_COORDS 
ROLE_BACK_STATIC 
ROLE_BACK_STATIC_EMPTY 
ROLE_BACK_SHEET 
ROLE_BACK_SHEET_EMPTY 
ROLE_BACK_CELLS 
ROLE_BACK_ANIM 
ROLE_BACK_MAP 
ROLE_BACK_TIMING 
ROLE_BACK_COORDS 
ROLE_PALETTE_NORMAL 
ROLE_PALETTE_SHINY 

Function Documentation

◆ AddAsset()

static int AddAsset ( AnimaPreviewAssetInfo assets,
int  max_assets,
int *  count,
AnimaPreviewAssetType  type,
int  animation_index,
int  map_index,
int  frame_count,
const char *  label,
const char *  display_name 
)
static

◆ AnimaBackend_BuildFrontNormalGifPath()

int AnimaBackend_BuildFrontNormalGifPath ( const char *  out_dir,
char *  buffer,
size_t  buffer_size 
)

Helper to generate output path for front normal battle idle GIF.

Parameters
out_dirRoot output directory.
bufferOutput path container.
buffer_sizeSize of destination path buffer.
Returns
0 on success; negative on buffer overflow.

◆ AnimaBackend_BuildFrontNormalIdleBreakGifPath()

int AnimaBackend_BuildFrontNormalIdleBreakGifPath ( const char *  out_dir,
char *  buffer,
size_t  buffer_size 
)

Helper to generate output path for front normal idle break battle GIF.

Parameters
out_dirRoot output directory.
bufferOutput path container.
buffer_sizeSize of destination path buffer.
Returns
0 on success; negative on buffer overflow.

◆ AnimaBackend_BuildFrontNormalStaticPath()

int AnimaBackend_BuildFrontNormalStaticPath ( const char *  out_dir,
char *  buffer,
size_t  buffer_size 
)

Helper to generate output path for static normal front static preview PNG.

Parameters
out_dirRoot output directory.
bufferOutput path container.
buffer_sizeSize of destination path buffer.
Returns
0 on success; negative on buffer overflow.

◆ AnimaBackend_ExportCurrentAsset()

int AnimaBackend_ExportCurrentAsset ( const char *  rom_path,
int  species,
int  preview_mode,
const AnimaPreviewOptions opts,
const char *  out_path 
)

Renders and exports the active target preview buffer to a local file.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
preview_modeSelected preview type matching AnimaPreviewAssetType.
optsRendering configurations.
out_pathPath to output destination file (PNG or GIF).
Returns
0 on success; negative on write or export failure.

◆ AnimaBackend_ExtractPokemon()

int AnimaBackend_ExtractPokemon ( const char *  rom_path,
int  species,
const char *  out_dir,
const AnimaExtractOptions options 
)

Performs a full asset extraction pipeline for a specific Pokemon species.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID of the Pokemon (1 to 649).
out_dirRoot directory where asset files will be exported.
optionsExtraction parameters selecting formats and blocks.
Returns
0 on success; negative values indicate internal parsing/write failures.

◆ AnimaBackend_GetFormBlockIndex()

static int AnimaBackend_GetFormBlockIndex ( int  species,
int  form_index 
)
static

◆ AnimaBackend_HasFemaleSprite()

int AnimaBackend_HasFemaleSprite ( const char *  rom_path,
int  species 
)

Verifies whether the specified species contains dedicated gender variant graphics.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID of the Pokemon.
Returns
1 if female-specific member sprites exist; 0 otherwise.

◆ AnimaBackend_ListPreviewAssets()

int AnimaBackend_ListPreviewAssets ( const char *  rom_path,
int  species,
const AnimaPreviewOptions opts,
AnimaPreviewAssetInfo out_assets,
int  max_assets,
int *  out_count 
)

Scans active Nitro headers in Pokegra member block to discover and populate all available assets.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
optsDiscovery configurations (side, gender, form, shiny context).
out_assetsArray pointer to populate with discovered asset info.
max_assetsCapacity limit of the out_assets array.
out_countOutput pointer filled with total count of discovered assets.
Returns
0 on success; negative on parsing failure.

◆ AnimaBackend_LoadComposedPreview()

int AnimaBackend_LoadComposedPreview ( const char *  rom_path,
int  species,
int  idle_repetitions,
AnimaIdlePreview out_preview 
)

High-level loader to build unified composed idle-to-break animation loop.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
idle_repetitionsPre-calculated or target number of idle iterations before break.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadComposedPreviewExt()

int AnimaBackend_LoadComposedPreviewExt ( const char *  rom_path,
int  species,
int  idle_repetitions,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Extended composed idle-to-break preview builder supporting complete variant selections.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
idle_repetitionsTarget number of idle iterations before break.
optsRendering configurations.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadIdleBreakPreview()

int AnimaBackend_LoadIdleBreakPreview ( const char *  rom_path,
int  species,
AnimaIdlePreview out_preview 
)

High-level loader to build the idle break variant preview buffer.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadIdleBreakPreviewExt()

int AnimaBackend_LoadIdleBreakPreviewExt ( const char *  rom_path,
int  species,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Extended idle break preview builder supporting shiny and perspective parameters.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
optsRendering configurations.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadIdlePreview()

int AnimaBackend_LoadIdlePreview ( const char *  rom_path,
int  species,
AnimaIdlePreview out_preview 
)

High-level loader to construct a basic idle preview (Base front normal).

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
out_previewOutput container to hold RGBA buffer.
Returns
0 on success; negative on parsing/decompress errors.

◆ AnimaBackend_LoadIdlePreviewExt()

int AnimaBackend_LoadIdlePreviewExt ( const char *  rom_path,
int  species,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Extended loader for basic idle previews targeting custom shiny, perspective, or form variables.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
optsRendering configurations.
out_previewOutput container to hold RGBA buffer.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadNmarAnimationPreviewExt()

int AnimaBackend_LoadNmarAnimationPreviewExt ( const char *  rom_path,
int  species,
int  animation_index,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Builds custom NMAR-selected animation preview from direct timeline records.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
animation_indexDirect NMAR animation timeline sequence index.
optsRendering configurations.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadNmcrMapPreviewExt()

int AnimaBackend_LoadNmcrMapPreviewExt ( const char *  rom_path,
int  species,
int  map_index,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Builds direct static NMCR-selected composite layout preview frame.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
map_indexDirect NMCR map record index.
optsRendering configurations.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadSpritesheetPreview()

int AnimaBackend_LoadSpritesheetPreview ( const char *  rom_path,
int  species,
AnimaIdlePreview out_preview 
)

High-level loader to build the spritesheet PNG preview buffer (Base front normal).

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaBackend_LoadSpritesheetPreviewExt()

int AnimaBackend_LoadSpritesheetPreviewExt ( const char *  rom_path,
int  species,
const AnimaPreviewOptions opts,
AnimaIdlePreview out_preview 
)

Extended spritesheet preview builder with complete variant option mappings.

Parameters
rom_pathPath to the Pokemon Black/White .nds ROM.
speciesNational Dex ID.
optsRendering configurations.
out_previewOutput container.
Returns
0 on success; negative on failure.

◆ AnimaExtractOptions_Init()

void AnimaExtractOptions_Init ( AnimaExtractOptions options)

Initialises default options for extraction.

Parameters
optionsPointer to options struct to populate.

◆ AnimaIdlePreview_Free()

void AnimaIdlePreview_Free ( AnimaIdlePreview preview)

Deallocates memory within an AnimaIdlePreview container.

Parameters
previewPointer to preview struct to clean.

◆ ComposerTransformFromNmarFrame()

static void ComposerTransformFromNmarFrame ( const NmarFrame frame,
ComposerTransform out_transform 
)
static

◆ CopyIndexedFramesToPreview()

static int CopyIndexedFramesToPreview ( const u8 indices,
int  frame_count,
int  width,
int  height,
const NclrPalette palette,
int  delay_cs,
AnimaIdlePreview out_preview 
)
static

◆ ExtractDecodedMember()

static int ExtractDecodedMember ( const NarcArchive narc,
int  member_id,
const PokemonMemberSpec spec,
u8 **  out_data,
size_t *  out_size 
)
static

◆ ExtractDecodedPokemonRole()

static int ExtractDecodedPokemonRole ( const NarcArchive narc,
int  species,
PokemonMemberRole  role,
u8 **  out_data,
size_t *  out_size 
)
static

◆ ExtractDecodedPokemonRoleExt()

static int ExtractDecodedPokemonRoleExt ( const NarcArchive narc,
int  species,
PokemonMemberRole  role,
const AnimaPreviewOptions opts,
u8 **  out_data,
size_t *  out_size 
)
static

◆ FillAssetText()

static void FillAssetText ( AnimaPreviewAssetInfo asset,
AnimaPreviewAssetType  type,
int  animation_index,
int  map_index,
int  frame_count,
const char *  label,
const char *  display_name 
)
static

◆ FindBreakNmarAnimationIndex()

static int FindBreakNmarAnimationIndex ( const NmarFile nmar,
int  idle_map,
int  break_map,
const NmcrFile nmcr,
const NanrFile nanr,
const NcerFile ncer 
)
static

◆ FindIdleNmarAnimationIndex()

static int FindIdleNmarAnimationIndex ( const NmarFile nmar)
static

◆ GenerateAssembledStaticAndLeaves()

static int GenerateAssembledStaticAndLeaves ( const char *  out_dir,
const GifExportOptions gif_options,
int  export_idle_break_gifs,
int  export_composed_gifs 
)
static

◆ GeneratePokemonCellPreviews()

static void GeneratePokemonCellPreviews ( int  species,
const char *  out_dir 
)
static

◆ GeneratePokemonTilePreviews()

static void GeneratePokemonTilePreviews ( int  species,
const char *  out_dir 
)
static

◆ InitPokegraFromRom()

static int InitPokegraFromRom ( const char *  rom_path,
u8 **  out_rom,
size_t *  out_rom_size,
NarcArchive out_pokegra 
)
static

◆ IsStrongBreakLabel()

static int IsStrongBreakLabel ( const char *  label)
static

◆ NmarAnimationContainsMapOtherThan()

static int NmarAnimationContainsMapOtherThan ( const NmarFile nmar,
int  animation_index,
int  map_index 
)
static

◆ NmarAnimationFirstMap()

static int NmarAnimationFirstMap ( const NmarFile nmar,
int  animation_index 
)
static

◆ NmarAnimationFrameCountForPreview()

static int NmarAnimationFrameCountForPreview ( const NmarFile nmar,
int  animation_index,
int  delay_cs 
)
static

◆ NmarAnimationIsUsable()

static int NmarAnimationIsUsable ( const NmarFile nmar,
const NmcrFile nmcr,
const NanrFile nanr,
const NcerFile ncer,
int  animation_index 
)
static

◆ NmarAnimationReferencesMap()

static int NmarAnimationReferencesMap ( const NmarFile nmar,
int  map_index 
)
static

◆ NmcrMapIsUsable()

static int NmcrMapIsUsable ( const NmcrFile nmcr,
const NanrFile nanr,
const NcerFile ncer,
int  map_index 
)
static

◆ OptionsRequestOnlyDsFiles()

static int OptionsRequestOnlyDsFiles ( const AnimaExtractOptions options)
static

◆ PreviewResources_Free()

static void PreviewResources_Free ( PreviewResourceSet res)
static

◆ PreviewResources_Load()

static int PreviewResources_Load ( const char *  rom_path,
int  species,
const AnimaPreviewOptions opts,
PreviewResourceSet res 
)
static

◆ PrintFirstFourBytes()

static void PrintFirstFourBytes ( const u8 data,
size_t  size 
)
static

◆ RemoveChildDirectory()

static void RemoveChildDirectory ( const char *  out_dir,
const char *  child 
)
static

◆ RenderComposedAnimationSmart()

static int RenderComposedAnimationSmart ( const NcerFile ncer,
const NanrFile nanr,
const NmcrFile nmcr,
const NmarFile nmar,
int  idle_map,
int  break_map,
int  preferred_break_animation_index,
const NcgrImage ncgr,
const NclrPalette palette,
int  idle_repetitions,
int  tile_stride,
int  margin,
u8 **  out_frames,
int *  out_frame_count,
int *  out_width,
int *  out_height,
const CoordFile coords,
int  delay_cs 
)
static

◆ RenderNmarAnimationPreviewFromResources()

static int RenderNmarAnimationPreviewFromResources ( const PreviewResourceSet res,
int  animation_index,
AnimaIdlePreview out_preview 
)
static

◆ RenderNmcrMapPreviewFromResources()

static int RenderNmcrMapPreviewFromResources ( const PreviewResourceSet res,
int  map_index,
AnimaIdlePreview out_preview 
)
static

◆ ResolveBreakMapValidated()

static int ResolveBreakMapValidated ( const NmarFile nmar,
int  idle_map,
const NmcrFile nmcr,
const NanrFile nanr,
const NcerFile ncer 
)
static

◆ ResolveIdleMapIndex()

static int ResolveIdleMapIndex ( const NmcrFile nmcr,
const NanrFile nanr,
const NcerFile ncer,
const NmarFile nmar 
)
static

◆ ResolveMemberRole()

static PokemonMemberRole ResolveMemberRole ( PokemonMemberRole  role,
const AnimaPreviewOptions opts 
)
static

◆ ResolvePreviewGifDelayCs()

static int ResolvePreviewGifDelayCs ( const AnimaPreviewOptions opts)
static

◆ WritePokemonBlockMembers()

static int WritePokemonBlockMembers ( const NarcArchive narc,
int  species,
int  block_index,
const char *  out_dir 
)
static

◆ WritePreviewGifFromPalette()

static int WritePreviewGifFromPalette ( const char *  out_path,
const AnimaIdlePreview preview,
const NclrPalette palette 
)
static

Variable Documentation

◆ g_member_specs

const PokemonMemberSpec g_member_specs[20]
static
Initial value:
= {
{ ROLE_FRONT_STATIC, "NCGR_STATIC", "front_static", "ncgr", 0 },
{ ROLE_FRONT_STATIC_EMPTY,"EMPTY", "front_static_empty", "bin", 0 },
{ ROLE_FRONT_SHEET, "NCGR_SHEET", "front_sheet", "ncgr", 0 },
{ ROLE_FRONT_SHEET_EMPTY, "EMPTY", "front_sheet_empty", "bin", 0 },
{ ROLE_FRONT_CELLS, "NCER_CELLS", "front_cells", "ncer", 0 },
{ ROLE_FRONT_ANIM, "NANR_ANIM", "front_anim", "nanr", 0 },
{ ROLE_FRONT_MAP, "NMCR_MAP", "front_map", "nmcr", 0 },
{ ROLE_FRONT_TIMING, "NMAR_TIMING", "front_timing", "nmar", 0 },
{ ROLE_FRONT_COORDS, "COORDS", "front_coords", "bin", 1 },
{ ROLE_BACK_STATIC, "NCGR_STATIC", "back_static", "ncgr", 0 },
{ ROLE_BACK_STATIC_EMPTY, "EMPTY", "back_static_empty", "bin", 0 },
{ ROLE_BACK_SHEET, "NCGR_SHEET", "back_sheet", "ncgr", 0 },
{ ROLE_BACK_SHEET_EMPTY, "EMPTY", "back_sheet_empty", "bin", 0 },
{ ROLE_BACK_CELLS, "NCER_CELLS", "back_cells", "ncer", 0 },
{ ROLE_BACK_ANIM, "NANR_ANIM", "back_anim", "nanr", 0 },
{ ROLE_BACK_MAP, "NMCR_MAP", "back_map", "nmcr", 0 },
{ ROLE_BACK_TIMING, "NMAR_TIMING", "back_timing", "nmar", 0 },
{ ROLE_BACK_COORDS, "COORDS", "back_coords", "bin", 1 },
{ ROLE_PALETTE_NORMAL, "NCLR_PALETTE", "palette_normal", "nclr", 0 },
{ ROLE_PALETTE_SHINY, "NCLR_PALETTE", "palette_shiny", "nclr", 0 }
}
@ ROLE_BACK_CELLS
Definition: anima_backend.c:54
@ ROLE_FRONT_SHEET
Definition: anima_backend.c:43
@ ROLE_PALETTE_NORMAL
Definition: anima_backend.c:59
@ ROLE_FRONT_STATIC_EMPTY
Definition: anima_backend.c:42
@ ROLE_BACK_ANIM
Definition: anima_backend.c:55
@ ROLE_FRONT_TIMING
Definition: anima_backend.c:48
@ ROLE_FRONT_ANIM
Definition: anima_backend.c:46
@ ROLE_FRONT_CELLS
Definition: anima_backend.c:45
@ ROLE_FRONT_COORDS
Definition: anima_backend.c:49
@ ROLE_FRONT_SHEET_EMPTY
Definition: anima_backend.c:44
@ ROLE_BACK_STATIC_EMPTY
Definition: anima_backend.c:51
@ ROLE_PALETTE_SHINY
Definition: anima_backend.c:60
@ ROLE_FRONT_MAP
Definition: anima_backend.c:47
@ ROLE_BACK_SHEET_EMPTY
Definition: anima_backend.c:53
@ ROLE_BACK_STATIC
Definition: anima_backend.c:50
@ ROLE_BACK_COORDS
Definition: anima_backend.c:58
@ ROLE_BACK_MAP
Definition: anima_backend.c:56
@ ROLE_BACK_SHEET
Definition: anima_backend.c:52
@ ROLE_BACK_TIMING
Definition: anima_backend.c:57
@ ROLE_FRONT_STATIC
Definition: anima_backend.c:41

◆ s_game_is_sequel

int s_game_is_sequel = 0
static