isle-portable/LEGO1/omni/include/mxdsfile.h
Anonymous Maarten 9e686e2a87
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy

* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def

* Add initial .clang-tidy and fixes

* fix file perms

* Comment out DESCRIPTION

* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def

* Looks like clang is allergic to the libs in the directx5 SDK

* Update .clang-tidy

* Fix typo in .clang-tidy

* Attempt to generate an action error

* Revert "Attempt to generate an action error"

This reverts commit 96c4c65fedbc4102837f4bcbbb9ee83a7d14cba3.

* cmake: test with -Wparentheses + optionally with -Werror

* ci: -k0 is a Ninja argument

* Use -Werror only for msys2 builds

* cmake: only emit warnings for specific warnings

* cmake: and don't do -Werror/-WX anymore

* Fix warnings

* Fix mingw warnings

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
2024-02-01 21:42:10 +01:00

65 lines
1.8 KiB
C++

#ifndef MXDSFILE_H
#define MXDSFILE_H
#include "mxdssource.h"
#include "mxioinfo.h"
#include "mxstring.h"
#include "mxtypes.h"
#include <windows.h>
// VTABLE: LEGO1 0x100dc890
class MxDSFile : public MxDSSource {
public:
MxDSFile(const char* p_filename, MxULong p_skipReadingChunks);
~MxDSFile() override; // vtable+0x00
// FUNCTION: LEGO1 0x100c0120
inline const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x10102594
return "MxDSFile";
}
// FUNCTION: LEGO1 0x100c0130
inline MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, MxDSFile::ClassName()) || MxDSSource::IsA(p_name);
}
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
inline void SetFileName(const char* p_filename) { m_filename = p_filename; }
inline MxS32 CalcFileSize() { return GetFileSize(m_io.m_info.hmmio, NULL); }
// SYNTHETIC: LEGO1 0x100c01e0
// MxDSFile::`scalar deleting destructor'
private:
MxLong ReadChunks();
struct ChunkHeader {
ChunkHeader() : m_majorVersion(0), m_minorVersion(0), m_bufferSize(0), m_streamBuffersNum(0) {}
MxU16 m_majorVersion;
MxU16 m_minorVersion;
MxULong m_bufferSize;
MxS16 m_streamBuffersNum;
MxS16 m_reserved;
};
MxString m_filename;
MXIOINFO m_io;
ChunkHeader m_header;
// If false, read chunks immediately on open, otherwise
// skip reading chunks until ReadChunks is explicitly called.
MxULong m_skipReadingChunks;
};
#endif // MXDSFILE_H