yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze_rom.h File Reference

ROM loading and ROM-backed helpers for the YAZE public API. More...

#include <stdint.h>
#include "yaze_errors.h"
#include "yaze_graphics.h"
#include "zelda.h"
Include dependency graph for yaze_rom.h:

Go to the source code of this file.

Functions

zelda3_romyaze_load_rom_file (const char *filename)
 Load a ROM file.
 
yaze_status yaze_validate_rom (const zelda3_rom *rom)
 Validate ROM integrity.
 
yaze_status yaze_get_rom_info (const zelda3_rom *rom, zelda3_version *version, uint64_t *size)
 Get ROM information.
 
snes_paletteyaze_load_palette_from_rom (const zelda3_rom *rom, uint16_t palette_id)
 Load palette from ROM.
 
snes_tile8 yaze_load_tile_from_rom (const zelda3_rom *rom, uint32_t tile_id, uint8_t bpp)
 Load tile data from ROM.
 
snes_color yaze_get_color_from_paletteset (const zelda3_rom *rom, int palette_set, int palette, int color)
 Get a color from a palette set.
 

Detailed Description

ROM loading and ROM-backed helpers for the YAZE public API.

Definition in file yaze_rom.h.

Function Documentation

◆ yaze_load_rom_file()

zelda3_rom * yaze_load_rom_file ( const char * filename)

Load a ROM file.

Loads a Zelda 3 ROM file and validates its format.

Parameters
filenamePath to ROM file (.sfc, .smc, etc.)
Returns
Pointer to ROM structure, or NULL on error
Note
Caller must call yaze_unload_rom() to free memory

◆ yaze_validate_rom()

yaze_status yaze_validate_rom ( const zelda3_rom * rom)

Validate ROM integrity.

Checks if the ROM data is valid and uncorrupted.

Parameters
romROM to validate
Returns
YAZE_OK if valid, error code if corrupted

◆ yaze_get_rom_info()

yaze_status yaze_get_rom_info ( const zelda3_rom * rom,
zelda3_version * version,
uint64_t * size )

Get ROM information.

Parameters
romROM to query
versionPointer to store detected ROM version
sizePointer to store ROM size in bytes
Returns
YAZE_OK on success, error code on failure

◆ yaze_load_palette_from_rom()

snes_palette * yaze_load_palette_from_rom ( const zelda3_rom * rom,
uint16_t palette_id )

Load palette from ROM.

Parameters
romROM to load palette from
palette_idID of palette to load
Returns
Loaded palette, or NULL on error

◆ yaze_load_tile_from_rom()

snes_tile8 yaze_load_tile_from_rom ( const zelda3_rom * rom,
uint32_t tile_id,
uint8_t bpp )

Load tile data from ROM.

Parameters
romROM to load from
tile_idID of tile to load
bppBits per pixel (1, 2, 4, 8)
Returns
Loaded tile data, or empty tile on error

◆ yaze_get_color_from_paletteset()

snes_color yaze_get_color_from_paletteset ( const zelda3_rom * rom,
int palette_set,
int palette,
int color )

Get a color from a palette set.

Retrieves a specific color from a palette set in the ROM.

Parameters
romThe ROM to get the color from
palette_setThe palette set index (0-255)
paletteThe palette index within the set (0-15)
colorThe color index within the palette (0-15)
Returns
The color from the palette set

Definition at line 191 of file yaze.cc.

References snes_color::blue, yaze::gfx::PaletteGroupMap::get_group(), snes_color::green, yaze::gfx::kPaletteGroupAddressesKeys, yaze::gfx::PaletteGroup::palette(), yaze::zelda3::GameData::palette_groups, and snes_color::red.

Here is the call graph for this function: