Isle
Loading...
Searching...
No Matches
mxio.h
Go to the documentation of this file.
1#ifndef MXIO_H
2#define MXIO_H
3
4#include "mxtypes.h"
5
6// mmsystem.h requires inclusion of windows.h before
7// clang-format off
8#include <windows.h>
9#include <mmsystem.h>
10// clang-format on
11
12#if defined(_M_IX86) || defined(__i386__)
13#define MXIO_MINFO_MFILE
14#endif
15
16// SIZE 0x48
17
22class MXIOINFO {
23public:
27 MXIOINFO();
28
32 ~MXIOINFO();
33
40 MxU16 Open(const char* p_filename, MxULong p_flags);
41
47 MxU16 Close(MxLong p_unused);
48
55 MxLong Read(void* p_buf, MxLong p_len);
56
63 MxLong Write(void* p_buf, MxLong p_len);
64
71 MxLong Seek(MxLong p_offset, MxLong p_origin);
72
80 MxU16 SetBuffer(char* p_buf, MxLong p_len, MxLong p_unused);
81
87 MxU16 Flush(MxU16 p_unused);
88
94 MxU16 Advance(MxU16 p_option);
95
103 MxU16 Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU16 p_descend);
104
111 MxU16 Ascend(MMCKINFO* p_chunkInfo, MxU16 p_ascend);
112
119 MxU16 CreateChunk(MMCKINFO* p_chunkInfo, MxU16 p_create);
120
125 MMIOINFO m_info;
126
127#ifndef MXIO_MINFO_MFILE
131 HFILE m_file;
132#endif
133};
134
135#endif // MXIO_H
[AI] A wrapper for low-level file I/O, abstracting MMIOINFO functionality, and providing additional b...
Definition: mxio.h:22
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...
Definition: mxio.cpp:464
MxLong Seek(MxLong p_offset, MxLong p_origin)
[AI] Seeks to a specific position in the file (or file buffer).
Definition: mxio.cpp:215
MxU16 Advance(MxU16 p_option)
[AI] Advances the buffer state for reading/writing the next block, committing dirty writes and loadin...
Definition: mxio.cpp:390
~MXIOINFO()
[AI] Destructor, closes the file and releases all memory associated with buffers if necessary.
Definition: mxio.cpp:31
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).
Definition: mxio.cpp:318
MxU16 Ascend(MMCKINFO *p_chunkInfo, MxU16 p_ascend)
[AI] Ascends from a chunk in a hierarchical file, correcting chunk size and finishing the chunk corre...
Definition: mxio.cpp:553
MxLong Read(void *p_buf, MxLong p_len)
[AI] Reads a number of bytes from the file or buffer into the destination buffer.
Definition: mxio.cpp:107
MXIOINFO()
[AI] Constructs a new MXIOINFO instance and initializes all struct members to zero.
Definition: mxio.cpp:24
MxLong Write(void *p_buf, MxLong p_len)
[AI] Writes data to the file or internal buffer.
Definition: mxio.cpp:157
MxU16 CreateChunk(MMCKINFO *p_chunkInfo, MxU16 p_create)
[AI] Creates a new hierarchical chunk (RIFF or LIST or other type), writing initial chunk header.
Definition: mxio.cpp:617
HFILE m_file
[AI] File handle used when MMIOINFO is not used as a file (HFILE abstraction).
Definition: mxio.h:131
MxU16 Open(const char *p_filename, MxULong p_flags)
[AI] Opens a file for buffered/unbuffered I/O, initializing MMIOINFO and (optionally) internal buffer...
Definition: mxio.cpp:38
MMIOINFO m_info
[AI] Underlying MMIOINFO structure used for buffered and low-level file I/O.
Definition: mxio.h:125
MxU16 Flush(MxU16 p_unused)
[AI] Flushes contents of the buffer to disk if necessary (e.g., if data is dirty).
Definition: mxio.cpp:338
MxU16 Close(MxLong p_unused)
[AI] Closes the file and releases its resources, including buffer memory if owned.
Definition: mxio.cpp:85
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned int MxULong
[AI]
Definition: mxtypes.h:93
unsigned short MxU16
[AI]
Definition: mxtypes.h:20