#ifndef RGPRE_H
#define RGPRE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ByteBuffer {
uint8_t *ptr;
int32_t length;
int32_t capacity;
} ByteBuffer;
typedef struct RgWorldHandle RgWorldHandle;
typedef struct RgRtxHandle RgRtxHandle;
void rg_free_buffer(ByteBuffer *buffer);
ByteBuffer *rg_last_error(void);
typedef struct TextureHeader {
int32_t width;
int32_t height;
int32_t frame_count;
int32_t rgba_size;
} TextureHeader;
typedef struct AllFramesHeader {
int32_t width;
int32_t height;
int32_t frame_count;
} AllFramesHeader;
typedef struct RgmdHeader {
uint8_t magic[4];
uint8_t version[4];
int32_t submesh_count;
int32_t frame_count;
int32_t total_vertex_count;
int32_t total_index_count;
float radius;
} RgmdHeader;
typedef struct RgmdSubmeshHeader {
uint8_t textured;
uint8_t color_r;
uint8_t color_g;
uint8_t color_b;
uint16_t texture_id;
uint8_t image_id;
uint8_t _pad;
int32_t vertex_count;
int32_t index_count;
} RgmdSubmeshHeader;
typedef struct RgmdVertex {
float position[3];
float normal[3];
float uv[2];
} RgmdVertex;
typedef struct RgmdDeltaVertex {
float dx;
float dy;
float dz;
float dnx;
float dny;
float dnz;
} RgmdDeltaVertex;
typedef struct RgplHeader {
uint8_t magic[4];
int32_t placement_count;
int32_t light_count;
} RgplHeader;
typedef struct RgplPlacement {
uint8_t model_name[32];
uint8_t source_id[32];
float transform[16];
uint16_t texture_id;
uint8_t image_id;
uint8_t object_type;
} RgplPlacement;
typedef struct RgplLight {
uint8_t name[32];
float color[3];
float position[3];
float range;
uint8_t light_type;
uint8_t _pad[3];
} RgplLight;
typedef struct RobHeader {
int32_t segment_count;
} RobHeader;
typedef struct RobSegmentHeader {
uint8_t segment_name[8];
uint8_t has_model;
uint8_t _pad[3];
int32_t model_data_size;
} RobSegmentHeader;
typedef struct RgWorldDescriptor {
int32_t world_id;
uint8_t has_wld;
uint8_t _pad[3];
uint16_t texbsi_id;
uint8_t _pad2[2];
uint8_t rgm_path[64];
uint8_t wld_path[64];
uint8_t palette_path[64];
} RgWorldDescriptor;
ByteBuffer *rg_convert_model_from_path(const char *file_path, const char *assets_dir);
ByteBuffer *rg_convert_rgm_from_path(const char *file_path, const char *assets_dir);
ByteBuffer *rg_convert_wld_from_path(const char *file_path, const char *assets_dir);
RgWorldHandle *rg_open_world(const char *assets_dir, int32_t world_id);
RgWorldHandle *rg_open_world_explicit(const char *assets_dir, const char *rgm_path, const char *wld_path, const char *palette_path);
void rg_close_world(RgWorldHandle *world);
int32_t rg_world_count(const char *assets_dir);
ByteBuffer *rg_get_world_descriptor(RgWorldHandle *world);
ByteBuffer *rg_get_world_terrain(RgWorldHandle *world);
ByteBuffer *rg_get_world_placements(RgWorldHandle *world);
ByteBuffer *rg_decode_texture_world(RgWorldHandle *world, uint16_t texture_id, uint8_t image_id);
ByteBuffer *rg_decode_texture_all_frames_world(RgWorldHandle *world, uint16_t texture_id, uint8_t image_id);
int32_t rg_rgm_section_count_world(RgWorldHandle *world, const char *section_tag);
ByteBuffer *rg_get_rgm_section_world(RgWorldHandle *world, const char *section_tag, int32_t section_index);
ByteBuffer *rg_parse_model_data(const char *file_path, const char *assets_dir);
ByteBuffer *rg_parse_rob_data(const char *file_path, const char *assets_dir);
ByteBuffer *rg_parse_model_data_world(RgWorldHandle *world, const char *file_path);
ByteBuffer *rg_parse_rob_data_world(RgWorldHandle *world, const char *file_path);
ByteBuffer *rg_parse_wld_terrain_data(const char *file_path);
ByteBuffer *rg_parse_rgm_placements(const char *file_path);
int32_t rg_gxa_frame_count(const char *file_path);
ByteBuffer *rg_decode_gxa(const char *file_path, int32_t frame);
ByteBuffer *rg_convert_sfx_to_wav(const char *file_path, int32_t effect_index);
int32_t rg_sfx_effect_count(const char *file_path);
RgRtxHandle *rg_open_rtx(const char *file_path);
void rg_close_rtx(RgRtxHandle *handle);
int32_t rg_rtx_handle_entry_count(const RgRtxHandle *handle);
int32_t rg_rtx_handle_entry_tag(const RgRtxHandle *handle, int32_t entry_index);
ByteBuffer *rg_rtx_handle_convert_entry_to_wav(const RgRtxHandle *handle, int32_t entry_index);
ByteBuffer *rg_rtx_handle_get_subtitle(const RgRtxHandle *handle, int32_t entry_index);
ByteBuffer *rg_convert_fnt_to_ttf(const char *file_path);
#ifdef __cplusplus
}
#endif
#endif