KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

API for Managing VMU File Headers More...

Topics

 Eyecatch Types
 Values for various VMU eyecatch formats
 

Files

file  vmu_pkg.h
 VMU Packaging functionality.
 

Data Structures

struct  vmu_pkg_t
 VMU Package type. More...
 
struct  vmu_hdr_t
 Final VMU package type. More...
 

Functions

int vmu_pkg_build (vmu_pkg_t *src, uint8_t **dst, int *dst_size)
 Convert a vmu_pkg_t into an array of uint8s.
 
int vmu_pkg_parse (uint8_t *data, vmu_pkg_t *pkg)
 Parse an array of uint8s into a vmu_pkg_t.
 
int vmu_pkg_load_icon (vmu_pkg_t *pkg, const char *icon_fn)
 Load a .ico file to use as a VMU file's icon.
 

Detailed Description

API for Managing VMU File Headers

This API is provided as a utility for easy management of VMS file headers. These headers must be present on every file saved within the VMU's filesystem for both the Dreamcast and VMU's BIOS to detect them properly.

Function Documentation

◆ vmu_pkg_build()

int vmu_pkg_build ( vmu_pkg_t * src,
uint8_t ** dst,
int * dst_size )

Convert a vmu_pkg_t into an array of uint8s.

This function converts a vmu_pkg_t structure into an array of uint8's which may be written to a VMU file via fs_vmu, or whatever.

Parameters
srcThe vmu_pkg_t to convert.
dstThe buffer (will be allocated for you).
dst_sizeThe size of the output.
Returns
0 on success, <0 on failure.

◆ vmu_pkg_load_icon()

int vmu_pkg_load_icon ( vmu_pkg_t * pkg,
const char * icon_fn )

Load a .ico file to use as a VMU file's icon.

Icon files must be in the ICO file format, be 32x32 in size, contain a bitmap (no PNG or compressed BMP), and use paletted 4bpp. They can contain more than one frame, and they can use up to 16 colors if transparency is not used, or 15 colors otherwise. Finally, all frames must use the same palette.

This function assumes that the vmu_pkg_t has been properly initialized; in particular, the .icon_cnt must be set, and the .icon_data must point to a valid buffer (of 512 bytes per frame).

If the .ico file contains more frames than requested, only the first ones are loaded. If it contains less frames than requested, the .icon_cnt field will be updated to the new frame count.

Parameters
pkgA pointer a pre-initialized vmu_pkg_t
icon_fnThe file path to the .ico file
Return values
-1If the .ico file cannot be loaded.
0On success.

◆ vmu_pkg_parse()

int vmu_pkg_parse ( uint8_t * data,
vmu_pkg_t * pkg )

Parse an array of uint8s into a vmu_pkg_t.

This function does the opposite of vmu_pkg_build and is used to parse VMU files read in.

Parameters
dataThe buffer to parse.
pkgWhere to store the vmu_pkg_t.
Return values
-1On invalid CRC in the data.
0On success.