|
AnimaEngine
1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
|
Implementations of GUI application state handlers. More...
#include "gui_state.h"#include "file_util.h"#include "gif_writer.h"#include "nds_header.h"#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <string.h>Functions | |
| void | GuiState_Init (GuiState *state) |
| Initializes default options inside a GuiState structure. More... | |
| int | GuiState_LoadAndValidateRom (GuiState *state, const char *path) |
| Validates NDS ROM header and initializes internal directory mappings. More... | |
| void | GuiState_SetStatus (GuiState *state, const char *text) |
| Sets statusbar notification message. More... | |
| void | GuiState_CopyText (char *dst, size_t dst_size, const char *src) |
| Helper utility to safely copy a string with bounding limit constraints. More... | |
| const char * | GuiState_BaseName (const char *path) |
| Extracts file basename from full absolute or relative path. More... | |
| void | GuiState_SanitizePath (const char *name, char *out, size_t out_size) |
| Sanitizes folder name by stripping out illegal character blocks. More... | |
| static void | GuiState_SanitizeDisplayPath (const char *name, char *out, size_t out_size) |
| Sanitizes species name for building camel-cased display output path strings. More... | |
| void | GuiState_BuildOutputDir (const PokemonCatalogEntry *entry, char *buf, size_t sz) |
| Builds directory path where current species assets will be written. More... | |
| static int | StrContainsInsensitive (const char *hay, const char *needle) |
| Checks if a string contains another string case-insensitively. More... | |
| int | GuiState_EntryMatchesQuery (const PokemonCatalogEntry *entry, const char *query) |
| Checks if a Pokemon species matches the search filtering text query. More... | |
| const PokemonCatalogEntry * | GuiState_SelectedEntry (int dex_id) |
| Retrieves the species catalog entry matching index. More... | |
| int | GuiState_GetFormCount (const GuiState *state, int dex_id) |
| Retrieves form count for a species. More... | |
| const char * | GuiState_GetFormName (const GuiState *state, int dex_id, int form_idx) |
| Retrieves user-friendly label name of alternate form index. More... | |
| static void | GuiState_BuildPreviewOptions (GuiState *state, AnimaPreviewOptions *opts) |
| Constructs option query filters matching current UI selected states. More... | |
| static const AnimaPreviewAssetInfo * | GuiState_CurrentAsset (const GuiState *state) |
| Gets the currently selected preview asset info descriptor. More... | |
| int | GuiState_RefreshAssets (GuiState *state, const PokemonCatalogEntry *entry) |
| Scans ROM files to discover all asset variants for selected species. More... | |
| void | GuiState_UpdatePreview (GuiPreview *p) |
| Advances active viewport frame index based on real-world elapsed frame delta time. More... | |
| int | GuiState_GifDelayCs (const GuiState *state) |
| Retrieves the current custom GIF frame delay. More... | |
| void | GuiState_SetGifDelayCs (GuiState *state, int delay_cs) |
| Sets the custom GIF frame delay. More... | |
| void | GuiState_UnloadPreview (GuiPreview *p) |
| Deallocates texture cache and color frames stored inside preview struct. More... | |
| static void | GuiState_SetPreviewContentBounds (GuiPreview *p) |
| Computes a tight bounding box encapsulating all non-transparent pixels in the preview animation frames. More... | |
| static int | LoadPreviewFromBackend (GuiState *state, const PokemonCatalogEntry *entry) |
| Loads the default idle animation preview frames from the backend. More... | |
| static int | LoadPngPreview (GuiState *state, const PokemonCatalogEntry *entry, int backend_func(GuiState *, const PokemonCatalogEntry *, AnimaIdlePreview *)) |
| Helper for wrapping static single-frame PNG preview loaders. More... | |
| static int | LoadAnimatedPreview (GuiState *state, const PokemonCatalogEntry *entry, int backend_func(GuiState *, const PokemonCatalogEntry *, AnimaIdlePreview *)) |
| Helper for wrapping multi-frame animated preview loaders. More... | |
| static int | LoadSpritesheet (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading spritesheet asset frames. More... | |
| static int | LoadStaticIdle (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading static idle preview frame. More... | |
| static int | LoadBreak (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading idle break preview frame loop. More... | |
| static int | LoadComposed (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading composed animation frame loop. More... | |
| static int | LoadNmarAnimation (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading NMAR timeline-driven animation. More... | |
| static int | LoadNmcrMap (GuiState *state, const PokemonCatalogEntry *entry, AnimaIdlePreview *out) |
| Direct callback for loading NMCR layout map composition. More... | |
| int | GuiState_TryLoadPreview (GuiState *state, const PokemonCatalogEntry *entry) |
| Attempts to load the preview for a Pokemon catalog entry. More... | |
| void | GuiState_RunExport (GuiState *state, const PokemonCatalogEntry *entry, int export_spritesheets, int export_static, int export_gif, int export_idle_break, int export_composed) |
| Performs batch export run for currently selected Pokemon. More... | |
| void | GuiState_ExportDsFiles (GuiState *state, const PokemonCatalogEntry *entry) |
| Raw dumps individual compressed Nitro NARC blocks for selected species to disk. More... | |
| void | GuiState_ExportAllAssets (GuiState *state, const PokemonCatalogEntry *entry) |
| Recursively renders and writes all assets discovered for species. More... | |
| static int | GuiState_ExportLoadedPreviewGif (const GuiState *state, const char *out_path) |
| Exports currently loaded preview frame buffer directly to a custom GIF file. More... | |
| void | GuiState_ExportCurrent (GuiState *state, const PokemonCatalogEntry *entry) |
| Exports the currently active preview asset view to its default output file path. More... | |
Implementations of GUI application state handlers.
| const char* GuiState_BaseName | ( | const char * | path | ) |
Extracts file basename from full absolute or relative path.
| path | File path. |
| void GuiState_BuildOutputDir | ( | const PokemonCatalogEntry * | entry, |
| char * | buf, | ||
| size_t | sz | ||
| ) |
Builds directory path where current species assets will be written.
| entry | Pointer to Pokemon catalog entry. |
| buf | Output path buffer. |
| sz | Size of output path buffer. |
|
static |
Constructs option query filters matching current UI selected states.
| state | GUI state context. |
| opts | Destination options. |
| void GuiState_CopyText | ( | char * | dst, |
| size_t | dst_size, | ||
| const char * | src | ||
| ) |
Helper utility to safely copy a string with bounding limit constraints.
| dst | Destination buffer. |
| dst_size | Destination capacity limit in bytes. |
| src | Source string. |
|
static |
Gets the currently selected preview asset info descriptor.
| state | GUI state. |
| int GuiState_EntryMatchesQuery | ( | const PokemonCatalogEntry * | entry, |
| const char * | query | ||
| ) |
Checks if a Pokemon species matches the search filtering text query.
| entry | Pointer to Pokemon catalog entry. |
| query | Search query text filter. |
| void GuiState_ExportAllAssets | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry | ||
| ) |
Recursively renders and writes all assets discovered for species.
| state | Global GUI state. |
| entry | Catalog entry. |
| void GuiState_ExportCurrent | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry | ||
| ) |
Exports the currently active preview asset view to its default output file path.
| state | Global GUI state. |
| entry | Catalog entry. |
| void GuiState_ExportDsFiles | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry | ||
| ) |
Raw dumps individual compressed Nitro NARC blocks for selected species to disk.
| state | Global GUI state. |
| entry | Catalog entry. |
|
static |
Exports currently loaded preview frame buffer directly to a custom GIF file.
| state | GUI state context. |
| out_path | Destination file path. |
| int GuiState_GetFormCount | ( | const GuiState * | state, |
| int | dex_id | ||
| ) |
Retrieves form count for a species.
| state | Global GUI state pointer. |
| dex_id | National Dex ID. |
| const char* GuiState_GetFormName | ( | const GuiState * | state, |
| int | dex_id, | ||
| int | form_idx | ||
| ) |
Retrieves user-friendly label name of alternate form index.
| state | Global GUI state pointer. |
| dex_id | National Dex ID. |
| form_idx | Form index. |
| int GuiState_GifDelayCs | ( | const GuiState * | state | ) |
Retrieves the current custom GIF frame delay.
| state | Global GUI state pointer. |
| void GuiState_Init | ( | GuiState * | state | ) |
Initializes default options inside a GuiState structure.
| state | Pointer to state to initialize. |
| int GuiState_LoadAndValidateRom | ( | GuiState * | state, |
| const char * | path | ||
| ) |
Validates NDS ROM header and initializes internal directory mappings.
| state | Global GUI state pointer. |
| path | Path to NDS ROM file. |
| int GuiState_RefreshAssets | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry | ||
| ) |
Scans ROM files to discover all asset variants for selected species.
| state | Global GUI state pointer. |
| entry | Pokemon catalog entry. |
| void GuiState_RunExport | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry, | ||
| int | export_spritesheets, | ||
| int | export_static, | ||
| int | export_gif, | ||
| int | export_idle_break, | ||
| int | export_composed | ||
| ) |
Performs batch export run for currently selected Pokemon.
| state | Global GUI state. |
| entry | Catalog entry. |
| export_spritesheets | 1 to generate sheets. |
| export_static | 1 to generate static first-frame. |
| export_gif | 1 to write standard GIF. |
| export_idle_break | 1 to write break GIF. |
| export_composed | 1 to write merged loop. |
|
static |
Sanitizes species name for building camel-cased display output path strings.
| name | Source string. |
| out | Output buffer. |
| out_size | Size of output buffer. |
| void GuiState_SanitizePath | ( | const char * | name, |
| char * | out, | ||
| size_t | out_size | ||
| ) |
Sanitizes folder name by stripping out illegal character blocks.
| name | Source directory folder name. |
| out | Destination buffer. |
| out_size | Size of destination buffer. |
| const PokemonCatalogEntry* GuiState_SelectedEntry | ( | int | dex_id | ) |
Retrieves the species catalog entry matching index.
| dex_id | National Dex ID (1 to 649). |
| void GuiState_SetGifDelayCs | ( | GuiState * | state, |
| int | delay_cs | ||
| ) |
Sets the custom GIF frame delay.
| state | Global GUI state pointer. |
| delay_cs | Custom delay in centiseconds. |
|
static |
Computes a tight bounding box encapsulating all non-transparent pixels in the preview animation frames.
| p | Target preview. |
| void GuiState_SetStatus | ( | GuiState * | state, |
| const char * | text | ||
| ) |
Sets statusbar notification message.
| state | Global GUI state pointer. |
| text | Format string. |
| int GuiState_TryLoadPreview | ( | GuiState * | state, |
| const PokemonCatalogEntry * | entry | ||
| ) |
Attempts to load the preview for a Pokemon catalog entry.
| state | Global GUI state pointer. |
| entry | Pokemon catalog entry. |
| void GuiState_UnloadPreview | ( | GuiPreview * | p | ) |
Deallocates texture cache and color frames stored inside preview struct.
| p | Pointer to preview struct. |
| void GuiState_UpdatePreview | ( | GuiPreview * | p | ) |
Advances active viewport frame index based on real-world elapsed frame delta time.
| p | Pointer to active preview structure to advance. |
|
static |
Helper for wrapping multi-frame animated preview loaders.
| state | GUI state context. |
| entry | Pokemon catalog entry. |
| backend_func | Specific backend load routine. |
|
static |
Direct callback for loading idle break preview frame loop.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Direct callback for loading composed animation frame loop.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Direct callback for loading NMAR timeline-driven animation.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Direct callback for loading NMCR layout map composition.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Helper for wrapping static single-frame PNG preview loaders.
| state | GUI state context. |
| entry | Pokemon catalog entry. |
| backend_func | Specific backend load routine. |
|
static |
Loads the default idle animation preview frames from the backend.
| state | GUI state context. |
| entry | Target Pokemon entry. |
|
static |
Direct callback for loading spritesheet asset frames.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Direct callback for loading static idle preview frame.
| state | GUI state. |
| entry | Pokemon entry. |
| out | Output preview structure. |
|
static |
Checks if a string contains another string case-insensitively.
| hay | String to search in. |
| needle | Substring to search for. |