| 1 |
#ifndef GARGLK_GI_BLORB_H |
| 2 |
#define GARGLK_GI_BLORB_H |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
typedef glui32 giblorb_err_t; |
| 19 |
#define giblorb_err_None (0) |
| 20 |
#define giblorb_err_CompileTime (1) |
| 21 |
#define giblorb_err_Alloc (2) |
| 22 |
#define giblorb_err_Read (3) |
| 23 |
#define giblorb_err_NotAMap (4) |
| 24 |
#define giblorb_err_Format (5) |
| 25 |
#define giblorb_err_NotFound (6) |
| 26 |
|
| 27 |
|
| 28 |
#define giblorb_method_DontLoad (0) |
| 29 |
#define giblorb_method_Memory (1) |
| 30 |
#define giblorb_method_FilePos (2) |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
#define giblorb_make_id(c1, c2, c3, c4) \ |
| 35 |
(((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4)) |
| 36 |
|
| 37 |
#define giblorb_ID_Exec (giblorb_make_id('E', 'x', 'e', 'c')) |
| 38 |
#define giblorb_ID_Snd (giblorb_make_id('S', 'n', 'd', ' ')) |
| 39 |
#define giblorb_ID_Pict (giblorb_make_id('P', 'i', 'c', 't')) |
| 40 |
#define giblorb_ID_Data (giblorb_make_id('D', 'a', 't', 'a')) |
| 41 |
#define giblorb_ID_Copyright (giblorb_make_id('(', 'c', ')', ' ')) |
| 42 |
#define giblorb_ID_AUTH (giblorb_make_id('A', 'U', 'T', 'H')) |
| 43 |
#define giblorb_ID_ANNO (giblorb_make_id('A', 'N', 'N', 'O')) |
| 44 |
#define giblorb_ID_TEXT (giblorb_make_id('T', 'E', 'X', 'T')) |
| 45 |
#define giblorb_ID_BINA (giblorb_make_id('B', 'I', 'N', 'A')) |
| 46 |
#define giblorb_ID_JPEG (giblorb_make_id('J', 'P', 'E', 'G')) |
| 47 |
#define giblorb_ID_PNG (giblorb_make_id('P', 'N', 'G', ' ')) |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
typedef struct giblorb_map_struct giblorb_map_t; |
| 52 |
|
| 53 |
|
| 54 |
typedef struct giblorb_result_struct { |
| 55 |
glui32 chunknum; |
| 56 |
|
| 57 |
union { |
| 58 |
void *ptr; |
| 59 |
|
| 60 |
glui32 startpos; |
| 61 |
|
| 62 |
} data; |
| 63 |
glui32 length; |
| 64 |
glui32 chunktype; |
| 65 |
} giblorb_result_t; |
| 66 |
|
| 67 |
typedef struct giblorb_image_info_struct { |
| 68 |
glui32 chunktype; |
| 69 |
glui32 width; |
| 70 |
glui32 height; |
| 71 |
char *alttext; |
| 72 |
} giblorb_image_info_t; |
| 73 |
|
| 74 |
extern giblorb_err_t giblorb_create_map(strid_t file, |
| 75 |
giblorb_map_t **newmap); |
| 76 |
extern giblorb_err_t giblorb_destroy_map(giblorb_map_t *map); |
| 77 |
|
| 78 |
extern giblorb_err_t giblorb_load_chunk_by_type(giblorb_map_t *map, |
| 79 |
glui32 method, giblorb_result_t *res, glui32 chunktype, |
| 80 |
glui32 count); |
| 81 |
extern giblorb_err_t giblorb_load_chunk_by_number(giblorb_map_t *map, |
| 82 |
glui32 method, giblorb_result_t *res, glui32 chunknum); |
| 83 |
extern giblorb_err_t giblorb_unload_chunk(giblorb_map_t *map, |
| 84 |
glui32 chunknum); |
| 85 |
|
| 86 |
extern giblorb_err_t giblorb_load_resource(giblorb_map_t *map, |
| 87 |
glui32 method, giblorb_result_t *res, glui32 usage, |
| 88 |
glui32 resnum); |
| 89 |
extern giblorb_err_t giblorb_count_resources(giblorb_map_t *map, |
| 90 |
glui32 usage, glui32 *num, glui32 *min, glui32 *max); |
| 91 |
|
| 92 |
extern giblorb_err_t giblorb_load_image_info(giblorb_map_t *map, |
| 93 |
glui32 resnum, giblorb_image_info_t *res); |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
extern giblorb_err_t giblorb_set_resource_map(strid_t file); |
| 100 |
extern giblorb_map_t *giblorb_get_resource_map(void); |
| 101 |
|
| 102 |
#ifdef __cplusplus |
| 103 |
} |
| 104 |
#endif |
| 105 |
|
| 106 |
#endif |