Isle
Loading...
Searching...
No Matches
mxdsfile.h
Go to the documentation of this file.
1#ifndef MXDSFILE_H
2#define MXDSFILE_H
3
4#include "mxdssource.h"
5#include "mxio.h"
6#include "mxstring.h"
7#include "mxtypes.h"
8
9#include <windows.h>
10
20class MxDSFile : public MxDSSource {
21public:
27 MxDSFile(const char* p_filename, MxULong p_skipReadingChunks);
28
29#ifdef ISLE_APP
33 ~MxDSFile() override { Close(); }
34#else
38 __declspec(dllexport) ~MxDSFile() override { Close(); }
39#endif
40
45 const char* ClassName() const override // vtable+0x0c
46 {
47 // STRING: LEGO1 0x10102594
48 return "MxDSFile";
49 }
50
56 MxBool IsA(const char* p_name) const override // vtable+0x10
57 {
58 return !strcmp(p_name, MxDSFile::ClassName()) || MxDSSource::IsA(p_name);
59 }
60
66 MxResult Open(MxULong) override; // vtable+0x14
67
72 MxResult Close() override; // vtable+0x18
73
79 MxResult Read(unsigned char*, MxULong) override; // vtable+0x20
80
86 MxResult Seek(MxLong, MxS32) override; // vtable+0x24
87
91 MxULong GetBufferSize() override; // vtable+0x28
92
96 MxULong GetStreamBuffersNum() override; // vtable+0x2c
97
102 void SetFileName(const char* p_filename) { m_filename = p_filename; }
103
108 MxS32 CalcFileSize() { return GetFileSize(m_io.m_info.hmmio, NULL); }
109
110 // SIZE 0x0c
114 struct ChunkHeader {
119
125 };
126
127private:
133 MxResult ReadChunks();
134
135 MxString m_filename;
136 MXIOINFO m_io;
137 ChunkHeader m_header;
138
142 MxULong m_skipReadingChunks; // 0x78
143};
144
145#endif // MXDSFILE_H
[AI] A wrapper for low-level file I/O, abstracting MMIOINFO functionality, and providing additional b...
Definition: mxio.h:22
MMIOINFO m_info
[AI] Underlying MMIOINFO structure used for buffered and low-level file I/O.
Definition: mxio.h:125
[AI] Represents a source file handler for SI (Streamer Interface) files, providing buffered access fo...
Definition: mxdsfile.h:20
void SetFileName(const char *p_filename)
[AI] Sets the SI file's name.
Definition: mxdsfile.h:102
MxResult Read(unsigned char *, MxULong) override
[AI] Reads up to the specified number of bytes from the file into a buffer.
Definition: mxdsfile.cpp:108
MxS32 CalcFileSize()
[AI] Calculates and returns the file size by querying the system (Windows GetFileSize).
Definition: mxdsfile.h:108
MxResult Seek(MxLong, MxS32) override
[AI] Seeks to an absolute or relative position in the file.
Definition: mxdsfile.cpp:120
const char * ClassName() const override
[AI] Class identification.
Definition: mxdsfile.h:45
MxResult Close() override
[AI] Closes the file and releases internal file buffers.
Definition: mxdsfile.cpp:92
MxULong GetStreamBuffersNum() override
[AI] Returns the number of streaming buffers, as specified in the SI file header.
Definition: mxdsfile.cpp:139
MxResult Open(MxULong) override
[AI] Opens the SI file for reading or writing with the specified style flags.
Definition: mxdsfile.cpp:25
__declspec(dllexport) ~MxDSFile() override
[AI] Destructor (exported for DLL builds).
Definition: mxdsfile.h:38
MxULong GetBufferSize() override
[AI] Returns the SI chunk's buffer size, as obtained from the SI file header.
Definition: mxdsfile.cpp:132
MxBool IsA(const char *p_name) const override
[AI] Type comparison with other class names (for dynamic type identification).
Definition: mxdsfile.h:56
[AI] Abstract base class representing a source of streamable data, providing an interface for reading...
Definition: mxdssource.h:20
MxBool IsA(const char *p_name) const override
[AI] Runtime type information check.
Definition: mxdssource.h:49
Mindscape custom string class for managing dynamic C-strings within the game engine.
Definition: mxstring.h:14
#define override
Definition: compat.h:21
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
signed short MxS16
[AI]
Definition: mxtypes.h:26
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxULong
[AI]
Definition: mxtypes.h:93
[AI] Represents the SI file stream's header chunk, containing versioning and SI buffer info.
Definition: mxdsfile.h:114
ChunkHeader()
[AI] Default constructor.
Definition: mxdsfile.h:118
MxS16 m_majorVersion
[AI] Major SI file version (e.g., 2 for LEGO Island SI files).
Definition: mxdsfile.h:120
MxS16 m_reserved
[AI] Reserved for potential SI formatting/extensions.
Definition: mxdsfile.h:124
MxS16 m_streamBuffersNum
[AI] Number of streaming buffers for this SI file.
Definition: mxdsfile.h:123
MxS16 m_minorVersion
[AI] Minor SI file version (e.g., 2 for LEGO Island SI files).
Definition: mxdsfile.h:121
MxULong m_bufferSize
[AI] Buffer size defined for the SI stream (bytes).
Definition: mxdsfile.h:122