More fixes

This commit is contained in:
Christian Semmler 2023-12-12 10:57:28 -05:00
parent 13b5d95512
commit aed1d26f81
26 changed files with 122 additions and 122 deletions

View File

@ -3,7 +3,7 @@
DECOMP_SIZE_ASSERT(MxAudioManager, 0x30); DECOMP_SIZE_ASSERT(MxAudioManager, 0x30);
// GLOBAL: LEGO1 0x10102108 // GLOBAL: LEGO1 0x10102108
MxS32 MxAudioManager::s_count = 0; MxS32 MxAudioManager::g_count = 0;
// FUNCTION: LEGO1 0x10029910 // FUNCTION: LEGO1 0x10029910
MxS32 MxAudioManager::GetVolume() MxS32 MxAudioManager::GetVolume()
@ -33,7 +33,7 @@ void MxAudioManager::Init()
void MxAudioManager::Destroy(MxBool p_fromDestructor) void MxAudioManager::Destroy(MxBool p_fromDestructor)
{ {
this->m_criticalSection.Enter(); this->m_criticalSection.Enter();
s_count--; g_count--;
Init(); Init();
this->m_criticalSection.Leave(); this->m_criticalSection.Leave();
@ -51,7 +51,7 @@ MxResult MxAudioManager::InitPresenters()
this->m_criticalSection.Enter(); this->m_criticalSection.Enter();
success = TRUE; success = TRUE;
result = SUCCESS; result = SUCCESS;
s_count++; g_count++;
} }
if (result) if (result)

View File

@ -18,7 +18,7 @@ class MxAudioManager : public MxMediaManager {
private: private:
void Destroy(MxBool p_fromDestructor); void Destroy(MxBool p_fromDestructor);
static MxS32 s_count; static MxS32 g_count;
protected: protected:
void Init(); void Init();

View File

@ -13,7 +13,7 @@ class MxDeviceModeFinder {
MxDeviceModeFinder(); MxDeviceModeFinder();
~MxDeviceModeFinder(); ~MxDeviceModeFinder();
undefined4 m_unk0xnown[56]; undefined4 m_pad[56];
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // +0xe0 MxDirectDraw::DeviceModesInfo* m_deviceInfo; // +0xe0
}; };

View File

@ -301,7 +301,7 @@ BOOL MxDirectDraw::IsSupportedMode(int width, int height, int bpp)
{ {
Mode mode = {width, height, bpp}; Mode mode = {width, height, bpp};
for (int i = 0; i < m_pCurrentDeviceModesList->count; i++) { for (int i = 0; i < m_pCurrentDeviceModesList->m_count; i++) {
if (m_pCurrentDeviceModesList->m_modeArray[i] == mode) { if (m_pCurrentDeviceModesList->m_modeArray[i] == mode) {
return TRUE; return TRUE;
} }
@ -892,21 +892,21 @@ int MxDirectDraw::FlipToGDISurface()
void MxDirectDraw::Error(const char* p_message, MxS32 p_error) void MxDirectDraw::Error(const char* p_message, MxS32 p_error)
{ {
// GLOBAL: LEGO1 0x10100c70 // GLOBAL: LEGO1 0x10100c70
static BOOL s_isInsideError = FALSE; static BOOL g_isInsideError = FALSE;
if (!s_isInsideError) { if (!g_isInsideError) {
s_isInsideError = TRUE; g_isInsideError = TRUE;
Destroy(); Destroy();
if (m_pErrorHandler) { if (m_pErrorHandler) {
m_pErrorHandler(p_message, p_error, m_pErrorHandlerArg); m_pErrorHandler(p_message, p_error, m_pErrorHandlerArg);
} }
s_isInsideError = FALSE; g_isInsideError = FALSE;
} }
} }
// FUNCTION: LEGO1 0x1009e880 // FUNCTION: LEGO1 0x1009e880
const char* MxDirectDraw::ErrorToString(HRESULT error) const char* MxDirectDraw::ErrorToString(HRESULT p_error)
{ {
switch (error) { switch (p_error) {
case DD_OK: case DD_OK:
return "No error.\0"; return "No error.\0";
case DDERR_ALREADYINITIALIZED: case DDERR_ALREADYINITIALIZED:

View File

@ -31,9 +31,9 @@ class MxDirectDraw {
struct DeviceModesInfo { struct DeviceModesInfo {
GUID* m_guid; GUID* m_guid;
Mode* m_modeArray; Mode* m_modeArray;
MxS32 count; MxS32 m_count;
DDCAPS m_ddcaps; DDCAPS m_ddcaps;
void* m_178; void* m_unk0x178;
DeviceModesInfo(); DeviceModesInfo();
~DeviceModesInfo(); ~DeviceModesInfo();
@ -59,7 +59,7 @@ class MxDirectDraw {
BOOL m_bIgnoreWMSIZE; BOOL m_bIgnoreWMSIZE;
BOOL m_bPrimaryPalettized; BOOL m_bPrimaryPalettized;
BOOL m_bFullScreen; BOOL m_bFullScreen;
void* m_850; void* m_unk0x850;
BOOL m_bOnlySystemMemory; BOOL m_bOnlySystemMemory;
BOOL m_bIsOnPrimaryDevice; BOOL m_bIsOnPrimaryDevice;
ErrorHandler m_pErrorHandler; ErrorHandler m_pErrorHandler;
@ -91,7 +91,7 @@ class MxDirectDraw {
); );
virtual void Destroy(); virtual void Destroy();
virtual void DestroyButNotDirectDraw(); virtual void DestroyButNotDirectDraw();
virtual const char* ErrorToString(HRESULT error); virtual const char* ErrorToString(HRESULT p_error);
protected: protected:
BOOL CacheOriginalPaletteEntries(); BOOL CacheOriginalPaletteEntries();

View File

@ -71,7 +71,7 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource)
} }
// STUB: LEGO1 0x100d15e0 // STUB: LEGO1 0x100d15e0
void MxDiskStreamProvider::VTable0x20(undefined4 p_unknown1) void MxDiskStreamProvider::VTable0x20(undefined4)
{ {
// TODO // TODO
} }

View File

@ -49,7 +49,7 @@ class MxDiskStreamProvider : public MxStreamProvider {
virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14
virtual MxU32 GetFileSize() override; // vtable+0x18 virtual MxU32 GetFileSize() override; // vtable+0x18
virtual MxU32 GetStreamBuffersNum() override; // vtable+0x1c virtual MxU32 GetStreamBuffersNum() override; // vtable+0x1c
virtual void VTable0x20(undefined4 p_unknown1) override; // vtable+0x20 virtual void VTable0x20(undefined4) override; // vtable+0x20
virtual MxU32 GetLengthInDWords() override; // vtable+0x24 virtual MxU32 GetLengthInDWords() override; // vtable+0x24
virtual MxU32* GetBufferForDWords() override; // vtable+0x28 virtual MxU32* GetBufferForDWords() override; // vtable+0x28

View File

@ -119,10 +119,10 @@ MxResult MxDSBuffer::SetBufferPointer(MxU32* p_buffer, MxU32 p_size)
} }
// FUNCTION: LEGO1 0x100c6f80 // FUNCTION: LEGO1 0x100c6f80
void MxDSBuffer::FUN_100c6f80(MxU32 p_unk) void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset)
{ {
if (p_unk < m_writeOffset) { if (p_writeOffset < m_writeOffset) {
m_pIntoBuffer2 = m_pBuffer + p_unk; m_pIntoBuffer2 = m_pBuffer + p_writeOffset;
m_pIntoBuffer = m_pBuffer + p_unk; m_pIntoBuffer = m_pBuffer + p_writeOffset;
} }
} }

View File

@ -27,7 +27,7 @@ class MxDSBuffer : public MxCore {
MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode); MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode);
MxResult SetBufferPointer(MxU32* p_buffer, MxU32 p_size); MxResult SetBufferPointer(MxU32* p_buffer, MxU32 p_size);
void FUN_100c6f80(MxU32 p_unk); void FUN_100c6f80(MxU32 p_writeOffset);
inline MxU8* GetBuffer() { return m_pBuffer; } inline MxU8* GetBuffer() { return m_pBuffer; }
inline MxU32 GetWriteOffset() { return m_writeOffset; } inline MxU32 GetWriteOffset() { return m_writeOffset; }

View File

@ -33,7 +33,7 @@ class MxDSChunk : public MxCore {
return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name);
} }
inline void SetFlags(MxU16 flags) { m_flags = flags; } inline void SetFlags(MxU16 p_flags) { m_flags = p_flags; }
inline void SetTime(MxLong p_time) { m_time = p_time; } inline void SetTime(MxLong p_time) { m_time = p_time; }
inline void SetLength(MxU32 p_length) { m_length = p_length; } inline void SetLength(MxU32 p_length) { m_length = p_length; }
inline void SetData(MxU8* p_data) { m_data = p_data; } inline void SetData(MxU8* p_data) { m_data = p_data; }

View File

@ -12,20 +12,20 @@ MxDSFile::~MxDSFile()
} }
// FUNCTION: LEGO1 0x100cc4b0 // FUNCTION: LEGO1 0x100cc4b0
MxDSFile::MxDSFile(const char* filename, MxULong skipReadingChunks) MxDSFile::MxDSFile(const char* p_filename, MxULong p_skipReadingChunks)
{ {
m_filename = filename; m_filename = p_filename;
m_skipReadingChunks = skipReadingChunks; m_skipReadingChunks = p_skipReadingChunks;
} }
// FUNCTION: LEGO1 0x100cc590 // FUNCTION: LEGO1 0x100cc590
MxLong MxDSFile::Open(MxULong uStyle) MxLong MxDSFile::Open(MxULong p_uStyle)
{ {
MXIOINFO& io = m_io; MXIOINFO& io = m_io;
MxLong longResult = 1; MxLong longResult = 1;
memset(&io, 0, sizeof(MXIOINFO)); memset(&io, 0, sizeof(MXIOINFO));
if (io.Open(m_filename.GetData(), uStyle) != 0) { if (io.Open(m_filename.GetData(), p_uStyle) != 0) {
return -1; return -1;
} }
@ -63,7 +63,7 @@ MxLong MxDSFile::ReadChunks()
} }
m_io.Read(&m_header, 0xc); m_io.Read(&m_header, 0xc);
if ((m_header.majorVersion == SI_MAJOR_VERSION) && (m_header.minorVersion == SI_MINOR_VERSION)) { if ((m_header.m_majorVersion == SI_MAJOR_VERSION) && (m_header.m_minorVersion == SI_MINOR_VERSION)) {
childChunk.ckid = FOURCC('M', 'x', 'O', 'f'); childChunk.ckid = FOURCC('M', 'x', 'O', 'f');
if (m_io.Descend(&childChunk, &topChunk, 0) != 0) { if (m_io.Descend(&childChunk, &topChunk, 0) != 0) {
return -1; return -1;
@ -106,19 +106,19 @@ MxResult MxDSFile::Read(unsigned char* p_buf, MxULong p_nbytes)
} }
// FUNCTION: LEGO1 0x100cc7b0 // FUNCTION: LEGO1 0x100cc7b0
MxLong MxDSFile::Seek(MxLong lOffset, int iOrigin) MxLong MxDSFile::Seek(MxLong p_lOffset, MxS32 p_iOrigin)
{ {
return (m_position = m_io.Seek(lOffset, iOrigin)) == -1 ? -1 : 0; return (m_position = m_io.Seek(p_lOffset, p_iOrigin)) == -1 ? -1 : 0;
} }
// FUNCTION: LEGO1 0x100cc7e0 // FUNCTION: LEGO1 0x100cc7e0
MxULong MxDSFile::GetBufferSize() MxULong MxDSFile::GetBufferSize()
{ {
return m_header.bufferSize; return m_header.m_bufferSize;
} }
// FUNCTION: LEGO1 0x100cc7f0 // FUNCTION: LEGO1 0x100cc7f0
MxULong MxDSFile::GetStreamBuffersNum() MxULong MxDSFile::GetStreamBuffersNum()
{ {
return m_header.streamBuffersNum; return m_header.m_streamBuffersNum;
} }

View File

@ -9,7 +9,7 @@
// VTABLE: LEGO1 0x100dc890 // VTABLE: LEGO1 0x100dc890
class MxDSFile : public MxDSSource { class MxDSFile : public MxDSSource {
public: public:
__declspec(dllexport) MxDSFile(const char* filename, MxULong skipReadingChunks); __declspec(dllexport) MxDSFile(const char* p_filename, MxULong p_skipReadingChunks);
__declspec(dllexport) virtual ~MxDSFile(); // vtable+0x0 __declspec(dllexport) virtual ~MxDSFile(); // vtable+0x0
// FUNCTION: LEGO1 0x100c0120 // FUNCTION: LEGO1 0x100c0120
@ -37,13 +37,13 @@ class MxDSFile : public MxDSSource {
private: private:
MxLong ReadChunks(); MxLong ReadChunks();
struct ChunkHeader { struct ChunkHeader {
ChunkHeader() : majorVersion(0), minorVersion(0), bufferSize(0), streamBuffersNum(0) {} ChunkHeader() : m_majorVersion(0), m_minorVersion(0), m_bufferSize(0), m_streamBuffersNum(0) {}
MxU16 majorVersion; MxU16 m_majorVersion;
MxU16 minorVersion; MxU16 m_minorVersion;
MxULong bufferSize; MxULong m_bufferSize;
MxS16 streamBuffersNum; MxS16 m_streamBuffersNum;
MxS16 reserved; MxS16 m_reserved;
}; };
MxString m_filename; MxString m_filename;

View File

@ -53,14 +53,14 @@ MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction)
} }
// FUNCTION: LEGO1 0x100ca290 // FUNCTION: LEGO1 0x100ca290
void MxDSMultiAction::SetUnknown90(MxLong p_unkTimingField) void MxDSMultiAction::SetUnknown90(MxLong p_unk0x90)
{ {
this->m_unk0x90 = p_unkTimingField; this->m_unk0x90 = p_unk0x90;
MxDSActionListCursor cursor(this->m_actions); MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action; MxDSAction* action;
while (cursor.Next(action)) while (cursor.Next(action))
action->SetUnknown90(p_unkTimingField); action->SetUnknown90(p_unk0x90);
} }
// FUNCTION: LEGO1 0x100ca370 // FUNCTION: LEGO1 0x100ca370
@ -102,14 +102,14 @@ MxDSAction* MxDSMultiAction::Clone()
} }
// FUNCTION: LEGO1 0x100ca5e0 // FUNCTION: LEGO1 0x100ca5e0
undefined4 MxDSMultiAction::unk14() undefined4 MxDSMultiAction::VTable0x14()
{ {
undefined4 result = MxDSAction::unk14(); undefined4 result = MxDSAction::VTable0x14();
MxDSActionListCursor cursor(this->m_actions); MxDSActionListCursor cursor(this->m_actions);
MxDSAction* action; MxDSAction* action;
while (cursor.Next(action)) while (cursor.Next(action))
result += action->unk14(); result += action->VTable0x14();
return result; return result;
} }

View File

@ -27,14 +27,14 @@ class MxDSMultiAction : public MxDSAction {
return !strcmp(p_name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(p_name); return !strcmp(p_name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(p_name);
} }
virtual undefined4 unk14() override; // vtable+14; virtual undefined4 VTable0x14() override; // vtable+14;
virtual MxU32 GetSizeOnDisk() override; // vtable+18; virtual MxU32 GetSizeOnDisk() override; // vtable+18;
virtual void Deserialize(char** p_source, MxS16 p_unk0x24) override; // vtable+1c; virtual void Deserialize(char** p_source, MxS16 p_unk0x24) override; // vtable+1c;
virtual void SetAtomId(MxAtomId p_atomId) override; // vtable+20; virtual void SetAtomId(MxAtomId p_atomId) override; // vtable+20;
virtual MxDSAction* Clone() override; // vtable+2c; virtual MxDSAction* Clone() override; // vtable+2c;
virtual void MergeFrom(MxDSAction& p_dsAction) override; // vtable+30; virtual void MergeFrom(MxDSAction& p_dsAction) override; // vtable+30;
virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34; virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34;
virtual void SetUnknown90(MxLong p_unkTimingField) override; // vtable+38; virtual void SetUnknown90(MxLong p_unk0x90) override; // vtable+38;
inline MxDSActionList* GetActionList() const { return m_actions; }; inline MxDSActionList* GetActionList() const { return m_actions; };

View File

@ -99,7 +99,7 @@ void MxDSObject::SetSourceName(const char* p_sourceName)
} }
// FUNCTION: LEGO1 0x100bf9c0 // FUNCTION: LEGO1 0x100bf9c0
undefined4 MxDSObject::unk14() undefined4 MxDSObject::VTable0x14()
{ {
return 10; return 10;
} }

View File

@ -32,7 +32,7 @@ class MxDSObject : public MxCore {
return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name);
}; // vtable+10; }; // vtable+10;
virtual undefined4 unk14(); // vtable+14; virtual undefined4 VTable0x14(); // vtable+14;
virtual MxU32 GetSizeOnDisk(); // vtable+18; virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char** p_source, MxS16 p_unk0x24); // vtable+1c; virtual void Deserialize(char** p_source, MxS16 p_unk0x24); // vtable+1c;
inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20; inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20;

View File

@ -79,7 +79,7 @@ void MxDSStreamingAction::SetInternalAction(MxDSAction* p_dsAction)
} }
// FUNCTION: LEGO1 0x100cd2d0 // FUNCTION: LEGO1 0x100cd2d0
void MxDSStreamingAction::FUN_100CD2D0() void MxDSStreamingAction::FUN_100cd2d0()
{ {
if (this->m_duration == -1) if (this->m_duration == -1)
return; return;

View File

@ -29,7 +29,7 @@ class MxDSStreamingAction : public MxDSAction {
MxResult Init(); MxResult Init();
void SetInternalAction(MxDSAction* p_dsAction); void SetInternalAction(MxDSAction* p_dsAction);
void FUN_100CD2D0(); void FUN_100cd2d0();
private: private:
MxU32 m_unk0x94; MxU32 m_unk0x94;

View File

@ -57,7 +57,7 @@ class MxHashTable : protected MxCollection<T> {
friend class MxHashTableCursor<T>; friend class MxHashTableCursor<T>;
protected: protected:
void _NodeInsert(MxHashTableNode<T>*); void NodeInsert(MxHashTableNode<T>*);
MxHashTableNode<T>** m_slots; // 0x10 MxHashTableNode<T>** m_slots; // 0x10
MxU32 m_numSlots; // 0x14 MxU32 m_numSlots; // 0x14
@ -173,8 +173,8 @@ inline void MxHashTable<T>::Resize()
{ {
// Save a reference to the current table // Save a reference to the current table
// so we can walk nodes and re-insert // so we can walk nodes and re-insert
MxU32 old_size = m_numSlots; MxU32 oldSize = m_numSlots;
MxHashTableNode<T>** old_table = m_slots; MxHashTableNode<T>** oldTable = m_slots;
switch (m_resizeOption) { switch (m_resizeOption) {
case HashTableOpt_ExpandAdd: case HashTableOpt_ExpandAdd:
@ -190,21 +190,21 @@ inline void MxHashTable<T>::Resize()
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots); memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
this->m_count = 0; this->m_count = 0;
for (MxS32 i = 0; i != old_size; i++) { for (MxS32 i = 0; i != oldSize; i++) {
MxHashTableNode<T>* t = old_table[i]; MxHashTableNode<T>* t = oldTable[i];
while (t) { while (t) {
MxHashTableNode<T>* next = t->m_next; MxHashTableNode<T>* next = t->m_next;
_NodeInsert(t); NodeInsert(t);
t = next; t = next;
} }
} }
delete[] old_table; delete[] oldTable;
} }
template <class T> template <class T>
inline void MxHashTable<T>::_NodeInsert(MxHashTableNode<T>* p_node) inline void MxHashTable<T>::NodeInsert(MxHashTableNode<T>* p_node)
{ {
MxS32 bucket = p_node->m_hash % m_numSlots; MxS32 bucket = p_node->m_hash % m_numSlots;
@ -226,7 +226,7 @@ inline void MxHashTable<T>::Add(T p_newobj)
MxU32 hash = Hash(p_newobj); MxU32 hash = Hash(p_newobj);
MxHashTableNode<T>* node = new MxHashTableNode<T>(p_newobj, hash); MxHashTableNode<T>* node = new MxHashTableNode<T>(p_newobj, hash);
MxHashTable<T>::_NodeInsert(node); MxHashTable<T>::NodeInsert(node);
} }
#undef HASH_TABLE_INIT_SIZE #undef HASH_TABLE_INIT_SIZE

View File

@ -22,14 +22,14 @@ MXIOINFO::~MXIOINFO()
// FUNCTION: LEGO1 0x100cc830 // FUNCTION: LEGO1 0x100cc830
MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags) MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags)
{ {
OFSTRUCT _unused; OFSTRUCT unused;
MxU16 result = 0; MxU16 result = 0;
m_info.lBufOffset = 0; m_info.lBufOffset = 0;
m_info.lDiskOffset = 0; m_info.lDiskOffset = 0;
// DECOMP: Cast of p_flags to u16 forces the `movzx` instruction // DECOMP: Cast of p_flags to u16 forces the `movzx` instruction
m_info.hmmio = (HMMIO) OpenFile(p_filename, &_unused, (MxU16) p_flags); m_info.hmmio = (HMMIO) OpenFile(p_filename, &unused, (MxU16) p_flags);
if ((HFILE) m_info.hmmio != HFILE_ERROR) { if ((HFILE) m_info.hmmio != HFILE_ERROR) {
m_info.dwFlags = p_flags; m_info.dwFlags = p_flags;
@ -87,45 +87,45 @@ MxU16 MXIOINFO::Close(MxLong p_unused)
// FUNCTION: LEGO1 0x100cc930 // FUNCTION: LEGO1 0x100cc930
MxLong MXIOINFO::Read(void* p_buf, MxLong p_len) MxLong MXIOINFO::Read(void* p_buf, MxLong p_len)
{ {
MxLong bytes_read = 0; MxLong bytesRead = 0;
if (m_info.pchBuffer) { if (m_info.pchBuffer) {
MxLong bytes_left = m_info.pchEndRead - m_info.pchNext; MxLong bytesLeft = m_info.pchEndRead - m_info.pchNext;
while (p_len > 0) { while (p_len > 0) {
if (bytes_left > 0) { if (bytesLeft > 0) {
if (p_len < bytes_left) if (p_len < bytesLeft)
bytes_left = p_len; bytesLeft = p_len;
memcpy(p_buf, m_info.pchNext, bytes_left); memcpy(p_buf, m_info.pchNext, bytesLeft);
p_len -= bytes_left; p_len -= bytesLeft;
m_info.pchNext += bytes_left; m_info.pchNext += bytesLeft;
bytes_read += bytes_left; bytesRead += bytesLeft;
} }
if (p_len <= 0 || Advance(0)) if (p_len <= 0 || Advance(0))
break; break;
bytes_left = m_info.pchEndRead - m_info.pchNext; bytesLeft = m_info.pchEndRead - m_info.pchNext;
if (bytes_left <= 0) if (bytesLeft <= 0)
break; break;
} }
} }
else if (m_info.hmmio && p_len > 0) { else if (m_info.hmmio && p_len > 0) {
bytes_read = _hread((HFILE) m_info.hmmio, p_buf, p_len); bytesRead = _hread((HFILE) m_info.hmmio, p_buf, p_len);
if (bytes_read == -1) { if (bytesRead == -1) {
bytes_read = 0; bytesRead = 0;
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
} }
else { else {
m_info.lDiskOffset += bytes_read; m_info.lDiskOffset += bytesRead;
} }
} }
return bytes_read; return bytesRead;
} }
// FUNCTION: LEGO1 0x100cca00 // FUNCTION: LEGO1 0x100cca00
@ -171,13 +171,13 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin)
else { else {
// align offset to buffer size // align offset to buffer size
MxLong new_offset = p_offset - (p_offset % m_info.cchBuffer); MxLong newOffset = p_offset - (p_offset % m_info.cchBuffer);
m_info.lBufOffset = new_offset; m_info.lBufOffset = newOffset;
// do we need to seek again? // do we need to seek again?
// (i.e. are we already aligned to buffer size?) // (i.e. are we already aligned to buffer size?)
if (p_offset != new_offset) { if (p_offset != newOffset) {
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, new_offset, SEEK_SET); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, newOffset, SEEK_SET);
if (m_info.lDiskOffset == -1) { if (m_info.lDiskOffset == -1) {
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
@ -194,15 +194,15 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin)
} }
else { else {
// We can read from the file. Fill the buffer. // We can read from the file. Fill the buffer.
MxLong bytes_read = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, m_info.cchBuffer); MxLong bytesRead = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, m_info.cchBuffer);
if (bytes_read == -1) { if (bytesRead == -1) {
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
} }
else { else {
m_info.lDiskOffset += bytes_read; m_info.lDiskOffset += bytesRead;
m_info.pchNext = p_offset - m_info.lBufOffset + m_info.pchBuffer; m_info.pchNext = p_offset - m_info.lBufOffset + m_info.pchBuffer;
m_info.pchEndRead = m_info.pchBuffer + bytes_read; m_info.pchEndRead = m_info.pchBuffer + bytesRead;
if (m_info.pchNext < m_info.pchEndRead) { if (m_info.pchNext < m_info.pchEndRead) {
result = p_offset; result = p_offset;
@ -278,10 +278,10 @@ MxU16 MXIOINFO::Flush(MxU16 p_unused)
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
} }
else { else {
MxLong bytes_written = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cchBuffer); MxLong bytesWritten = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cchBuffer);
if (bytes_written != -1 && bytes_written == cchBuffer) { if (bytesWritten != -1 && bytesWritten == cchBuffer) {
m_info.lDiskOffset += bytes_written; m_info.lDiskOffset += bytesWritten;
m_info.pchNext = m_info.pchBuffer; m_info.pchNext = m_info.pchBuffer;
m_info.dwFlags &= ~MMIO_DIRTY; m_info.dwFlags &= ~MMIO_DIRTY;
} }
@ -327,10 +327,10 @@ MxU16 MXIOINFO::Advance(MxU16 p_option)
result = MMIOERR_CANNOTSEEK; result = MMIOERR_CANNOTSEEK;
} }
else { else {
MxLong bytes_written = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cch); MxLong bytesWritten = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cch);
if (bytes_written != -1 && bytes_written == cch) { if (bytesWritten != -1 && bytesWritten == cch) {
m_info.lDiskOffset += bytes_written; m_info.lDiskOffset += bytesWritten;
m_info.pchNext = m_info.pchBuffer; m_info.pchNext = m_info.pchBuffer;
m_info.pchEndRead = m_info.pchBuffer; m_info.pchEndRead = m_info.pchBuffer;
m_info.dwFlags &= ~MMIO_DIRTY; m_info.dwFlags &= ~MMIO_DIRTY;
@ -355,16 +355,16 @@ MxU16 MXIOINFO::Advance(MxU16 p_option)
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
} }
else { else {
MxLong bytes_read = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, cch); MxLong bytesRead = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, cch);
if (bytes_read == -1) { if (bytesRead == -1) {
result = MMIOERR_CANNOTREAD; result = MMIOERR_CANNOTREAD;
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
} }
else { else {
m_info.lDiskOffset += bytes_read; m_info.lDiskOffset += bytesRead;
m_info.pchNext = m_info.pchBuffer; m_info.pchNext = m_info.pchBuffer;
m_info.pchEndRead = m_info.pchBuffer + bytes_read; m_info.pchEndRead = m_info.pchBuffer + bytesRead;
} }
} }
} }
@ -410,18 +410,18 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU
ofs = p_parentInfo->cksize + p_parentInfo->dwDataOffset; ofs = p_parentInfo->cksize + p_parentInfo->dwDataOffset;
BOOL running = TRUE; BOOL running = TRUE;
BOOL read_ok = FALSE; BOOL readOk = FALSE;
MMCKINFO tmp; MMCKINFO tmp;
tmp.dwFlags = 0; tmp.dwFlags = 0;
while (running) { while (running) {
if (Read(&tmp, 8) != 8) { if (Read(&tmp, 8) != 8) {
// If the first read fails, report read error. Else EOF. // If the first read fails, report read error. Else EOF.
result = read_ok ? MMIOERR_CHUNKNOTFOUND : MMIOERR_CANNOTREAD; result = readOk ? MMIOERR_CHUNKNOTFOUND : MMIOERR_CANNOTREAD;
running = FALSE; running = FALSE;
} }
else { else {
read_ok = TRUE; readOk = TRUE;
if (m_info.pchBuffer) { if (m_info.pchBuffer) {
tmp.dwDataOffset = m_info.pchNext - m_info.pchBuffer + m_info.lBufOffset; tmp.dwDataOffset = m_info.pchNext - m_info.pchBuffer + m_info.lBufOffset;
} }

View File

@ -59,7 +59,7 @@ class MxList : protected MxCollection<T> {
virtual ~MxList() override; virtual ~MxList() override;
void Append(T p_obj) { _InsertEntry(p_obj, this->m_last, NULL); }; void Append(T p_obj) { InsertEntry(p_obj, this->m_last, NULL); };
void DeleteAll(MxBool p_destroy = TRUE); void DeleteAll(MxBool p_destroy = TRUE);
MxU32 GetCount() { return this->m_count; } MxU32 GetCount() { return this->m_count; }
void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; } void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; }
@ -70,8 +70,8 @@ class MxList : protected MxCollection<T> {
MxListEntry<T>* m_first; // 0x10 MxListEntry<T>* m_first; // 0x10
MxListEntry<T>* m_last; // 0x14 MxListEntry<T>* m_last; // 0x14
void _DeleteEntry(MxListEntry<T>* match); void DeleteEntry(MxListEntry<T>* match);
MxListEntry<T>* _InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*); MxListEntry<T>* InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
}; };
template <class T> template <class T>
@ -141,7 +141,7 @@ inline void MxList<T>::DeleteAll(MxBool p_destroy)
} }
template <class T> template <class T>
inline MxListEntry<T>* MxList<T>::_InsertEntry(T p_newobj, MxListEntry<T>* p_prev, MxListEntry<T>* p_next) inline MxListEntry<T>* MxList<T>::InsertEntry(T p_newobj, MxListEntry<T>* p_prev, MxListEntry<T>* p_next)
{ {
MxListEntry<T>* newEntry = new MxListEntry<T>(p_newobj, p_prev, p_next); MxListEntry<T>* newEntry = new MxListEntry<T>(p_newobj, p_prev, p_next);
@ -160,19 +160,19 @@ inline MxListEntry<T>* MxList<T>::_InsertEntry(T p_newobj, MxListEntry<T>* p_pre
} }
template <class T> template <class T>
inline void MxList<T>::_DeleteEntry(MxListEntry<T>* match) inline void MxList<T>::DeleteEntry(MxListEntry<T>* p_match)
{ {
if (match->GetPrev()) if (p_match->GetPrev())
match->GetPrev()->SetNext(match->GetNext()); p_match->GetPrev()->SetNext(p_match->GetNext());
else else
m_first = match->GetNext(); m_first = p_match->GetNext();
if (match->GetNext()) if (p_match->GetNext())
match->GetNext()->SetPrev(match->GetPrev()); p_match->GetNext()->SetPrev(p_match->GetPrev());
else else
m_last = match->GetPrev(); m_last = p_match->GetPrev();
delete match; delete p_match;
this->m_count--; this->m_count--;
} }
@ -189,7 +189,7 @@ inline MxBool MxListCursor<T>::Find(T p_obj)
template <class T> template <class T>
inline void MxListCursor<T>::Detach() inline void MxListCursor<T>::Detach()
{ {
m_list->_DeleteEntry(m_match); m_list->DeleteEntry(m_match);
m_match = NULL; m_match = NULL;
} }
@ -247,7 +247,7 @@ template <class T>
inline void MxListCursor<T>::Prepend(T p_newobj) inline void MxListCursor<T>::Prepend(T p_newobj)
{ {
if (m_match) if (m_match)
m_list->_InsertEntry(p_newobj, m_match->GetPrev(), m_match); m_list->InsertEntry(p_newobj, m_match->GetPrev(), m_match);
} }
#endif // MXLIST_H #endif // MXLIST_H

View File

@ -16,7 +16,7 @@ class MxQueue : public MxList<T> {
MxBool has_next = (m_first != NULL); MxBool has_next = (m_first != NULL);
if (m_first) { if (m_first) {
p_obj = m_first->GetValue(); p_obj = m_first->GetValue();
_DeleteEntry(m_first); DeleteEntry(m_first);
} }
return has_next; return has_next;

View File

@ -52,13 +52,13 @@ void MxRegionLeftRightList::Destroy(MxRegionLeftRight* p_leftRight)
// MxListCursor<MxRegionLeftRight *>::MxListCursor<MxRegionLeftRight *> // MxListCursor<MxRegionLeftRight *>::MxListCursor<MxRegionLeftRight *>
// TEMPLATE: LEGO1 0x100c58c0 // TEMPLATE: LEGO1 0x100c58c0
// MxList<MxRegionLeftRight *>::_InsertEntry // MxList<MxRegionLeftRight *>::InsertEntry
// TEMPLATE: LEGO1 0x100c5970 // TEMPLATE: LEGO1 0x100c5970
// MxList<MxRegionTopBottom *>::_InsertEntry // MxList<MxRegionTopBottom *>::InsertEntry
// TEMPLATE: LEGO1 0x100c5a20 // TEMPLATE: LEGO1 0x100c5a20
// MxListEntry<MxRegionTopBottom *>::MxListEntry<MxRegionTopBottom *> // MxListEntry<MxRegionTopBottom *>::MxListEntry<MxRegionTopBottom *>
// TEMPLATE: LEGO1 0x100c5a40 // TEMPLATE: LEGO1 0x100c5a40
// MxList<MxRegionLeftRight *>::_DeleteEntry // MxList<MxRegionLeftRight *>::DeleteEntry

View File

@ -17,7 +17,7 @@ DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18)
// MxList<MxString>::Append // MxList<MxString>::Append
// TEMPLATE: LEGO1 0x100cc2d0 // TEMPLATE: LEGO1 0x100cc2d0
// MxList<MxString>::_InsertEntry // MxList<MxString>::InsertEntry
// TEMPLATE: LEGO1 0x100cc3c0 // TEMPLATE: LEGO1 0x100cc3c0
// MxListEntry<MxString>::MxListEntry<MxString> // MxListEntry<MxString>::MxListEntry<MxString>

View File

@ -93,4 +93,4 @@ const char* MxVariableTable::GetVariable(const char* p_key)
// MxHashTable<MxVariable *>::Resize // MxHashTable<MxVariable *>::Resize
// TEMPLATE: LEGO1 0x100b7b80 // TEMPLATE: LEGO1 0x100b7b80
// MxHashTable<MxVariable *>::_NodeInsert // MxHashTable<MxVariable *>::NodeInsert

View File

@ -10,7 +10,7 @@ UnionName: '^\(anon|^[A-Z][a-zA-Z0-9]+$'
VariableName: VariableName:
ScopePrefix: ScopePrefix:
Global: 'g_' Global: 'g_'
Static: 's_' Static: 'g_'
ClassMember: 'm_' ClassMember: 'm_'
StructMember: 'm_' StructMember: 'm_'
DataTypePrefix: DataTypePrefix: