2023-04-27 22:19:39 -04:00
|
|
|
#ifndef MXDSFILE_H
|
|
|
|
#define MXDSFILE_H
|
|
|
|
|
2023-06-27 14:44:02 -04:00
|
|
|
#include "mxdssource.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxio.h"
|
2023-06-29 04:10:08 -04:00
|
|
|
#include "mxstring.h"
|
2023-09-20 16:22:57 -04:00
|
|
|
#include "mxtypes.h"
|
2023-06-27 22:04:07 -04:00
|
|
|
|
2023-12-13 18:11:07 -05:00
|
|
|
#include <windows.h>
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// VTABLE: LEGO1 0x100dc890
|
2024-02-03 11:33:22 -05:00
|
|
|
// SIZE 0x7c
|
2023-10-24 19:38:27 -04:00
|
|
|
class MxDSFile : public MxDSSource {
|
2023-04-27 22:19:39 -04:00
|
|
|
public:
|
2024-01-24 21:16:29 -05:00
|
|
|
MxDSFile(const char* p_filename, MxULong p_skipReadingChunks);
|
2024-02-03 11:33:22 -05:00
|
|
|
|
|
|
|
#ifdef ISLE_APP
|
|
|
|
~MxDSFile() override { Close(); }
|
|
|
|
#else
|
|
|
|
// We have to explicitly use dllexport, otherwise this function cannot be exported,
|
|
|
|
// since it is inlined everywhere in LEGO1.DLL
|
|
|
|
// FUNCTION: LEGO1 0x100bfed0
|
|
|
|
__declspec(dllexport) ~MxDSFile() override { Close(); }
|
|
|
|
#endif
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c0120
|
2024-07-04 19:06:32 -04:00
|
|
|
const char* ClassName() const override // vtable+0x0c
|
2023-10-24 19:38:27 -04:00
|
|
|
{
|
2023-12-27 15:59:42 -05:00
|
|
|
// STRING: LEGO1 0x10102594
|
2023-10-24 19:38:27 -04:00
|
|
|
return "MxDSFile";
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c0130
|
2024-07-04 19:06:32 -04:00
|
|
|
MxBool IsA(const char* p_name) const override // vtable+0x10
|
2023-10-24 19:38:27 -04:00
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
return !strcmp(p_name, MxDSFile::ClassName()) || MxDSSource::IsA(p_name);
|
2023-10-24 19:38:27 -04:00
|
|
|
}
|
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
MxLong Open(MxULong) override; // vtable+0x14
|
|
|
|
MxLong Close() override; // vtable+0x18
|
|
|
|
MxResult Read(unsigned char*, MxULong) override; // vtable+0x20
|
|
|
|
MxLong Seek(MxLong, int) override; // vtable+0x24
|
|
|
|
MxULong GetBufferSize() override; // vtable+0x28
|
|
|
|
MxULong GetStreamBuffersNum() override; // vtable+0x2c
|
2023-10-29 10:01:14 -04:00
|
|
|
|
2024-07-04 19:06:32 -04:00
|
|
|
void SetFileName(const char* p_filename) { m_filename = p_filename; }
|
2023-10-29 10:01:14 -04:00
|
|
|
|
2024-07-04 19:06:32 -04:00
|
|
|
MxS32 CalcFileSize() { return GetFileSize(m_io.m_info.hmmio, NULL); }
|
2023-12-13 18:11:07 -05:00
|
|
|
|
2024-01-18 08:34:14 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x100c01e0
|
|
|
|
// MxDSFile::`scalar deleting destructor'
|
|
|
|
|
2024-02-03 11:33:22 -05:00
|
|
|
// SIZE 0x0c
|
2023-10-24 19:38:27 -04:00
|
|
|
struct ChunkHeader {
|
2023-12-13 05:48:14 -05:00
|
|
|
ChunkHeader() : m_majorVersion(0), m_minorVersion(0), m_bufferSize(0), m_streamBuffersNum(0) {}
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2024-02-03 11:33:22 -05:00
|
|
|
MxU16 m_majorVersion; // 0x00
|
|
|
|
MxU16 m_minorVersion; // 0x02
|
|
|
|
MxULong m_bufferSize; // 0x04
|
|
|
|
MxS16 m_streamBuffersNum; // 0x08
|
|
|
|
MxS16 m_reserved; // 0x0a
|
2023-10-24 19:38:27 -04:00
|
|
|
};
|
|
|
|
|
2024-02-03 11:33:22 -05:00
|
|
|
private:
|
|
|
|
MxLong ReadChunks();
|
|
|
|
|
|
|
|
MxString m_filename; // 0x14
|
|
|
|
MXIOINFO m_io; // 0x24
|
|
|
|
ChunkHeader m_header; // 0x6c
|
2023-10-24 19:38:27 -04:00
|
|
|
|
|
|
|
// If false, read chunks immediately on open, otherwise
|
|
|
|
// skip reading chunks until ReadChunks is explicitly called.
|
2024-02-03 11:33:22 -05:00
|
|
|
MxULong m_skipReadingChunks; // 0x78
|
2023-04-27 22:19:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MXDSFILE_H
|