mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-26 01:44:19 +00:00
Reorganize sources and files (#414)
* Reorganize sources * Refactor * Remove relative paths * Renames * Fix gitignore * Remove stuff * Try fixing format script * Fix format * Fix format * Fix naming script * Test format * Fix format
This commit is contained in:
committed by
GitHub
parent
6a85e62406
commit
c47206617d
33
LEGO1/omni/src/notify/mxactionnotificationparam.cpp
Normal file
33
LEGO1/omni/src/notify/mxactionnotificationparam.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "mxactionnotificationparam.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxActionNotificationParam, 0x14)
|
||||
DECOMP_SIZE_ASSERT(MxEndActionNotificationParam, 0x14)
|
||||
|
||||
// FUNCTION: LEGO1 0x100510c0
|
||||
MxNotificationParam* MxActionNotificationParam::Clone()
|
||||
{
|
||||
return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10051270
|
||||
MxNotificationParam* MxEndActionNotificationParam::Clone()
|
||||
{
|
||||
return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b0300
|
||||
MxNotificationParam* MxStartActionNotificationParam::Clone()
|
||||
{
|
||||
return new MxStartActionNotificationParam(
|
||||
c_notificationStartAction,
|
||||
this->m_sender,
|
||||
this->m_action,
|
||||
this->m_realloc
|
||||
);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100b04f0
|
||||
MxNotificationParam* MxType4NotificationParam::Clone()
|
||||
{
|
||||
return new MxType4NotificationParam(this->m_sender, this->m_action, this->m_unk0x14);
|
||||
}
|
||||
189
LEGO1/omni/src/notify/mxnotificationmanager.cpp
Normal file
189
LEGO1/omni/src/notify/mxnotificationmanager.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
#include "mxnotificationmanager.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "legoomni.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxparam.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxNotification, 0x8);
|
||||
DECOMP_SIZE_ASSERT(MxNotificationManager, 0x40);
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac220
|
||||
MxNotification::MxNotification(MxCore* p_target, MxNotificationParam* p_param)
|
||||
{
|
||||
m_target = p_target;
|
||||
m_param = p_param->Clone();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac240
|
||||
MxNotification::~MxNotification()
|
||||
{
|
||||
delete m_param;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac250
|
||||
MxNotificationManager::MxNotificationManager() : MxCore(), m_lock(), m_listenerIds()
|
||||
{
|
||||
m_unk0x2c = 0;
|
||||
m_queue = NULL;
|
||||
m_active = TRUE;
|
||||
m_sendList = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac450
|
||||
MxNotificationManager::~MxNotificationManager()
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
Tickle();
|
||||
delete m_queue;
|
||||
m_queue = NULL;
|
||||
|
||||
TickleManager()->UnregisterClient(this);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac600
|
||||
MxResult MxNotificationManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
MxResult result = SUCCESS;
|
||||
m_queue = new MxNotificationPtrList();
|
||||
|
||||
if (m_queue == NULL) {
|
||||
result = FAILURE;
|
||||
}
|
||||
else {
|
||||
TickleManager()->RegisterClient(this, 10);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac6c0
|
||||
MxResult MxNotificationManager::Send(MxCore* p_listener, MxNotificationParam* p_param)
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
|
||||
if (m_active == FALSE) {
|
||||
return FAILURE;
|
||||
}
|
||||
else {
|
||||
MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
|
||||
if (it == m_listenerIds.end()) {
|
||||
return FAILURE;
|
||||
}
|
||||
else {
|
||||
MxNotification* notif = new MxNotification(p_listener, p_param);
|
||||
if (notif != NULL) {
|
||||
m_queue->push_back(notif);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac800
|
||||
MxResult MxNotificationManager::Tickle()
|
||||
{
|
||||
m_sendList = new MxNotificationPtrList();
|
||||
if (m_sendList == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
else {
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
MxNotificationPtrList* temp1 = m_queue;
|
||||
MxNotificationPtrList* temp2 = m_sendList;
|
||||
m_queue = temp2;
|
||||
m_sendList = temp1;
|
||||
}
|
||||
|
||||
while (m_sendList->size() != 0) {
|
||||
MxNotification* notif = m_sendList->front();
|
||||
m_sendList->pop_front();
|
||||
notif->GetTarget()->Notify(*notif->GetParam());
|
||||
delete notif;
|
||||
}
|
||||
|
||||
delete m_sendList;
|
||||
m_sendList = NULL;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ac990
|
||||
void MxNotificationManager::FlushPending(MxCore* p_listener)
|
||||
{
|
||||
MxNotificationPtrList pending;
|
||||
MxNotification* notif;
|
||||
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
|
||||
// Find all notifications from, and addressed to, p_listener.
|
||||
if (m_sendList != NULL) {
|
||||
MxNotificationPtrList::iterator it = m_sendList->begin();
|
||||
while (it != m_sendList->end()) {
|
||||
notif = *it;
|
||||
if ((notif->GetTarget()->GetId() == p_listener->GetId()) ||
|
||||
(notif->GetParam()->GetSender()) &&
|
||||
(notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) {
|
||||
m_sendList->erase(it++);
|
||||
pending.push_back(notif);
|
||||
}
|
||||
else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MxNotificationPtrList::iterator it = m_queue->begin();
|
||||
while (it != m_queue->end()) {
|
||||
notif = *it;
|
||||
if ((notif->GetTarget()->GetId() == p_listener->GetId()) ||
|
||||
(notif->GetParam()->GetSender()) && (notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) {
|
||||
m_queue->erase(it++);
|
||||
pending.push_back(notif);
|
||||
}
|
||||
else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deliver those notifications.
|
||||
while (pending.size() != 0) {
|
||||
notif = pending.front();
|
||||
pending.pop_front();
|
||||
notif->GetTarget()->Notify(*notif->GetParam());
|
||||
delete notif;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100acd20
|
||||
void MxNotificationManager::Register(MxCore* p_listener)
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
|
||||
MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
|
||||
if (it != m_listenerIds.end())
|
||||
return;
|
||||
|
||||
m_listenerIds.push_back(p_listener->GetId());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100acdf0
|
||||
void MxNotificationManager::Unregister(MxCore* p_listener)
|
||||
{
|
||||
MxAutoLocker lock(&m_lock);
|
||||
|
||||
MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId());
|
||||
|
||||
if (it != m_listenerIds.end()) {
|
||||
m_listenerIds.erase(it);
|
||||
FlushPending(p_listener);
|
||||
}
|
||||
}
|
||||
11
LEGO1/omni/src/notify/mxnotificationparam.cpp
Normal file
11
LEGO1/omni/src/notify/mxnotificationparam.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "mxnotificationparam.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxNotificationParam, 0xc);
|
||||
|
||||
// FUNCTION: LEGO1 0x10010390
|
||||
MxNotificationParam* MxNotificationParam::Clone()
|
||||
{
|
||||
return new MxNotificationParam(m_type, m_sender);
|
||||
}
|
||||
3
LEGO1/omni/src/notify/mxtype17notificationparam.cpp
Normal file
3
LEGO1/omni/src/notify/mxtype17notificationparam.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "mxtype17notificationparam.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c)
|
||||
Reference in New Issue
Block a user