isle/LEGO1/omni/include/mxdsfile.h

84 lines
2.3 KiB
C
Raw Normal View History

2023-04-27 22:19:39 -04:00
#ifndef MXDSFILE_H
#define MXDSFILE_H
#include "mxdssource.h"
#include "mxio.h"
#include "mxstring.h"
#include "mxtypes.h"
#include <windows.h>
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// VTABLE: LEGO1 0x100dc890
2024-09-01 20:08:53 -04:00
// VTABLE: BETA10 0x101c2418
// SIZE 0x7c
2023-10-24 19:38:27 -04:00
class MxDSFile : public MxDSSource {
2023-04-27 22:19:39 -04:00
public:
MxDSFile(const char* p_filename, MxULong p_skipReadingChunks);
#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
2024-09-01 20:08:53 -04:00
// FUNCTION: BETA10 0x10148ac0
__declspec(dllexport) ~MxDSFile() override { Close(); }
#endif
2023-10-24 19:38:27 -04:00
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x100c0120
2024-09-01 20:08:53 -04:00
// FUNCTION: BETA10 0x10148dc0
const char* ClassName() const override // vtable+0x0c
2023-10-24 19:38:27 -04:00
{
// STRING: LEGO1 0x10102594
2023-10-24 19:38:27 -04:00
return "MxDSFile";
}
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x100c0130
2024-09-01 20:08:53 -04:00
// FUNCTION: BETA10 0x10148de0
MxBool IsA(const char* p_name) const override // vtable+0x10
2023-10-24 19:38:27 -04:00
{
return !strcmp(p_name, MxDSFile::ClassName()) || MxDSSource::IsA(p_name);
2023-10-24 19:38:27 -04:00
}
2024-09-01 20:08:53 -04:00
MxResult Open(MxULong) override; // vtable+0x14
MxResult Close() override; // vtable+0x18
MxResult Read(unsigned char*, MxULong) override; // vtable+0x20
2024-09-01 20:08:53 -04:00
MxResult Seek(MxLong, int) override; // vtable+0x24
MxULong GetBufferSize() override; // vtable+0x28
MxULong GetStreamBuffersNum() override; // vtable+0x2c
2024-09-01 20:08:53 -04:00
// FUNCTION: BETA10 0x1015e110
void SetFileName(const char* p_filename) { m_filename = p_filename; }
MxS32 CalcFileSize() { return GetFileSize(m_io.m_info.hmmio, NULL); }
// SYNTHETIC: LEGO1 0x100c01e0
2024-09-01 20:08:53 -04:00
// SYNTHETIC: BETA10 0x10148e40
// MxDSFile::`scalar deleting destructor'
// SIZE 0x0c
2023-10-24 19:38:27 -04:00
struct ChunkHeader {
2024-09-01 20:08:53 -04:00
// FUNCTION: BETA10 0x1015e040
ChunkHeader() : m_majorVersion(0), m_minorVersion(0), m_bufferSize(0), m_streamBuffersNum(0) {}
2023-10-24 19:38:27 -04:00
2024-09-01 20:08:53 -04:00
MxS16 m_majorVersion; // 0x00
MxS16 m_minorVersion; // 0x02
MxULong m_bufferSize; // 0x04
MxS16 m_streamBuffersNum; // 0x08
MxS16 m_reserved; // 0x0a
2023-10-24 19:38:27 -04:00
};
private:
2024-09-01 20:08:53 -04:00
MxResult 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.
MxULong m_skipReadingChunks; // 0x78
2023-04-27 22:19:39 -04:00
};
#endif // MXDSFILE_H