More BETA matches in MxDiskStreamController (#1292)

* More BETA matches in `MxDiskStreamController`

* Fix
This commit is contained in:
Christian Semmler 2024-12-27 13:03:04 -07:00 committed by GitHub
parent 2422d997cf
commit 8afa64048b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 65 additions and 35 deletions

View File

@ -2478,6 +2478,8 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
Vector3* v1 = p_edge->CWVertex(*p_boundary);
Vector3* v2 = p_edge->CCWVertex(*p_boundary);
assert(v1 && v2);
p1 = *v2;
p1 -= *v1;
p1 *= p_destScale;
@ -2490,7 +2492,12 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
boundingBox.Min() -= vec;
boundingBox.Max() = p1;
boundingBox.Max() += vec;
return GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE;
if (GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE) {
return TRUE;
}
return FALSE;
}
// FUNCTION: LEGO1 0x10064120

View File

@ -97,4 +97,7 @@ private:
// TEMPLATE: BETA10 0x10150e60
// MxUtilityList<MxNextActionDataStart *>::PushBack
// TEMPLATE: BETA10 0x10150ff0
// MxUtilityList<MxDSObject *>::PushBack
#endif // MXDISKSTREAMCONTROLLER_H

View File

@ -74,14 +74,14 @@ public:
MxStreamProvider* GetProvider() { return m_provider; }
MxDSObjectList& GetUnk0x3c() { return m_unk0x3c; }
MxDSObjectList& GetUnk0x54() { return m_unk0x54; }
MxDSSubscriberList& GetSubscriberList() { return m_subscriberList; }
MxDSSubscriberList& GetSubscriberList() { return m_subscribers; }
protected:
MxCriticalSection m_criticalSection; // 0x08
MxAtomId m_atom; // 0x24
MxStreamProvider* m_provider; // 0x28
undefined4* m_unk0x2c; // 0x2c
MxDSSubscriberList m_subscriberList; // 0x30
MxDSSubscriberList m_subscribers; // 0x30
MxDSObjectList m_unk0x3c; // 0x3c
MxNextActionDataStartList m_nextActionList; // 0x48
MxDSObjectList m_unk0x54; // 0x54

View File

@ -8,6 +8,8 @@
#include "mxomni.h"
#include "mxticklemanager.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8);
// FUNCTION: LEGO1 0x100c7120
@ -17,6 +19,7 @@ MxDiskStreamController::MxDiskStreamController()
}
// FUNCTION: LEGO1 0x100c7530
// FUNCTION: BETA10 0x10153a2d
MxDiskStreamController::~MxDiskStreamController()
{
AUTOLOCK(m_criticalSection);
@ -35,6 +38,8 @@ MxDiskStreamController::~MxDiskStreamController()
#endif
}
assert(m_subscribers.size() == 0);
MxDSObject* object;
while (m_unk0x3c.PopFront(object)) {
delete object;
@ -65,28 +70,32 @@ MxDiskStreamController::~MxDiskStreamController()
}
// FUNCTION: LEGO1 0x100c7790
// FUNCTION: BETA10 0x10153ea8
MxResult MxDiskStreamController::Open(const char* p_filename)
{
AUTOLOCK(m_criticalSection);
MxResult result = MxStreamController::Open(p_filename);
if (result == SUCCESS) {
m_provider = new MxDiskStreamProvider();
if (m_provider == NULL) {
result = FAILURE;
}
else {
result = m_provider->SetResourceToGet(this);
if (result != SUCCESS) {
delete m_provider;
m_provider = NULL;
}
else {
TickleManager()->RegisterClient(this, 10);
}
}
if (result != SUCCESS) {
goto done;
}
m_provider = new MxDiskStreamProvider();
if (m_provider == NULL) {
result = FAILURE;
goto done;
}
result = m_provider->SetResourceToGet(this);
if (result != SUCCESS) {
delete m_provider;
m_provider = NULL;
goto done;
}
TickleManager()->RegisterClient(this, 10);
done:
return result;
}
@ -97,6 +106,7 @@ MxResult MxDiskStreamController::VTable0x18(undefined4, undefined4)
}
// FUNCTION: LEGO1 0x100c7890
// FUNCTION: BETA10 0x101543bb
MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action)
{
AUTOLOCK(m_criticalSection);
@ -104,7 +114,7 @@ MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action)
return FAILURE;
}
m_list0x80.push_back(p_action);
m_list0x80.PushBack(p_action);
FUN_100c7970();
return SUCCESS;
}
@ -122,6 +132,7 @@ void MxDiskStreamController::FUN_100c7970()
}
// FUNCTION: LEGO1 0x100c7980
// FUNCTION: BETA10 0x10154848
void MxDiskStreamController::FUN_100c7980()
{
MxDSBuffer* buffer;
@ -159,24 +170,33 @@ void MxDiskStreamController::FUN_100c7980()
}
// FUNCTION: LEGO1 0x100c7ac0
// FUNCTION: BETA10 0x10154abb
MxDSStreamingAction* MxDiskStreamController::VTable0x28()
{
AUTOLOCK(m_criticalSection);
MxDSObject* oldAction;
MxDSStreamingAction* result = NULL;
assert(m_provider);
MxDSStreamingAction* request = NULL;
MxU32 filesize = m_provider->GetFileSize();
if (m_unk0x3c.PopFront(oldAction)) {
result = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction);
if (result) {
MxU32 offset = result->GetBufferOffset() + filesize;
((MxDSStreamingAction*) oldAction)->SetUnknown94(offset);
((MxDSStreamingAction*) oldAction)->SetBufferOffset(offset);
m_unk0x3c.push_back(oldAction);
}
if (!m_unk0x3c.PopFront(oldAction)) {
goto done;
}
return result;
request = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction);
assert(request);
if (!request) {
goto done;
}
((MxDSStreamingAction*) oldAction)->SetUnknown94(request->GetBufferOffset() + filesize);
((MxDSStreamingAction*) oldAction)->SetBufferOffset(((MxDSStreamingAction*) oldAction)->GetUnknown94());
m_unk0x3c.PushBack(oldAction);
done:
return request;
}
// FUNCTION: LEGO1 0x100c7c00

View File

@ -32,7 +32,7 @@ MxStreamController::~MxStreamController()
AUTOLOCK(m_criticalSection);
MxDSSubscriber* subscriber;
while (m_subscriberList.PopFront(subscriber)) {
while (m_subscribers.PopFront(subscriber)) {
delete subscriber;
}
@ -80,14 +80,14 @@ MxResult MxStreamController::Open(const char* p_filename)
// FUNCTION: BETA10 0x1014e730
void MxStreamController::AddSubscriber(MxDSSubscriber* p_subscriber)
{
m_subscriberList.PushBack(p_subscriber);
m_subscribers.PushBack(p_subscriber);
}
// FUNCTION: LEGO1 0x100c1620
// FUNCTION: BETA10 0x1014e7b4
void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber)
{
m_subscriberList.Remove(p_subscriber);
m_subscribers.Remove(p_subscriber);
}
// FUNCTION: LEGO1 0x100c1690
@ -173,7 +173,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
}
if (newUnknown24 == -1) {
for (MxDSSubscriberList::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); it++) {
for (MxDSSubscriberList::iterator it = m_subscribers.begin(); it != m_subscribers.end(); it++) {
MxDSSubscriber* subscriber = *it;
if (subscriber->GetObjectId() == p_action->GetObjectId()) {
@ -288,7 +288,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action)
chunk->SetChunkFlags(DS_CHUNK_BIT3);
chunk->SetObjectId(objectId);
if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) {
if (chunk->SendChunk(m_subscribers, FALSE, p_action->GetUnknown24()) != SUCCESS) {
delete chunk;
}
@ -318,7 +318,7 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA
// FUNCTION: BETA10 0x1014f3b5
MxBool MxStreamController::IsStoped(MxDSObject* p_obj)
{
MxDSSubscriber* subscriber = m_subscriberList.Find(p_obj);
MxDSSubscriber* subscriber = m_subscribers.Find(p_obj);
if (subscriber) {
MxTrace(