More fixes

This commit is contained in:
Christian Semmler 2023-12-12 11:17:52 -05:00
parent 34b3d92696
commit 71335281a2
13 changed files with 74 additions and 74 deletions

View File

@ -387,9 +387,9 @@ MxBool MxOmni::IsSound3D()
} }
// FUNCTION: LEGO1 0x100b0990 // FUNCTION: LEGO1 0x100b0990
void MxOmni::SetSound3D(MxBool p_3dsound) void MxOmni::SetSound3D(MxBool p_use3dSound)
{ {
g_use3dSound = p_3dsound; g_use3dSound = p_use3dSound;
} }
// FUNCTION: LEGO1 0x100b09a0 // FUNCTION: LEGO1 0x100b09a0

View File

@ -34,7 +34,7 @@ class MxOmni : public MxCore {
__declspec(dllexport) static MxBool IsSound3D(); __declspec(dllexport) static MxBool IsSound3D();
__declspec(dllexport) static void SetCD(const char* p_cd); __declspec(dllexport) static void SetCD(const char* p_cd);
__declspec(dllexport) static void SetHD(const char* p_hd); __declspec(dllexport) static void SetHD(const char* p_hd);
__declspec(dllexport) static void SetSound3D(MxBool p_3dsound); __declspec(dllexport) static void SetSound3D(MxBool p_use3dSound);
MxOmni(); MxOmni();
virtual ~MxOmni() override; virtual ~MxOmni() override;

View File

@ -11,7 +11,7 @@
DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c); DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c);
// GLOBAL: LEGO1 0x10101eb0 // GLOBAL: LEGO1 0x10101eb0
const char* g_strBMP_ISMAP = "BMP_ISMAP"; const char* g_strBmpIsmap = "BMP_ISMAP";
// FUNCTION: LEGO1 0x10043550 // FUNCTION: LEGO1 0x10043550
// MxStillPresenter::~MxStillPresenter // MxStillPresenter::~MxStillPresenter
@ -92,10 +92,10 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
MVideoManager()->InvalidateRect(rect); MVideoManager()->InvalidateRect(rect);
if (m_flags & Flag_Bit2) { if (m_flags & Flag_Bit2) {
undefined4 unk = 0; undefined4 und = 0;
m_unk0x58 = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44( m_unk0x58 = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44(
m_bitmap, m_bitmap,
&unk, &und,
(m_flags & Flag_Bit4) / 8, (m_flags & Flag_Bit4) / 8,
m_action->GetFlags() & MxDSAction::Flag_Bit4 m_action->GetFlags() & MxDSAction::Flag_Bit4
); );
@ -106,7 +106,7 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
delete m_bitmap; delete m_bitmap;
m_bitmap = NULL; m_bitmap = NULL;
if (m_unk0x58 && unk) if (m_unk0x58 && und)
m_flags |= Flag_Bit3; m_flags |= Flag_Bit3;
else else
m_flags &= ~Flag_Bit3; m_flags &= ~Flag_Bit3;
@ -169,14 +169,14 @@ void MxStillPresenter::VTable0x88(MxS32 p_x, MxS32 p_y)
MxS32 height = GetHeight() - 1; MxS32 height = GetHeight() - 1;
MxS32 width = GetWidth() - 1; MxS32 width = GetWidth() - 1;
MxRect32 rect_a(x, y, width + x, height + y); MxRect32 rectA(x, y, width + x, height + y);
MxRect32 rect_b(m_location.m_x, m_location.m_y, width + m_location.m_x, height + m_location.m_y); MxRect32 rectB(m_location.m_x, m_location.m_y, width + m_location.m_x, height + m_location.m_y);
MVideoManager()->InvalidateRect(rect_a); MVideoManager()->InvalidateRect(rectA);
MVideoManager()->VTable0x34(rect_a.GetLeft(), rect_a.GetTop(), rect_a.GetWidth(), rect_a.GetHeight()); MVideoManager()->VTable0x34(rectA.GetLeft(), rectA.GetTop(), rectA.GetWidth(), rectA.GetHeight());
MVideoManager()->InvalidateRect(rect_b); MVideoManager()->InvalidateRect(rectB);
MVideoManager()->VTable0x34(rect_b.GetLeft(), rect_b.GetTop(), rect_b.GetWidth(), rect_b.GetHeight()); MVideoManager()->VTable0x34(rectB.GetLeft(), rectB.GetTop(), rectB.GetWidth(), rectB.GetHeight());
} }
} }
@ -223,7 +223,7 @@ void MxStillPresenter::ParseExtra()
} }
} }
if (KeyValueStringParse(output, g_strBMP_ISMAP, buf)) { if (KeyValueStringParse(output, g_strBmpIsmap, buf)) {
m_flags |= Flag_Bit5; m_flags |= Flag_Bit5;
m_flags &= ~Flag_Bit2; m_flags &= ~Flag_Bit2;
m_flags &= ~Flag_Bit3; m_flags &= ~Flag_Bit3;

View File

@ -15,7 +15,7 @@ MxResult MxStreamController::VTable0x18(undefined4, undefined4)
} }
// FUNCTION: LEGO1 0x100b9410 // FUNCTION: LEGO1 0x100b9410
MxResult MxStreamController::vtable0x1C(undefined4, undefined4) MxResult MxStreamController::VTable0x1c(undefined4, undefined4)
{ {
return FAILURE; return FAILURE;
} }
@ -91,7 +91,7 @@ MxResult MxStreamController::Open(const char* p_filename)
MxAutoLocker locker(&m_criticalSection); MxAutoLocker locker(&m_criticalSection);
MakeSourceName(sourceName, p_filename); MakeSourceName(sourceName, p_filename);
this->atom = MxAtomId(sourceName, LookupMode_LowerCase2); this->m_atom = MxAtomId(sourceName, LookupMode_LowerCase2);
return SUCCESS; return SUCCESS;
} }
@ -122,7 +122,7 @@ MxResult MxStreamController::VTable0x24(MxDSAction* p_action)
{ {
MxAutoLocker locker(&m_criticalSection); MxAutoLocker locker(&m_criticalSection);
VTable0x30(p_action); VTable0x30(p_action);
m_action0x60 = m_unk0xList0x54.Find(p_action, TRUE); m_action0x60 = m_unk0x54.Find(p_action, TRUE);
if (m_action0x60 == NULL) { if (m_action0x60 == NULL) {
return FAILURE; return FAILURE;
} }
@ -167,7 +167,7 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action)
{ {
MxAutoLocker locker(&m_criticalSection); MxAutoLocker locker(&m_criticalSection);
MxResult result = FAILURE; MxResult result = FAILURE;
MxDSAction* action = m_unk0xList0x3c.Find(p_action, TRUE); MxDSAction* action = m_unk0x3c.Find(p_action, TRUE);
if (action != NULL) { if (action != NULL) {
MxNextActionDataStart* data = m_nextActionList.Find(action->GetObjectId(), action->GetUnknown24()); MxNextActionDataStart* data = m_nextActionList.Find(action->GetObjectId(), action->GetUnknown24());
delete action; delete action;

View File

@ -32,31 +32,31 @@ class MxStreamController : public MxCore {
return !strcmp(p_name, MxStreamController::ClassName()) || MxCore::IsA(p_name); return !strcmp(p_name, MxStreamController::ClassName()) || MxCore::IsA(p_name);
} }
virtual MxResult Open(const char* p_filename); // vtable+0x14 virtual MxResult Open(const char* p_filename); // vtable+0x14
virtual MxResult VTable0x18(undefined4 p_unknown, undefined4 p_unknown2); // vtable+0x18 virtual MxResult VTable0x18(undefined4, undefined4); // vtable+0x18
virtual MxResult vtable0x1C(undefined4 p_unknown, undefined4 p_unknown2); // vtable+0x1c virtual MxResult VTable0x1c(undefined4, undefined4); // vtable+0x1c
virtual MxResult VTable0x20(MxDSAction* p_action); // vtable+0x20 virtual MxResult VTable0x20(MxDSAction* p_action); // vtable+0x20
virtual MxResult VTable0x24(MxDSAction* p_action); // vtable+0x24 virtual MxResult VTable0x24(MxDSAction* p_action); // vtable+0x24
virtual MxResult VTable0x28(); // vtable+0x28 virtual MxResult VTable0x28(); // vtable+0x28
virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c
virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30 virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30
MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val);
MxBool FUN_100c20d0(MxDSObject& p_obj); MxBool FUN_100c20d0(MxDSObject& p_obj);
MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval);
MxResult FUN_100c1f00(MxDSAction* p_action); MxResult FUN_100c1f00(MxDSAction* p_action);
inline MxAtomId& GetAtom() { return atom; }; inline MxAtomId& GetAtom() { return m_atom; };
protected: protected:
MxCriticalSection m_criticalSection; // 0x8 MxCriticalSection m_criticalSection; // 0x8
MxAtomId atom; // 0x24 MxAtomId m_atom; // 0x24
MxStreamProvider* m_provider; // 0x28 MxStreamProvider* m_provider; // 0x28
undefined4 m_unk0x2c; // 0x2c undefined4 m_unk0x2c; // 0x2c
MxStreamListMxDSSubscriber m_subscriberList; // 0x30 MxStreamListMxDSSubscriber m_subscriberList; // 0x30
MxStreamListMxDSAction m_unk0xList0x3c; // 0x3c MxStreamListMxDSAction m_unk0x3c; // 0x3c
MxStreamListMxNextActionDataStart m_nextActionList; // 0x48 MxStreamListMxNextActionDataStart m_nextActionList; // 0x48
MxStreamListMxDSAction m_unk0xList0x54; // 0x54 MxStreamListMxDSAction m_unk0x54; // 0x54
MxDSAction* m_action0x60; // 0x60 MxDSAction* m_action0x60; // 0x60
}; };

View File

@ -69,16 +69,15 @@ MxStreamController* MxStreamer::Open(const char* p_name, MxU16 p_lookupType)
} }
// FUNCTION: LEGO1 0x100b9570 // FUNCTION: LEGO1 0x100b9570
MxLong MxStreamer::Close(const char* p) MxLong MxStreamer::Close(const char* p_name)
{ {
MxDSAction ds; MxDSAction ds;
ds.SetUnknown24(-2); ds.SetUnknown24(-2);
for (list<MxStreamController*>::iterator it = m_openStreams.begin(); it != m_openStreams.end(); it++) { for (list<MxStreamController*>::iterator it = m_openStreams.begin(); it != m_openStreams.end(); it++) {
MxStreamController* c = *it; MxStreamController* c = *it;
if (!p || !strcmp(p, c->GetAtom().GetInternal())) { if (!p_name || !strcmp(p_name, c->GetAtom().GetInternal())) {
m_openStreams.erase(it); m_openStreams.erase(it);
if (!c->FUN_100c20d0(ds)) { if (!c->FUN_100c20d0(ds)) {
@ -120,10 +119,10 @@ MxStreamController* MxStreamer::GetOpenStream(const char* p_name)
} }
// FUNCTION: LEGO1 0x100b9930 // FUNCTION: LEGO1 0x100b9930
MxResult MxStreamer::AddStreamControllerToOpenList(MxStreamController* stream) MxResult MxStreamer::AddStreamControllerToOpenList(MxStreamController* p_stream)
{ {
if (find(m_openStreams.begin(), m_openStreams.end(), stream) == m_openStreams.end()) { if (find(m_openStreams.begin(), m_openStreams.end(), p_stream) == m_openStreams.end()) {
m_openStreams.push_back(stream); m_openStreams.push_back(p_stream);
return SUCCESS; return SUCCESS;
} }
@ -176,10 +175,10 @@ MxLong MxStreamer::Notify(MxParam& p_param)
} }
// No offset, function is always inlined // No offset, function is always inlined
MxStreamerSubClass1::MxStreamerSubClass1(undefined4 size) MxStreamerSubClass1::MxStreamerSubClass1(undefined4 p_size)
{ {
m_buffer = NULL; m_buffer = NULL;
m_size = size; m_size = p_size;
undefined4* ptr = &m_unk0x08; undefined4* ptr = &m_unk0x08;
for (int i = 0; i >= 0; i--) { for (int i = 0; i >= 0; i--) {
ptr[i] = 0; ptr[i] = 0;

View File

@ -14,7 +14,7 @@
// STL. But I haven't figured out what yet (it's definitely not a vector). // STL. But I haven't figured out what yet (it's definitely not a vector).
class MxStreamerSubClass1 { class MxStreamerSubClass1 {
public: public:
inline MxStreamerSubClass1(undefined4 size); inline MxStreamerSubClass1(undefined4 p_size);
~MxStreamerSubClass1() { delete[] m_buffer; } ~MxStreamerSubClass1() { delete[] m_buffer; }

View File

@ -12,6 +12,6 @@ MxResult MxStreamProvider::SetResourceToGet(MxStreamController* p_resource)
} }
// FUNCTION: LEGO1 0x100d07d0 // FUNCTION: LEGO1 0x100d07d0
void MxStreamProvider::VTable0x20(undefined4 p_unknown1) void MxStreamProvider::VTable0x20(undefined4)
{ {
} }

View File

@ -28,7 +28,7 @@ class MxStreamProvider : public MxCore {
virtual MxResult SetResourceToGet(MxStreamController* p_resource); // vtable+0x14 virtual MxResult SetResourceToGet(MxStreamController* p_resource); // vtable+0x14
virtual MxU32 GetFileSize() = 0; // vtable+0x18 virtual MxU32 GetFileSize() = 0; // vtable+0x18
virtual MxU32 GetStreamBuffersNum() = 0; // vtable+0x1c virtual MxU32 GetStreamBuffersNum() = 0; // vtable+0x1c
virtual void VTable0x20(undefined4 p_unknown1); // vtable+0x20 virtual void VTable0x20(undefined4); // vtable+0x20
virtual MxU32 GetLengthInDWords() = 0; // vtable+0x24 virtual MxU32 GetLengthInDWords() = 0; // vtable+0x24
virtual MxU32* GetBufferForDWords() = 0; // vtable+0x28 virtual MxU32* GetBufferForDWords() = 0; // vtable+0x28

View File

@ -17,20 +17,20 @@ MxString::MxString()
} }
// FUNCTION: LEGO1 0x100ae2a0 // FUNCTION: LEGO1 0x100ae2a0
MxString::MxString(const MxString& str) MxString::MxString(const MxString& p_str)
{ {
this->m_length = str.m_length; this->m_length = p_str.m_length;
this->m_data = new char[this->m_length + 1]; this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, str.m_data); strcpy(this->m_data, p_str.m_data);
} }
// FUNCTION: LEGO1 0x100ae350 // FUNCTION: LEGO1 0x100ae350
MxString::MxString(const char* str) MxString::MxString(const char* p_str)
{ {
if (str) { if (p_str) {
this->m_length = strlen(str); this->m_length = strlen(p_str);
this->m_data = new char[this->m_length + 1]; this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, str); strcpy(this->m_data, p_str);
} }
else { else {
this->m_data = new char[1]; this->m_data = new char[1];
@ -58,26 +58,26 @@ void MxString::ToLowerCase()
} }
// FUNCTION: LEGO1 0x100ae4b0 // FUNCTION: LEGO1 0x100ae4b0
MxString& MxString::operator=(const MxString& param) MxString& MxString::operator=(const MxString& p_str)
{ {
if (this->m_data != param.m_data) { if (this->m_data != p_str.m_data) {
delete[] this->m_data; delete[] this->m_data;
this->m_length = param.m_length; this->m_length = p_str.m_length;
this->m_data = new char[this->m_length + 1]; this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, param.m_data); strcpy(this->m_data, p_str.m_data);
} }
return *this; return *this;
} }
// FUNCTION: LEGO1 0x100ae510 // FUNCTION: LEGO1 0x100ae510
const MxString& MxString::operator=(const char* param) const MxString& MxString::operator=(const char* p_data)
{ {
if (this->m_data != param) { if (this->m_data != p_data) {
delete[] this->m_data; delete[] this->m_data;
this->m_length = strlen(param); this->m_length = strlen(p_data);
this->m_data = new char[this->m_length + 1]; this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, param); strcpy(this->m_data, p_data);
} }
return *this; return *this;
@ -86,29 +86,29 @@ const MxString& MxString::operator=(const char* param)
// Return type is intentionally just MxString, not MxString&. // Return type is intentionally just MxString, not MxString&.
// This forces MSVC to add $ReturnUdt$ to the stack for 100% match. // This forces MSVC to add $ReturnUdt$ to the stack for 100% match.
// FUNCTION: LEGO1 0x100ae580 // FUNCTION: LEGO1 0x100ae580
MxString MxString::operator+(const char* str) MxString MxString::operator+(const char* p_str)
{ {
// MxString constructor allocates 1 byte for m_data, so free that first // MxString constructor allocates 1 byte for m_data, so free that first
MxString tmp; MxString tmp;
delete[] tmp.m_data; delete[] tmp.m_data;
tmp.m_length = strlen(str) + this->m_length; tmp.m_length = strlen(p_str) + this->m_length;
tmp.m_data = new char[tmp.m_length + 1]; tmp.m_data = new char[tmp.m_length + 1];
strcpy(tmp.m_data, this->m_data); strcpy(tmp.m_data, this->m_data);
strcpy(tmp.m_data + this->m_length, str); strcpy(tmp.m_data + this->m_length, p_str);
return MxString(tmp); return MxString(tmp);
} }
// FUNCTION: LEGO1 0x100ae690 // FUNCTION: LEGO1 0x100ae690
MxString& MxString::operator+=(const char* str) MxString& MxString::operator+=(const char* p_str)
{ {
int newlen = this->m_length + strlen(str); int newlen = this->m_length + strlen(p_str);
char* tmp = new char[newlen + 1]; char* tmp = new char[newlen + 1];
strcpy(tmp, this->m_data); strcpy(tmp, this->m_data);
strcpy(tmp + this->m_length, str); strcpy(tmp + this->m_length, p_str);
delete[] this->m_data; delete[] this->m_data;
this->m_length = newlen; this->m_length = newlen;

View File

@ -6,17 +6,17 @@
// VTABLE: LEGO1 0x100dc110 // VTABLE: LEGO1 0x100dc110
class MxString : public MxCore { class MxString : public MxCore {
public: public:
__declspec(dllexport) MxString(const MxString&); __declspec(dllexport) MxString(const MxString& p_str);
__declspec(dllexport) virtual ~MxString(); __declspec(dllexport) virtual ~MxString();
__declspec(dllexport) const MxString& operator=(const char*); __declspec(dllexport) const MxString& operator=(const char* p_data);
MxString(); MxString();
MxString(const char*); MxString(const char*);
void ToUpperCase(); void ToUpperCase();
void ToLowerCase(); void ToLowerCase();
MxString& operator=(const MxString&); MxString& operator=(const MxString& p_str);
MxString operator+(const char*); MxString operator+(const char* p_str);
MxString& operator+=(const char*); MxString& operator+=(const char* p_str);
inline MxS8 Compare(const MxString& p_str) const { return strcmp(m_data, p_str.m_data); } inline MxS8 Compare(const MxString& p_str) const { return strcmp(m_data, p_str.m_data); }
inline const char* GetData() const { return m_data; } inline const char* GetData() const { return m_data; }

View File

@ -7,7 +7,7 @@
#include <process.h> #include <process.h>
// FUNCTION: LEGO1 0x100b8bb0 // FUNCTION: LEGO1 0x100b8bb0
MxTickleThread::MxTickleThread(MxCore* p_target, int p_frequencyMS) MxTickleThread::MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS)
{ {
m_target = p_target; m_target = p_target;
m_frequencyMS = p_frequencyMS; m_frequencyMS = p_frequencyMS;
@ -18,14 +18,15 @@ MxTickleThread::MxTickleThread(MxCore* p_target, int p_frequencyMS)
MxResult MxTickleThread::Run() MxResult MxTickleThread::Run()
{ {
MxTimer* timer = Timer(); MxTimer* timer = Timer();
int lastTickled = -m_frequencyMS; MxS32 lastTickled = -m_frequencyMS;
while (IsRunning()) { while (IsRunning()) {
int currentTime = timer->GetTime(); MxLong currentTime = timer->GetTime();
if (currentTime < lastTickled) { if (currentTime < lastTickled) {
lastTickled = -m_frequencyMS; lastTickled = -m_frequencyMS;
} }
int timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled;
MxS32 timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled;
if (timeRemainingMS <= 0) { if (timeRemainingMS <= 0) {
m_target->Tickle(); m_target->Tickle();
timeRemainingMS = 0; timeRemainingMS = 0;
@ -54,7 +55,7 @@ MxThread::~MxThread()
typedef unsigned(__stdcall* ThreadFunc)(void*); typedef unsigned(__stdcall* ThreadFunc)(void*);
// FUNCTION: LEGO1 0x100bf610 // FUNCTION: LEGO1 0x100bf610
MxResult MxThread::Start(int p_stack, int p_flag) MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag)
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
if (m_semaphore.Init(0, 1) == SUCCESS) { if (m_semaphore.Init(0, 1) == SUCCESS) {

View File

@ -13,7 +13,7 @@ class MxThread {
// Note: Comes before virtual destructor // Note: Comes before virtual destructor
virtual MxResult Run(); virtual MxResult Run();
MxResult Start(int p_stack, int p_flag); MxResult Start(MxS32 p_stack, MxS32 p_flag);
void Terminate(); void Terminate();
@ -43,7 +43,7 @@ class MxThread {
// VTABLE: LEGO1 0x100dc6d8 // VTABLE: LEGO1 0x100dc6d8
class MxTickleThread : public MxThread { class MxTickleThread : public MxThread {
public: public:
MxTickleThread(MxCore* p_target, int p_frequencyMS); MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS);
// Only inlined, no offset // Only inlined, no offset
virtual ~MxTickleThread() {} virtual ~MxTickleThread() {}