mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
Move Read/Write functions to LegoStorage
base class, match Act1State::Serialize
(#1335)
* Move Read/Write function to LegoStorage base class * Proper const use for vector / BETA match * Match `Act1State::Serialize`
This commit is contained in:

committed by
GitHub

parent
77a3dc0795
commit
70b0f76fa1
@@ -33,6 +33,151 @@ public:
|
||||
// FUNCTION: LEGO1 0x10045af0
|
||||
virtual LegoBool IsReadMode() { return m_mode == c_read; } // vtable+0x18
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
// FUNCTION: BETA10 0x10017bb0
|
||||
LegoStorage* WriteMxString(MxString p_data)
|
||||
{
|
||||
WriteString(p_data.GetData());
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017c80
|
||||
LegoStorage* WriteString(const char* p_data)
|
||||
{
|
||||
LegoS16 length = strlen(p_data);
|
||||
WriteS16(length);
|
||||
Write(p_data, length);
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b0d0
|
||||
LegoStorage* WriteU8(LegoU8 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017ce0
|
||||
LegoStorage* WriteS16(LegoS16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b110
|
||||
LegoStorage* WriteU16(LegoU16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088540
|
||||
LegoStorage* WriteS32(MxS32 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b150
|
||||
LegoStorage* WriteU32(MxU32 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* WriteFloat(LegoFloat p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100343d0
|
||||
LegoStorage* WriteVector(Mx3DPointFloat p_data)
|
||||
{
|
||||
WriteFloat(p_data[0]);
|
||||
WriteFloat(p_data[1]);
|
||||
WriteFloat(p_data[2]);
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10034470
|
||||
LegoStorage* ReadMxString(MxString& p_data)
|
||||
{
|
||||
LegoS16 length;
|
||||
ReadS16(length);
|
||||
|
||||
char* text = new char[length + 1];
|
||||
Read(text, length);
|
||||
|
||||
text[length] = '\0';
|
||||
p_data = text;
|
||||
delete[] text;
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* ReadString(char* p_data)
|
||||
{
|
||||
LegoS16 length;
|
||||
ReadS16(length);
|
||||
Read(p_data, length);
|
||||
p_data[length] = '\0';
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b190
|
||||
LegoStorage* ReadU8(LegoU8& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10024680
|
||||
LegoStorage* ReadS16(LegoS16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b1d0
|
||||
LegoStorage* ReadU16(LegoU16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088580
|
||||
LegoStorage* ReadS32(MxS32& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b210
|
||||
LegoStorage* ReadU32(MxU32& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* ReadFloat(LegoFloat& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10034430
|
||||
LegoStorage* ReadVector(Mx3DPointFloat& p_data)
|
||||
{
|
||||
ReadFloat(p_data[0]);
|
||||
ReadFloat(p_data[1]);
|
||||
ReadFloat(p_data[2]);
|
||||
return this;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10045b00
|
||||
// LegoStorage::`scalar deleting destructor'
|
||||
|
||||
@@ -86,151 +231,6 @@ public:
|
||||
LegoResult SetPosition(LegoU32 p_position) override; // vtable+0x10
|
||||
LegoResult Open(const char* p_name, LegoU32 p_mode);
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
// FUNCTION: BETA10 0x10017bb0
|
||||
LegoStorage* Write(MxString p_data)
|
||||
{
|
||||
Write(p_data.GetData());
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017c80
|
||||
LegoStorage* Write(const char* p_data)
|
||||
{
|
||||
LegoS16 length = strlen(p_data);
|
||||
Write(length);
|
||||
Write(p_data, length);
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b0d0
|
||||
LegoStorage* Write(LegoU8 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017ce0
|
||||
LegoStorage* Write(LegoS16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b110
|
||||
LegoStorage* Write(LegoU16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088540
|
||||
LegoStorage* Write(MxS32 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b150
|
||||
LegoStorage* Write(MxU32 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* Write(LegoFloat p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100343d0
|
||||
LegoStorage* Write(Mx3DPointFloat p_vec)
|
||||
{
|
||||
Write(p_vec[0]);
|
||||
Write(p_vec[1]);
|
||||
Write(p_vec[2]);
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* Read(char* p_data)
|
||||
{
|
||||
LegoS16 length;
|
||||
Read(length);
|
||||
Read(p_data, length);
|
||||
p_data[length] = '\0';
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10034470
|
||||
LegoStorage* Read(MxString& p_data)
|
||||
{
|
||||
LegoS16 length;
|
||||
Read(length);
|
||||
|
||||
char* text = new char[length + 1];
|
||||
Read(text, length);
|
||||
|
||||
text[length] = '\0';
|
||||
p_data = text;
|
||||
delete[] text;
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b190
|
||||
LegoStorage* Read(LegoU8& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10024680
|
||||
LegoStorage* Read(LegoS16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b1d0
|
||||
LegoStorage* Read(LegoU16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088580
|
||||
LegoStorage* Read(MxS32& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b210
|
||||
LegoStorage* Read(MxU32& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoStorage* Read(LegoFloat& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10034430
|
||||
LegoStorage* Read(Mx3DPointFloat& p_vec)
|
||||
{
|
||||
Read(p_vec[0]);
|
||||
Read(p_vec[1]);
|
||||
Read(p_vec[2]);
|
||||
return this;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10099230
|
||||
// LegoFile::`scalar deleting destructor'
|
||||
|
||||
|
Reference in New Issue
Block a user