summaryrefslogtreecommitdiffstats
path: root/sdk/rwsdk/include/d3d8/rttoc.h
blob: 02893aa85f12f7f35871d3c99e3464ff375cc22d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
 *                                                                         *
 * Module  : rttoc.h                                                       *
 *                                                                         *
 * Purpose : Table Of Contents (TOC)                                       *
 *                                                                         *
 **************************************************************************/

#ifndef RTTOC_H
#define RTTOC_H

/**
 * \defgroup rttoc RtTOC
 * \ingroup rttool
 *
 * Table Of Contents (TOC) - e.g. creating a TOC for a RwStream.
 */

/****************************************************************************
 Includes
 */
#include "rwcore.h"

#include "rpcriter.h"

/****************************************************************************
 Defines
 */

/****************************************************************************
 Global Types
 */

typedef struct _rtTOCGUID _rtTOCGUID;
struct _rtTOCGUID
{
    RwUInt32        data1;
    RwUInt16        data2;
    RwUInt16        data3;
    RwUInt8         data4[8];
};

typedef struct RtTOCEntry RtTOCEntry;
/**
 * \ingroup rttoc
 * \struct RtTOCEntry
 * 
 * BLAH
 */
struct RtTOCEntry
{  
    RwCorePluginID  id;    /**< Chunk ID */
    RwUInt32        offset;/**< Offset of chunk from the start of the file 
                            *   including TOC */
    _rtTOCGUID      guid;  /**< GUID */
};

typedef struct RtTOC RtTOC;

/**
 * \ingroup rttoc
 * \struct RtTOC
 *
 * BLAH
 */
struct RtTOC
{
    RwInt32         numEntries; /**< Number of entries*/
    RtTOCEntry      entry[1];   /**< Entry*/
};

/****************************************************************************
 Function prototypes
 */

#ifdef    __cplusplus
extern "C"
{
#endif                          /* __cplusplus */

/* Create/Destroy */
extern RtTOC *RtTOCCreate(RwStream *stream);
extern void RtTOCDestroy(RtTOC *toc);

/* Access */
extern RwInt32 RtTOCGetNumEntries(const RtTOC *toc);
extern RtTOCEntry *RtTOCGetEntry(RtTOC *toc, RwInt32 entry);

/* Serialization */
extern RwUInt32 RtTOCStreamGetSize(const RtTOC *toc);
extern const RtTOC *RtTOCStreamWrite(RtTOC *toc, RwStream *stream);
extern RtTOC *RtTOCStreamRead(RwStream *stream);


#ifdef    __cplusplus
}
#endif                          /* __cplusplus */

#endif /* RTTOC_H */