Skip to main content

Crate hypercutter

Crate hypercutter 

Source
Expand description

Extract tilesets, palettes, sprites, and field effects from GBA Pokemon ROMs (Emerald, FireRed, LeafGreen, Ruby, Sapphire).

§Quickstart

use hypercutter::{Extractor, Rom, SymbolTable};

let rom = Rom::open("pokeemerald.gba")?;
let symbols = SymbolTable::resolve_for_rom(&rom)?;
let extractor = Extractor::new(&rom, &symbols);
let metatiles = extractor.metatiles()?;

Re-exports§

pub use cli::Cli;Non-WebAssembly

Modules§

cliNon-WebAssembly
CLI implementation: argument parsing, symbol lookup, output writing.
sprite_packNon-WebAssembly
Sprite and field effect extraction.

Structs§

ExtractOptions
Configuration for extraction.
Extractor
High-level extraction facade.
Footprint
A 16×16 1bpp footprint image (32 bytes: 4 GBA tiles of 1bpp × 8 bytes each).
FormSprite
An alternate-form sprite (e.g. Unown B, Deoxys Attack).
MapLayout
Packed on-disk representation of a GBA MapLayout.
Metatile
A metatile: 8 layers (4 bottom + 4 top).
MetatileData
Decoded metatile bank.
MetatileEntry
One metatile entry: a primary tileset plus an optional secondary.
MetatileLayer
Decoded metatile layer.
MetatileLayerBits
Packed 16-bit metatile layer entry.
Metatiles
All metatiles extracted from a ROM, indexed by name.
MonCoords
Decoded mon coords.
MonCoordsOnDisk
On-disk MonCoords struct (4 bytes, 2 padding).
Palette
One palette of 16 RGBA colors.
PaletteData
A bank of up to 16 palettes, decoded from a contiguous BGR555 block.
Rgba
An RGBA color with 8 bits per channel.
RgbaImage
A row-major RGBA image buffer.
Rom
A fully loaded GBA Pokemon ROM.
SpeciesId
Identifier for a Pokemon species.
Sprite
A full base-species sprite (front, back, normal and shiny palettes).
SpriteRenderer
Render a single Pokemon battle sprite sheet (64×64 4bpp) using a palette.
SpriteSheet
A single Pokemon battle sprite sheet (64×64 frame at 4bpp).
Symbol
One entry in a parsed symbol table.
SymbolTable
In-memory symbol table with O(1) name and address lookups.
TileData
One 8×8 tile of 4bpp graphics, stored as 32 raw bytes.
Tileset
A fully decoded tileset, ready for rendering.
TilesetHeader
Packed on-disk representation of a GBA Tileset.
TilesetRenderer
Tileset renderer that composites metatiles into a single RGBA image.

Enums§

Error
Errors that can occur when extracting data from a Pokemon ROM.
Game
One of the five supported GBA Pokemon games.
Scope
Scope of a symbol.

Constants§

DEFAULT_ROM_BASE_ADDRESS
Default GBA ROM base address.
GAME_CODE_LENGTH
Length of the game code in bytes.
GAME_CODE_OFFSET
Byte offset of the 4-byte game code within the ROM header.
MAP_LAYOUT_SIZE
Size of the GBA MapLayout struct in bytes.
METATILE_LAYER_COUNT
Number of tiles in a metatile (2×2 = 4 bottom + 4 top).
MON_PIC_HEIGHT_TILES
Height of a Pokemon battle sprite frame in tiles.
MON_PIC_PIXELS
Pixels per side of a 4bpp Pokemon frame.
MON_PIC_WIDTH_TILES
Width of a Pokemon battle sprite frame in tiles.
PALETTE_COLORS
Number of colors in a single palette.
PALETTE_COUNT
Number of palettes in a tileset palette bank.
POKEMON_PALETTE_BYTES
Bytes in a single 16-color Pokemon palette.
POKEMON_PIC_BYTES
Bytes in a fully-populated 64×64 4bpp sprite frame (used by the form-packing heuristic).
TILESET_SIZE
Size of the GBA Tileset struct in bytes.
TILE_SIZE
Size of a single 4bpp tile in bytes.

Functions§

bgr555_to_rgba
Convert a 16-bit BGR555 color to 8-bit RGBA with full opacity.
decode_tile_4bpp
Decode 32 bytes of 4bpp tile data into 64 palette indices (row-major, 8×8).
decompress_lzss
Decompress an LZSS-compressed buffer.
is_lzss
Returns true if the buffer starts with a valid LZSS magic byte (0x10 or 0x11).
pokemon_char
Map a single Pokemon GBA character byte to its ASCII rendering.
read_ptr_table
Read a u32 pointer table (array of ROM addresses) starting at address.
read_slice_at
Read a contiguous slice of T from a ROM starting at address.
read_struct_at
Read a BinRead-derived struct from a ROM at a given address.
read_u32_at
Read a single u32 little-endian from a ROM address.
render_footprint
Render a Pokemon footprint (16×16 1bpp) into an RGBA image.
renderer_for_sprite
Helper for converting a Sprite to a SpriteRenderer.
sprite_palette
Helper for picking a palette out of a PaletteData for a sprite.

Type Aliases§

Result
Result alias for the library.