mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 08:41:16 +00:00
More fixes
This commit is contained in:
parent
13b5d95512
commit
aed1d26f81
@ -3,7 +3,7 @@
|
||||
DECOMP_SIZE_ASSERT(MxAudioManager, 0x30);
|
||||
|
||||
// GLOBAL: LEGO1 0x10102108
|
||||
MxS32 MxAudioManager::s_count = 0;
|
||||
MxS32 MxAudioManager::g_count = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x10029910
|
||||
MxS32 MxAudioManager::GetVolume()
|
||||
@ -33,7 +33,7 @@ void MxAudioManager::Init()
|
||||
void MxAudioManager::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
this->m_criticalSection.Enter();
|
||||
s_count--;
|
||||
g_count--;
|
||||
Init();
|
||||
this->m_criticalSection.Leave();
|
||||
|
||||
@ -51,7 +51,7 @@ MxResult MxAudioManager::InitPresenters()
|
||||
this->m_criticalSection.Enter();
|
||||
success = TRUE;
|
||||
result = SUCCESS;
|
||||
s_count++;
|
||||
g_count++;
|
||||
}
|
||||
|
||||
if (result)
|
||||
|
||||
@ -18,7 +18,7 @@ class MxAudioManager : public MxMediaManager {
|
||||
private:
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
|
||||
static MxS32 s_count;
|
||||
static MxS32 g_count;
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
@ -13,7 +13,7 @@ class MxDeviceModeFinder {
|
||||
MxDeviceModeFinder();
|
||||
~MxDeviceModeFinder();
|
||||
|
||||
undefined4 m_unk0xnown[56];
|
||||
undefined4 m_pad[56];
|
||||
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // +0xe0
|
||||
};
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ BOOL MxDirectDraw::IsSupportedMode(int width, int height, int 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) {
|
||||
return TRUE;
|
||||
}
|
||||
@ -892,21 +892,21 @@ int MxDirectDraw::FlipToGDISurface()
|
||||
void MxDirectDraw::Error(const char* p_message, MxS32 p_error)
|
||||
{
|
||||
// GLOBAL: LEGO1 0x10100c70
|
||||
static BOOL s_isInsideError = FALSE;
|
||||
if (!s_isInsideError) {
|
||||
s_isInsideError = TRUE;
|
||||
static BOOL g_isInsideError = FALSE;
|
||||
if (!g_isInsideError) {
|
||||
g_isInsideError = TRUE;
|
||||
Destroy();
|
||||
if (m_pErrorHandler) {
|
||||
m_pErrorHandler(p_message, p_error, m_pErrorHandlerArg);
|
||||
}
|
||||
s_isInsideError = FALSE;
|
||||
g_isInsideError = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009e880
|
||||
const char* MxDirectDraw::ErrorToString(HRESULT error)
|
||||
const char* MxDirectDraw::ErrorToString(HRESULT p_error)
|
||||
{
|
||||
switch (error) {
|
||||
switch (p_error) {
|
||||
case DD_OK:
|
||||
return "No error.\0";
|
||||
case DDERR_ALREADYINITIALIZED:
|
||||
|
||||
@ -31,9 +31,9 @@ class MxDirectDraw {
|
||||
struct DeviceModesInfo {
|
||||
GUID* m_guid;
|
||||
Mode* m_modeArray;
|
||||
MxS32 count;
|
||||
MxS32 m_count;
|
||||
DDCAPS m_ddcaps;
|
||||
void* m_178;
|
||||
void* m_unk0x178;
|
||||
|
||||
DeviceModesInfo();
|
||||
~DeviceModesInfo();
|
||||
@ -59,7 +59,7 @@ class MxDirectDraw {
|
||||
BOOL m_bIgnoreWMSIZE;
|
||||
BOOL m_bPrimaryPalettized;
|
||||
BOOL m_bFullScreen;
|
||||
void* m_850;
|
||||
void* m_unk0x850;
|
||||
BOOL m_bOnlySystemMemory;
|
||||
BOOL m_bIsOnPrimaryDevice;
|
||||
ErrorHandler m_pErrorHandler;
|
||||
@ -91,7 +91,7 @@ class MxDirectDraw {
|
||||
);
|
||||
virtual void Destroy();
|
||||
virtual void DestroyButNotDirectDraw();
|
||||
virtual const char* ErrorToString(HRESULT error);
|
||||
virtual const char* ErrorToString(HRESULT p_error);
|
||||
|
||||
protected:
|
||||
BOOL CacheOriginalPaletteEntries();
|
||||
|
||||
@ -71,7 +71,7 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100d15e0
|
||||
void MxDiskStreamProvider::VTable0x20(undefined4 p_unknown1)
|
||||
void MxDiskStreamProvider::VTable0x20(undefined4)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class MxDiskStreamProvider : public MxStreamProvider {
|
||||
virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14
|
||||
virtual MxU32 GetFileSize() override; // vtable+0x18
|
||||
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* GetBufferForDWords() override; // vtable+0x28
|
||||
|
||||
|
||||
@ -119,10 +119,10 @@ MxResult MxDSBuffer::SetBufferPointer(MxU32* p_buffer, MxU32 p_size)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c6f80
|
||||
void MxDSBuffer::FUN_100c6f80(MxU32 p_unk)
|
||||
void MxDSBuffer::FUN_100c6f80(MxU32 p_writeOffset)
|
||||
{
|
||||
if (p_unk < m_writeOffset) {
|
||||
m_pIntoBuffer2 = m_pBuffer + p_unk;
|
||||
m_pIntoBuffer = m_pBuffer + p_unk;
|
||||
if (p_writeOffset < m_writeOffset) {
|
||||
m_pIntoBuffer2 = m_pBuffer + p_writeOffset;
|
||||
m_pIntoBuffer = m_pBuffer + p_writeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class MxDSBuffer : public MxCore {
|
||||
|
||||
MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode);
|
||||
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 MxU32 GetWriteOffset() { return m_writeOffset; }
|
||||
|
||||
@ -33,7 +33,7 @@ class MxDSChunk : public MxCore {
|
||||
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 SetLength(MxU32 p_length) { m_length = p_length; }
|
||||
inline void SetData(MxU8* p_data) { m_data = p_data; }
|
||||
|
||||
@ -12,20 +12,20 @@ MxDSFile::~MxDSFile()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100cc4b0
|
||||
MxDSFile::MxDSFile(const char* filename, MxULong skipReadingChunks)
|
||||
MxDSFile::MxDSFile(const char* p_filename, MxULong p_skipReadingChunks)
|
||||
{
|
||||
m_filename = filename;
|
||||
m_skipReadingChunks = skipReadingChunks;
|
||||
m_filename = p_filename;
|
||||
m_skipReadingChunks = p_skipReadingChunks;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100cc590
|
||||
MxLong MxDSFile::Open(MxULong uStyle)
|
||||
MxLong MxDSFile::Open(MxULong p_uStyle)
|
||||
{
|
||||
MXIOINFO& io = m_io;
|
||||
MxLong longResult = 1;
|
||||
memset(&io, 0, sizeof(MXIOINFO));
|
||||
|
||||
if (io.Open(m_filename.GetData(), uStyle) != 0) {
|
||||
if (io.Open(m_filename.GetData(), p_uStyle) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ MxLong MxDSFile::ReadChunks()
|
||||
}
|
||||
|
||||
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');
|
||||
if (m_io.Descend(&childChunk, &topChunk, 0) != 0) {
|
||||
return -1;
|
||||
@ -106,19 +106,19 @@ MxResult MxDSFile::Read(unsigned char* p_buf, MxULong p_nbytes)
|
||||
}
|
||||
|
||||
// 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
|
||||
MxULong MxDSFile::GetBufferSize()
|
||||
{
|
||||
return m_header.bufferSize;
|
||||
return m_header.m_bufferSize;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100cc7f0
|
||||
MxULong MxDSFile::GetStreamBuffersNum()
|
||||
{
|
||||
return m_header.streamBuffersNum;
|
||||
return m_header.m_streamBuffersNum;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
// VTABLE: LEGO1 0x100dc890
|
||||
class MxDSFile : public MxDSSource {
|
||||
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
|
||||
|
||||
// FUNCTION: LEGO1 0x100c0120
|
||||
@ -37,13 +37,13 @@ class MxDSFile : public MxDSSource {
|
||||
private:
|
||||
MxLong ReadChunks();
|
||||
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 minorVersion;
|
||||
MxULong bufferSize;
|
||||
MxS16 streamBuffersNum;
|
||||
MxS16 reserved;
|
||||
MxU16 m_majorVersion;
|
||||
MxU16 m_minorVersion;
|
||||
MxULong m_bufferSize;
|
||||
MxS16 m_streamBuffersNum;
|
||||
MxS16 m_reserved;
|
||||
};
|
||||
|
||||
MxString m_filename;
|
||||
|
||||
@ -53,14 +53,14 @@ MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction)
|
||||
}
|
||||
|
||||
// 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);
|
||||
MxDSAction* action;
|
||||
while (cursor.Next(action))
|
||||
action->SetUnknown90(p_unkTimingField);
|
||||
action->SetUnknown90(p_unk0x90);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ca370
|
||||
@ -102,14 +102,14 @@ MxDSAction* MxDSMultiAction::Clone()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ca5e0
|
||||
undefined4 MxDSMultiAction::unk14()
|
||||
undefined4 MxDSMultiAction::VTable0x14()
|
||||
{
|
||||
undefined4 result = MxDSAction::unk14();
|
||||
undefined4 result = MxDSAction::VTable0x14();
|
||||
|
||||
MxDSActionListCursor cursor(this->m_actions);
|
||||
MxDSAction* action;
|
||||
while (cursor.Next(action))
|
||||
result += action->unk14();
|
||||
result += action->VTable0x14();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -27,14 +27,14 @@ class MxDSMultiAction : public MxDSAction {
|
||||
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 void Deserialize(char** p_source, MxS16 p_unk0x24) override; // vtable+1c;
|
||||
virtual void SetAtomId(MxAtomId p_atomId) override; // vtable+20;
|
||||
virtual MxDSAction* Clone() override; // vtable+2c;
|
||||
virtual void MergeFrom(MxDSAction& p_dsAction) override; // vtable+30;
|
||||
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; };
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ void MxDSObject::SetSourceName(const char* p_sourceName)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bf9c0
|
||||
undefined4 MxDSObject::unk14()
|
||||
undefined4 MxDSObject::VTable0x14()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ class MxDSObject : public MxCore {
|
||||
return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name);
|
||||
}; // vtable+10;
|
||||
|
||||
virtual undefined4 unk14(); // vtable+14;
|
||||
virtual undefined4 VTable0x14(); // vtable+14;
|
||||
virtual MxU32 GetSizeOnDisk(); // vtable+18;
|
||||
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;
|
||||
|
||||
@ -79,7 +79,7 @@ void MxDSStreamingAction::SetInternalAction(MxDSAction* p_dsAction)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100cd2d0
|
||||
void MxDSStreamingAction::FUN_100CD2D0()
|
||||
void MxDSStreamingAction::FUN_100cd2d0()
|
||||
{
|
||||
if (this->m_duration == -1)
|
||||
return;
|
||||
|
||||
@ -29,7 +29,7 @@ class MxDSStreamingAction : public MxDSAction {
|
||||
|
||||
MxResult Init();
|
||||
void SetInternalAction(MxDSAction* p_dsAction);
|
||||
void FUN_100CD2D0();
|
||||
void FUN_100cd2d0();
|
||||
|
||||
private:
|
||||
MxU32 m_unk0x94;
|
||||
|
||||
@ -57,7 +57,7 @@ class MxHashTable : protected MxCollection<T> {
|
||||
friend class MxHashTableCursor<T>;
|
||||
|
||||
protected:
|
||||
void _NodeInsert(MxHashTableNode<T>*);
|
||||
void NodeInsert(MxHashTableNode<T>*);
|
||||
|
||||
MxHashTableNode<T>** m_slots; // 0x10
|
||||
MxU32 m_numSlots; // 0x14
|
||||
@ -173,8 +173,8 @@ inline void MxHashTable<T>::Resize()
|
||||
{
|
||||
// Save a reference to the current table
|
||||
// so we can walk nodes and re-insert
|
||||
MxU32 old_size = m_numSlots;
|
||||
MxHashTableNode<T>** old_table = m_slots;
|
||||
MxU32 oldSize = m_numSlots;
|
||||
MxHashTableNode<T>** oldTable = m_slots;
|
||||
|
||||
switch (m_resizeOption) {
|
||||
case HashTableOpt_ExpandAdd:
|
||||
@ -190,21 +190,21 @@ inline void MxHashTable<T>::Resize()
|
||||
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
|
||||
this->m_count = 0;
|
||||
|
||||
for (MxS32 i = 0; i != old_size; i++) {
|
||||
MxHashTableNode<T>* t = old_table[i];
|
||||
for (MxS32 i = 0; i != oldSize; i++) {
|
||||
MxHashTableNode<T>* t = oldTable[i];
|
||||
|
||||
while (t) {
|
||||
MxHashTableNode<T>* next = t->m_next;
|
||||
_NodeInsert(t);
|
||||
NodeInsert(t);
|
||||
t = next;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] old_table;
|
||||
delete[] oldTable;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -226,7 +226,7 @@ inline void MxHashTable<T>::Add(T p_newobj)
|
||||
MxU32 hash = Hash(p_newobj);
|
||||
MxHashTableNode<T>* node = new MxHashTableNode<T>(p_newobj, hash);
|
||||
|
||||
MxHashTable<T>::_NodeInsert(node);
|
||||
MxHashTable<T>::NodeInsert(node);
|
||||
}
|
||||
|
||||
#undef HASH_TABLE_INIT_SIZE
|
||||
|
||||
@ -22,14 +22,14 @@ MXIOINFO::~MXIOINFO()
|
||||
// FUNCTION: LEGO1 0x100cc830
|
||||
MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags)
|
||||
{
|
||||
OFSTRUCT _unused;
|
||||
OFSTRUCT unused;
|
||||
MxU16 result = 0;
|
||||
|
||||
m_info.lBufOffset = 0;
|
||||
m_info.lDiskOffset = 0;
|
||||
|
||||
// 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) {
|
||||
m_info.dwFlags = p_flags;
|
||||
@ -87,45 +87,45 @@ MxU16 MXIOINFO::Close(MxLong p_unused)
|
||||
// FUNCTION: LEGO1 0x100cc930
|
||||
MxLong MXIOINFO::Read(void* p_buf, MxLong p_len)
|
||||
{
|
||||
MxLong bytes_read = 0;
|
||||
MxLong bytesRead = 0;
|
||||
|
||||
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) {
|
||||
|
||||
if (bytes_left > 0) {
|
||||
if (p_len < bytes_left)
|
||||
bytes_left = p_len;
|
||||
if (bytesLeft > 0) {
|
||||
if (p_len < bytesLeft)
|
||||
bytesLeft = p_len;
|
||||
|
||||
memcpy(p_buf, m_info.pchNext, bytes_left);
|
||||
p_len -= bytes_left;
|
||||
memcpy(p_buf, m_info.pchNext, bytesLeft);
|
||||
p_len -= bytesLeft;
|
||||
|
||||
m_info.pchNext += bytes_left;
|
||||
bytes_read += bytes_left;
|
||||
m_info.pchNext += bytesLeft;
|
||||
bytesRead += bytesLeft;
|
||||
}
|
||||
|
||||
if (p_len <= 0 || Advance(0))
|
||||
break;
|
||||
|
||||
bytes_left = m_info.pchEndRead - m_info.pchNext;
|
||||
if (bytes_left <= 0)
|
||||
bytesLeft = m_info.pchEndRead - m_info.pchNext;
|
||||
if (bytesLeft <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
bytes_read = 0;
|
||||
if (bytesRead == -1) {
|
||||
bytesRead = 0;
|
||||
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
|
||||
}
|
||||
else {
|
||||
m_info.lDiskOffset += bytes_read;
|
||||
m_info.lDiskOffset += bytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100cca00
|
||||
@ -171,13 +171,13 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin)
|
||||
else {
|
||||
|
||||
// align offset to buffer size
|
||||
MxLong new_offset = p_offset - (p_offset % m_info.cchBuffer);
|
||||
m_info.lBufOffset = new_offset;
|
||||
MxLong newOffset = p_offset - (p_offset % m_info.cchBuffer);
|
||||
m_info.lBufOffset = newOffset;
|
||||
|
||||
// do we need to seek again?
|
||||
// (i.e. are we already aligned to buffer size?)
|
||||
if (p_offset != new_offset) {
|
||||
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, new_offset, SEEK_SET);
|
||||
if (p_offset != newOffset) {
|
||||
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, newOffset, SEEK_SET);
|
||||
|
||||
if (m_info.lDiskOffset == -1) {
|
||||
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 {
|
||||
// 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);
|
||||
}
|
||||
else {
|
||||
m_info.lDiskOffset += bytes_read;
|
||||
m_info.lDiskOffset += bytesRead;
|
||||
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) {
|
||||
result = p_offset;
|
||||
@ -278,10 +278,10 @@ MxU16 MXIOINFO::Flush(MxU16 p_unused)
|
||||
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
|
||||
}
|
||||
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) {
|
||||
m_info.lDiskOffset += bytes_written;
|
||||
if (bytesWritten != -1 && bytesWritten == cchBuffer) {
|
||||
m_info.lDiskOffset += bytesWritten;
|
||||
m_info.pchNext = m_info.pchBuffer;
|
||||
m_info.dwFlags &= ~MMIO_DIRTY;
|
||||
}
|
||||
@ -327,10 +327,10 @@ MxU16 MXIOINFO::Advance(MxU16 p_option)
|
||||
result = MMIOERR_CANNOTSEEK;
|
||||
}
|
||||
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) {
|
||||
m_info.lDiskOffset += bytes_written;
|
||||
if (bytesWritten != -1 && bytesWritten == cch) {
|
||||
m_info.lDiskOffset += bytesWritten;
|
||||
m_info.pchNext = m_info.pchBuffer;
|
||||
m_info.pchEndRead = m_info.pchBuffer;
|
||||
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);
|
||||
}
|
||||
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;
|
||||
m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR);
|
||||
}
|
||||
else {
|
||||
m_info.lDiskOffset += bytes_read;
|
||||
m_info.lDiskOffset += bytesRead;
|
||||
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;
|
||||
|
||||
BOOL running = TRUE;
|
||||
BOOL read_ok = FALSE;
|
||||
BOOL readOk = FALSE;
|
||||
MMCKINFO tmp;
|
||||
tmp.dwFlags = 0;
|
||||
|
||||
while (running) {
|
||||
if (Read(&tmp, 8) != 8) {
|
||||
// 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;
|
||||
}
|
||||
else {
|
||||
read_ok = TRUE;
|
||||
readOk = TRUE;
|
||||
if (m_info.pchBuffer) {
|
||||
tmp.dwDataOffset = m_info.pchNext - m_info.pchBuffer + m_info.lBufOffset;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ class MxList : protected MxCollection<T> {
|
||||
|
||||
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);
|
||||
MxU32 GetCount() { return this->m_count; }
|
||||
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_last; // 0x14
|
||||
|
||||
void _DeleteEntry(MxListEntry<T>* match);
|
||||
MxListEntry<T>* _InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
||||
void DeleteEntry(MxListEntry<T>* match);
|
||||
MxListEntry<T>* InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@ -141,7 +141,7 @@ inline void MxList<T>::DeleteAll(MxBool p_destroy)
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -160,19 +160,19 @@ inline MxListEntry<T>* MxList<T>::_InsertEntry(T p_newobj, MxListEntry<T>* p_pre
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void MxList<T>::_DeleteEntry(MxListEntry<T>* match)
|
||||
inline void MxList<T>::DeleteEntry(MxListEntry<T>* p_match)
|
||||
{
|
||||
if (match->GetPrev())
|
||||
match->GetPrev()->SetNext(match->GetNext());
|
||||
if (p_match->GetPrev())
|
||||
p_match->GetPrev()->SetNext(p_match->GetNext());
|
||||
else
|
||||
m_first = match->GetNext();
|
||||
m_first = p_match->GetNext();
|
||||
|
||||
if (match->GetNext())
|
||||
match->GetNext()->SetPrev(match->GetPrev());
|
||||
if (p_match->GetNext())
|
||||
p_match->GetNext()->SetPrev(p_match->GetPrev());
|
||||
else
|
||||
m_last = match->GetPrev();
|
||||
m_last = p_match->GetPrev();
|
||||
|
||||
delete match;
|
||||
delete p_match;
|
||||
this->m_count--;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ inline MxBool MxListCursor<T>::Find(T p_obj)
|
||||
template <class T>
|
||||
inline void MxListCursor<T>::Detach()
|
||||
{
|
||||
m_list->_DeleteEntry(m_match);
|
||||
m_list->DeleteEntry(m_match);
|
||||
m_match = NULL;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ template <class T>
|
||||
inline void MxListCursor<T>::Prepend(T p_newobj)
|
||||
{
|
||||
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
|
||||
|
||||
@ -16,7 +16,7 @@ class MxQueue : public MxList<T> {
|
||||
MxBool has_next = (m_first != NULL);
|
||||
if (m_first) {
|
||||
p_obj = m_first->GetValue();
|
||||
_DeleteEntry(m_first);
|
||||
DeleteEntry(m_first);
|
||||
}
|
||||
|
||||
return has_next;
|
||||
|
||||
@ -52,13 +52,13 @@ void MxRegionLeftRightList::Destroy(MxRegionLeftRight* p_leftRight)
|
||||
// MxListCursor<MxRegionLeftRight *>::MxListCursor<MxRegionLeftRight *>
|
||||
|
||||
// TEMPLATE: LEGO1 0x100c58c0
|
||||
// MxList<MxRegionLeftRight *>::_InsertEntry
|
||||
// MxList<MxRegionLeftRight *>::InsertEntry
|
||||
|
||||
// TEMPLATE: LEGO1 0x100c5970
|
||||
// MxList<MxRegionTopBottom *>::_InsertEntry
|
||||
// MxList<MxRegionTopBottom *>::InsertEntry
|
||||
|
||||
// TEMPLATE: LEGO1 0x100c5a20
|
||||
// MxListEntry<MxRegionTopBottom *>::MxListEntry<MxRegionTopBottom *>
|
||||
|
||||
// TEMPLATE: LEGO1 0x100c5a40
|
||||
// MxList<MxRegionLeftRight *>::_DeleteEntry
|
||||
// MxList<MxRegionLeftRight *>::DeleteEntry
|
||||
|
||||
@ -17,7 +17,7 @@ DECOMP_SIZE_ASSERT(MxListEntry<MxString>, 0x18)
|
||||
// MxList<MxString>::Append
|
||||
|
||||
// TEMPLATE: LEGO1 0x100cc2d0
|
||||
// MxList<MxString>::_InsertEntry
|
||||
// MxList<MxString>::InsertEntry
|
||||
|
||||
// TEMPLATE: LEGO1 0x100cc3c0
|
||||
// MxListEntry<MxString>::MxListEntry<MxString>
|
||||
|
||||
@ -93,4 +93,4 @@ const char* MxVariableTable::GetVariable(const char* p_key)
|
||||
// MxHashTable<MxVariable *>::Resize
|
||||
|
||||
// TEMPLATE: LEGO1 0x100b7b80
|
||||
// MxHashTable<MxVariable *>::_NodeInsert
|
||||
// MxHashTable<MxVariable *>::NodeInsert
|
||||
|
||||
@ -10,7 +10,7 @@ UnionName: '^\(anon|^[A-Z][a-zA-Z0-9]+$'
|
||||
VariableName:
|
||||
ScopePrefix:
|
||||
Global: 'g_'
|
||||
Static: 's_'
|
||||
Static: 'g_'
|
||||
ClassMember: 'm_'
|
||||
StructMember: 'm_'
|
||||
DataTypePrefix:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user