Use AUTOLOCK macro (#660)

* Use AUTOLOCK macro

* MxAutoLock

* Remove semicolon

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

---------

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
MS 2024-03-12 10:23:50 -04:00 committed by GitHub
parent b0483000d8
commit e3d7188ec9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 127 additions and 125 deletions

View file

@ -249,7 +249,7 @@ add_library(omni STATIC
LEGO1/omni/src/stream/mxstreamer.cpp
LEGO1/omni/src/stream/mxstreamlist.cpp
LEGO1/omni/src/stream/mxstreamprovider.cpp
LEGO1/omni/src/system/mxautolocker.cpp
LEGO1/omni/src/system/mxautolock.cpp
LEGO1/omni/src/system/mxcriticalsection.cpp
LEGO1/omni/src/system/mxscheduler.cpp
LEGO1/omni/src/system/mxsemaphore.cpp

View file

@ -1,6 +1,6 @@
#include "legosoundmanager.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxomni.h"
// FUNCTION: LEGO1 0x100298a0
@ -90,6 +90,6 @@ MxResult LegoSoundManager::Tickle()
{
MxSoundManager::Tickle();
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
return m_unk0x40->Tickle();
}

View file

@ -3,7 +3,7 @@
#include "legosoundmanager.h"
#include "legovideomanager.h"
#include "misc.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmultiaction.h"
#include "mxmediapresenter.h"
#include "mxmisc.h"
@ -29,7 +29,7 @@ MxCompositeMediaPresenter::~MxCompositeMediaPresenter()
// FUNCTION: LEGO1 0x10074090
MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = FAILURE;
MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList();
@ -96,7 +96,7 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
// FUNCTION: LEGO1 0x100742e0
void MxCompositeMediaPresenter::StartingTickle()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!m_unk0x4e) {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
@ -142,7 +142,7 @@ void MxCompositeMediaPresenter::StartingTickle()
// FUNCTION: LEGO1 0x10074470
MxResult MxCompositeMediaPresenter::Tickle()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
switch (m_currentTickleState) {
case e_ready:
@ -169,7 +169,7 @@ MxResult MxCompositeMediaPresenter::Tickle()
// FUNCTION: LEGO1 0x10074540
MxResult MxCompositeMediaPresenter::PutData()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (m_currentTickleState >= e_streaming && m_currentTickleState <= e_done) {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {

View file

@ -15,7 +15,7 @@
#include "misc.h"
#include "modeldb/modeldb.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsactionlist.h"
#include "mxdschunk.h"
#include "mxdsmediaaction.h"
@ -78,7 +78,7 @@ LegoWorldPresenter::~LegoWorldPresenter()
// FUNCTION: LEGO1 0x10066870
MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = FAILURE;
MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList();

View file

@ -4,7 +4,7 @@
#include "legoomni.h"
#include "legovideomanager.h"
#include "misc.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "roi/legoroi.h"
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338)
@ -224,7 +224,7 @@ MxResult LegoInputManager::GetJoystickState(
// FUNCTION: LEGO1 0x1005c470
void LegoInputManager::Register(MxCore* p_notify)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
LegoNotifyListCursor cursor(m_keyboardNotifyList);
if (!cursor.Find(p_notify)) {
@ -235,7 +235,7 @@ void LegoInputManager::Register(MxCore* p_notify)
// FUNCTION: LEGO1 0x1005c5c0
void LegoInputManager::UnRegister(MxCore* p_notify)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
LegoNotifyListCursor cursor(m_keyboardNotifyList);
if (cursor.Find(p_notify)) {
@ -281,7 +281,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p
// FUNCTION: LEGO1 0x1005c820
void LegoInputManager::ProcessEvents()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
LegoEventNotificationParam event;
while (m_eventQueue->Dequeue(event)) {

View file

@ -16,7 +16,7 @@
#include "misc.h"
#include "misc/legocontainer.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdsfile.h"
#include "mxmisc.h"
@ -309,7 +309,7 @@ void LegoOmni::Init()
// FUNCTION: LEGO1 0x10058c30
void LegoOmni::Destroy()
{
MxAutoLocker lock(&this->m_criticalsection);
AUTOLOCK(m_criticalSection);
m_notificationManager->Unregister(this);
@ -389,7 +389,7 @@ void LegoOmni::Destroy()
MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
{
MxResult result = FAILURE;
MxAutoLocker lock(&this->m_criticalsection);
AUTOLOCK(m_criticalSection);
p_param.CreateFlags().CreateObjectFactory(FALSE);
p_param.CreateFlags().CreateVideoManager(FALSE);

View file

@ -2,7 +2,7 @@
#include "legovideomanager.h"
#include "misc.h"
#include "mxautolocker.h"
#include "mxautolock.h"
DECOMP_SIZE_ASSERT(LegoPathPresenter, 0x54);
@ -44,7 +44,7 @@ void LegoPathPresenter::Destroy(MxBool p_fromDestructor)
}
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
Init();
}

View file

@ -0,0 +1,17 @@
#ifndef MXAUTOLOCK_H
#define MXAUTOLOCK_H
#include "mxcriticalsection.h"
#define AUTOLOCK(CS) MxAutoLock lock(&CS)
class MxAutoLock {
public:
MxAutoLock(MxCriticalSection* p_criticalSection);
~MxAutoLock();
private:
MxCriticalSection* m_criticalSection;
};
#endif // MXAUTOLOCK_H

View file

@ -1,15 +0,0 @@
#ifndef MXAUTOLOCKER_H
#define MXAUTOLOCKER_H
#include "mxcriticalsection.h"
class MxAutoLocker {
public:
MxAutoLocker(MxCriticalSection* p_criticalSection);
~MxAutoLocker();
private:
MxCriticalSection* m_criticalSection;
};
#endif // MXAUTOLOCKER_H

View file

@ -91,7 +91,7 @@ class MxOmni : public MxCore {
MxTimer* m_timer; // 0x3c
MxStreamer* m_streamer; // 0x40
MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44
MxCriticalSection m_criticalsection; // 0x48
MxCriticalSection m_criticalSection; // 0x48
MxBool m_timerRunning; // 0x64
};

View file

@ -1,7 +1,7 @@
#include "mxmidipresenter.h"
#include "decomp.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdssound.h"
#include "mxmisc.h"
#include "mxmusicmanager.h"
@ -115,7 +115,7 @@ MxResult MxMIDIPresenter::PutData()
void MxMIDIPresenter::EndAction()
{
if (m_action) {
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxMediaPresenter::EndAction();
MusicManager()->DeinitializeMIDI();

View file

@ -1,7 +1,7 @@
#include "mxsoundmanager.h"
#include "define.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxmisc.h"
#include "mxomni.h"
#include "mxpresenter.h"
@ -168,7 +168,7 @@ void MxSoundManager::SetVolume(MxS32 p_volume)
// FUNCTION: LEGO1 0x100aebd0
MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(m_presenters);
@ -195,7 +195,7 @@ MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_undefined)
// FUNCTION: LEGO1 0x100aed10
void MxSoundManager::Pause()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(m_presenters);
@ -210,7 +210,7 @@ void MxSoundManager::Pause()
// FUNCTION: LEGO1 0x100aee10
void MxSoundManager::Resume()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(m_presenters);

View file

@ -2,7 +2,7 @@
#include "decomp.h"
#include "define.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdssound.h"
#include "mxmisc.h"
#include "mxomni.h"
@ -241,7 +241,7 @@ void MxWavePresenter::LoopChunk(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b2160
MxResult MxWavePresenter::PutData()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (IsEnabled()) {
switch (m_currentTickleState) {
@ -280,7 +280,7 @@ MxResult MxWavePresenter::PutData()
void MxWavePresenter::EndAction()
{
if (m_action) {
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxMediaPresenter::EndAction();
if (m_dsBuffer) {

View file

@ -1,7 +1,7 @@
#include "mxcompositepresenter.h"
#include "decomp.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmultiaction.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
@ -24,7 +24,7 @@ MxCompositePresenter::~MxCompositePresenter()
// FUNCTION: LEGO1 0x100b6410
MxResult MxCompositePresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = FAILURE;
MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList();
@ -77,7 +77,7 @@ MxResult MxCompositePresenter::StartAction(MxStreamController* p_controller, MxD
// FUNCTION: LEGO1 0x100b65e0
void MxCompositePresenter::EndAction()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!m_action) {
return;
@ -113,7 +113,7 @@ void MxCompositePresenter::EndAction()
// FUNCTION: LEGO1 0x100b6760
MxLong MxCompositePresenter::Notify(MxParam& p_param)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:

View file

@ -1,7 +1,7 @@
#include "mxmediamanager.h"
#include "decomp.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxomni.h"
#include "mxpresenter.h"
#include "mxticklemanager.h"
@ -33,7 +33,7 @@ MxResult MxMediaManager::Init()
// FUNCTION: LEGO1 0x100b85e0
MxResult MxMediaManager::InitPresenters()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
this->m_presenters = new MxPresenterList;
@ -48,7 +48,7 @@ MxResult MxMediaManager::InitPresenters()
// FUNCTION: LEGO1 0x100b8710
void MxMediaManager::Destroy()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (this->m_presenters) {
delete this->m_presenters;
@ -60,7 +60,7 @@ void MxMediaManager::Destroy()
// FUNCTION: LEGO1 0x100b8790
MxResult MxMediaManager::Tickle()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(this->m_presenters);
@ -80,7 +80,7 @@ MxResult MxMediaManager::Tickle()
// FUNCTION: LEGO1 0x100b88c0
void MxMediaManager::RegisterPresenter(MxPresenter& p_presenter)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
this->m_presenters->Append(&p_presenter);
}
@ -88,7 +88,7 @@ void MxMediaManager::RegisterPresenter(MxPresenter& p_presenter)
// FUNCTION: LEGO1 0x100b8980
void MxMediaManager::UnregisterPresenter(MxPresenter& p_presenter)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenterListCursor cursor(this->m_presenters);
if (cursor.Find(&p_presenter)) {
@ -99,7 +99,7 @@ void MxMediaManager::UnregisterPresenter(MxPresenter& p_presenter)
// FUNCTION: LEGO1 0x100b8ac0
void MxMediaManager::StopPresenters()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* presenter;
MxPresenterListCursor cursor(this->m_presenters);

View file

@ -1,7 +1,7 @@
#include "mxmediapresenter.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxcompositepresenter.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
@ -25,7 +25,7 @@ void MxMediaPresenter::Init()
void MxMediaPresenter::Destroy(MxBool p_fromDestructor)
{
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (m_currentChunk && m_subscriber) {
m_subscriber->FreeDataChunk(m_currentChunk);
@ -101,7 +101,7 @@ MxStreamChunk* MxMediaPresenter::NextChunk()
MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxResult result = FAILURE;
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
if (m_action->GetFlags() & MxDSAction::c_looping) {
@ -132,7 +132,7 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct
// FUNCTION: LEGO1 0x100b5bc0
void MxMediaPresenter::EndAction()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!m_action) {
return;
@ -172,7 +172,7 @@ void MxMediaPresenter::EndAction()
// FUNCTION: LEGO1 0x100b5d10
MxResult MxMediaPresenter::Tickle()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
CurrentChunk();

View file

@ -3,7 +3,7 @@
#include "decomp.h"
#include "define.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxcompositepresenter.h"
#include "mxdsanim.h"
#include "mxdssound.h"
@ -34,7 +34,7 @@ void MxPresenter::Init()
// FUNCTION: LEGO1 0x100b4d80
MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
this->m_action = p_action;
@ -55,7 +55,7 @@ void MxPresenter::EndAction()
return;
}
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!this->m_compositePresenter) {
#ifdef COMPAT_MODE
@ -79,7 +79,7 @@ void MxPresenter::EndAction()
// FUNCTION: LEGO1 0x100b4fc0
void MxPresenter::ParseExtra()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxU16 extraLength;
char* extraData;
@ -113,7 +113,7 @@ void MxPresenter::ParseExtra()
void MxPresenter::SendToCompositePresenter(MxOmni* p_omni)
{
if (m_compositePresenter) {
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
#ifdef COMPAT_MODE
{
@ -132,7 +132,7 @@ void MxPresenter::SendToCompositePresenter(MxOmni* p_omni)
// FUNCTION: LEGO1 0x100b5200
MxResult MxPresenter::Tickle()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
switch (this->m_currentTickleState) {
case e_ready:

View file

@ -1,7 +1,7 @@
#include "mxeventpresenter.h"
#include "decomp.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxeventmanager.h"
#include "mxmisc.h"
#include "mxvariabletable.h"
@ -90,7 +90,7 @@ void MxEventPresenter::StartingTickle()
// FUNCTION: LEGO1 0x100c2ef0
MxResult MxEventPresenter::PutData()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (IsEnabled()) {
if (m_currentTickleState >= e_streaming &&

View file

@ -2,7 +2,7 @@
#include "mxactionnotificationparam.h"
#include "mxatom.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmultiaction.h"
#include "mxeventmanager.h"
#include "mxmisc.h"
@ -338,7 +338,7 @@ MxBool MxOmni::ActionSourceEquals(MxDSAction* p_action, const char* p_name)
// FUNCTION: LEGO1 0x100b07f0
MxLong MxOmni::Notify(MxParam& p_param)
{
MxAutoLocker lock(&this->m_criticalsection);
AUTOLOCK(m_criticalSection);
if (((MxNotificationParam&) p_param).GetNotification() != c_notificationEndAction) {
return 0;

View file

@ -2,7 +2,7 @@
#include "compat.h"
#include "decomp.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxmisc.h"
#include "mxparam.h"
#include "mxticklemanager.h"
@ -36,7 +36,7 @@ MxNotificationManager::MxNotificationManager() : MxCore(), m_lock(), m_listenerI
// FUNCTION: LEGO1 0x100ac450
MxNotificationManager::~MxNotificationManager()
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
Tickle();
delete m_queue;
m_queue = NULL;
@ -63,7 +63,7 @@ MxResult MxNotificationManager::Create(MxU32 p_frequencyMS, MxBool p_createThrea
// FUNCTION: LEGO1 0x100ac6c0
MxResult MxNotificationManager::Send(MxCore* p_listener, MxNotificationParam* p_param)
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
if (m_active == FALSE) {
return FAILURE;
@ -94,7 +94,7 @@ MxResult MxNotificationManager::Tickle()
}
else {
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
MxNotificationPtrList* temp1 = m_queue;
MxNotificationPtrList* temp2 = m_sendList;
m_queue = temp2;
@ -121,7 +121,7 @@ void MxNotificationManager::FlushPending(MxCore* p_listener)
MxNotification* notif;
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
// Find all notifications from, and addressed to, p_listener.
if (m_sendList != NULL) {
@ -166,7 +166,7 @@ void MxNotificationManager::FlushPending(MxCore* p_listener)
// FUNCTION: LEGO1 0x100acd20
void MxNotificationManager::Register(MxCore* p_listener)
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
if (it != m_listenerIds.end()) {
@ -179,7 +179,7 @@ void MxNotificationManager::Register(MxCore* p_listener)
// FUNCTION: LEGO1 0x100acdf0
void MxNotificationManager::Unregister(MxCore* p_listener)
{
MxAutoLocker lock(&m_lock);
AUTOLOCK(m_lock);
MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());

View file

@ -1,7 +1,7 @@
#include "mxdiskstreamcontroller.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdiskstreamprovider.h"
#include "mxdsstreamingaction.h"
#include "mxmisc.h"
@ -19,7 +19,7 @@ MxDiskStreamController::MxDiskStreamController()
// FUNCTION: LEGO1 0x100c7530
MxDiskStreamController::~MxDiskStreamController()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
m_unk0xc4 = FALSE;
m_unk0x70 = FALSE;
@ -67,7 +67,7 @@ MxDiskStreamController::~MxDiskStreamController()
// FUNCTION: LEGO1 0x100c7790
MxResult MxDiskStreamController::Open(const char* p_filename)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = MxStreamController::Open(p_filename);
if (result == SUCCESS) {
@ -99,7 +99,7 @@ MxResult MxDiskStreamController::VTable0x18(undefined4, undefined4)
// FUNCTION: LEGO1 0x100c7890
MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (p_action == NULL) {
return FAILURE;
}
@ -128,7 +128,7 @@ void MxDiskStreamController::FUN_100c7980()
MxDSStreamingAction* action = NULL;
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (m_unk0x3c.size() && m_unk0x8c < m_provider->GetStreamBuffersNum()) {
buffer = new MxDSBuffer();
@ -161,7 +161,7 @@ void MxDiskStreamController::FUN_100c7980()
// FUNCTION: LEGO1 0x100c7ac0
MxDSStreamingAction* MxDiskStreamController::VTable0x28()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSAction* oldAction;
MxDSStreamingAction* result = NULL;
MxU32 filesize = m_provider->GetFileSize();
@ -182,7 +182,7 @@ MxDSStreamingAction* MxDiskStreamController::VTable0x28()
// FUNCTION: LEGO1 0x100c7c00
MxResult MxDiskStreamController::VTable0x30(MxDSAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = MxStreamController::VTable0x30(p_action);
MxDSStreamingAction* item;
@ -231,7 +231,7 @@ void MxDiskStreamController::FUN_100c7ce0(MxDSBuffer* p_buffer)
// FUNCTION: LEGO1 0x100c7d10
MxResult MxDiskStreamController::FUN_100c7d10()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSStreamingAction* action = FUN_100c7db0();
if (!action) {
@ -250,7 +250,7 @@ MxResult MxDiskStreamController::FUN_100c7d10()
// FUNCTION: LEGO1 0x100c7db0
MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
for (MxStreamListMxNextActionDataStart::iterator it = m_nextActionList.begin(); it != m_nextActionList.end();
it++) {
@ -276,7 +276,7 @@ MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0()
// FUNCTION: LEGO1 0x100c7f40
void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (p_streamingaction) {
m_list0x64.push_back(p_streamingaction);
}
@ -285,7 +285,7 @@ void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction
// FUNCTION: LEGO1 0x100c7ff0
MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSStreamingAction* entry =
(MxDSStreamingAction*) m_list0x80.Find(p_action, FALSE); // TODO: is this a seperate class?
if (entry) {
@ -331,7 +331,7 @@ void MxDiskStreamController::FUN_100c8120(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c8160
MxResult MxDiskStreamController::VTable0x24(MxDSAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
if (m_unk0x54.Find(p_action, FALSE) == NULL) {
if (VTable0x30(p_action) == SUCCESS) {
#ifdef COMPAT_MODE
@ -373,7 +373,7 @@ MxResult MxDiskStreamController::VTable0x24(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c8360
MxResult MxDiskStreamController::FUN_100c8360(MxDSStreamingAction* p_action)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSBuffer* buffer = p_action->GetUnknowna0();
MxDSStreamingAction* action2 = (MxDSStreamingAction*) m_list0x90.Find(p_action, TRUE);
buffer->FUN_100c6f80(p_action->GetUnknown94() - p_action->GetBufferOffset());
@ -404,14 +404,14 @@ MxResult MxDiskStreamController::FUN_100c8360(MxDSStreamingAction* p_action)
// FUNCTION: LEGO1 0x100c84a0
void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer)
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
m_list0x74.push_back(p_buffer);
}
// FUNCTION: LEGO1 0x100c8540
void MxDiskStreamController::FUN_100c8540()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
for (list<MxDSBuffer*>::iterator it = m_list0x74.begin(); it != m_list0x74.end();) {
MxDSBuffer* buf = *it;
if (buf->GetRefCount() == 0) {
@ -452,14 +452,14 @@ MxResult MxDiskStreamController::Tickle()
// FUNCTION: LEGO1 0x100c8670
void MxDiskStreamController::FUN_100c8670(MxDSStreamingAction* p_streamingAction)
{
MxAutoLocker lock(&this->m_critical9c);
AUTOLOCK(m_critical9c);
m_list0xb8.push_back(p_streamingAction);
}
// FUNCTION: LEGO1 0x100c8720
void MxDiskStreamController::FUN_100c8720()
{
MxAutoLocker lock(&this->m_critical9c);
AUTOLOCK(m_critical9c);
MxDSStreamingAction* action;
while (!m_list0xb8.empty()) {

View file

@ -1,6 +1,6 @@
#include "mxdiskstreamprovider.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdiskstreamcontroller.h"
#include "mxdsbuffer.h"
#include "mxdsstreamingaction.h"
@ -52,7 +52,7 @@ MxDiskStreamProvider::~MxDiskStreamProvider()
action = NULL;
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
m_list.PopFrontStreamingAction(action);
}
@ -124,7 +124,7 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
action = NULL;
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
m_list.PopFrontStreamingAction(action);
}
@ -142,7 +142,7 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action)
else {
do {
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
action = (MxDSStreamingAction*) m_list.Find(p_action, TRUE);
}
@ -199,7 +199,7 @@ MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action)
}
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
m_list.push_back(p_action);
}
@ -215,7 +215,7 @@ void MxDiskStreamProvider::PerformWork()
MxDSStreamingAction* streamingAction = NULL;
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!m_list.empty()) {
streamingAction = (MxDSStreamingAction*) m_list.front();
@ -230,7 +230,7 @@ void MxDiskStreamProvider::PerformWork()
MxDSBuffer* buffer;
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (!m_list.PopFrontStreamingAction(streamingAction)) {
goto done;

View file

@ -1,6 +1,6 @@
#include "mxramstreamcontroller.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsstreamingaction.h"
#include "mxramstreamprovider.h"
@ -9,7 +9,7 @@ DECOMP_SIZE_ASSERT(MxRAMStreamController, 0x98);
// FUNCTION: LEGO1 0x100c6110
MxResult MxRAMStreamController::Open(const char* p_filename)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (MxStreamController::Open(p_filename) != SUCCESS) {
return FAILURE;
}
@ -37,7 +37,7 @@ MxResult MxRAMStreamController::Open(const char* p_filename)
// FUNCTION: LEGO1 0x100c6210
MxResult MxRAMStreamController::VTable0x20(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxS32 unk0x24 = 0;
MxResult result = FAILURE;
@ -81,7 +81,7 @@ MxResult MxRAMStreamController::VTable0x24(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c63c0
MxResult MxRAMStreamController::DeserializeObject(MxDSStreamingAction& p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result;
MxDSStreamingAction* value = NULL;

View file

@ -1,6 +1,6 @@
#include "mxstreamcontroller.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmultiaction.h"
#include "mxdsstreamingaction.h"
#include "mxmisc.h"
@ -42,7 +42,7 @@ MxStreamController::MxStreamController()
// FUNCTION: LEGO1 0x100c1290
MxStreamController::~MxStreamController()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSSubscriber* subscriber;
while (m_subscriberList.PopFront(subscriber)) {
@ -82,7 +82,7 @@ MxStreamController::~MxStreamController()
MxResult MxStreamController::Open(const char* p_filename)
{
char sourceName[256];
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MakeSourceName(sourceName, p_filename);
this->m_atom = MxAtomId(sourceName, e_lowerCase2);
@ -104,7 +104,7 @@ void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber)
// FUNCTION: LEGO1 0x100c1690
MxResult MxStreamController::VTable0x20(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result;
MxU32 offset = 0;
@ -129,7 +129,7 @@ MxResult MxStreamController::VTable0x20(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c1740
MxResult MxStreamController::VTable0x24(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
VTable0x30(p_action);
m_action0x60 = m_unk0x54.Find(p_action, TRUE);
if (m_action0x60 == NULL) {
@ -219,7 +219,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
// FUNCTION: LEGO1 0x100c1c10
MxResult MxStreamController::VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (FUN_100c1a00(p_action, p_bufferval) != SUCCESS) {
return FAILURE;
}
@ -229,7 +229,7 @@ MxResult MxStreamController::VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval)
// FUNCTION: LEGO1 0x100c1ce0
MxResult MxStreamController::VTable0x30(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxResult result = FAILURE;
MxDSAction* action = m_unk0x3c.Find(p_action, TRUE);
if (action != NULL) {
@ -244,7 +244,7 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c1da0
MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxDSAction* action = p_action->Clone();
if (action == NULL) {
@ -259,7 +259,7 @@ MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action)
// FUNCTION: LEGO1 0x100c1e70
MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxPresenter* result = NULL;
if (p_action.GetObjectId() != -1) {
MxDSAction* action = m_unk0x3c.Find(&p_action, FALSE);
@ -274,7 +274,7 @@ MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action)
// FUNCTION: LEGO1 0x100c1f00
MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
MxU32 objectId = p_action->GetObjectId();
MxStreamChunk* chunk = new MxStreamChunk;

View file

@ -1,7 +1,7 @@
#include "mxautolocker.h"
#include "mxautolock.h"
// FUNCTION: LEGO1 0x100b8ed0
MxAutoLocker::MxAutoLocker(MxCriticalSection* p_criticalSection)
MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection)
{
this->m_criticalSection = p_criticalSection;
if (this->m_criticalSection != 0) {
@ -10,7 +10,7 @@ MxAutoLocker::MxAutoLocker(MxCriticalSection* p_criticalSection)
}
// FUNCTION: LEGO1 0x100b8ef0
MxAutoLocker::~MxAutoLocker()
MxAutoLock::~MxAutoLock()
{
if (this->m_criticalSection != 0) {
this->m_criticalSection->Leave();

View file

@ -1,6 +1,6 @@
#include "mxloopingsmkpresenter.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmediaaction.h"
DECOMP_SIZE_ASSERT(MxLoopingSmkPresenter, 0x724);
@ -122,7 +122,7 @@ void MxLoopingSmkPresenter::RepeatingTickle()
// FUNCTION: LEGO1 0x100b4cd0
MxResult MxLoopingSmkPresenter::AddToManager()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
return MxSmkPresenter::AddToManager();
}

View file

@ -1,6 +1,6 @@
#include "mxvideomanager.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxmisc.h"
#include "mxomni.h"
#include "mxpresenter.h"
@ -306,7 +306,7 @@ void MxVideoManager::InvalidateRect(MxRect32& p_rect)
// FUNCTION: LEGO1 0x100bea90
MxResult MxVideoManager::Tickle()
{
MxAutoLocker lock(&this->m_criticalSection);
AUTOLOCK(m_criticalSection);
SortPresenterList();

View file

@ -1,6 +1,6 @@
#include "mxvideopresenter.h"
#include "mxautolocker.h"
#include "mxautolock.h"
#include "mxdsmediaaction.h"
#include "mxmisc.h"
#include "mxregioncursor.h"
@ -544,7 +544,7 @@ void MxVideoPresenter::EndAction()
{
if (m_action) {
MxMediaPresenter::EndAction();
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (m_bitmap) {
MxLong height = m_bitmap->GetBmiHeightAbs();
@ -562,7 +562,7 @@ void MxVideoPresenter::EndAction()
// FUNCTION: LEGO1 0x100b3280
MxResult MxVideoPresenter::PutData()
{
MxAutoLocker lock(&m_criticalSection);
AUTOLOCK(m_criticalSection);
if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5) {
PutFrame();