mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 08:54:15 +00:00
Implement misc.lib (#483)
* Implement misc.lib * Lowercase files * Minor changes * Fix file cases * Fixes * Fix missing dtor * Add override * Match LegoImage::Read * Fix delete call --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -14,7 +14,7 @@ Act1State::Act1State()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10033ac0
|
||||
MxResult Act1State::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult Act1State::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -25,7 +25,7 @@ LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026120
|
||||
MxResult LegoVehicleBuildState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult LegoVehicleBuildState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -18,7 +18,7 @@ AnimState::~AnimState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100652d0
|
||||
MxResult AnimState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult AnimState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "legoanimationmanager.h"
|
||||
#include "legoomni.h"
|
||||
#include "legostate.h"
|
||||
#include "legostream.h"
|
||||
#include "legoutil.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "mxbackgroundaudiomanager.h"
|
||||
@@ -31,6 +30,13 @@ const char* g_playersGSI = "Players.gsi";
|
||||
// STRING: LEGO1 0x100f3e24
|
||||
const char* g_historyGSI = "History.gsi";
|
||||
|
||||
// This is a pointer to the end of the global variable name table, which has
|
||||
// the text "END_OF_VARIABLES" in it.
|
||||
// TODO: make g_endOfVariables reference the actual end of the variable array.
|
||||
// GLOBAL: LEGO1 0x100f3e50
|
||||
// STRING: LEGO1 0x100f3e00
|
||||
const char* g_endOfVariables = "END_OF_VARIABLES";
|
||||
|
||||
// GLOBAL: LEGO1 0x100f3e58
|
||||
ColorStringStruct g_colorSaveData[43] = {
|
||||
{"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, {"c_chbasey0", "lego black"},
|
||||
@@ -119,8 +125,8 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
MxVariableTable* variableTable = VariableTable();
|
||||
MxString savePath;
|
||||
GetFileSavePath(&savePath, p_slot);
|
||||
LegoFileStream fileStream;
|
||||
if (fileStream.Open(savePath.GetData(), LegoStream::c_writeBit) != FAILURE) {
|
||||
LegoFile fileStream;
|
||||
if (fileStream.Open(savePath.GetData(), LegoFile::c_write) != FAILURE) {
|
||||
MxU32 maybeVersion = 0x1000C;
|
||||
fileStream.Write(&maybeVersion, 4);
|
||||
fileStream.Write(&m_unk0x24, 2);
|
||||
@@ -128,12 +134,12 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
fileStream.Write(&m_unk0xc, 1);
|
||||
|
||||
for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) {
|
||||
if (LegoStream::WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE)
|
||||
if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE)
|
||||
return result;
|
||||
}
|
||||
|
||||
if (LegoStream::WriteVariable(&fileStream, variableTable, "backgroundcolor") != FAILURE) {
|
||||
if (LegoStream::WriteVariable(&fileStream, variableTable, "lightposition") != FAILURE) {
|
||||
if (WriteVariable(&fileStream, variableTable, "backgroundcolor") != FAILURE) {
|
||||
if (WriteVariable(&fileStream, variableTable, "lightposition") != FAILURE) {
|
||||
WriteEndOfVariables(&fileStream);
|
||||
|
||||
// TODO: Calls down to more aggregate writing functions
|
||||
@@ -166,8 +172,27 @@ void LegoGameState::SetSavePath(char* p_savePath)
|
||||
m_savePath = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10039f70
|
||||
MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
const char* variableValue = p_from->GetVariable(p_variableName);
|
||||
|
||||
if (variableValue) {
|
||||
MxU8 length = strlen(p_variableName);
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS) {
|
||||
if (p_stream->Write(p_variableName, length) == SUCCESS) {
|
||||
length = strlen(variableValue);
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS)
|
||||
result = p_stream->Write((char*) variableValue, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003a020
|
||||
MxResult LegoGameState::WriteEndOfVariables(LegoStream* p_stream)
|
||||
MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_stream)
|
||||
{
|
||||
MxU8 len = strlen(g_endOfVariables);
|
||||
if (p_stream->Write(&len, 1) == SUCCESS)
|
||||
@@ -175,6 +200,36 @@ MxResult LegoGameState::WriteEndOfVariables(LegoStream* p_stream)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// 95% match, just some instruction ordering differences on the call to
|
||||
// MxVariableTable::SetVariable at the end.
|
||||
// FUNCTION: LEGO1 0x1003a080
|
||||
MxS32 LegoGameState::ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to)
|
||||
{
|
||||
MxS32 result = 1;
|
||||
MxU8 length;
|
||||
|
||||
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
|
||||
char nameBuffer[256];
|
||||
if (p_stream->Read(nameBuffer, length) == SUCCESS) {
|
||||
nameBuffer[length] = '\0';
|
||||
if (strcmp(nameBuffer, g_endOfVariables) == 0)
|
||||
// 2 -> "This was the last entry, done reading."
|
||||
result = 2;
|
||||
else {
|
||||
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
|
||||
char valueBuffer[256];
|
||||
if (p_stream->Read(valueBuffer, length) == SUCCESS) {
|
||||
result = 0;
|
||||
valueBuffer[length] = '\0';
|
||||
p_to->SetVariable(nameBuffer, valueBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003a170
|
||||
void LegoGameState::GetFileSavePath(MxString* p_outPath, MxULong p_slotn)
|
||||
{
|
||||
@@ -312,7 +367,7 @@ void LegoGameState::ScoreStruct::WriteScoreHistory()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003ccf0
|
||||
void LegoGameState::ScoreStruct::FUN_1003ccf0(LegoFileStream&)
|
||||
void LegoGameState::ScoreStruct::FUN_1003ccf0(LegoFile&)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -320,16 +375,16 @@ void LegoGameState::ScoreStruct::FUN_1003ccf0(LegoFileStream&)
|
||||
// FUNCTION: LEGO1 0x1003cdd0
|
||||
void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
|
||||
{
|
||||
LegoFileStream stream;
|
||||
LegoFile stream;
|
||||
MxString savePath(m_savePath);
|
||||
savePath += "\\";
|
||||
savePath += g_historyGSI;
|
||||
|
||||
if (p_flags == LegoStream::c_writeBit) {
|
||||
if (p_flags == LegoFile::c_write) {
|
||||
m_unk0xa6.WriteScoreHistory();
|
||||
}
|
||||
|
||||
if (stream.Open(savePath.GetData(), (LegoStream::OpenFlags) p_flags) == SUCCESS) {
|
||||
if (stream.Open(savePath.GetData(), p_flags) == SUCCESS) {
|
||||
m_unk0xa6.FUN_1003ccf0(stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,23 +20,10 @@ MxBool LegoState::SetFlag()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10005fb0
|
||||
MxResult LegoState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult LegoState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFileStream->IsWriteMode()) {
|
||||
p_legoFileStream->FUN_10006030(this->ClassName());
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(this->ClassName());
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
LegoFileStream* LegoFileStream::FUN_10006030(MxString p_str)
|
||||
{
|
||||
const char* data = p_str.GetData();
|
||||
MxU32 fullLength = strlen(data);
|
||||
|
||||
MxU16 limitedLength = fullLength;
|
||||
Write(&limitedLength, sizeof(limitedLength));
|
||||
Write(data, (MxS16) fullLength);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
|
||||
#include "legostream.h"
|
||||
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
// This is a pointer to the end of the global variable name table, which has
|
||||
// the text "END_OF_VARIABLES" in it.
|
||||
// TODO: make g_endOfVariables reference the actual end of the variable array.
|
||||
// GLOBAL: LEGO1 0x100f3e50
|
||||
// STRING: LEGO1 0x100f3e00
|
||||
const char* g_endOfVariables = "END_OF_VARIABLES";
|
||||
|
||||
// Very likely but not certain sizes.
|
||||
// The classes are only used on the stack in functions we have not 100% matched
|
||||
// yet, we can confirm the size once we have.
|
||||
DECOMP_SIZE_ASSERT(LegoStream, 0x8);
|
||||
DECOMP_SIZE_ASSERT(LegoFileStream, 0xC);
|
||||
DECOMP_SIZE_ASSERT(LegoMemoryStream, 0x10);
|
||||
|
||||
// FUNCTION: LEGO1 0x10039f70
|
||||
MxResult LegoStream::WriteVariable(LegoStream* p_stream, MxVariableTable* p_from, const char* p_variableName)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
const char* variableValue = p_from->GetVariable(p_variableName);
|
||||
|
||||
if (variableValue) {
|
||||
MxU8 length = strlen(p_variableName);
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS) {
|
||||
if (p_stream->Write(p_variableName, length) == SUCCESS) {
|
||||
length = strlen(variableValue);
|
||||
if (p_stream->Write((char*) &length, 1) == SUCCESS)
|
||||
result = p_stream->Write((char*) variableValue, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 95% match, just some instruction ordering differences on the call to
|
||||
// MxVariableTable::SetVariable at the end.
|
||||
// FUNCTION: LEGO1 0x1003a080
|
||||
MxS32 LegoStream::ReadVariable(LegoStream* p_stream, MxVariableTable* p_to)
|
||||
{
|
||||
MxS32 result = 1;
|
||||
MxU8 length;
|
||||
|
||||
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
|
||||
char nameBuffer[256];
|
||||
if (p_stream->Read(nameBuffer, length) == SUCCESS) {
|
||||
nameBuffer[length] = '\0';
|
||||
if (strcmp(nameBuffer, g_endOfVariables) == 0)
|
||||
// 2 -> "This was the last entry, done reading."
|
||||
result = 2;
|
||||
else {
|
||||
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
|
||||
char valueBuffer[256];
|
||||
if (p_stream->Read(valueBuffer, length) == SUCCESS) {
|
||||
result = 0;
|
||||
valueBuffer[length] = '\0';
|
||||
p_to->SetVariable(nameBuffer, valueBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10045ae0
|
||||
MxBool LegoStream::IsWriteMode()
|
||||
{
|
||||
return m_mode == LEGOSTREAM_MODE_WRITE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10045af0
|
||||
MxBool LegoStream::IsReadMode()
|
||||
{
|
||||
return m_mode == LEGOSTREAM_MODE_READ;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099080
|
||||
LegoMemoryStream::LegoMemoryStream(char* p_buffer) : LegoStream()
|
||||
{
|
||||
m_buffer = p_buffer;
|
||||
m_offset = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099160
|
||||
MxResult LegoMemoryStream::Read(void* p_buffer, MxU32 p_size)
|
||||
{
|
||||
memcpy(p_buffer, m_buffer + m_offset, p_size);
|
||||
m_offset += p_size;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099190
|
||||
MxResult LegoMemoryStream::Write(const void* p_buffer, MxU32 p_size)
|
||||
{
|
||||
memcpy(m_buffer + m_offset, p_buffer, p_size);
|
||||
m_offset += p_size;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100991c0
|
||||
LegoFileStream::LegoFileStream() : LegoStream()
|
||||
{
|
||||
m_hFile = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099250
|
||||
LegoFileStream::~LegoFileStream()
|
||||
{
|
||||
if (m_hFile != NULL)
|
||||
fclose(m_hFile);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100992c0
|
||||
MxResult LegoFileStream::Read(void* p_buffer, MxU32 p_size)
|
||||
{
|
||||
if (m_hFile == NULL)
|
||||
return FAILURE;
|
||||
|
||||
return (fread(p_buffer, 1, p_size, m_hFile) == p_size) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099300
|
||||
MxResult LegoFileStream::Write(const void* p_buffer, MxU32 p_size)
|
||||
{
|
||||
if (m_hFile == NULL)
|
||||
return FAILURE;
|
||||
|
||||
return (fwrite(p_buffer, 1, p_size, m_hFile) == p_size) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099340
|
||||
MxResult LegoFileStream::Tell(MxU32* p_offset)
|
||||
{
|
||||
if (m_hFile == NULL)
|
||||
return FAILURE;
|
||||
|
||||
int got = ftell(m_hFile);
|
||||
if (got == -1)
|
||||
return FAILURE;
|
||||
|
||||
*p_offset = got;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099370
|
||||
MxResult LegoFileStream::Seek(MxU32 p_offset)
|
||||
{
|
||||
if (m_hFile == NULL)
|
||||
return FAILURE;
|
||||
|
||||
return (fseek(m_hFile, p_offset, 0) == 0) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100993a0
|
||||
MxResult LegoFileStream::Open(const char* p_filename, OpenFlags p_mode)
|
||||
{
|
||||
char modeString[4];
|
||||
|
||||
if (m_hFile != NULL)
|
||||
fclose(m_hFile);
|
||||
|
||||
modeString[0] = '\0';
|
||||
if (p_mode & c_readBit) {
|
||||
m_mode = LEGOSTREAM_MODE_READ;
|
||||
strcat(modeString, "r");
|
||||
}
|
||||
|
||||
if (p_mode & c_writeBit) {
|
||||
if (m_mode != LEGOSTREAM_MODE_READ)
|
||||
m_mode = LEGOSTREAM_MODE_WRITE;
|
||||
strcat(modeString, "w");
|
||||
}
|
||||
|
||||
if ((p_mode & c_binaryBit) != 0)
|
||||
strcat(modeString, "b");
|
||||
else
|
||||
strcat(modeString, "t");
|
||||
|
||||
return (m_hFile = fopen(p_filename, modeString)) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994a0
|
||||
MxResult LegoMemoryStream::Tell(MxU32* p_offset)
|
||||
{
|
||||
*p_offset = m_offset;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994b0
|
||||
MxResult LegoMemoryStream::Seek(MxU32 p_offset)
|
||||
{
|
||||
m_offset = p_offset;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "legounksavedatawriter.h"
|
||||
|
||||
#include "legogamestate.h"
|
||||
#include "legostream.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108);
|
||||
@@ -10,7 +9,7 @@ DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108);
|
||||
LegoSaveDataEntry3 g_saveData3[66];
|
||||
|
||||
// FUNCTION: LEGO1 0x10083310
|
||||
MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStream* p_stream)
|
||||
MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ GasStationState::GasStationState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10006300
|
||||
MxResult GasStationState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult GasStationState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -20,7 +20,7 @@ AmbulanceMissionState::AmbulanceMissionState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10037440
|
||||
MxResult AmbulanceMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult AmbulanceMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -14,7 +14,7 @@ HospitalState::HospitalState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10076530
|
||||
MxResult HospitalState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult HospitalState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20)
|
||||
DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0)
|
||||
|
||||
// STUB: LEGO1 0x100393c0
|
||||
MxResult PizzaMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult PizzaMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -7,7 +7,7 @@ PizzeriaState::PizzeriaState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10017da0
|
||||
MxResult PizzeriaState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult PizzeriaState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -12,18 +12,18 @@ PoliceState::PoliceState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
MxResult PoliceState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult PoliceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFileStream->IsWriteMode()) {
|
||||
p_legoFileStream->FUN_10006030(ClassName());
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(ClassName());
|
||||
}
|
||||
|
||||
if (p_legoFileStream->IsReadMode()) {
|
||||
p_legoFileStream->Read(&m_unk0x8, sizeof(m_unk0x8));
|
||||
if (p_legoFile->IsReadMode()) {
|
||||
p_legoFile->Read(&m_unk0x8, sizeof(m_unk0x8));
|
||||
}
|
||||
else {
|
||||
undefined4 unk0x8 = m_unk0x8;
|
||||
p_legoFileStream->Write(&unk0x8, sizeof(m_unk0x8));
|
||||
p_legoFile->Write(&unk0x8, sizeof(m_unk0x8));
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -12,7 +12,7 @@ RaceState::RaceState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10016140
|
||||
MxResult RaceState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult RaceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
|
||||
@@ -21,54 +21,54 @@ TowTrackMissionState::TowTrackMissionState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dde0
|
||||
MxResult TowTrackMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
|
||||
MxResult TowTrackMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFileStream->IsWriteMode()) {
|
||||
p_legoFileStream->FUN_10006030(this->ClassName());
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(this->ClassName());
|
||||
}
|
||||
|
||||
if (p_legoFileStream->IsReadMode()) {
|
||||
p_legoFileStream->Read(&m_unk0x12, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_unk0x14, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_unk0x16, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_unk0x18, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_unk0x1a, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_unk0x1c, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_color1, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_color2, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_color3, sizeof(MxU16));
|
||||
p_legoFileStream->Read(&m_color4, sizeof(MxU16));
|
||||
if (p_legoFile->IsReadMode()) {
|
||||
p_legoFile->Read(&m_unk0x12, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_unk0x14, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_unk0x16, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_unk0x18, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_unk0x1a, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_unk0x1c, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_color1, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_color2, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_color3, sizeof(MxU16));
|
||||
p_legoFile->Read(&m_color4, sizeof(MxU16));
|
||||
}
|
||||
else if (p_legoFileStream->IsWriteMode()) {
|
||||
else if (p_legoFile->IsWriteMode()) {
|
||||
MxU16 write = m_unk0x12;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_unk0x14;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_unk0x16;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_unk0x18;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_unk0x1a;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_unk0x1c;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_color1;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_color2;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_color3;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
|
||||
write = m_color4;
|
||||
p_legoFileStream->Write(&write, sizeof(MxU16));
|
||||
p_legoFile->Write(&write, sizeof(MxU16));
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "legoanimpresenter.h"
|
||||
|
||||
#include "legoomni.h"
|
||||
#include "legostream.h"
|
||||
#include "legoworld.h"
|
||||
#include "mxcompositepresenter.h"
|
||||
#include "mxdsanim.h"
|
||||
@@ -60,7 +59,7 @@ void LegoAnimPresenter::Destroy(MxBool p_fromDestructor)
|
||||
MxResult LegoAnimPresenter::VTable0x88(MxStreamChunk* p_chunk)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
LegoMemoryStream stream((char*) p_chunk->GetData());
|
||||
LegoMemory stream((char*) p_chunk->GetData());
|
||||
|
||||
MxS32 magicSig;
|
||||
MxS32 val2 = 0;
|
||||
@@ -238,7 +237,7 @@ LegoAnimClass::~LegoAnimClass()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a0c70
|
||||
MxResult LegoAnimClass::VTable0x10(LegoMemoryStream* p_stream, MxS32)
|
||||
MxResult LegoAnimClass::VTable0x10(LegoMemory* p_stream, MxS32)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "legopalettepresenter.h"
|
||||
|
||||
#include "lego/sources/misc/legostorage.h"
|
||||
#include "legoomni.h"
|
||||
#include "legostream.h"
|
||||
#include "legovideomanager.h"
|
||||
#include "mxstreamchunk.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ MxResult LegoPalettePresenter::ParsePalette(MxStreamChunk* p_chunk)
|
||||
RGBQUAD palette[256];
|
||||
MxResult result = FAILURE;
|
||||
|
||||
LegoMemoryStream stream((char*) p_chunk->GetData());
|
||||
LegoMemory stream((char*) p_chunk->GetData());
|
||||
if (stream.Read(buffer, sizeof(buffer)) == SUCCESS) {
|
||||
if (stream.Read(palette, sizeof(palette)) == SUCCESS) {
|
||||
m_palette = new MxPalette(palette);
|
||||
|
||||
Reference in New Issue
Block a user