yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze.h
Go to the documentation of this file.
1#ifndef YAZE_H
2#define YAZE_H
3
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include <stdbool.h>
21#include <stddef.h>
22#include <stdint.h>
23
24#include "zelda.h"
25
41#ifndef YAZE_VERSION_STRING
42/* Fallback if yaze_config.h not included - will be overridden by build */
43#define YAZE_VERSION_STRING "0.4.0"
44#define YAZE_VERSION_NUMBER 400
45#endif
46
53
75
82const char* yaze_status_to_string(yaze_status status);
83
93
101void yaze_library_shutdown(void);
102
110int yaze_app_main(int argc, char** argv);
111
118bool yaze_check_version_compatibility(const char* expected_version);
119
125const char* yaze_get_version_string(void);
126
133
146yaze_status yaze_init(yaze_editor_context* context, const char* rom_filename);
147
158
171typedef struct yaze_bitmap {
172 int width;
173 int height;
174 uint8_t bpp;
175 uint8_t* data;
177
189yaze_bitmap yaze_load_bitmap(const char* filename);
190
198void yaze_free_bitmap(yaze_bitmap* bitmap);
199
210yaze_bitmap yaze_create_bitmap(int width, int height, uint8_t bpp);
211
218typedef struct snes_color {
219 uint16_t red;
220 uint16_t green;
221 uint16_t blue;
223
232snes_color yaze_rgb_to_snes_color(uint8_t r, uint8_t g, uint8_t b);
233
242void yaze_snes_color_to_rgb(snes_color color, uint8_t* r, uint8_t* g, uint8_t* b);
243
250typedef struct snes_palette {
251 uint16_t id;
252 uint16_t size;
255
263snes_palette* yaze_create_palette(uint16_t id, uint16_t size);
264
271
279snes_palette* yaze_load_palette_from_rom(const zelda3_rom* rom, uint16_t palette_id);
280
287typedef struct snes_tile8 {
288 uint32_t id;
289 uint32_t palette_id;
290 uint8_t data[64];
292
301snes_tile8 yaze_load_tile_from_rom(const zelda3_rom* rom, uint32_t tile_id, uint8_t bpp);
302
311snes_tile8 yaze_convert_tile_bpp(const snes_tile8* tile, uint8_t from_bpp, uint8_t to_bpp);
312
320
324
325typedef struct snes_tile32 {
326 uint16_t t0;
327 uint16_t t1;
328 uint16_t t2;
329 uint16_t t3;
331
349zelda3_rom* yaze_load_rom_file(const char* filename);
350
360
369yaze_status yaze_get_rom_info(const zelda3_rom* rom, zelda3_version* version, uint64_t* size);
370
383 int palette_set, int palette,
384 int color);
385
405
412
420const zelda3_overworld_map* yaze_get_overworld_map(const zelda3_overworld* overworld, int map_index);
421
429
449
457const zelda3_dungeon_room* yaze_load_room(const zelda3_rom* rom, int room_id);
458
465void yaze_free_rooms(zelda3_dungeon_room* rooms, int room_count);
466
486yaze_status yaze_load_messages(const zelda3_rom* rom, zelda3_message** messages, int* message_count);
487
495const zelda3_message* yaze_get_message(const zelda3_rom* rom, int message_id);
496
503void yaze_free_messages(zelda3_message* messages, int message_count);
504
513typedef void (*yaze_cleanup_func)(void);
514
526typedef struct yaze_extension {
527 const char* name;
528 const char* version;
529 const char* description;
530 const char* author;
543
550 void (*cleanup)(void);
551
559 uint32_t (*get_capabilities)(void);
561
563#define YAZE_EXT_CAP_ROM_EDITING (1 << 0)
564#define YAZE_EXT_CAP_GRAPHICS (1 << 1)
565#define YAZE_EXT_CAP_AUDIO (1 << 2)
566#define YAZE_EXT_CAP_SCRIPTING (1 << 3)
567#define YAZE_EXT_CAP_IMPORT_EXPORT (1 << 4)
576
584
587#ifdef __cplusplus
588}
589#endif
590
591#endif // YAZE_H
yaze_status yaze_library_init(void)
Initialize the YAZE library.
Definition yaze.cc:19
int yaze_app_main(int argc, char **argv)
Main entry point for the YAZE application.
int yaze_get_version_number(void)
Get the current YAZE version number.
Definition yaze.cc:65
const char * yaze_get_version_string(void)
Get the current YAZE version string.
Definition yaze.cc:63
yaze_status
Status codes returned by YAZE functions.
Definition yaze.h:65
bool yaze_check_version_compatibility(const char *expected_version)
Check if the current YAZE version is compatible with the expected version.
Definition yaze.cc:67
yaze_status yaze_shutdown(yaze_editor_context *context)
Shutdown and clean up a YAZE editor context.
Definition yaze.cc:100
yaze_status yaze_init(yaze_editor_context *context, const char *rom_filename)
Initialize a YAZE editor context.
Definition yaze.cc:74
const char * yaze_status_to_string(yaze_status status)
Convert a status code to a human-readable string.
Definition yaze.cc:40
void yaze_library_shutdown(void)
Shutdown the YAZE library.
Definition yaze.cc:29
@ YAZE_OK
Definition yaze.h:66
@ YAZE_ERROR_CORRUPTION
Definition yaze.h:72
@ YAZE_ERROR_IO
Definition yaze.h:71
@ YAZE_ERROR_FILE_NOT_FOUND
Definition yaze.h:69
@ YAZE_ERROR_INVALID_ARG
Definition yaze.h:68
@ YAZE_ERROR_MEMORY
Definition yaze.h:70
@ YAZE_ERROR_NOT_INITIALIZED
Definition yaze.h:73
@ YAZE_ERROR_UNKNOWN
Definition yaze.h:67
void yaze_free_rooms(zelda3_dungeon_room *rooms, int room_count)
Free dungeon room data.
const zelda3_dungeon_room * yaze_load_room(const zelda3_rom *rom, int room_id)
Load a specific dungeon room.
zelda3_dungeon_room * yaze_load_all_rooms(const zelda3_rom *rom, int *room_count)
Load all dungeon rooms from ROM.
yaze_status yaze_unregister_extension(const char *name)
Unregister an extension.
struct yaze_extension yaze_extension
Extension interface for YAZE.
yaze_status yaze_register_extension(const yaze_extension *extension)
Register an extension with YAZE.
snes_color yaze_rgb_to_snes_color(uint8_t r, uint8_t g, uint8_t b)
Convert RGB888 color to SNES color.
Definition yaze.cc:317
snes_palette * yaze_load_palette_from_rom(const zelda3_rom *rom, uint16_t palette_id)
Load palette from ROM.
struct snes_palette snes_palette
SNES color palette.
yaze_bitmap yaze_load_bitmap(const char *filename)
Load a bitmap from file.
Definition yaze.cc:181
snes_tile8 yaze_load_tile_from_rom(const zelda3_rom *rom, uint32_t tile_id, uint8_t bpp)
Load tile data from ROM.
struct snes_tile_info snes_tile_info
struct snes_tile32 snes_tile32
struct yaze_bitmap yaze_bitmap
Bitmap data structure.
snes_palette * yaze_create_palette(uint16_t id, uint16_t size)
Create an empty palette.
struct snes_color snes_color
SNES color in 15-bit RGB format (BGR555)
snes_tile8 yaze_convert_tile_bpp(const snes_tile8 *tile, uint8_t from_bpp, uint8_t to_bpp)
Convert tile data between different bit depths.
yaze_bitmap yaze_create_bitmap(int width, int height, uint8_t bpp)
Create an empty bitmap.
Definition yaze.cc:301
struct snes_tile16 snes_tile16
struct snes_tile8 snes_tile8
8x8 SNES tile data
void yaze_free_bitmap(yaze_bitmap *bitmap)
Free bitmap data.
Definition yaze.cc:291
void yaze_free_palette(snes_palette *palette)
Free palette memory.
void yaze_snes_color_to_rgb(snes_color color, uint8_t *r, uint8_t *g, uint8_t *b)
Convert SNES color to RGB888.
Definition yaze.cc:325
void yaze_free_messages(zelda3_message *messages, int message_count)
Free message data.
yaze_status yaze_load_messages(const zelda3_rom *rom, zelda3_message **messages, int *message_count)
Load all text messages from ROM.
Definition yaze.cc:244
const zelda3_message * yaze_get_message(const zelda3_rom *rom, int message_id)
Get a specific message by ID.
zelda3_overworld * yaze_load_overworld(const zelda3_rom *rom)
Load the overworld from ROM.
Definition yaze.cc:212
int yaze_get_overworld_map_count(const zelda3_overworld *overworld)
Get total number of overworld maps.
void yaze_free_overworld(zelda3_overworld *overworld)
Free overworld data.
const zelda3_overworld_map * yaze_get_overworld_map(const zelda3_overworld *overworld, int map_index)
Get overworld map by index.
zelda3_version
Different versions of the game supported by YAZE.
Definition zelda.h:33
yaze_status yaze_validate_rom(const zelda3_rom *rom)
Validate ROM integrity.
zelda3_rom * yaze_load_rom_file(const char *filename)
Load a ROM file.
yaze_status yaze_get_rom_info(const zelda3_rom *rom, zelda3_version *version, uint64_t *size)
Get ROM information.
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.
Definition yaze.cc:190
SNES color in 15-bit RGB format (BGR555)
Definition yaze.h:218
uint16_t green
Definition yaze.h:220
uint16_t red
Definition yaze.h:219
uint16_t blue
Definition yaze.h:221
SNES color palette.
Definition yaze.h:250
uint16_t id
Definition yaze.h:251
uint16_t size
Definition yaze.h:252
snes_color * colors
Definition yaze.h:253
snes_tile_info tiles[4]
Definition yaze.h:322
uint16_t t1
Definition yaze.h:327
uint16_t t0
Definition yaze.h:326
uint16_t t2
Definition yaze.h:328
uint16_t t3
Definition yaze.h:329
8x8 SNES tile data
Definition yaze.h:287
uint32_t id
Definition yaze.h:288
uint8_t data[64]
Definition yaze.h:290
uint32_t palette_id
Definition yaze.h:289
uint8_t palette
Definition yaze.h:315
bool priority
Definition yaze.h:316
bool vertical_mirror
Definition yaze.h:317
uint16_t id
Definition yaze.h:314
bool horizontal_mirror
Definition yaze.h:318
Bitmap data structure.
Definition yaze.h:171
uint8_t * data
Definition yaze.h:175
int height
Definition yaze.h:173
uint8_t bpp
Definition yaze.h:174
int width
Definition yaze.h:172
zelda3_rom * rom
Definition yaze.h:50
const char * error_message
Definition yaze.h:51
Extension interface for YAZE.
Definition yaze.h:526
const char * author
Definition yaze.h:530
void(* cleanup)(void)
Clean up the extension.
Definition yaze.h:550
uint32_t(* get_capabilities)(void)
Get extension capabilities.
Definition yaze.h:559
const char * description
Definition yaze.h:529
const char * version
Definition yaze.h:528
int api_version
Definition yaze.h:531
yaze_status(* initialize)(yaze_editor_context *context)
Initialize the extension.
Definition yaze.h:542
const char * name
Definition yaze.h:527
Complete dungeon room data.
Definition zelda.h:461
In-game text message data.
Definition zelda.h:272
Overworld map data.
Definition zelda.h:295
Complete overworld data.
Definition zelda.h:333
ROM data structure.
Definition zelda.h:210
void(* yaze_cleanup_func)(void)
Definition yaze.h:513
struct yaze_editor_context yaze_editor_context
void(* yaze_initialize_func)(yaze_editor_context *context)
Function pointer to initialize the extension.
Definition yaze.h:512
The Legend of Zelda: A Link to the Past - Data Structures and Constants.