mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy
* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def
* Add initial .clang-tidy and fixes
* fix file perms
* Comment out DESCRIPTION
* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def
* Looks like clang is allergic to the libs in the directx5 SDK
* Update .clang-tidy
* Fix typo in .clang-tidy
* Attempt to generate an action error
* Revert "Attempt to generate an action error"
This reverts commit 96c4c65fed.
* cmake: test with -Wparentheses + optionally with -Werror
* ci: -k0 is a Ninja argument
* Use -Werror only for msys2 builds
* cmake: only emit warnings for specific warnings
* cmake: and don't do -Werror/-WX anymore
* Fix warnings
* Fix mingw warnings
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
committed by
GitHub
parent
97d1ba7c71
commit
9e686e2a87
@@ -35,8 +35,9 @@ MxDiskStreamController::~MxDiskStreamController()
|
||||
}
|
||||
|
||||
MxDSAction* action;
|
||||
while (m_unk0x3c.PopFront(action))
|
||||
while (m_unk0x3c.PopFront(action)) {
|
||||
delete action;
|
||||
}
|
||||
|
||||
if (m_provider) {
|
||||
delete m_provider;
|
||||
@@ -45,11 +46,13 @@ MxDiskStreamController::~MxDiskStreamController()
|
||||
|
||||
FUN_100c8720();
|
||||
|
||||
while (m_list0x80.PopFront(action))
|
||||
while (m_list0x80.PopFront(action)) {
|
||||
FUN_100c7cb0((MxDSStreamingAction*) action);
|
||||
}
|
||||
|
||||
while (m_list0x64.PopFront(action))
|
||||
while (m_list0x64.PopFront(action)) {
|
||||
FUN_100c7cb0((MxDSStreamingAction*) action);
|
||||
}
|
||||
|
||||
while (!m_list0x74.empty()) {
|
||||
MxDSBuffer* buffer = m_list0x74.front();
|
||||
@@ -130,15 +133,17 @@ void MxDiskStreamController::FUN_100c7980()
|
||||
buffer = new MxDSBuffer();
|
||||
|
||||
if (buffer->AllocateBuffer(m_provider->GetFileSize(), MxDSBuffer::e_chunk) != SUCCESS) {
|
||||
if (buffer)
|
||||
if (buffer) {
|
||||
delete buffer;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
action = VTable0x28();
|
||||
if (!action) {
|
||||
if (buffer)
|
||||
if (buffer) {
|
||||
delete buffer;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,8 +233,9 @@ MxResult MxDiskStreamController::FUN_100c7d10()
|
||||
MxAutoLocker lock(&this->m_criticalSection);
|
||||
MxDSStreamingAction* action = FUN_100c7db0();
|
||||
|
||||
if (!action)
|
||||
if (!action) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (FUN_100c8360(action) != SUCCESS) {
|
||||
VTable0x24(action);
|
||||
@@ -290,11 +296,13 @@ MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action)
|
||||
|
||||
FUN_100c7f40(action);
|
||||
|
||||
if (VTable0x2c(p_action, entry->GetUnknown94()) != SUCCESS)
|
||||
if (VTable0x2c(p_action, entry->GetUnknown94()) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
else if (MxStreamController::VTable0x20(p_action) != SUCCESS)
|
||||
else if (MxStreamController::VTable0x20(p_action) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_unk0x70 = TRUE;
|
||||
m_unk0xc4 = TRUE;
|
||||
@@ -312,8 +320,9 @@ void MxDiskStreamController::FUN_100c8120(MxDSAction* p_action)
|
||||
|
||||
while (TRUE) {
|
||||
MxDSAction* found = m_unk0x54.Find(p_action, TRUE);
|
||||
if (!found)
|
||||
if (!found) {
|
||||
break;
|
||||
}
|
||||
delete found;
|
||||
}
|
||||
}
|
||||
@@ -408,8 +417,9 @@ void MxDiskStreamController::FUN_100c8540()
|
||||
m_list0x74.erase(it++);
|
||||
FUN_100c7ce0(buf);
|
||||
}
|
||||
else
|
||||
else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_nextActionList.empty()) {
|
||||
|
||||
@@ -19,8 +19,9 @@ MxU32 g_unk0x10102878 = 0;
|
||||
// FUNCTION: LEGO1 0x100d0f30
|
||||
MxResult MxDiskStreamProviderThread::Run()
|
||||
{
|
||||
if (m_target)
|
||||
if (m_target) {
|
||||
((MxDiskStreamProvider*) m_target)->WaitForWorkToComplete();
|
||||
}
|
||||
MxThread::Run();
|
||||
// They should probably have writen "return MxThread::Run()" but they didn't.
|
||||
return SUCCESS;
|
||||
@@ -55,11 +56,13 @@ MxDiskStreamProvider::~MxDiskStreamProvider()
|
||||
m_list.PopFrontStreamingAction(action);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
if (!action) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000)
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) {
|
||||
g_unk0x10102878--;
|
||||
}
|
||||
|
||||
((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action);
|
||||
} while (action);
|
||||
@@ -70,8 +73,9 @@ MxDiskStreamProvider::~MxDiskStreamProvider()
|
||||
m_thread.Terminate();
|
||||
}
|
||||
|
||||
if (m_pFile)
|
||||
if (m_pFile) {
|
||||
delete m_pFile;
|
||||
}
|
||||
|
||||
m_pFile = NULL;
|
||||
}
|
||||
@@ -91,8 +95,9 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource)
|
||||
path = MxString(MxOmni::GetCD()) + p_resource->GetAtom().GetInternal() + ".si";
|
||||
m_pFile->SetFileName(path.GetData());
|
||||
|
||||
if (m_pFile->Open(0) != 0)
|
||||
if (m_pFile->Open(0) != 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
m_remainingWork = TRUE;
|
||||
@@ -123,11 +128,13 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
|
||||
m_list.PopFrontStreamingAction(action);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000)
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) {
|
||||
g_unk0x10102878--;
|
||||
}
|
||||
|
||||
((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action);
|
||||
} while (action);
|
||||
@@ -139,11 +146,13 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
|
||||
action = (MxDSStreamingAction*) m_list.Find(p_action, TRUE);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000)
|
||||
if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) {
|
||||
g_unk0x10102878--;
|
||||
}
|
||||
|
||||
((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action);
|
||||
} while (action);
|
||||
@@ -155,8 +164,9 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
|
||||
{
|
||||
while (m_remainingWork) {
|
||||
m_busySemaphore.Wait(INFINITE);
|
||||
if (m_unk0x35)
|
||||
if (m_unk0x35) {
|
||||
PerformWork();
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -165,14 +175,16 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
|
||||
// FUNCTION: LEGO1 0x100d1780
|
||||
MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action)
|
||||
{
|
||||
if (!m_remainingWork)
|
||||
if (!m_remainingWork) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_action->GetUnknown9c() > 0 && !p_action->GetUnknowna0()) {
|
||||
MxDSBuffer* buffer = new MxDSBuffer();
|
||||
|
||||
if (!buffer)
|
||||
if (!buffer) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (buffer->AllocateBuffer(GetFileSize(), MxDSBuffer::e_allocate) != SUCCESS) {
|
||||
delete buffer;
|
||||
@@ -220,8 +232,9 @@ void MxDiskStreamProvider::PerformWork()
|
||||
{
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
if (!m_list.PopFrontStreamingAction(streamingAction))
|
||||
if (!m_list.PopFrontStreamingAction(streamingAction)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (streamingAction->GetUnknowna0()->GetWriteOffset() < 0x20000) {
|
||||
@@ -276,15 +289,17 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action)
|
||||
{
|
||||
MxDSBuffer* buffer = new MxDSBuffer();
|
||||
|
||||
if (!buffer)
|
||||
if (!buffer) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxU32 size = p_action->GetUnknowna0()->GetWriteOffset() - p_action->GetUnknown94() + p_action->GetBufferOffset() +
|
||||
(p_action->GetUnknowna4() ? p_action->GetUnknowna4()->GetWriteOffset() : 0);
|
||||
|
||||
if (buffer->AllocateBuffer(size, MxDSBuffer::e_allocate) != SUCCESS) {
|
||||
if (!buffer)
|
||||
if (!buffer) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
delete buffer;
|
||||
return FAILURE;
|
||||
@@ -327,8 +342,9 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action)
|
||||
size = ReadData(*pdata, buffer->GetWriteOffset());
|
||||
|
||||
MxDSBuffer* buffer3 = new MxDSBuffer();
|
||||
if (!buffer3)
|
||||
if (!buffer3) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (buffer3->AllocateBuffer(size, MxDSBuffer::e_allocate) == SUCCESS) {
|
||||
memcpy(buffer3->GetBuffer(), p_action->GetUnknowna4()->GetBuffer(), size);
|
||||
@@ -342,8 +358,9 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action)
|
||||
MxU8* data2 = buffer4->GetBuffer();
|
||||
|
||||
while (TRUE) {
|
||||
if (*MxStreamChunk::IntoTime(data2) > p_action->GetUnknown9c())
|
||||
if (*MxStreamChunk::IntoTime(data2) > p_action->GetUnknown9c()) {
|
||||
break;
|
||||
}
|
||||
|
||||
data += MxDSChunk::Size(*MxDSChunk::IntoLength(data));
|
||||
unk0x14 += MxDSChunk::Size(*MxDSChunk::IntoLength(data));
|
||||
|
||||
@@ -164,19 +164,22 @@ MxResult MxDSBuffer::FUN_100c67b0(
|
||||
MxResult result = FAILURE;
|
||||
|
||||
m_unk0x30 = (MxDSStreamingAction*) p_controller->GetUnk0x3c().Find(p_action, FALSE);
|
||||
if (m_unk0x30 == NULL)
|
||||
if (m_unk0x30 == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxU8* data;
|
||||
while (data = (MxU8*) SkipToData()) {
|
||||
while ((data = (MxU8*) SkipToData())) {
|
||||
if (*p_streamingAction == NULL) {
|
||||
result = CreateObject(p_controller, (MxU32*) data, p_action, p_streamingAction);
|
||||
|
||||
if (result == FAILURE)
|
||||
if (result == FAILURE) {
|
||||
return result;
|
||||
}
|
||||
// TODO: Not a MxResult value?
|
||||
if (result == 1)
|
||||
if (result == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
MxDSBuffer* buffer = (*p_streamingAction)->GetUnknowna0();
|
||||
@@ -226,8 +229,9 @@ MxResult MxDSBuffer::CreateObject(
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (*p_data == FOURCC('M', 'x', 'O', 'b'))
|
||||
if (*p_data == FOURCC('M', 'x', 'O', 'b')) {
|
||||
return StartPresenterFromAction(p_controller, p_action, (MxDSAction*) header);
|
||||
}
|
||||
else if (*p_data == FOURCC('M', 'x', 'C', 'h')) {
|
||||
MxStreamChunk* chunk = (MxStreamChunk*) header;
|
||||
if (!m_unk0x30->HasId((chunk)->GetObjectId())) {
|
||||
@@ -316,8 +320,9 @@ MxResult MxDSBuffer::ParseChunk(
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
if (buffer) {
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
delete p_header;
|
||||
return FAILURE;
|
||||
@@ -337,8 +342,9 @@ MxResult MxDSBuffer::ParseChunk(
|
||||
MxNextActionDataStart* data =
|
||||
p_controller->FindNextActionDataStartFromStreamingAction(m_unk0x30);
|
||||
|
||||
if (data)
|
||||
if (data) {
|
||||
data->SetData(m_unk0x30->GetBufferOffset());
|
||||
}
|
||||
|
||||
m_unk0x30->FUN_100cd2d0();
|
||||
}
|
||||
@@ -472,8 +478,9 @@ MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data)
|
||||
if (bytesRead <= m_bytesRemaining) {
|
||||
memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead);
|
||||
|
||||
if (m_writeOffset == m_bytesRemaining)
|
||||
if (m_writeOffset == m_bytesRemaining) {
|
||||
*(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoLength(m_pBuffer) + MxStreamChunk::GetHeaderSize();
|
||||
}
|
||||
|
||||
m_bytesRemaining -= bytesRead;
|
||||
result = SUCCESS;
|
||||
@@ -510,8 +517,9 @@ MxU8* MxDSBuffer::FUN_100c6fa0(MxU8* p_data)
|
||||
break;
|
||||
case FOURCC('M', 'x', 'O', 'b'):
|
||||
case FOURCC('M', 'x', 'C', 'h'):
|
||||
if (current != p_data)
|
||||
if (current != p_data) {
|
||||
return current;
|
||||
}
|
||||
current = ((MxU32) current & 1) + current;
|
||||
current += 8;
|
||||
break;
|
||||
|
||||
@@ -15,8 +15,9 @@ MxDSChunk::MxDSChunk()
|
||||
// FUNCTION: LEGO1 0x100be170
|
||||
MxDSChunk::~MxDSChunk()
|
||||
{
|
||||
if (m_flags & c_bit1)
|
||||
if (m_flags & c_bit1) {
|
||||
delete[] m_data;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100be1e0
|
||||
|
||||
@@ -98,8 +98,9 @@ MxLong MxDSFile::Close()
|
||||
// FUNCTION: LEGO1 0x100cc780
|
||||
MxResult MxDSFile::Read(unsigned char* p_buf, MxULong p_nbytes)
|
||||
{
|
||||
if (m_io.Read(p_buf, p_nbytes) != p_nbytes)
|
||||
if (m_io.Read(p_buf, p_nbytes) != p_nbytes) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_position += p_nbytes;
|
||||
return SUCCESS;
|
||||
|
||||
@@ -16,17 +16,20 @@ MxDSSubscriber::MxDSSubscriber()
|
||||
// FUNCTION: LEGO1 0x100b7e00
|
||||
MxDSSubscriber::~MxDSSubscriber()
|
||||
{
|
||||
if (m_controller)
|
||||
if (m_controller) {
|
||||
m_controller->RemoveSubscriber(this);
|
||||
}
|
||||
|
||||
DeleteChunks();
|
||||
|
||||
if (m_pendingChunkCursor)
|
||||
if (m_pendingChunkCursor) {
|
||||
delete m_pendingChunkCursor;
|
||||
}
|
||||
m_pendingChunkCursor = NULL;
|
||||
|
||||
if (m_consumedChunkCursor)
|
||||
if (m_consumedChunkCursor) {
|
||||
delete m_consumedChunkCursor;
|
||||
}
|
||||
m_consumedChunkCursor = NULL;
|
||||
}
|
||||
|
||||
@@ -36,17 +39,20 @@ MxResult MxDSSubscriber::Create(MxStreamController* p_controller, MxU32 p_object
|
||||
m_objectId = p_objectId;
|
||||
m_unk0x48 = p_unk0x48;
|
||||
|
||||
if (!p_controller)
|
||||
if (!p_controller) {
|
||||
return FAILURE;
|
||||
}
|
||||
m_controller = p_controller;
|
||||
|
||||
m_pendingChunkCursor = new MxStreamChunkListCursor(&m_pendingChunks);
|
||||
if (!m_pendingChunkCursor)
|
||||
if (!m_pendingChunkCursor) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_consumedChunkCursor = new MxStreamChunkListCursor(&m_consumedChunks);
|
||||
if (!m_consumedChunkCursor)
|
||||
if (!m_consumedChunkCursor) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_controller->AddSubscriber(this);
|
||||
return SUCCESS;
|
||||
@@ -74,10 +80,12 @@ void MxDSSubscriber::DeleteChunks()
|
||||
MxResult MxDSSubscriber::AddChunk(MxStreamChunk* p_chunk, MxBool p_append)
|
||||
{
|
||||
if (m_pendingChunkCursor) {
|
||||
if (p_append)
|
||||
if (p_append) {
|
||||
m_pendingChunks.Append(p_chunk);
|
||||
else
|
||||
}
|
||||
else {
|
||||
m_pendingChunks.Prepend(p_chunk);
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -88,8 +96,9 @@ MxStreamChunk* MxDSSubscriber::NextChunk()
|
||||
{
|
||||
MxStreamChunk* chunk = NULL;
|
||||
|
||||
if (m_pendingChunkCursor)
|
||||
if (m_pendingChunkCursor) {
|
||||
m_pendingChunkCursor->First(chunk);
|
||||
}
|
||||
|
||||
if (chunk) {
|
||||
m_pendingChunkCursor->Detach();
|
||||
@@ -104,8 +113,9 @@ MxStreamChunk* MxDSSubscriber::CurrentChunk()
|
||||
{
|
||||
MxStreamChunk* chunk = NULL;
|
||||
|
||||
if (m_pendingChunkCursor)
|
||||
if (m_pendingChunkCursor) {
|
||||
m_pendingChunkCursor->First(chunk);
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
@@ -116,10 +126,12 @@ void MxDSSubscriber::DestroyChunk(MxStreamChunk* p_chunk)
|
||||
if (p_chunk) {
|
||||
if (m_consumedChunkCursor->Find(p_chunk)) {
|
||||
m_consumedChunkCursor->Detach();
|
||||
if (p_chunk)
|
||||
if (p_chunk) {
|
||||
delete p_chunk;
|
||||
}
|
||||
}
|
||||
else if (p_chunk->GetFlags() & MxDSChunk::c_bit1 && p_chunk)
|
||||
else if (p_chunk->GetFlags() & MxDSChunk::c_bit1 && p_chunk) {
|
||||
delete p_chunk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,9 @@ MxU16 MXIOINFO::Close(MxLong p_unused)
|
||||
_lclose((HFILE) m_info.hmmio);
|
||||
m_info.hmmio = 0;
|
||||
|
||||
if (m_info.dwFlags & MMIO_ALLOCBUF)
|
||||
if (m_info.dwFlags & MMIO_ALLOCBUF) {
|
||||
delete[] m_info.pchBuffer;
|
||||
}
|
||||
|
||||
m_info.pchEndWrite = 0;
|
||||
m_info.pchEndRead = 0;
|
||||
@@ -95,8 +96,9 @@ MxLong MXIOINFO::Read(void* p_buf, MxLong p_len)
|
||||
while (p_len > 0) {
|
||||
|
||||
if (bytesLeft > 0) {
|
||||
if (p_len < bytesLeft)
|
||||
if (p_len < bytesLeft) {
|
||||
bytesLeft = p_len;
|
||||
}
|
||||
|
||||
memcpy(p_buf, m_info.pchNext, bytesLeft);
|
||||
p_len -= bytesLeft;
|
||||
@@ -105,12 +107,14 @@ MxLong MXIOINFO::Read(void* p_buf, MxLong p_len)
|
||||
bytesRead += bytesLeft;
|
||||
}
|
||||
|
||||
if (p_len <= 0 || Advance(0))
|
||||
if (p_len <= 0 || Advance(0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
bytesLeft = m_info.pchEndRead - m_info.pchNext;
|
||||
if (bytesLeft <= 0)
|
||||
if (bytesLeft <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_info.hmmio && p_len > 0) {
|
||||
@@ -381,8 +385,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU
|
||||
{
|
||||
MxU16 result = 0;
|
||||
|
||||
if (!p_chunkInfo)
|
||||
if (!p_chunkInfo) {
|
||||
return MMIOERR_BASE; // ?
|
||||
}
|
||||
|
||||
if (!p_descend) {
|
||||
p_chunkInfo->dwFlags = 0;
|
||||
@@ -406,8 +411,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU
|
||||
else {
|
||||
MxULong ofs = MAXLONG;
|
||||
|
||||
if (p_parentInfo)
|
||||
if (p_parentInfo) {
|
||||
ofs = p_parentInfo->cksize + p_parentInfo->dwDataOffset;
|
||||
}
|
||||
|
||||
BOOL running = TRUE;
|
||||
BOOL readOk = FALSE;
|
||||
@@ -452,8 +458,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU
|
||||
}
|
||||
}
|
||||
|
||||
if (!result)
|
||||
if (!result) {
|
||||
memcpy(p_chunkInfo, &tmp, sizeof(MMCKINFO));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -71,8 +71,9 @@ MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource)
|
||||
path = MxString(MxOmni::GetCD()) + p_resource->GetAtom().GetInternal() + ".si";
|
||||
m_pFile->SetFileName(path.GetData());
|
||||
|
||||
if (m_pFile->Open(0) != 0)
|
||||
if (m_pFile->Open(0) != 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
m_fileSize = m_pFile->CalcFileSize();
|
||||
@@ -131,23 +132,27 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size)
|
||||
MxDSBuffer::Append(data2, data3);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
else {
|
||||
*MxStreamChunk::IntoFlags(data2) &= ~MxDSChunk::c_split;
|
||||
}
|
||||
}
|
||||
|
||||
data2 += MxDSChunk::Size(*MxDSChunk::IntoLength(data2));
|
||||
memcpy(data2, data3, MxDSChunk::Size(*psize));
|
||||
|
||||
if (*MxStreamChunk::IntoObjectId(data2) == id &&
|
||||
(*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_end))
|
||||
(*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_end)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
data++;
|
||||
}
|
||||
} while (data < end);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,14 @@ MxStreamController::~MxStreamController()
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
|
||||
MxDSSubscriber* subscriber;
|
||||
while (m_subscriberList.PopFront(subscriber))
|
||||
while (m_subscriberList.PopFront(subscriber)) {
|
||||
delete subscriber;
|
||||
}
|
||||
|
||||
MxDSAction* action;
|
||||
while (m_unk0x3c.PopFront(action))
|
||||
while (m_unk0x3c.PopFront(action)) {
|
||||
delete action;
|
||||
}
|
||||
|
||||
if (m_provider) {
|
||||
MxStreamProvider* provider = m_provider;
|
||||
@@ -71,8 +73,9 @@ MxStreamController::~MxStreamController()
|
||||
m_unk0x2c = NULL;
|
||||
}
|
||||
|
||||
while (m_unk0x54.PopFront(action))
|
||||
while (m_unk0x54.PopFront(action)) {
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c1520
|
||||
@@ -109,13 +112,16 @@ MxResult MxStreamController::VTable0x20(MxDSAction* p_action)
|
||||
MxS32 objectId = p_action->GetObjectId();
|
||||
MxStreamProvider* provider = m_provider;
|
||||
|
||||
if ((MxS32) provider->GetLengthInDWords() > objectId)
|
||||
if ((MxS32) provider->GetLengthInDWords() > objectId) {
|
||||
offset = provider->GetBufferForDWords()[objectId];
|
||||
}
|
||||
|
||||
if (offset)
|
||||
if (offset) {
|
||||
result = VTable0x2c(p_action, offset);
|
||||
else
|
||||
}
|
||||
else {
|
||||
result = FAILURE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -159,16 +165,18 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
|
||||
for (MxStreamListMxDSAction::iterator it = m_unk0x54.begin(); it != m_unk0x54.end(); it++) {
|
||||
MxDSAction* action = *it;
|
||||
|
||||
if (action->GetObjectId() == p_action->GetObjectId())
|
||||
if (action->GetObjectId() == p_action->GetObjectId()) {
|
||||
newUnknown24 = Max(newUnknown24, action->GetUnknown24());
|
||||
}
|
||||
}
|
||||
|
||||
if (newUnknown24 == -1) {
|
||||
for (MxStreamListMxDSAction::iterator it = m_unk0x3c.begin(); it != m_unk0x3c.end(); it++) {
|
||||
MxDSAction* action = *it;
|
||||
|
||||
if (action->GetObjectId() == p_action->GetObjectId())
|
||||
if (action->GetObjectId() == p_action->GetObjectId()) {
|
||||
newUnknown24 = Max(newUnknown24, action->GetUnknown24());
|
||||
}
|
||||
}
|
||||
|
||||
if (newUnknown24 == -1) {
|
||||
@@ -176,8 +184,9 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
|
||||
it++) {
|
||||
MxDSSubscriber* subscriber = *it;
|
||||
|
||||
if (subscriber->GetObjectId() == p_action->GetObjectId())
|
||||
if (subscriber->GetObjectId() == p_action->GetObjectId()) {
|
||||
newUnknown24 = Max(newUnknown24, subscriber->GetUnknown48());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,14 +194,16 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
|
||||
p_action->SetUnknown24(newUnknown24 + 1);
|
||||
}
|
||||
else {
|
||||
if (m_unk0x3c.Find(p_action, FALSE))
|
||||
if (m_unk0x3c.Find(p_action, FALSE)) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
MxDSStreamingAction* streamingAction = new MxDSStreamingAction(*p_action, p_offset);
|
||||
|
||||
if (!streamingAction)
|
||||
if (!streamingAction) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxU32 fileSize = m_provider->GetFileSize();
|
||||
streamingAction->SetBufferOffset(fileSize * (p_offset / fileSize));
|
||||
@@ -268,14 +279,16 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
|
||||
MxU32 objectId = p_action->GetObjectId();
|
||||
MxStreamChunk* chunk = new MxStreamChunk;
|
||||
|
||||
if (!chunk)
|
||||
if (!chunk) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
chunk->SetFlags(MxDSChunk::c_bit3);
|
||||
chunk->SetObjectId(objectId);
|
||||
|
||||
if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS)
|
||||
if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) {
|
||||
delete chunk;
|
||||
}
|
||||
|
||||
if (p_action->IsA("MxDSMultiAction")) {
|
||||
MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList();
|
||||
@@ -283,8 +296,9 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
|
||||
MxDSAction* action;
|
||||
|
||||
while (cursor.Next(action)) {
|
||||
if (FUN_100c1f00(action) != SUCCESS)
|
||||
if (FUN_100c1f00(action) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,8 +314,9 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA
|
||||
// FUNCTION: LEGO1 0x100c20d0
|
||||
MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
|
||||
{
|
||||
if (m_subscriberList.Find(&p_obj))
|
||||
if (m_subscriberList.Find(&p_obj)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (p_obj.IsA("MxDSMultiAction")) {
|
||||
MxDSActionList* actions = ((MxDSMultiAction&) p_obj).GetActionList();
|
||||
@@ -309,8 +324,9 @@ MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj)
|
||||
MxDSAction* action;
|
||||
|
||||
while (cursor.Next(action)) {
|
||||
if (!FUN_100c20d0(*action))
|
||||
if (!FUN_100c20d0(*action)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,9 @@ MxLong MxStreamer::Close(const char* p_name)
|
||||
if (!p_name || !strcmp(p_name, c->GetAtom().GetInternal())) {
|
||||
m_openStreams.erase(it);
|
||||
|
||||
if (c->FUN_100c20d0(ds))
|
||||
if (c->FUN_100c20d0(ds)) {
|
||||
delete c;
|
||||
}
|
||||
else {
|
||||
#ifdef COMPAT_MODE
|
||||
{
|
||||
@@ -185,8 +186,9 @@ MxResult MxStreamer::DeleteObject(MxDSAction* p_dsAction)
|
||||
MxBool MxStreamer::FUN_100b9b30(MxDSObject& p_dsObject)
|
||||
{
|
||||
MxStreamController* controller = GetOpenStream(p_dsObject.GetAtomId().GetInternal());
|
||||
if (controller)
|
||||
if (controller) {
|
||||
return controller->FUN_100c20d0(p_dsObject);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -200,8 +202,9 @@ MxLong MxStreamer::Notify(MxParam& p_param)
|
||||
|
||||
MxStreamController* c = static_cast<MxStreamerNotification&>(p_param).GetController();
|
||||
|
||||
if (c->FUN_100c20d0(ds))
|
||||
if (c->FUN_100c20d0(ds)) {
|
||||
delete c;
|
||||
}
|
||||
else {
|
||||
#ifdef COMPAT_MODE
|
||||
{
|
||||
|
||||
@@ -36,8 +36,9 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete)
|
||||
if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 ||
|
||||
p_action->GetUnknown24() == (*it)->GetUnknown24()) {
|
||||
found = *it;
|
||||
if (p_action->GetUnknown24() != -3)
|
||||
if (p_action->GetUnknown24() != -3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,8 +54,9 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete)
|
||||
MxNextActionDataStart* MxStreamListMxNextActionDataStart::Find(MxU32 p_id, MxS16 p_value)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (p_id == (*it)->GetObjectId() && p_value == (*it)->GetUnknown24())
|
||||
if (p_id == (*it)->GetObjectId() && p_value == (*it)->GetUnknown24()) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user