Isle
Loading...
Searching...
No Matches
mxdschunk.h
Go to the documentation of this file.
1#ifndef MXDSCHUNK_H
2#define MXDSCHUNK_H
3
4#include "decomp.h"
5#include "mxcore.h"
6#include "mxtypes.h"
7
10#define DS_CHUNK_BIT1 0x01
11
14#define DS_CHUNK_END_OF_STREAM 0x02
15
18#define DS_CHUNK_BIT3 0x04
19
22#define DS_CHUNK_SPLIT 0x10
23
26#define DS_CHUNK_BIT16 0x8000
27
35// VTABLE: LEGO1 0x100dc7f8
36// VTABLE: BETA10 0x101c23d0
37// SIZE 0x1c
38class MxDSChunk : public MxCore {
39public:
41 MxDSChunk();
42
44 ~MxDSChunk() override;
45
47 const char* ClassName() const override // vtable+0x0c
48 {
49 // STRING: LEGO1 0x10101e6c
50 return "MxDSChunk";
51 }
52
56 MxBool IsA(const char* p_name) const override // vtable+0x10
57 {
58 return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name);
59 }
60
63 static MxU32 GetHeaderSize();
64
68 static MxU32 Size(MxU8* p_buffer) { return (*(MxU32*) (p_buffer + 4) & 1) + *(MxU32*) (p_buffer + 4) + 8; }
69
73 static MxU8* End(MxU8* p_buffer) { return p_buffer + Size(p_buffer); }
74
77 void SetChunkFlags(MxU16 p_flags) { m_flags = p_flags; }
78
81 void SetObjectId(undefined4 p_objectid) { m_objectId = p_objectid; }
82
85 void SetTime(MxLong p_time) { m_time = p_time; }
86
89 void SetLength(MxU32 p_length) { m_length = p_length; }
90
93 void SetData(MxU8* p_data) { m_data = p_data; }
94
97
100
102 MxLong GetTime() { return m_time; }
103
106
108 MxU8* GetData() { return m_data; }
109
111 void Release()
112 {
113 if (m_data) {
114 delete[] m_data;
115 }
116 }
117
118 // SYNTHETIC: LEGO1 0x100be150
119 // SYNTHETIC: BETA10 0x101474c0
120 // MxDSChunk::`scalar deleting destructor'
121
122protected:
128};
129
130#endif // MXDSCHUNK_H
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
virtual MxBool IsA(const char *p_name) const
[AI] Checks whether this object's class type or parents match the given name.
Definition: mxcore.h:46
[AI] Represents a chunk of data extracted from a stream (typically from a Mindscape/Mx SI file or str...
Definition: mxdschunk.h:38
static MxU32 GetHeaderSize()
[AI] Returns the fixed size of the chunk header, typically used for parsing binary streams.
Definition: mxdschunk.cpp:27
static MxU32 Size(MxU8 *p_buffer)
[AI] Returns the total size (header + data) of a chunk from a raw buffer pointer.
Definition: mxdschunk.h:68
const char * ClassName() const override
[AI] Returns the class name ("MxDSChunk") for runtime type identification. [AI]
Definition: mxdschunk.h:47
MxBool IsA(const char *p_name) const override
[AI] Checks if this object or any parent class matches the provided class name string.
Definition: mxdschunk.h:56
undefined4 GetObjectId()
[AI] Returns the object id of this chunk. [AI]
Definition: mxdschunk.h:99
MxU32 GetLength()
[AI] Returns the length in bytes of the data payload. [AI]
Definition: mxdschunk.h:105
void Release()
[AI] Releases (deletes) data payload if present, regardless of flags; call to explicitly free memory ...
Definition: mxdschunk.h:111
MxLong m_time
[AI] Timestamp (tick/frame) value for the chunk. Used for ordering, sequencing, and synchronization....
Definition: mxdschunk.h:125
MxU32 m_objectId
[AI] Logical id field linking chunk to a resource, action, or entity. [AI]
Definition: mxdschunk.h:124
MxLong GetTime()
[AI] Returns the time (timestamp or tick) associated with this chunk. [AI]
Definition: mxdschunk.h:102
void SetData(MxU8 *p_data)
[AI] Sets the pointer to the raw payload data (may or may not be owned by chunk object).
Definition: mxdschunk.h:93
MxU8 * GetData()
[AI] Returns a pointer to the start of the data payload. [AI]
Definition: mxdschunk.h:108
static MxU8 * End(MxU8 *p_buffer)
[AI] Returns a pointer to the end of this chunk for sequential iteration through a chunked buffer.
Definition: mxdschunk.h:73
~MxDSChunk() override
[AI] Virtual destructor. Cleans up any owned chunk data if flagged by DS_CHUNK_BIT1....
Definition: mxdschunk.cpp:18
void SetChunkFlags(MxU16 p_flags)
[AI] Sets all chunk header flag bits.
Definition: mxdschunk.h:77
void SetObjectId(undefined4 p_objectid)
[AI] Sets the object id for this chunk (links chunk data to logical entity, resource,...
Definition: mxdschunk.h:81
MxU16 m_flags
[AI] Flag bitfield indicating properties/status of the chunk. See DS_CHUNK_* defines....
Definition: mxdschunk.h:123
MxU16 GetChunkFlags()
[AI] Returns the chunk's flag bitfield. [AI]
Definition: mxdschunk.h:96
MxU32 m_length
[AI] Number of bytes of data in this chunk's payload. [AI]
Definition: mxdschunk.h:126
MxDSChunk()
[AI] Constructs a new, empty chunk. All members initialized to safe defaults. [AI]
Definition: mxdschunk.cpp:7
void SetLength(MxU32 p_length)
[AI] Sets the payload data length for this chunk.
Definition: mxdschunk.h:89
MxU8 * m_data
[AI] Pointer to chunk's raw data buffer. Ownership is determined by DS_CHUNK_BIT1 flag and usage cont...
Definition: mxdschunk.h:127
void SetTime(MxLong p_time)
[AI] Sets the time (timestamp/tick/frame) associated with this chunk.
Definition: mxdschunk.h:85
#define override
Definition: compat.h:21
unsigned int undefined4
Definition: decomp.h:28
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
unsigned short MxU16
[AI]
Definition: mxtypes.h:20
unsigned int MxU32
[AI]
Definition: mxtypes.h:32