mirror of
https://github.com/isledecomp/isle.git
synced 2025-02-16 11:40:09 -05:00
STL lists for stream classes (#307)
This commit is contained in:
parent
10062d2b28
commit
3d48cdede1
12 changed files with 184 additions and 15 deletions
|
@ -173,6 +173,7 @@ add_library(lego1 SHARED
|
|||
LEGO1/mxstreamchunklist.cpp
|
||||
LEGO1/mxstreamcontroller.cpp
|
||||
LEGO1/mxstreamer.cpp
|
||||
LEGO1/mxstreamlist.cpp
|
||||
LEGO1/mxstreamprovider.cpp
|
||||
LEGO1/mxstring.cpp
|
||||
LEGO1/mxstringlist.cpp
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#include "mxcriticalsection.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxCriticalSection, 0x1c);
|
||||
|
||||
// 0x10101e78
|
||||
int g_useMutex = 0;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
// SIZE 0x1c
|
||||
class MxCriticalSection {
|
||||
public:
|
||||
__declspec(dllexport) MxCriticalSection();
|
||||
|
|
|
@ -5,12 +5,26 @@
|
|||
#include "mxomni.h"
|
||||
#include "mxticklemanager.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100c7120 STUB
|
||||
DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8);
|
||||
|
||||
// OFFSET: LEGO1 0x100c7120
|
||||
MxDiskStreamController::MxDiskStreamController()
|
||||
{
|
||||
// TODO
|
||||
m_unk8c = 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c7330 TEMPLATE
|
||||
// list<MxDSAction *,allocator<MxDSAction *> >::_Buynode
|
||||
|
||||
// OFFSET: LEGO1 0x100c7420 TEMPLATE
|
||||
// list<MxDSBuffer *,allocator<MxDSBuffer *> >::~list<MxDSBuffer *,allocator<MxDSBuffer *> >
|
||||
|
||||
// OFFSET: LEGO1 0x100c7490 TEMPLATE
|
||||
// list<MxDSBuffer *,allocator<MxDSBuffer *> >::_Buynode
|
||||
|
||||
// OFFSET: LEGO1 0x100c74e0 TEMPLATE
|
||||
// List<MxDSBuffer *>::~List<MxDSBuffer *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c7530 STUB
|
||||
MxDiskStreamController::~MxDiskStreamController()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef MXDISKSTREAMCONTROLLER_H
|
||||
#define MXDISKSTREAMCONTROLLER_H
|
||||
|
||||
#include "compat.h" // STL
|
||||
#include "decomp.h"
|
||||
#include "mxdsbuffer.h"
|
||||
#include "mxstreamcontroller.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
|
@ -34,6 +37,17 @@ public:
|
|||
{
|
||||
return !strcmp(name, MxDiskStreamController::ClassName()) || MxStreamController::IsA(name);
|
||||
}
|
||||
|
||||
private:
|
||||
MxStreamListMxDSAction m_list0x64; // 0x64
|
||||
undefined m_unk70; // 0x70
|
||||
list<MxDSBuffer*> m_list0x74; // 0x74
|
||||
MxStreamListMxDSAction m_list0x80; // 0x80
|
||||
undefined2 m_unk8c; // 0x8c
|
||||
MxStreamListMxDSAction m_list0x90; // 0x90
|
||||
MxCriticalSection m_critical9c; // 0x9c
|
||||
MxStreamListMxDSAction m_list0xb8; // 0xb8
|
||||
undefined m_unkc4; // 0xc4
|
||||
};
|
||||
|
||||
#endif // MXDISKSTREAMCONTROLLER_H
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#ifndef MXDISKSTREAMPROVIDER_H
|
||||
#define MXDISKSTREAMPROVIDER_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "mxcriticalsection.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxstreamlist.h"
|
||||
#include "mxstreamprovider.h"
|
||||
#include "mxthread.h"
|
||||
#include "mxunklist.h"
|
||||
|
||||
class MxDiskStreamProvider;
|
||||
|
||||
|
@ -57,7 +59,7 @@ private:
|
|||
undefined m_remainingWork; // 0x34
|
||||
undefined m_unk35; // 0x35
|
||||
MxCriticalSection m_criticalSection; // 0x38
|
||||
MxUnkList m_list;
|
||||
MxStreamListMxDSAction m_list; // 0x54
|
||||
};
|
||||
|
||||
#endif // MXDISKSTREAMPROVIDER_H
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include "mxcore.h"
|
||||
#include "mxdschunk.h"
|
||||
#include "mxstreamchunk.h"
|
||||
#include "mxstreamcontroller.h"
|
||||
|
||||
class MxStreamController;
|
||||
|
||||
// VTABLE 0x100dc698
|
||||
// SIZE 0x4c
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
return !strcmp(name, MxNextActionDataStart::ClassName()) || MxCore::IsA(name);
|
||||
}
|
||||
|
||||
inline MxU32 GetObjectId() const { return m_objectId; }
|
||||
inline MxS16 GetUnknown24() const { return m_unk24val; }
|
||||
|
||||
private:
|
||||
MxU32 m_objectId;
|
||||
MxS16 m_unk24val;
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
#include "legoomni.h"
|
||||
#include "mxautolocker.h"
|
||||
#include "mxnextactiondatastart.h"
|
||||
#include "mxstreamchunk.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxStreamController, 0x64)
|
||||
DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14)
|
||||
|
||||
// OFFSET: LEGO1 0x100b9400
|
||||
|
@ -24,12 +26,58 @@ MxResult MxStreamController::vtable0x28()
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0b90 STUB
|
||||
// OFFSET: LEGO1 0x100c0b90
|
||||
MxStreamController::MxStreamController()
|
||||
{
|
||||
// TODO
|
||||
m_provider = NULL;
|
||||
m_unk2c = 0; // TODO: probably also NULL
|
||||
m_action0x60 = NULL;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0d60 TEMPLATE
|
||||
// list<MxDSAction *,allocator<MxDSAction *> >::~list<MxDSAction *,allocator<MxDSAction *> >
|
||||
|
||||
// OFFSET: LEGO1 0x100c0dd0 TEMPLATE
|
||||
// list<MxDSSubscriber *,allocator<MxDSSubscriber *> >::~list<MxDSSubscriber *,allocator<MxDSSubscriber *> >
|
||||
|
||||
// OFFSET: LEGO1 0x100c0e40 TEMPLATE
|
||||
// list<MxDSSubscriber *,allocator<MxDSSubscriber *> >::_Buynode
|
||||
|
||||
// clang-format off
|
||||
// OFFSET: LEGO1 0x100c0e70 TEMPLATE
|
||||
// list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >::~list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >
|
||||
// clang-format on
|
||||
|
||||
// OFFSET: LEGO1 0x100c0ee0 TEMPLATE
|
||||
// list<MxNextActionDataStart *,allocator<MxNextActionDataStart *> >::_Buynode
|
||||
|
||||
// OFFSET: LEGO1 0x100c0fc0 TEMPLATE
|
||||
// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber
|
||||
|
||||
// OFFSET: LEGO1 0x100c1010 TEMPLATE
|
||||
// MxStreamListMxDSAction::~MxStreamListMxDSAction
|
||||
|
||||
// OFFSET: LEGO1 0x100c1060 TEMPLATE
|
||||
// MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart
|
||||
|
||||
// OFFSET: LEGO1 0x100c10b0 TEMPLATE
|
||||
// MxStreamList<MxDSSubscriber *>::~MxStreamList<MxDSSubscriber *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c1100 TEMPLATE
|
||||
// MxStreamList<MxDSAction *>::~MxStreamList<MxDSAction *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c1150 TEMPLATE
|
||||
// MxStreamList<MxNextActionDataStart *>::~MxStreamList<MxNextActionDataStart *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c11a0 TEMPLATE
|
||||
// List<MxDSSubscriber *>::~List<MxDSSubscriber *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c11f0 TEMPLATE
|
||||
// List<MxDSAction *>::~List<MxDSAction *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c1240 TEMPLATE
|
||||
// List<MxNextActionDataStart *>::~List<MxNextActionDataStart *>
|
||||
|
||||
// OFFSET: LEGO1 0x100c1290 STUB
|
||||
MxStreamController::~MxStreamController()
|
||||
{
|
||||
|
@ -76,7 +124,7 @@ MxResult MxStreamController::vtable0x24(undefined4 p_unknown)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c1800 STUB
|
||||
// OFFSET: LEGO1 0x100c1800
|
||||
MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val)
|
||||
{
|
||||
MxNextActionDataStart* dataActionStart =
|
||||
|
@ -84,8 +132,9 @@ MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val)
|
|||
if (dataActionStart == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
// TODO: insert dataActionStart to a list
|
||||
return FAILURE;
|
||||
|
||||
m_nextActionList.push_back(dataActionStart);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c1a00 STUB
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#ifndef MXSTREAMCONTROLLER_H
|
||||
#define MXSTREAMCONTROLLER_H
|
||||
|
||||
#include "compat.h" // STL
|
||||
#include "decomp.h"
|
||||
#include "mxatomid.h"
|
||||
#include "mxcore.h"
|
||||
#include "mxcriticalsection.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxdsobject.h"
|
||||
#include "mxstreamlist.h"
|
||||
#include "mxstreamprovider.h"
|
||||
|
||||
// VTABLE 0x100dc968
|
||||
|
@ -46,11 +48,15 @@ public:
|
|||
inline MxAtomId& GetAtom() { return atom; };
|
||||
|
||||
protected:
|
||||
MxCriticalSection m_criticalSection;
|
||||
MxAtomId atom;
|
||||
MxStreamProvider* m_provider; // MxStreamProvider*
|
||||
undefined4 m_unk2c;
|
||||
undefined m_unk30[0x34];
|
||||
MxCriticalSection m_criticalSection; // 0x8
|
||||
MxAtomId atom; // 0x24
|
||||
MxStreamProvider* m_provider; // 0x28
|
||||
undefined4 m_unk2c; // 0x2c
|
||||
MxStreamListMxDSSubscriber m_subscriberList; // 0x30
|
||||
MxStreamListMxDSAction m_unkList0x3c; // 0x3c
|
||||
MxStreamListMxNextActionDataStart m_nextActionList; // 0x48
|
||||
MxStreamListMxDSAction m_unkList0x54; // 0x54
|
||||
MxDSAction* m_action0x60; // 0x60
|
||||
};
|
||||
|
||||
#endif // MXSTREAMCONTROLLER_H
|
||||
|
|
47
LEGO1/mxstreamlist.cpp
Normal file
47
LEGO1/mxstreamlist.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "mxstreamlist.h"
|
||||
|
||||
// Wrappers around STL list that are used by the MxStream* classes.
|
||||
DECOMP_SIZE_ASSERT(MxStreamListMxDSAction, 0xc);
|
||||
DECOMP_SIZE_ASSERT(MxStreamListMxNextActionDataStart, 0xc);
|
||||
DECOMP_SIZE_ASSERT(MxStreamListMxDSSubscriber, 0xc);
|
||||
|
||||
// OFFSET: LEGO1 0x100bfa80
|
||||
MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete)
|
||||
{
|
||||
// DECOMP: ALPHA 0x1008b99d ?
|
||||
|
||||
MxDSAction* found = NULL;
|
||||
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (p_action->GetObjectId() == -1 || p_action->GetObjectId() == (*it)->GetObjectId()) {
|
||||
if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 ||
|
||||
p_action->GetUnknown24() == (*it)->GetUnknown24()) {
|
||||
found = *it;
|
||||
if (p_action->GetUnknown24() != -3)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_delete && found != NULL) {
|
||||
erase(it);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c2240
|
||||
MxNextActionDataStart* MxStreamListMxNextActionDataStart::Find(MxU32 p_id, MxS16 p_value)
|
||||
{
|
||||
MxNextActionDataStart* match = NULL;
|
||||
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
if (p_id == (*it)->GetObjectId() && (p_value == -2 || p_value == (*it)->GetUnknown24())) {
|
||||
match = *it;
|
||||
erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
27
LEGO1/mxstreamlist.h
Normal file
27
LEGO1/mxstreamlist.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef MXSTREAMLIST_H
|
||||
#define MXSTREAMLIST_H
|
||||
|
||||
#include "compat.h" // STL
|
||||
#include "mxdsaction.h"
|
||||
#include "mxdssubscriber.h"
|
||||
#include "mxnextactiondatastart.h"
|
||||
|
||||
template <class T>
|
||||
class MxStreamList : public list<T> {};
|
||||
|
||||
// SIZE 0xc
|
||||
class MxStreamListMxDSAction : public MxStreamList<MxDSAction*> {
|
||||
public:
|
||||
MxDSAction* Find(MxDSAction* p_action, MxBool p_delete);
|
||||
};
|
||||
|
||||
// SIZE 0xc
|
||||
class MxStreamListMxNextActionDataStart : public MxStreamList<MxNextActionDataStart*> {
|
||||
public:
|
||||
MxNextActionDataStart* Find(MxU32, MxS16);
|
||||
};
|
||||
|
||||
// SIZE 0xc
|
||||
class MxStreamListMxDSSubscriber : public MxStreamList<MxDSSubscriber*> {};
|
||||
|
||||
#endif // MXSTREAMLIST_H
|
Loading…
Reference in a new issue