AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
anima_backend.h
Go to the documentation of this file.
1 
10 #ifndef ANIMA_BACKEND_H
11 #define ANIMA_BACKEND_H
12 
13 #include <stddef.h>
14 #include "gif_pipeline.h"
15 
16 #define ANIMA_PATH_BUFFER_SIZE 4096
17 #define ANIMA_BW_TILE_STRIDE 32
18 #define ANIMA_COMPOSITE_MARGIN 8
19 #define ANIMA_POKEGRA_PATH "/a/0/0/4"
20 #define ANIMA_MAX_PREVIEW_ASSETS 96
21 #define ANIMA_PREVIEW_ASSET_NAME_SIZE 96
26 typedef enum AnimaPreviewAssetType {
35 
39 typedef struct AnimaExtractOptions {
46  int form_index;
49 
53 typedef struct AnimaIdlePreview {
54  int width;
55  int height;
57  int delay_cs;
58  unsigned char *rgba;
60 
64 typedef struct AnimaPreviewOptions {
65  int gender;
66  int is_shiny;
67  int form_index;
68  int is_back;
70  int map_index;
73 
77 typedef struct AnimaPreviewAssetInfo {
80  int map_index;
82  char label[32];
85 
91 
101  const char *rom_path,
102  int species,
103  const char *out_dir,
104  const AnimaExtractOptions *options
105 );
106 
115  const char *out_dir,
116  char *buffer,
117  size_t buffer_size
118 );
119 
128  const char *out_dir,
129  char *buffer,
130  size_t buffer_size
131 );
132 
141  const char *out_dir,
142  char *buffer,
143  size_t buffer_size
144 );
145 
152 int AnimaBackend_HasFemaleSprite(const char *rom_path, int species);
153 
162  const char *rom_path,
163  int species,
164  AnimaIdlePreview *out_preview
165 );
166 
176  const char *rom_path,
177  int species,
178  const AnimaPreviewOptions *opts,
179  AnimaIdlePreview *out_preview
180 );
181 
187 
196  const char *rom_path,
197  int species,
198  AnimaIdlePreview *out_preview
199 );
200 
210  const char *rom_path,
211  int species,
212  const AnimaPreviewOptions *opts,
213  AnimaIdlePreview *out_preview
214 );
215 
224  const char *rom_path,
225  int species,
226  AnimaIdlePreview *out_preview
227 );
228 
238  const char *rom_path,
239  int species,
240  const AnimaPreviewOptions *opts,
241  AnimaIdlePreview *out_preview
242 );
243 
253  const char *rom_path,
254  int species,
255  int idle_repetitions,
256  AnimaIdlePreview *out_preview
257 );
258 
269  const char *rom_path,
270  int species,
271  int idle_repetitions,
272  const AnimaPreviewOptions *opts,
273  AnimaIdlePreview *out_preview
274 );
275 
286  const char *rom_path,
287  int species,
288  int animation_index,
289  const AnimaPreviewOptions *opts,
290  AnimaIdlePreview *out_preview
291 );
292 
303  const char *rom_path,
304  int species,
305  int map_index,
306  const AnimaPreviewOptions *opts,
307  AnimaIdlePreview *out_preview
308 );
309 
321  const char *rom_path,
322  int species,
323  const AnimaPreviewOptions *opts,
324  AnimaPreviewAssetInfo *out_assets,
325  int max_assets,
326  int *out_count
327 );
328 
339  const char *rom_path,
340  int species,
341  int preview_mode,
342  const AnimaPreviewOptions *opts,
343  const char *out_path
344 );
345 
346 #endif
void AnimaExtractOptions_Init(AnimaExtractOptions *options)
Initialises default options for extraction.
Definition: anima_backend.c:1335
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.
Definition: anima_backend.c:3154
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.
Definition: anima_backend.c:3129
int AnimaBackend_BuildFrontNormalGifPath(const char *out_dir, char *buffer, size_t buffer_size)
Helper to generate output path for front normal battle idle GIF.
Definition: anima_backend.c:1352
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).
Definition: anima_backend.c:2334
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.
Definition: anima_backend.c:3345
int AnimaBackend_LoadIdleBreakPreview(const char *rom_path, int species, AnimaIdlePreview *out_preview)
High-level loader to build the idle break variant preview buffer.
Definition: anima_backend.c:2423
int AnimaBackend_HasFemaleSprite(const char *rom_path, int species)
Verifies whether the specified species contains dedicated gender variant graphics.
Definition: anima_backend.c:3498
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.
Definition: anima_backend.c:3523
AnimaPreviewAssetType
Categorization of discoverable/renderable assets for a species.
Definition: anima_backend.h:26
@ ANIMA_PREVIEW_ASSET_NMAR_ANIMATION_GIF
Definition: anima_backend.h:32
@ ANIMA_PREVIEW_ASSET_STATIC_IDLE_PNG
Definition: anima_backend.h:29
@ ANIMA_PREVIEW_ASSET_SPRITESHEET_PNG
Definition: anima_backend.h:28
@ ANIMA_PREVIEW_ASSET_IDLE_BREAK_GIF
Definition: anima_backend.h:30
@ ANIMA_PREVIEW_ASSET_IDLE_GIF
Definition: anima_backend.h:27
@ ANIMA_PREVIEW_ASSET_COMPOSED_GIF
Definition: anima_backend.h:31
@ ANIMA_PREVIEW_ASSET_NMCR_MAP_GIF
Definition: anima_backend.h:33
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.
Definition: anima_backend.c:1372
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.
Definition: anima_backend.c:4064
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.
Definition: anima_backend.c:3835
int AnimaBackend_LoadSpritesheetPreviewExt(const char *rom_path, int species, const AnimaPreviewOptions *opts, AnimaIdlePreview *out_preview)
Extended spritesheet preview builder with complete variant option mappings.
Definition: anima_backend.c:3745
#define ANIMA_PREVIEW_ASSET_NAME_SIZE
Definition: anima_backend.h:21
struct AnimaPreviewOptions AnimaPreviewOptions
Configuration context specifying target variant rendering parameters.
struct AnimaIdlePreview AnimaIdlePreview
Raw RGBA frame buffer container used by both CLI rendering and GUI preview components.
struct AnimaExtractOptions AnimaExtractOptions
Configuration parameters for a batch extraction pipeline run.
struct AnimaPreviewAssetInfo AnimaPreviewAssetInfo
Metadata record detailing a discovered asset available for preview and export.
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.
Definition: anima_backend.c:1392
int AnimaBackend_LoadIdlePreview(const char *rom_path, int species, AnimaIdlePreview *out_preview)
High-level loader to construct a basic idle preview (Base front normal).
Definition: anima_backend.c:2113
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.
Definition: anima_backend.c:3229
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.
Definition: anima_backend.c:4256
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.
Definition: anima_backend.c:2643
void AnimaIdlePreview_Free(AnimaIdlePreview *preview)
Deallocates memory within an AnimaIdlePreview container.
Definition: anima_backend.c:2817
High-level animation assembly and LZW GIF compilation pipeline.
Configuration parameters for a batch extraction pipeline run.
Definition: anima_backend.h:39
int export_json
Definition: anima_backend.h:45
int export_idle_break_gifs
Definition: anima_backend.h:43
int form_index
Definition: anima_backend.h:46
int export_gifs
Definition: anima_backend.h:42
int export_composed_gifs
Definition: anima_backend.h:44
GifExportOptions gif_options
Definition: anima_backend.h:47
int export_static_previews
Definition: anima_backend.h:41
int export_spritesheets
Definition: anima_backend.h:40
Raw RGBA frame buffer container used by both CLI rendering and GUI preview components.
Definition: anima_backend.h:53
int height
Definition: anima_backend.h:55
int width
Definition: anima_backend.h:54
int frame_count
Definition: anima_backend.h:56
unsigned char * rgba
Definition: anima_backend.h:58
int delay_cs
Definition: anima_backend.h:57
Metadata record detailing a discovered asset available for preview and export.
Definition: anima_backend.h:77
int frame_count
Definition: anima_backend.h:81
int map_index
Definition: anima_backend.h:80
AnimaPreviewAssetType type
Definition: anima_backend.h:78
char display_name[ANIMA_PREVIEW_ASSET_NAME_SIZE]
Definition: anima_backend.h:83
int animation_index
Definition: anima_backend.h:79
char label[32]
Definition: anima_backend.h:82
Configuration context specifying target variant rendering parameters.
Definition: anima_backend.h:64
int form_index
Definition: anima_backend.h:67
int gif_delay_cs
Definition: anima_backend.h:71
int is_shiny
Definition: anima_backend.h:66
int map_index
Definition: anima_backend.h:70
int is_back
Definition: anima_backend.h:68
int animation_index
Definition: anima_backend.h:69
int gender
Definition: anima_backend.h:65
Detailed parameters configuring animation exporting behavior.
Definition: gif_pipeline.h:49