dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
headpack.h
Go to the documentation of this file.
1
2#ifndef HEADPACK_H
3#define HEADPACK_H
4
9#include <stdio.h>
10
11#define HEADPACK_INCLUDE_GUARD "RESEMB_H"
12
13#define HEADPACK_FNAME_MAX 255
14
15#define HEADPACK_STATE_IN_FMT_ARG 1
16#define HEADPACK_STATE_OUT_FMT_ARG 2
17
18#define HEADPACK_DEFS_MAX 255
19#define HEADPACK_HEADERS_MAX 255
20
21#define HEADPACK_TYPE_MAX 8
22
24#define PATH_TYPE_BIN 0
26#define PATH_TYPE_TXT 1
27
28typedef int (*headpack_writer)( const char*, FILE* );
29typedef int (*headpack_indexer)( const char*[], int, FILE* );
30
32 char prefix;
33 headpack_writer writer;
34 headpack_indexer indexer;
35 char type[HEADPACK_TYPE_MAX];
36};
37
38int headpack_register(
39 char prefix, headpack_writer writer, headpack_indexer indexer,
40 const char* type );
41
42int headpack_register_h( char* h );
43
49int path_bin_or_txt( const char* path );
50
58int path_to_define( const char* path, FILE* header );
59
68 unsigned char* buffer_in, int buffer_in_sz, const char* res_path,
69 int id, FILE* header, int in_fmt, int out_fmt );
70
71struct HEADPACK_DEF* headpack_get_def( const char* filename );
72
73int write_header(
74 FILE* header, int paths_in_sz, const char* paths_in[],
75 int in_fmt, int out_fmt );
76
77int headpack_main( int argc, char* argv[] );
78
79#ifdef HEADPACK_C
80struct HEADPACK_DEF g_headpack_defs[HEADPACK_DEFS_MAX];
81int g_headpack_defs_sz = 0;
82char* g_headpack_headers[HEADPACK_HEADERS_MAX];
83int g_headpack_headers_sz = 0;
84#else
85extern struct HEADPACK_DEF g_headpack_defs[];
86extern int g_headpack_defs_sz;
87extern char* g_headpack_headers[];
88extern int g_headpack_headers_sz;
89#endif /* HEADPACK_C */
90
91#endif /* !HEADPACK_H */
92
int path_bin_or_txt(const char *path)
Determine if a path points to a bitmap or tilemap.
int encode_binary_buffer(unsigned char *buffer_in, int buffer_in_sz, const char *res_path, int id, FILE *header, int in_fmt, int out_fmt)
Write the contents of the given buffer into the provided header as a hex-encoded constant to be compi...
int path_to_define(const char *path, FILE *header)
Given a file path, strip the directory and extension and write the resulting basename to the provided...
Definition: headpack.h:31