KallistiOS
git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
vmu_pkg.h
Go to the documentation of this file.
1
/* KallistiOS ##version##
2
3
dc/vmu_pkg.h
4
Copyright (C) 2002 Megan Potter
5
6
*/
7
8
/** \file dc/vmu_pkg.h
9
\brief VMU Packaging functionality.
10
\ingroup vmu_package
11
12
This file provides declarations for managing the headers that must be
13
attached to VMU files for the BIOS to pay attention to them. This does not
14
handle reading/writing files directly.
15
16
\author Megan Potter
17
\see dc/fs_vmu.h
18
*/
19
20
#ifndef __DC_VMU_PKG_H
21
#define __DC_VMU_PKG_H
22
23
#include <sys/cdefs.h>
24
__BEGIN_DECLS
25
26
#include <
arch/types.h
>
27
28
/** \defgroup vmu_package Header Package
29
\brief API for Managing VMU File Headers
30
\ingroup vmu
31
32
This API is provided as a utility for easy management of VMS file headers.
33
These headers must be present on every file saved within the VMU's
34
filesystem for both the Dreamcast and VMU's BIOS to detect them properly.
35
*/
36
37
/** \brief VMU Package type.
38
\ingroup vmu_package
39
40
Anyone wanting to package a VMU file should create one of these somewhere;
41
eventually it will be turned into a flat file that you can save using
42
fs_vmu.
43
44
\headerfile dc/vmu_pkg.h
45
*/
46
typedef
struct
vmu_pkg {
47
char
desc_short[20];
/**< \brief Short file description */
48
char
desc_long[36];
/**< \brief Long file description */
49
char
app_id[20];
/**< \brief Application ID */
50
int
icon_cnt
;
/**< \brief Number of icons */
51
int
icon_anim_speed
;
/**< \brief Icon animation speed */
52
int
eyecatch_type
;
/**< \brief "Eyecatch" type */
53
int
data_len
;
/**< \brief Number of data (payload) bytes */
54
uint16
icon_pal[16];
/**< \brief Icon palette (ARGB4444) */
55
const
uint8
*
icon_data
;
/**< \brief 512*n bytes of icon data */
56
const
uint8
*
eyecatch_data
;
/**< \brief Eyecatch data */
57
const
uint8
*
data
;
/**< \brief Payload data */
58
}
vmu_pkg_t
;
59
60
/** \brief Final VMU package type.
61
\ingroup vmu_package
62
63
This structure will be written into the file itself, not vmu_pkg_t.
64
65
\headerfile dc/vmu_pkg.h
66
*/
67
typedef
struct
vmu_hdr {
68
char
desc_short[16];
/**< \brief Space-padded short description */
69
char
desc_long[32];
/**< \brief Space-padded long description*/
70
char
app_id[16];
/**< \brief Null-padded application ID */
71
uint16
icon_cnt
;
/**< \brief Number of icons */
72
uint16
icon_anim_speed
;
/**< \brief Icon animation speed */
73
uint16
eyecatch_type
;
/**< \brief Eyecatch type */
74
uint16
crc
;
/**< \brief CRC of the file */
75
uint32
data_len
;
/**< \brief Payload size */
76
uint8
reserved[20];
/**< \brief Reserved (all zero) */
77
uint16
icon_pal[16];
/**< \brief Icon palette (ARGB4444) */
78
/* 512*n Icon Bitmaps */
79
/* Eyecatch palette + bitmap */
80
}
vmu_hdr_t
;
81
82
/** \defgroup vmu_ectype Eyecatch Types
83
\brief Values for various VMU eyecatch formats
84
\ingroup vmu_package
85
86
All eyecatches are 72x56, but the pixel format is variable. Note that in all
87
of the cases which use a palette, the palette entries are in ARGB4444 format
88
and come directly before the pixel data itself.
89
90
@{
91
*/
92
#define VMUPKG_EC_NONE 0
/**< \brief No eyecatch */
93
#define VMUPKG_EC_16BIT 1
/**< \brief 16-bit ARGB4444 */
94
#define VMUPKG_EC_256COL 2
/**< \brief 256-color palette */
95
#define VMUPKG_EC_16COL 3
/**< \brief 16-color palette */
96
/** @} */
97
98
/** \brief Convert a vmu_pkg_t into an array of uint8s.
99
\ingroup vmu_package
100
101
This function converts a vmu_pkg_t structure into an array of uint8's which
102
may be written to a VMU file via fs_vmu, or whatever.
103
104
\param src The vmu_pkg_t to convert.
105
\param dst The buffer (will be allocated for you).
106
\param dst_size The size of the output.
107
\return 0 on success, <0 on failure.
108
*/
109
int
vmu_pkg_build
(
vmu_pkg_t
*src,
uint8
** dst,
int
* dst_size);
110
111
/** \brief Parse an array of uint8s into a vmu_pkg_t.
112
\ingroup vmu_package
113
114
This function does the opposite of vmu_pkg_build and is used to parse VMU
115
files read in.
116
117
\param data The buffer to parse.
118
\param pkg Where to store the vmu_pkg_t.
119
\retval -1 On invalid CRC in the data.
120
\retval 0 On success.
121
*/
122
int
vmu_pkg_parse
(
uint8
*data,
vmu_pkg_t
*pkg);
123
124
125
__END_DECLS
126
127
#endif
/* __DC_VMU_PKG_H */
128
uint16
unsigned short uint16
16-bit unsigned integer
Definition
types.h:34
uint32
unsigned long uint32
32-bit unsigned integer
Definition
types.h:33
uint8
unsigned char uint8
8-bit unsigned integer
Definition
types.h:35
vmu_pkg_parse
int vmu_pkg_parse(uint8 *data, vmu_pkg_t *pkg)
Parse an array of uint8s into a vmu_pkg_t.
vmu_pkg_build
int vmu_pkg_build(vmu_pkg_t *src, uint8 **dst, int *dst_size)
Convert a vmu_pkg_t into an array of uint8s.
vmu_hdr_t
Final VMU package type.
Definition
vmu_pkg.h:67
vmu_hdr_t::crc
uint16 crc
CRC of the file.
Definition
vmu_pkg.h:74
vmu_hdr_t::eyecatch_type
uint16 eyecatch_type
Eyecatch type.
Definition
vmu_pkg.h:73
vmu_hdr_t::icon_anim_speed
uint16 icon_anim_speed
Icon animation speed.
Definition
vmu_pkg.h:72
vmu_hdr_t::data_len
uint32 data_len
Payload size.
Definition
vmu_pkg.h:75
vmu_hdr_t::icon_cnt
uint16 icon_cnt
Number of icons.
Definition
vmu_pkg.h:71
vmu_pkg_t
VMU Package type.
Definition
vmu_pkg.h:46
vmu_pkg_t::data
const uint8 * data
Payload data.
Definition
vmu_pkg.h:57
vmu_pkg_t::eyecatch_type
int eyecatch_type
"Eyecatch" type
Definition
vmu_pkg.h:52
vmu_pkg_t::icon_cnt
int icon_cnt
Number of icons.
Definition
vmu_pkg.h:50
vmu_pkg_t::data_len
int data_len
Number of data (payload) bytes.
Definition
vmu_pkg.h:53
vmu_pkg_t::icon_data
const uint8 * icon_data
512*n bytes of icon data
Definition
vmu_pkg.h:55
vmu_pkg_t::icon_anim_speed
int icon_anim_speed
Icon animation speed.
Definition
vmu_pkg.h:51
vmu_pkg_t::eyecatch_data
const uint8 * eyecatch_data
Eyecatch data.
Definition
vmu_pkg.h:56
types.h
Common integer types.
kernel
arch
dreamcast
include
dc
vmu_pkg.h
Generated by
1.11.0