dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
headpack.h File Reference

Functions comprising the headpack resource tool. More...

#include <stdio.h>
Include dependency graph for headpack.h:

Go to the source code of this file.

Data Structures

struct  HEADPACK_DEF
 

Macros

#define HEADPACK_INCLUDE_GUARD   "RESEMB_H"
 
#define HEADPACK_FNAME_MAX   255
 
#define HEADPACK_STATE_IN_FMT_ARG   1
 
#define HEADPACK_STATE_OUT_FMT_ARG   2
 
#define HEADPACK_DEFS_MAX   255
 
#define HEADPACK_HEADERS_MAX   255
 
#define HEADPACK_TYPE_MAX   8
 
#define PATH_TYPE_BIN   0
 Constant indicating path is to a bitmap (or binary) file.
 
#define PATH_TYPE_TXT   1
 Constant indicating path is to a tilemap (text) file.
 

Typedefs

typedef int(* headpack_writer) (const char *, FILE *)
 
typedef int(* headpack_indexer) (const char *[], int, FILE *)
 

Functions

int headpack_register (char prefix, headpack_writer writer, headpack_indexer indexer, const char *type)
 
int headpack_register_h (char *h)
 
int path_bin_or_txt (const char *path)
 Determine if a path points to a bitmap or tilemap.
 
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 header.
 
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 compiled into the deskai engine.
 
struct HEADPACK_DEFheadpack_get_def (const char *filename)
 
int write_header (FILE *header, int paths_in_sz, const char *paths_in[], int in_fmt, int out_fmt)
 
int headpack_main (int argc, char *argv[])
 

Variables

struct HEADPACK_DEF g_headpack_defs []
 
int g_headpack_defs_sz
 
char * g_headpack_headers []
 
int g_headpack_headers_sz
 

Detailed Description

Functions comprising the headpack resource tool.

Function Documentation

◆ encode_binary_buffer()

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 compiled into the deskai engine.

Parameters
idIndex of the resource to encode in the header.
headerMEMORY_PTR to the header file to write to.
Returns
Number of bytes written.

◆ path_bin_or_txt()

int path_bin_or_txt ( const char *  path)

Determine if a path points to a bitmap or tilemap.

Parameters
pathPath to examine the type of, by file extension.
Returns
PATH_TYPE_TXT for tilemaps, PATH_TYPE_BIN for others.

◆ path_to_define()

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 header.

Parameters
pathPath to extract and write the basename from.
headerMEMORY_PTR to the header file to write to.
Returns
Number of bytes written.