2020-07-18 10:30:51 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* *
|
|
|
|
* Module : rttoc.h *
|
|
|
|
* *
|
|
|
|
* Purpose : Table Of Contents (TOC) *
|
|
|
|
* *
|
|
|
|
******************************************************************************/
|
2019-05-18 10:39:39 +00:00
|
|
|
|
|
|
|
#ifndef RTTOC_H
|
|
|
|
#define RTTOC_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \defgroup rttoc RtTOC
|
2020-07-18 10:30:51 +00:00
|
|
|
* \ingroup streaming
|
2019-05-18 10:39:39 +00:00
|
|
|
*
|
2020-07-18 10:30:51 +00:00
|
|
|
* Table Of Contents (TOC) - creating a TOC for a stream.
|
2019-05-18 10:39:39 +00:00
|
|
|
*/
|
|
|
|
|
2020-07-18 10:30:51 +00:00
|
|
|
/******************************************************************************
|
2019-05-18 10:39:39 +00:00
|
|
|
Includes
|
|
|
|
*/
|
|
|
|
#include "rwcore.h"
|
|
|
|
|
|
|
|
#include "rpcriter.h"
|
|
|
|
|
2020-07-18 10:30:51 +00:00
|
|
|
/******************************************************************************
|
2019-05-18 10:39:39 +00:00
|
|
|
Defines
|
|
|
|
*/
|
|
|
|
|
2020-07-18 10:30:51 +00:00
|
|
|
/******************************************************************************
|
2019-05-18 10:39:39 +00:00
|
|
|
Global Types
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _rtTOCGUID _rtTOCGUID;
|
2020-07-18 10:30:51 +00:00
|
|
|
#if (!defined(DOXYGEN))
|
2019-05-18 10:39:39 +00:00
|
|
|
struct _rtTOCGUID
|
|
|
|
{
|
|
|
|
RwUInt32 data1;
|
|
|
|
RwUInt16 data2;
|
|
|
|
RwUInt16 data3;
|
|
|
|
RwUInt8 data4[8];
|
|
|
|
};
|
2020-07-18 10:30:51 +00:00
|
|
|
#endif /* (!defined(DOXYGEN)) */
|
2019-05-18 10:39:39 +00:00
|
|
|
|
|
|
|
typedef struct RtTOCEntry RtTOCEntry;
|
|
|
|
/**
|
|
|
|
* \ingroup rttoc
|
|
|
|
* \struct RtTOCEntry
|
|
|
|
*
|
2020-07-18 10:30:51 +00:00
|
|
|
* A Table Of Contents (TOC) entry structure.
|
2019-05-18 10:39:39 +00:00
|
|
|
*/
|
|
|
|
struct RtTOCEntry
|
|
|
|
{
|
2020-07-18 10:30:51 +00:00
|
|
|
RwCorePluginID id; /**< Chunk ID */
|
|
|
|
RwUInt32 gid; /**< Game ID */
|
|
|
|
RwUInt32 offset; /**< Offset of chunk from the start of the file
|
|
|
|
including TOC */
|
|
|
|
_rtTOCGUID guid; /**< GUID */
|
2019-05-18 10:39:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct RtTOC RtTOC;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rttoc
|
|
|
|
* \struct RtTOC
|
2020-07-18 10:30:51 +00:00
|
|
|
*
|
|
|
|
* Table Of Contents (TOC) structure.
|
2019-05-18 10:39:39 +00:00
|
|
|
*/
|
|
|
|
struct RtTOC
|
|
|
|
{
|
2020-07-18 10:30:51 +00:00
|
|
|
RwInt32 numEntries; /**< Number of entries */
|
|
|
|
RtTOCEntry entry[1]; /**< Entry */
|
2019-05-18 10:39:39 +00:00
|
|
|
};
|
|
|
|
|
2020-07-18 10:30:51 +00:00
|
|
|
/******************************************************************************
|
2019-05-18 10:39:39 +00:00
|
|
|
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 */
|