8#define SI_MAJOR_VERSION 2
9#define SI_MINOR_VERSION 2
19 SetFileName(p_filename);
20 m_skipReadingChunks = p_skipReadingChunks;
30 if (m_io.
Open(m_filename.
GetData(), p_uStyle) != 0) {
37 if (m_skipReadingChunks == 0) {
38 result = ReadChunks();
59 topChunk.fccType =
FOURCC(
'O',
'M',
'N',
'I');
60 if (m_io.
Descend(&topChunk,
NULL, MMIO_FINDRIFF) != 0) {
61 MxTrace(
"Unable to find Streamer RIFF chunk in file: %s\n", m_filename);
65 childChunk.ckid =
FOURCC(
'M',
'x',
'H',
'd');
66 if (m_io.
Descend(&childChunk, &topChunk, 0) != 0) {
67 MxTrace(
"Unable to find Header chunk in file: %s\n", m_filename);
71 m_io.
Read(&m_header, 0x0c);
74 MessageBoxA(
NULL, tempBuffer,
NULL, MB_ICONERROR);
78 childChunk.ckid =
FOURCC(
'M',
'x',
'O',
'f');
79 if (m_io.
Descend(&childChunk, &topChunk, 0) != 0) {
80 MxTrace(
"Unable to find Header chunk in file: %s\n", m_filename);
96 memset(&m_header, 0,
sizeof(m_header));
110 if (m_io.
Read(p_buf, p_nbytes) != p_nbytes) {
[AI] A wrapper for low-level file I/O, abstracting MMIOINFO functionality, and providing additional b...
MxU16 Descend(MMCKINFO *p_chunkInfo, const MMCKINFO *p_parentInfo, MxU16 p_descend)
[AI] Descends into a specific RIFF or LIST chunk in a hierarchical file, reading chunk headers and up...
MxLong Seek(MxLong p_offset, MxLong p_origin)
[AI] Seeks to a specific position in the file (or file buffer).
MxU16 SetBuffer(char *p_buf, MxLong p_len, MxLong p_unused)
[AI] Changes the buffer used for internal I/O (applies and releases old buffer if owned).
MxLong Read(void *p_buf, MxLong p_len)
[AI] Reads a number of bytes from the file or buffer into the destination buffer.
MxU16 Open(const char *p_filename, MxULong p_flags)
[AI] Opens a file for buffered/unbuffered I/O, initializing MMIOINFO and (optionally) internal buffer...
MxU16 Close(MxLong p_unused)
[AI] Closes the file and releases its resources, including buffer memory if owned.
[AI] Represents a source file handler for SI (Streamer Interface) files, providing buffered access fo...
MxResult Read(unsigned char *, MxULong) override
[AI] Reads up to the specified number of bytes from the file into a buffer.
MxResult Seek(MxLong, MxS32) override
[AI] Seeks to an absolute or relative position in the file.
MxResult Close() override
[AI] Closes the file and releases internal file buffers.
MxULong GetStreamBuffersNum() override
[AI] Returns the number of streaming buffers, as specified in the SI file header.
MxResult Open(MxULong) override
[AI] Opens the SI file for reading or writing with the specified style flags.
MxULong GetBufferSize() override
[AI] Returns the SI chunk's buffer size, as obtained from the SI file header.
[AI] Abstract base class representing a source of streamable data, providing an interface for reading...
MxLong m_position
[AI] Current seek/read/write position in the source. -1 if uninitialized, otherwise logical/physical ...
MxU32 * m_pBuffer
[AI] Pointer to allocated buffer, or NULL if uninitialized. Contains the raw read/streamed data.
MxULong m_lengthInDWords
[AI] Length of valid data in the stream, in DWORDs (32-bit units). Used for sizing and range checking...
char * GetData() const
Returns a pointer to the internal character buffer.
#define DECOMP_SIZE_ASSERT(T, S)
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
#define FOURCC(a, b, c, d)
[AI] Macro to compose a 32-bit code from four 8-bit characters (e.g., for resource and chunk IDs).