From a9a2c7d3b72203c6c0a012cc6088873cb3686b85 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 25 Oct 2023 18:09:09 +0200 Subject: [PATCH 1/6] Update CONTRIBUTING.md [skip ci] --- CONTRIBUTING.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 005f599c..b70c45b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,12 @@ This repository currently has only one goal: accuracy to the original executable In general, we're not exhaustively strict about coding style, but there are some preferable guidelines to follow that have been adopted from what we know about the original codebase: -- Indent: 2 spaces +### Formatting + +We are currently using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) with a configuration file that aims to replicate the code formatting employed by the original developers. There are [integrations](https://clang.llvm.org/docs/ClangFormat.html#vim-integration) available for most editors and IDEs. The required `clang-format` version is `17.x`. + +### Naming conventions + - `PascalCase` for classes, function names, and enumerations. - `m_camelCase` for member variables. - `g_camelCase` for global variables. From 220ad5d537c3f072f8e379c55998c82122ab75e0 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 25 Oct 2023 14:32:51 -0400 Subject: [PATCH 2/6] Use TEMPLATE syntax for MxHashTable decomp declarations --- LEGO1/mxhashtable.h | 6 ------ LEGO1/mxvariabletable.h | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/LEGO1/mxhashtable.h b/LEGO1/mxhashtable.h index 4cf43240..b8bd42e7 100644 --- a/LEGO1/mxhashtable.h +++ b/LEGO1/mxhashtable.h @@ -42,10 +42,8 @@ public: m_customDestructor = Destroy; } - // OFFSET: LEGO1 0x100afd30 static void Destroy(T*){}; - // OFFSET: LEGO1 0x100afcd0 virtual MxS8 Compare(T*, T*) = 0; protected: @@ -72,7 +70,6 @@ public: virtual MxS8 Compare(T*, T*) = 0; - // OFFSET: LEGO1 0x100afdc0 virtual MxU32 Hash(T*) = 0; // FIXME: use of friend here? @@ -154,7 +151,6 @@ private: }; template -// OFFSET: LEGO1 0x100b0bd0 MxHashTable::~MxHashTable() { for (int i = 0; i < m_numSlots; i++) { @@ -175,7 +171,6 @@ MxHashTable::~MxHashTable() } template -// OFFSET: LEGO1 0x100b7ab0 inline void MxHashTable::Resize() { // Save a reference to the current table @@ -212,7 +207,6 @@ inline void MxHashTable::Resize() } template -// OFFSET: LEGO1 0x100b7b80 inline void MxHashTable::_NodeInsert(MxHashTableNode* p_node) { int bucket = p_node->m_hash % m_numSlots; diff --git a/LEGO1/mxvariabletable.h b/LEGO1/mxvariabletable.h index 721a55c2..8bffab81 100644 --- a/LEGO1/mxvariabletable.h +++ b/LEGO1/mxvariabletable.h @@ -21,4 +21,13 @@ public: virtual MxU32 Hash(MxVariable*); // +0x18 }; +// OFFSET: LEGO1 0x100b0bd0 TEMPLATE +// MxHashTable::~MxHashTable + +// OFFSET: LEGO1 0x100b7ab0 TEMPLATE +// MxHashTable::Resize + +// OFFSET: LEGO1 0x100b7b80 TEMPLATE +// MxHashTable::_NodeInsert + #endif // MXVARIABLETABLE_H From 6b8dc8a0cc00332173f2cbc80b4fb556ecb103b0 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 25 Oct 2023 14:44:28 -0400 Subject: [PATCH 3/6] Match MxVariableTable::SetVariable to 100% --- LEGO1/mxhashtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LEGO1/mxhashtable.h b/LEGO1/mxhashtable.h index b8bd42e7..f9a8df73 100644 --- a/LEGO1/mxhashtable.h +++ b/LEGO1/mxhashtable.h @@ -180,10 +180,10 @@ inline void MxHashTable::Resize() switch (m_resizeOption) { case HASH_TABLE_OPT_EXPAND_ADD: - m_numSlots = old_size + m_increaseAmount; + m_numSlots += m_increaseAmount; break; case HASH_TABLE_OPT_EXPAND_MULTIPLY: - m_numSlots = old_size * m_increaseFactor; + m_numSlots *= m_increaseFactor; break; } From a01bcf52414a088f49a434d147f020152623295c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 25 Oct 2023 14:51:59 -0400 Subject: [PATCH 4/6] (clang-format) Insert newline at end of file (#247) * Insert newline at EOF * Fix formatting --- .clang-format | 1 + LEGO1/ambulance.cpp | 2 +- LEGO1/carrace.cpp | 2 +- LEGO1/define.h | 2 +- LEGO1/dunebuggy.cpp | 2 +- LEGO1/gifmanager.cpp | 2 +- LEGO1/gifmanager.h | 2 +- LEGO1/jetski.cpp | 2 +- LEGO1/jukebox.cpp | 2 +- LEGO1/legoentity.cpp | 2 +- LEGO1/legoflctexturepresenter.cpp | 2 +- LEGO1/legoinputmanager.cpp | 2 +- LEGO1/legometerpresenter.cpp | 2 +- LEGO1/legonavcontroller.cpp | 2 +- LEGO1/legopathactor.cpp | 2 +- LEGO1/legostate.cpp | 2 +- LEGO1/legoworld.cpp | 2 +- LEGO1/mxappnotificationparam.cpp | 2 +- LEGO1/mxappnotificationparam.h | 2 +- LEGO1/mxatomidcounter.h | 2 +- LEGO1/mxaudiomanager.cpp | 2 +- LEGO1/mxbackgroundaudiomanager.cpp | 2 +- LEGO1/mxcompositemediapresenter.cpp | 2 +- LEGO1/mxcontrolpresenter.cpp | 2 +- LEGO1/mxdsactionlist.cpp | 2 +- LEGO1/mxdsanim.cpp | 2 +- LEGO1/mxdsevent.cpp | 2 +- LEGO1/mxdsmediaaction.cpp | 2 +- LEGO1/mxdsmultiaction.cpp | 2 +- LEGO1/mxdsobject.cpp | 2 +- LEGO1/mxdsparallelaction.cpp | 2 +- LEGO1/mxdsselectaction.cpp | 2 +- LEGO1/mxdsserialaction.cpp | 2 +- LEGO1/mxdssound.cpp | 2 +- LEGO1/mxdsstill.cpp | 2 +- LEGO1/mxdsstreamingaction.cpp | 2 +- LEGO1/mxmatrix.h | 2 +- LEGO1/mxmediamanager.cpp | 2 +- LEGO1/mxmidipresenter.cpp | 2 +- LEGO1/mxmusicmanager.cpp | 2 +- LEGO1/mxmusicmanager.h | 2 +- LEGO1/mxnotificationmanager.cpp | 2 +- LEGO1/mxregion.cpp | 2 +- LEGO1/mxsemaphore.cpp | 2 +- LEGO1/mxsemaphore.h | 2 +- LEGO1/mxstreamer.cpp | 2 +- LEGO1/mxthread.cpp | 2 +- LEGO1/mxtype17notificationparam.cpp | 2 +- LEGO1/mxtype17notificationparam.h | 2 +- LEGO1/mxunklist.h | 2 +- LEGO1/pizzamissionstate.cpp | 2 +- LEGO1/racestate.cpp | 2 +- LEGO1/radio.cpp | 2 +- LEGO1/score.cpp | 2 +- 54 files changed, 54 insertions(+), 53 deletions(-) diff --git a/.clang-format b/.clang-format index 3612a9a0..4ff99b84 100644 --- a/.clang-format +++ b/.clang-format @@ -19,6 +19,7 @@ ContinuationIndentWidth: 4 IncludeBlocks: Regroup IndentAccessModifiers: false IndentWidth: 4 +InsertNewlineAtEOF: true PointerAlignment: Left SpaceAfterCStyleCast: true TabWidth: 4 diff --git a/LEGO1/ambulance.cpp b/LEGO1/ambulance.cpp index 7e07e198..81e71a4c 100644 --- a/LEGO1/ambulance.cpp +++ b/LEGO1/ambulance.cpp @@ -18,4 +18,4 @@ Ambulance::Ambulance() this->m_unk172 = 0; this->m_unk13c = 40.0; this->m_unk17c = 1.0; -} \ No newline at end of file +} diff --git a/LEGO1/carrace.cpp b/LEGO1/carrace.cpp index c5794cf1..0303a171 100644 --- a/LEGO1/carrace.cpp +++ b/LEGO1/carrace.cpp @@ -4,4 +4,4 @@ CarRace::CarRace() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/define.h b/LEGO1/define.h index e7f13fed..ba411bcb 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -5,4 +5,4 @@ extern const char* g_parseExtraTokens; extern const char* g_strWORLD; extern const char* g_strACTION; -#endif // DEFINE_H \ No newline at end of file +#endif // DEFINE_H diff --git a/LEGO1/dunebuggy.cpp b/LEGO1/dunebuggy.cpp index 20ddbb14..3219c718 100644 --- a/LEGO1/dunebuggy.cpp +++ b/LEGO1/dunebuggy.cpp @@ -9,4 +9,4 @@ DuneBuggy::DuneBuggy() { this->m_unk13c = 25.0; this->m_unk164 = 1.0; -} \ No newline at end of file +} diff --git a/LEGO1/gifmanager.cpp b/LEGO1/gifmanager.cpp index 96b35e85..dc004b16 100644 --- a/LEGO1/gifmanager.cpp +++ b/LEGO1/gifmanager.cpp @@ -22,4 +22,4 @@ GifMapEntry* GifMap::FindNode(const char*& string) current = current->m_left; } return ret; -} \ No newline at end of file +} diff --git a/LEGO1/gifmanager.h b/LEGO1/gifmanager.h index cf8b2fd3..37661abd 100644 --- a/LEGO1/gifmanager.h +++ b/LEGO1/gifmanager.h @@ -66,4 +66,4 @@ protected: undefined m_unk[0x1c]; }; -#endif // GIFMANAGER_H \ No newline at end of file +#endif // GIFMANAGER_H diff --git a/LEGO1/jetski.cpp b/LEGO1/jetski.cpp index 3b3362c5..fa6293b2 100644 --- a/LEGO1/jetski.cpp +++ b/LEGO1/jetski.cpp @@ -8,4 +8,4 @@ Jetski::Jetski() this->m_unk13c = 25.0; this->m_unk150 = 2.0; this->m_unk148 = 1; -} \ No newline at end of file +} diff --git a/LEGO1/jukebox.cpp b/LEGO1/jukebox.cpp index 44a6815b..028c757f 100644 --- a/LEGO1/jukebox.cpp +++ b/LEGO1/jukebox.cpp @@ -4,4 +4,4 @@ JukeBox::JukeBox() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 48978c54..004befc8 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -146,4 +146,4 @@ void LegoEntity::VTable0x48() void LegoEntity::VTable0x4c() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/legoflctexturepresenter.cpp b/LEGO1/legoflctexturepresenter.cpp index 132849d0..52bf5f16 100644 --- a/LEGO1/legoflctexturepresenter.cpp +++ b/LEGO1/legoflctexturepresenter.cpp @@ -4,4 +4,4 @@ LegoFlcTexturePresenter::LegoFlcTexturePresenter() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index c8f5cd68..f8f3be73 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -236,4 +236,4 @@ void LegoInputManager::KillTimer() LegoOmni* omni = LegoOmni::GetInstance(); ::KillTimer(omni->GetWindowHandle(), m_timer); } -} \ No newline at end of file +} diff --git a/LEGO1/legometerpresenter.cpp b/LEGO1/legometerpresenter.cpp index 6fed7419..6314a4fd 100644 --- a/LEGO1/legometerpresenter.cpp +++ b/LEGO1/legometerpresenter.cpp @@ -3,4 +3,4 @@ #include "decomp.h" // Uncomment when member class variables are fleshed out. -// DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94); // 0x1000a163 \ No newline at end of file +// DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94); // 0x1000a163 diff --git a/LEGO1/legonavcontroller.cpp b/LEGO1/legonavcontroller.cpp index b8a0b333..5b5fc38d 100644 --- a/LEGO1/legonavcontroller.cpp +++ b/LEGO1/legonavcontroller.cpp @@ -224,4 +224,4 @@ float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel, } return newVel; -} \ No newline at end of file +} diff --git a/LEGO1/legopathactor.cpp b/LEGO1/legopathactor.cpp index 0fe65213..58e9371b 100644 --- a/LEGO1/legopathactor.cpp +++ b/LEGO1/legopathactor.cpp @@ -164,4 +164,4 @@ void LegoPathActor::VTable0xa4() void LegoPathActor::VTable0xa8() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/legostate.cpp b/LEGO1/legostate.cpp index b82c07a3..2c2c3acc 100644 --- a/LEGO1/legostate.cpp +++ b/LEGO1/legostate.cpp @@ -39,4 +39,4 @@ LegoFileStream* LegoFileStream::FUN_10006030(MxString p_str) Write(data, (MxS16) fullLength); return this; -} \ No newline at end of file +} diff --git a/LEGO1/legoworld.cpp b/LEGO1/legoworld.cpp index 49043c0f..45fddf98 100644 --- a/LEGO1/legoworld.cpp +++ b/LEGO1/legoworld.cpp @@ -86,4 +86,4 @@ void SetIsWorldActive(MxBool p_isWorldActive) if (!p_isWorldActive) LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL); g_isWorldActive = p_isWorldActive; -} \ No newline at end of file +} diff --git a/LEGO1/mxappnotificationparam.cpp b/LEGO1/mxappnotificationparam.cpp index fd12ba47..8138a6cf 100644 --- a/LEGO1/mxappnotificationparam.cpp +++ b/LEGO1/mxappnotificationparam.cpp @@ -1,3 +1,3 @@ #include "mxappnotificationparam.h" -DECOMP_SIZE_ASSERT(MxAppNotificationParam, 0x1c) \ No newline at end of file +DECOMP_SIZE_ASSERT(MxAppNotificationParam, 0x1c) diff --git a/LEGO1/mxappnotificationparam.h b/LEGO1/mxappnotificationparam.h index 00ddd82b..ba144c31 100644 --- a/LEGO1/mxappnotificationparam.h +++ b/LEGO1/mxappnotificationparam.h @@ -17,4 +17,4 @@ protected: MxU8 m_unk18; }; -#endif // MXAPPNOTIFICATIONPARAM_H \ No newline at end of file +#endif // MXAPPNOTIFICATIONPARAM_H diff --git a/LEGO1/mxatomidcounter.h b/LEGO1/mxatomidcounter.h index 19c8ea03..3cfd7cb7 100644 --- a/LEGO1/mxatomidcounter.h +++ b/LEGO1/mxatomidcounter.h @@ -43,4 +43,4 @@ struct MxAtomIdCounterCompare { class MxAtomIdCounterSet : public set {}; -#endif // MXATOMIDCOUNTER_H \ No newline at end of file +#endif // MXATOMIDCOUNTER_H diff --git a/LEGO1/mxaudiomanager.cpp b/LEGO1/mxaudiomanager.cpp index 1f5453c0..759bc2c9 100644 --- a/LEGO1/mxaudiomanager.cpp +++ b/LEGO1/mxaudiomanager.cpp @@ -75,4 +75,4 @@ MxResult MxAudioManager::InitPresenters() void MxAudioManager::Destroy() { Destroy(FALSE); -} \ No newline at end of file +} diff --git a/LEGO1/mxbackgroundaudiomanager.cpp b/LEGO1/mxbackgroundaudiomanager.cpp index c56c86c3..e9106177 100644 --- a/LEGO1/mxbackgroundaudiomanager.cpp +++ b/LEGO1/mxbackgroundaudiomanager.cpp @@ -105,4 +105,4 @@ void MxBackgroundAudioManager::DestroyMusic() Streamer()->Close(m_script.GetInternal()); m_musicEnabled = FALSE; } -} \ No newline at end of file +} diff --git a/LEGO1/mxcompositemediapresenter.cpp b/LEGO1/mxcompositemediapresenter.cpp index 69d814b2..ff46bb37 100644 --- a/LEGO1/mxcompositemediapresenter.cpp +++ b/LEGO1/mxcompositemediapresenter.cpp @@ -4,4 +4,4 @@ MxCompositeMediaPresenter::MxCompositeMediaPresenter() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/mxcontrolpresenter.cpp b/LEGO1/mxcontrolpresenter.cpp index 70615e33..158e7460 100644 --- a/LEGO1/mxcontrolpresenter.cpp +++ b/LEGO1/mxcontrolpresenter.cpp @@ -11,4 +11,4 @@ MxControlPresenter::MxControlPresenter() this->m_unk52 = 0; this->m_unk58 = 0; this->m_unk54 = 0; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsactionlist.cpp b/LEGO1/mxdsactionlist.cpp index 254d311e..394512e5 100644 --- a/LEGO1/mxdsactionlist.cpp +++ b/LEGO1/mxdsactionlist.cpp @@ -20,4 +20,4 @@ void MxDSActionList::Destroy(MxDSAction* p_action) { if (p_action) delete p_action; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsanim.cpp b/LEGO1/mxdsanim.cpp index eccec392..8251fd70 100644 --- a/LEGO1/mxdsanim.cpp +++ b/LEGO1/mxdsanim.cpp @@ -38,4 +38,4 @@ MxDSAction* MxDSAnim::Clone() *clone = *this; return clone; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsevent.cpp b/LEGO1/mxdsevent.cpp index e3996542..152e6d77 100644 --- a/LEGO1/mxdsevent.cpp +++ b/LEGO1/mxdsevent.cpp @@ -38,4 +38,4 @@ MxDSAction* MxDSEvent::Clone() *clone = *this; return clone; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsmediaaction.cpp b/LEGO1/mxdsmediaaction.cpp index ab27538b..61c75654 100644 --- a/LEGO1/mxdsmediaaction.cpp +++ b/LEGO1/mxdsmediaaction.cpp @@ -91,4 +91,4 @@ void MxDSMediaAction::CopyMediaSrcPath(const char* p_mediaSrcPath) } else this->m_mediaSrcPath = NULL; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsmultiaction.cpp b/LEGO1/mxdsmultiaction.cpp index 5b3d796d..d990a595 100644 --- a/LEGO1/mxdsmultiaction.cpp +++ b/LEGO1/mxdsmultiaction.cpp @@ -151,4 +151,4 @@ void MxDSMultiAction::SetAtomId(MxAtomId p_atomId) MxDSAction* action; while (cursor.Next(action)) action->SetAtomId(p_atomId); -} \ No newline at end of file +} diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 9bcf28f4..c2fd7a88 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -191,4 +191,4 @@ MxDSObject* DeserializeDSObjectDispatch(char** p_source, MxS16 p_flags) } return obj; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsparallelaction.cpp b/LEGO1/mxdsparallelaction.cpp index bb6e510e..ada89bd7 100644 --- a/LEGO1/mxdsparallelaction.cpp +++ b/LEGO1/mxdsparallelaction.cpp @@ -84,4 +84,4 @@ MxLong MxDSParallelAction::GetDuration() this->m_duration *= this->m_loopCount; return this->m_duration; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsselectaction.cpp b/LEGO1/mxdsselectaction.cpp index 3479fd96..291a14df 100644 --- a/LEGO1/mxdsselectaction.cpp +++ b/LEGO1/mxdsselectaction.cpp @@ -129,4 +129,4 @@ void MxDSSelectAction::Deserialize(char** p_source, MxS16 p_unk24) } *p_source += extraFlag; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsserialaction.cpp b/LEGO1/mxdsserialaction.cpp index 563001b6..754e1cb6 100644 --- a/LEGO1/mxdsserialaction.cpp +++ b/LEGO1/mxdsserialaction.cpp @@ -78,4 +78,4 @@ MxLong MxDSSerialAction::GetDuration() } return this->m_duration; -} \ No newline at end of file +} diff --git a/LEGO1/mxdssound.cpp b/LEGO1/mxdssound.cpp index c008e6d2..32ec470e 100644 --- a/LEGO1/mxdssound.cpp +++ b/LEGO1/mxdssound.cpp @@ -60,4 +60,4 @@ MxDSAction* MxDSSound::Clone() *clone = *this; return clone; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsstill.cpp b/LEGO1/mxdsstill.cpp index 867f0883..c99c033f 100644 --- a/LEGO1/mxdsstill.cpp +++ b/LEGO1/mxdsstill.cpp @@ -38,4 +38,4 @@ MxDSAction* MxDSStill::Clone() *clone = *this; return clone; -} \ No newline at end of file +} diff --git a/LEGO1/mxdsstreamingaction.cpp b/LEGO1/mxdsstreamingaction.cpp index 9d030286..ec241943 100644 --- a/LEGO1/mxdsstreamingaction.cpp +++ b/LEGO1/mxdsstreamingaction.cpp @@ -89,4 +89,4 @@ void MxDSStreamingAction::FUN_100CD2D0() this->m_duration -= duration; this->m_unka8 += duration; -} \ No newline at end of file +} diff --git a/LEGO1/mxmatrix.h b/LEGO1/mxmatrix.h index 77ffb5a4..b9d5420d 100644 --- a/LEGO1/mxmatrix.h +++ b/LEGO1/mxmatrix.h @@ -65,4 +65,4 @@ public: }; }; -#endif // MXMATRIX_H \ No newline at end of file +#endif // MXMATRIX_H diff --git a/LEGO1/mxmediamanager.cpp b/LEGO1/mxmediamanager.cpp index f87c2387..8fa2ec32 100644 --- a/LEGO1/mxmediamanager.cpp +++ b/LEGO1/mxmediamanager.cpp @@ -99,4 +99,4 @@ void MxMediaManager::StopPresenters() while (cursor.Next(presenter)) presenter->EndAction(); -} \ No newline at end of file +} diff --git a/LEGO1/mxmidipresenter.cpp b/LEGO1/mxmidipresenter.cpp index 2d238e78..59e30fa3 100644 --- a/LEGO1/mxmidipresenter.cpp +++ b/LEGO1/mxmidipresenter.cpp @@ -36,4 +36,4 @@ void MxMIDIPresenter::DoneTickle() if (!MusicManager()->GetMIDIInitialized()) { this->EndAction(); } -} \ No newline at end of file +} diff --git a/LEGO1/mxmusicmanager.cpp b/LEGO1/mxmusicmanager.cpp index 5eb4f4ac..542bea64 100644 --- a/LEGO1/mxmusicmanager.cpp +++ b/LEGO1/mxmusicmanager.cpp @@ -143,4 +143,4 @@ done: m_criticalSection.Leave(); return status; -} \ No newline at end of file +} diff --git a/LEGO1/mxmusicmanager.h b/LEGO1/mxmusicmanager.h index 0ca09956..f128b1b6 100644 --- a/LEGO1/mxmusicmanager.h +++ b/LEGO1/mxmusicmanager.h @@ -40,4 +40,4 @@ protected: void InitData(); }; -#endif // MXMUSICMANAGER_H \ No newline at end of file +#endif // MXMUSICMANAGER_H diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index 0ac63e18..a54d185d 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -183,4 +183,4 @@ MxResult MxNotificationManager::Send(MxCore* p_listener, MxNotificationParam* p_ } return FAILURE; -} \ No newline at end of file +} diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index ce647906..5b7237cb 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -37,4 +37,4 @@ MxBool MxRegion::vtable20() { // TODO return FALSE; -} \ No newline at end of file +} diff --git a/LEGO1/mxsemaphore.cpp b/LEGO1/mxsemaphore.cpp index 7612e660..dfcb8707 100644 --- a/LEGO1/mxsemaphore.cpp +++ b/LEGO1/mxsemaphore.cpp @@ -26,4 +26,4 @@ void MxSemaphore::Wait(MxU32 p_timeoutMS) void MxSemaphore::Release(MxU32 p_releaseCount) { ReleaseSemaphore(m_hSemaphore, p_releaseCount, NULL); -} \ No newline at end of file +} diff --git a/LEGO1/mxsemaphore.h b/LEGO1/mxsemaphore.h index 3a17acdb..3bc6d66b 100644 --- a/LEGO1/mxsemaphore.h +++ b/LEGO1/mxsemaphore.h @@ -21,4 +21,4 @@ private: HANDLE m_hSemaphore; }; -#endif // MX_SEMAPHORE_H \ No newline at end of file +#endif // MX_SEMAPHORE_H diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index 1e2a9c90..b08be4bd 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -184,4 +184,4 @@ MxStreamerSubClass1::MxStreamerSubClass1(undefined4 size) for (int i = 0; i >= 0; i--) { ptr[i] = 0; } -} \ No newline at end of file +} diff --git a/LEGO1/mxthread.cpp b/LEGO1/mxthread.cpp index 507e1c3b..fd252799 100644 --- a/LEGO1/mxthread.cpp +++ b/LEGO1/mxthread.cpp @@ -96,4 +96,4 @@ MxResult MxTickleThread::Run() Sleep(timeRemainingMS); } return MxThread::Run(); -} \ No newline at end of file +} diff --git a/LEGO1/mxtype17notificationparam.cpp b/LEGO1/mxtype17notificationparam.cpp index 50cc1294..dbb047f6 100644 --- a/LEGO1/mxtype17notificationparam.cpp +++ b/LEGO1/mxtype17notificationparam.cpp @@ -1,3 +1,3 @@ #include "mxtype17notificationparam.h" -DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c) \ No newline at end of file +DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c) diff --git a/LEGO1/mxtype17notificationparam.h b/LEGO1/mxtype17notificationparam.h index 18859420..061cb768 100644 --- a/LEGO1/mxtype17notificationparam.h +++ b/LEGO1/mxtype17notificationparam.h @@ -17,4 +17,4 @@ protected: MxU16 m_unk28; }; -#endif // MXTYPE17NOTIFICATIONPARAM_H \ No newline at end of file +#endif // MXTYPE17NOTIFICATIONPARAM_H diff --git a/LEGO1/mxunklist.h b/LEGO1/mxunklist.h index 2bb0c847..cdbdeb13 100644 --- a/LEGO1/mxunklist.h +++ b/LEGO1/mxunklist.h @@ -35,4 +35,4 @@ public: MxU32 m_count; }; -#endif // MXUNKLIST_H \ No newline at end of file +#endif // MXUNKLIST_H diff --git a/LEGO1/pizzamissionstate.cpp b/LEGO1/pizzamissionstate.cpp index 363af636..83d5457c 100644 --- a/LEGO1/pizzamissionstate.cpp +++ b/LEGO1/pizzamissionstate.cpp @@ -10,4 +10,4 @@ PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 id) if (m_state[i].m_id == id) return m_state + i; return NULL; -} \ No newline at end of file +} diff --git a/LEGO1/racestate.cpp b/LEGO1/racestate.cpp index be1a1dc5..a690323e 100644 --- a/LEGO1/racestate.cpp +++ b/LEGO1/racestate.cpp @@ -20,4 +20,4 @@ RaceStateEntry* RaceState::GetState(MxU8 id) if (m_state[i].m_id == id) return m_state + i; } -} \ No newline at end of file +} diff --git a/LEGO1/radio.cpp b/LEGO1/radio.cpp index 9eae9166..8ed47409 100644 --- a/LEGO1/radio.cpp +++ b/LEGO1/radio.cpp @@ -4,4 +4,4 @@ Radio::~Radio() { // TODO -} \ No newline at end of file +} diff --git a/LEGO1/score.cpp b/LEGO1/score.cpp index e420e5cc..5aa31bee 100644 --- a/LEGO1/score.cpp +++ b/LEGO1/score.cpp @@ -324,4 +324,4 @@ MxBool Score::VTable0x64() DeleteScript(); m_unkf8 = 2; return TRUE; -} \ No newline at end of file +} From 9aadb0faebc47236f17d179c2621522aa1e29e59 Mon Sep 17 00:00:00 2001 From: Ramen2X <64166386+Ramen2X@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:49:51 -0400 Subject: [PATCH 5/6] update .gitignore [skip ci] ignore jetbrains IDE settings ignore python venvs --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 93ad1c7a..ef90adb6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,15 @@ Release/ *.ncb /.vs /.vscode +/.idea +.env +.venv +env/ +venv/ +ENV/ +VENV/ +env.bak/ +venv.bak/ ISLE.EXE LEGO1.DLL build/ From 7d8c57fc9cf57bed801c5a6e7f6dcaf3e9a2bc45 Mon Sep 17 00:00:00 2001 From: Nathan M Gilbert Date: Wed, 25 Oct 2023 16:51:59 -0400 Subject: [PATCH 6/6] Rename some functions and members (#246) * Rename some functions and members * Match LegoWorld::Notify to 100% * Match MxOmni::Destroy to 100% * Fix parameter prefix * Fix another parameter * Fix CR at EOF * Fix CR at EOF --------- Co-authored-by: Christian Semmler --- CMakeLists.txt | 2 +- LEGO1/legoentity.cpp | 74 ++++++++++++++-------------- LEGO1/legoentity.h | 45 ++++++++--------- LEGO1/legoeventnotificationparam.cpp | 5 ++ LEGO1/legoeventnotificationparam.h | 22 +++++++++ LEGO1/legoinputmanager.cpp | 8 +-- LEGO1/legoinputmanager.h | 5 +- LEGO1/legoworld.cpp | 36 ++++++++++++-- LEGO1/legoworld.h | 4 ++ LEGO1/mxactionnotificationparam.cpp | 2 +- LEGO1/mxappnotificationparam.cpp | 3 -- LEGO1/mxappnotificationparam.h | 20 -------- LEGO1/mxnotificationmanager.cpp | 5 +- LEGO1/mxnotificationmanager.h | 1 + LEGO1/mxnotificationparam.h | 23 +++++---- LEGO1/mxomni.cpp | 28 ++++++----- LEGO1/mxomni.h | 3 +- LEGO1/mxpresenter.cpp | 6 +-- LEGO1/mxstreamer.cpp | 2 +- LEGO1/score.cpp | 8 +-- LEGO1/score.h | 5 +- 21 files changed, 180 insertions(+), 127 deletions(-) create mode 100644 LEGO1/legoeventnotificationparam.cpp create mode 100644 LEGO1/legoeventnotificationparam.h delete mode 100644 LEGO1/mxappnotificationparam.cpp delete mode 100644 LEGO1/mxappnotificationparam.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 624f1f07..fa2d061e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(lego1 SHARED LEGO1/legocontrolmanager.cpp LEGO1/legoentity.cpp LEGO1/legoentitypresenter.cpp + LEGO1/legoeventnotificationparam.cpp LEGO1/legoflctexturepresenter.cpp LEGO1/legofullscreenmovie.cpp LEGO1/legogamestate.cpp @@ -99,7 +100,6 @@ add_library(lego1 SHARED LEGO1/legoworldpresenter.cpp LEGO1/motorcycle.cpp LEGO1/mxactionnotificationparam.cpp - LEGO1/mxappnotificationparam.cpp LEGO1/mxatomid.cpp LEGO1/mxatomidcounter.cpp LEGO1/mxaudiomanager.cpp diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 004befc8..19820154 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -12,22 +12,14 @@ LegoEntity::~LegoEntity() Destroy(TRUE); } -// OFFSET: LEGO1 0x100114f0 STUB -MxLong LegoEntity::Notify(MxParam& p) -{ - // TODO - - return 0; -} - // OFFSET: LEGO1 0x100105f0 -void LegoEntity::Reset() +void LegoEntity::Init() { - m_vec1.Fill(0); - m_vec2.Fill(0); - m_unk50 = 0; - m_unk54 = 0; - m_unk58 = 0; + m_worldLocation.Fill(0); + m_worldDirection.Fill(0); + m_worldSpeed = 0; + m_roi = NULL; + m_cameraFlag = 0; m_actionArgString = NULL; m_unk10 = 0; m_unk11 = 0; @@ -36,35 +28,53 @@ void LegoEntity::Reset() m_unk59 = 4; } +// OFFSET: LEGO1 0x10010650 STUB +void LegoEntity::ResetWorldTransform(MxBool p_inVehicle) +{ + // TODO +} + +// OFFSET: LEGO1 0x10010790 STUB +void LegoEntity::SetWorldTransform(MxVector3& p_loc, MxVector3& p_dir, MxVector3& p_up) +{ + // TODO +} + // OFFSET: LEGO1 0x100107e0 MxResult LegoEntity::InitFromMxDSObject(MxDSObject& p_dsObject) { m_mxEntityId = p_dsObject.GetObjectId(); m_atom = p_dsObject.GetAtomId(); - AddToCurrentWorld(); + Init(); return SUCCESS; } // OFFSET: LEGO1 0x10010810 STUB void LegoEntity::Destroy(MxBool p_fromDestructor) { - if (m_unk54) { + if (m_roi) { // TODO } delete[] m_actionArgString; - Reset(); + Init(); } // OFFSET: LEGO1 0x10010880 STUB -void LegoEntity::AddToCurrentWorld() +void LegoEntity::SetWorld() { LegoWorld* world = GetCurrentWorld(); if (world != NULL && world != (LegoWorld*) this) { - // TODO: world->vtable58(this); + // TODO: world->AddEntity(this); } } +// OFFSET: LEGO1 0x100108a0 STUB +void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) +{ + // TODO +} + // OFFSET: LEGO1 0x10010e10 void LegoEntity::ParseAction(char* p_extra) { @@ -88,24 +98,6 @@ void LegoEntity::ParseAction(char* p_extra) } } -// OFFSET: LEGO1 0x100108a0 STUB -void LegoEntity::VTable0x24() -{ - // TODO -} - -// OFFSET: LEGO1 0x10010790 STUB -void LegoEntity::VTable0x28() -{ - // TODO -} - -// OFFSET: LEGO1 0x10010650 STUB -void LegoEntity::VTable0x2c() -{ - // TODO -} - // OFFSET: LEGO1 0x10010f10 STUB void LegoEntity::VTable0x34() { @@ -147,3 +139,11 @@ void LegoEntity::VTable0x4c() { // TODO } + +// OFFSET: LEGO1 0x100114f0 STUB +MxLong LegoEntity::Notify(MxParam& p) +{ + // TODO + + return 0; +} diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index a77b65a0..1da99f3b 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -3,6 +3,7 @@ #include "decomp.h" #include "extra.h" +#include "legoroi.h" #include "mxdsobject.h" #include "mxentity.h" #include "mxvector.h" @@ -34,34 +35,34 @@ public: return !strcmp(name, LegoEntity::ClassName()) || MxEntity::IsA(name); } - virtual MxResult InitFromMxDSObject(MxDSObject& p_dsObject); // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c - virtual void ParseAction(char*); // vtable+0x20 - virtual void VTable0x24(); // vtable+0x24 - virtual void VTable0x28(); // vtable+0x28 - virtual void VTable0x2c(); // vtable+0x2c + virtual MxResult InitFromMxDSObject(MxDSObject& p_dsObject); // vtable+0x18 + virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c + virtual void ParseAction(char*); // vtable+0x20 + virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 + virtual void SetWorldTransform(MxVector3& p_loc, MxVector3& p_dir, MxVector3& p_up); // vtable+0x28 + virtual void ResetWorldTransform(MxBool p_inVehicle); // vtable+0x2c // OFFSET: LEGO1 0x10001090 - virtual void VTable0x30(undefined4 p_unk50) { m_unk50 = p_unk50; } // vtable+0x30 - virtual void VTable0x34(); // vtable+0x34 - virtual void VTable0x38(); // vtable+0x38 - virtual void VTable0x3c(); // vtable+0x3c - virtual void VTable0x40(); // vtable+0x40 - virtual void VTable0x44(); // vtable+0x44 - virtual void VTable0x48(); // vtable+0x48 - virtual void VTable0x4c(); // vtable+0x4c + virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 + virtual void VTable0x34(); // vtable+0x34 + virtual void VTable0x38(); // vtable+0x38 + virtual void VTable0x3c(); // vtable+0x3c + virtual void VTable0x40(); // vtable+0x40 + virtual void VTable0x44(); // vtable+0x44 + virtual void VTable0x48(); // vtable+0x48 + virtual void VTable0x4c(); // vtable+0x4c protected: - void Reset(); - void AddToCurrentWorld(); + void Init(); + void SetWorld(); undefined m_unk10; undefined m_unk11; - MxVector3Data m_vec1; // 0x14 - MxVector3Data m_vec2; // 0x28 - MxVector3Data m_vec3; // 0x3c - undefined4 m_unk50; - undefined4 m_unk54; - undefined m_unk58; + MxVector3Data m_worldLocation; // 0x14 + MxVector3Data m_worldDirection; // 0x28 + MxVector3Data m_worldUp; // 0x3c + MxFloat m_worldSpeed; // 0x50 + LegoROI* m_roi; // 0x54 + MxBool m_cameraFlag; // 0x58 undefined m_unk59; // For tokens from the extra string that look like this: // "Action:openram;\lego\scripts\Race\CarRaceR;0" diff --git a/LEGO1/legoeventnotificationparam.cpp b/LEGO1/legoeventnotificationparam.cpp new file mode 100644 index 00000000..70e0de00 --- /dev/null +++ b/LEGO1/legoeventnotificationparam.cpp @@ -0,0 +1,5 @@ +#include "legoeventnotificationparam.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x1c); diff --git a/LEGO1/legoeventnotificationparam.h b/LEGO1/legoeventnotificationparam.h new file mode 100644 index 00000000..f53fb822 --- /dev/null +++ b/LEGO1/legoeventnotificationparam.h @@ -0,0 +1,22 @@ +#ifndef LEGOEVENTNOTIFICATIONPARAM_H +#define LEGOEVENTNOTIFICATIONPARAM_H + +#include "mxnotificationparam.h" +#include "mxtypes.h" + +// VTABLE 0x100d6aa0 +class LegoEventNotificationParam : public MxNotificationParam { +public: + inline LegoEventNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {} + + virtual ~LegoEventNotificationParam() override {} // vtable+0x0 (scalar deleting destructor) + inline MxU8 GetKey() { return m_key; } + +protected: + MxU8 m_modifier; // 0x0c + MxS32 m_x; // 0x10 + MxS32 m_y; // 0x14 + MxU8 m_key; // 0x18 +}; + +#endif // LEGOEVENTNOTIFICATIONPARAM_H diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index f8f3be73..0fd1d22d 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -9,7 +9,7 @@ DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); // OFFSET: LEGO1 0x1005b790 LegoInputManager::LegoInputManager() { - m_unk0x5c = NULL; + m_eventQueue = NULL; m_world = NULL; m_camera = NULL; m_unk0x68 = NULL; @@ -51,9 +51,9 @@ void LegoInputManager::Destroy() { ReleaseDX(); - if (m_unk0x5c) - delete m_unk0x5c; - m_unk0x5c = NULL; + if (m_eventQueue) + delete m_eventQueue; + m_eventQueue = NULL; if (m_unk0x68) delete m_unk0x68; diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index 807e03d6..d0059605 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -2,6 +2,7 @@ #define LEGOINPUTMANAGER_H #include "decomp.h" +#include "legoeventnotificationparam.h" #include "legoworld.h" #include "mxlist.h" #include "mxpresenter.h" @@ -18,6 +19,8 @@ enum NotificationId { }; class LegoControlManager; +// TODO Really a MxQueue, but we don't have one of those +class LegoEventQueue : public MxList {}; // VTABLE 0x100d8760 // SIZE 0x338 @@ -52,7 +55,7 @@ public: // private: MxCriticalSection m_criticalSection; - MxList* m_unk0x5c; // list or hash table + LegoEventQueue* m_eventQueue; // list or hash table LegoCameraController* m_camera; LegoWorld* m_world; MxList* m_unk0x68; // list or hash table diff --git a/LEGO1/legoworld.cpp b/LEGO1/legoworld.cpp index 45fddf98..e4a2e6b4 100644 --- a/LEGO1/legoworld.cpp +++ b/LEGO1/legoworld.cpp @@ -2,12 +2,20 @@ #include "legoinputmanager.h" #include "legoomni.h" +#include "mxactionnotificationparam.h" +#include "mxnotificationparam.h" +#include "mxomni.h" #include "mxticklemanager.h" DECOMP_SIZE_ASSERT(LegoWorld, 0xf8); MxBool g_isWorldActive; +// OFFSET: LEGO1 0x100010a0 +void LegoWorld::VTable0x60() +{ +} + // OFFSET: LEGO1 0x1001ca40 STUB LegoWorld::LegoWorld() { @@ -26,12 +34,35 @@ void LegoWorld::Stop() TickleManager()->UnregisterClient(this); } +// OFFSET: LEGO1 0x1001f5e0 +MxLong LegoWorld::Notify(MxParam& p_param) +{ + MxLong ret = 0; + switch (((MxNotificationParam&) p_param).GetNotification()) { + case c_notificationEndAction: { + MxPresenter* presenter = (MxPresenter*) ((MxEndActionNotificationParam&) p_param).GetSender(); + EndAction(presenter); + ret = 1; + break; + } + case c_notificationNewPresenter: + TickleManager()->RegisterClient(this, 100); + break; + } + return ret; +} + // OFFSET: LEGO1 0x1001f630 STUB void LegoWorld::VTable0x54() { // TODO } +// OFFSET: LEGO1 0x10020f10 STUB +void LegoWorld::EndAction(MxPresenter* p_presenter) +{ +} + // OFFSET: LEGO1 0x10020220 STUB void LegoWorld::VTable0x58(MxCore* p_object) { @@ -44,11 +75,6 @@ MxBool LegoWorld::VTable0x5c() return FALSE; } -// OFFSET: LEGO1 0x100010a0 -void LegoWorld::VTable0x60() -{ -} - // OFFSET: LEGO1 0x1001d680 MxBool LegoWorld::VTable0x64() { diff --git a/LEGO1/legoworld.h b/LEGO1/legoworld.h index 31e5e593..b2ad8793 100644 --- a/LEGO1/legoworld.h +++ b/LEGO1/legoworld.h @@ -3,6 +3,7 @@ #include "legocameracontroller.h" #include "legoentity.h" +#include "mxpresenter.h" // VTABLE 0x100d6280 // SIZE 0xf8 @@ -11,6 +12,8 @@ public: __declspec(dllexport) LegoWorld(); __declspec(dllexport) virtual ~LegoWorld(); // vtable+0x0 + virtual MxLong Notify(MxParam& p) override; // vtable+0x4 + // OFFSET: LEGO1 0x1001d690 inline virtual const char* ClassName() const override // vtable+0x0c { @@ -33,6 +36,7 @@ public: virtual void VTable0x68(MxBool p_add); // vtable+68 MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); + void EndAction(MxPresenter* p_presenter); protected: undefined m_unk68[0x30]; diff --git a/LEGO1/mxactionnotificationparam.cpp b/LEGO1/mxactionnotificationparam.cpp index 7c144394..58ff8506 100644 --- a/LEGO1/mxactionnotificationparam.cpp +++ b/LEGO1/mxactionnotificationparam.cpp @@ -12,5 +12,5 @@ MxNotificationParam* MxActionNotificationParam::Clone() // OFFSET: LEGO1 0x10051270 MxNotificationParam* MxEndActionNotificationParam::Clone() { - return new MxEndActionNotificationParam(MXSTREAMER_UNKNOWN, this->m_sender, this->m_action, this->m_realloc); + return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc); } diff --git a/LEGO1/mxappnotificationparam.cpp b/LEGO1/mxappnotificationparam.cpp deleted file mode 100644 index 8138a6cf..00000000 --- a/LEGO1/mxappnotificationparam.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "mxappnotificationparam.h" - -DECOMP_SIZE_ASSERT(MxAppNotificationParam, 0x1c) diff --git a/LEGO1/mxappnotificationparam.h b/LEGO1/mxappnotificationparam.h deleted file mode 100644 index ba144c31..00000000 --- a/LEGO1/mxappnotificationparam.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MXAPPNOTIFICATIONPARAM_H -#define MXAPPNOTIFICATIONPARAM_H - -#include "decomp.h" -#include "mxnotificationparam.h" - -// VTABLE 0x100d6aa0 -class MxAppNotificationParam : public MxNotificationParam { -public: - inline MxAppNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {} - - virtual ~MxAppNotificationParam() override {} // vtable+0x0 (scalar deleting destructor) - inline MxU8 GetUnknown18() { return m_unk18; } - -protected: - undefined m_unkc[0xc]; - MxU8 m_unk18; -}; - -#endif // MXAPPNOTIFICATIONPARAM_H diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index a54d185d..a548f530 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -54,7 +54,10 @@ MxResult MxNotificationManager::Tickle() else { { MxAutoLocker lock(&m_lock); - swap(m_queue, m_sendList); + MxNotificationPtrList* temp1 = m_queue; + MxNotificationPtrList* temp2 = m_sendList; + m_queue = temp2; + m_sendList = temp1; } while (m_sendList->size() != 0) { diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h index 96d40c7b..1dcfb49a 100644 --- a/LEGO1/mxnotificationmanager.h +++ b/LEGO1/mxnotificationmanager.h @@ -46,6 +46,7 @@ public: MxResult Send(MxCore* p_listener, MxNotificationParam* p_param); inline MxNotificationPtrList* GetQueue() { return m_queue; } + inline void SetActive(MxBool p_active) { m_active = p_active; } private: void FlushPending(MxCore* p_listener); diff --git a/LEGO1/mxnotificationparam.h b/LEGO1/mxnotificationparam.h index 79e4d4cb..e5654243 100644 --- a/LEGO1/mxnotificationparam.h +++ b/LEGO1/mxnotificationparam.h @@ -9,22 +9,25 @@ class MxCore; enum MxParamType { PARAM_NONE = 0, - PAINT = 1, // 100dc210:100d8350 - MXSTREAMER_UNKNOWN = 2, // 100d8358:100d8350 - TYPE4 = 4, // 100dc208:100d8350 + PAINT = 1, // 100dc210:100d8350 + c_notificationEndAction = 2, // 100d8358:100d8350 + TYPE4 = 4, // 100dc208:100d8350 MXPRESENTER_NOTIFICATION = 5, MXSTREAMER_DELETE_NOTIFY = 6, // 100dc760 - APP_MESSAGE = 7, // 100d6aa0 - MOUSE_RELEASE = 8, // 100d6aa0 - MOUSE_PRESS = 9, // 100d6aa0 - MOUSE_MOVE = 10, // 100d6aa0 + c_notificationKeyPress = 7, // 100d6aa0 + c_notificationButtonUp = 8, // 100d6aa0 + c_notificationButtonDown = 9, // 100d6aa0 + c_notificationMouseMove = 10, // 100d6aa0 TYPE11 = 11, // 100d6aa0 - PARAM_TIMER = 15, // 100d6aa0 + c_notificationDragEnd = 12, + c_notificationDragStart = 13, + c_notificationDrag = 14, + c_notificationTimer = 15, // 100d6aa0 TYPE17 = 17, TYPE18 = 18, // 100d7e80 TYPE19 = 19, // 100d6230 TYPE20 = 20, - TYPE21 = 21, + c_notificationNewPresenter = 21, TYPE22 = 22, TYPE23 = 23, MXTRANSITIONMANAGER_TRANSITIONENDED = 24 @@ -38,7 +41,7 @@ public: virtual ~MxNotificationParam() override {} // vtable+0x0 (scalar deleting destructor) virtual MxNotificationParam* Clone(); // vtable+0x4 - inline MxParamType GetType() const { return m_type; } + inline MxParamType GetNotification() const { return m_type; } inline MxCore* GetSender() const { return m_sender; } protected: diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index e1013ce1..edd71d99 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -278,18 +278,23 @@ done: // OFFSET: LEGO1 0x100afe90 void MxOmni::Destroy() { - // FIXME: Stub - - /* - // TODO: private members - if (m_notificationManager) { - while (m_notificationManager->m_queue->size()) { - m_notificationManager->Tickle(); - } + { + MxDSAction action; + action.SetObjectId(-1); + action.SetUnknown24(-2); + DeleteObject(action); } - m_notificationManager->m_active = 0; - */ + // TODO: private members + if (m_notificationManager) { + while (m_notificationManager->GetQueue()) { + if (m_notificationManager->GetQueue()->size() == 0) + break; + m_notificationManager->Tickle(); + } + + m_notificationManager->SetActive(FALSE); + } delete m_eventManager; delete m_soundManager; @@ -313,6 +318,7 @@ void MxOmni::Destroy() } delete m_atomIdCounterSet; } + Init(); } // OFFSET: LEGO1 0x100b07f0 @@ -320,7 +326,7 @@ MxLong MxOmni::Notify(MxParam& p) { MxAutoLocker lock(&this->m_criticalsection); - if (((MxNotificationParam&) p).GetType() != MXSTREAMER_UNKNOWN) + if (((MxNotificationParam&) p).GetNotification() != c_notificationEndAction) return 0; return HandleNotificationType2(p); diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index baf72ff7..40fad828 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -69,7 +69,7 @@ protected: static MxOmni* g_instance; MxString m_mediaPath; // 0x8 - HWND m_windowHandle; // 0x18; + HWND m_windowHandle; // 0x18 MxObjectFactory* m_objectFactory; // 0x1C MxVariableTable* m_variableTable; // 0x20 MxTickleManager* m_tickleManager; // 0x24 @@ -96,7 +96,6 @@ __declspec(dllexport) MxMusicManager* MusicManager(); __declspec(dllexport) MxEventManager* EventManager(); __declspec(dllexport) MxNotificationManager* NotificationManager(); -MxResult DeleteObject(MxDSAction& p_dsAction); MxVideoManager* MVideoManager(); MxAtomIdCounterSet* AtomIdCounterSet(); MxObjectFactory* ObjectFactory(); diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 4f0b335a..13df6a60 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -30,11 +30,11 @@ void MxPresenter::Init() void MxPresenter::ParseExtra() { MxAutoLocker lock(&m_criticalSection); - MxU32 len = m_action->GetExtraLength(); + MxU16 len = m_action->GetExtraLength(); char* extraData = m_action->GetExtraData(); if (len) { - len &= MAXWORD; + // len &= MAXWORD; char extraCopy[512]; memcpy(extraCopy, extraData, len); extraCopy[len] = '\0'; @@ -141,7 +141,7 @@ void MxPresenter::EndAction() MxAutoLocker lock(&this->m_criticalSection); if (!this->m_unkPresenter) { MxOmni::GetInstance()->NotifyCurrentEntity( - &MxEndActionNotificationParam(MXSTREAMER_UNKNOWN, NULL, this->m_action, TRUE) + &MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE) ); } diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index b08be4bd..ee492e0d 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -156,7 +156,7 @@ MxBool MxStreamer::FUN_100b9b30(MxDSObject& p_dsObject) // OFFSET: LEGO1 0x100b9b60 MxLong MxStreamer::Notify(MxParam& p) { - if (((MxNotificationParam&) p).GetType() == MXSTREAMER_DELETE_NOTIFY) { + if (((MxNotificationParam&) p).GetNotification() == MXSTREAMER_DELETE_NOTIFY) { MxDSAction ds; ds.SetUnknown24(-2); diff --git a/LEGO1/score.cpp b/LEGO1/score.cpp index 5aa31bee..e58d7f32 100644 --- a/LEGO1/score.cpp +++ b/LEGO1/score.cpp @@ -40,16 +40,16 @@ MxLong Score::Notify(MxParam& p) MxLong ret = 0; LegoWorld::Notify(p); if (m_unkf6) { - switch (((MxNotificationParam&) p).GetType()) { + switch (((MxNotificationParam&) p).GetNotification()) { case PAINT: ret = 1; Paint(); break; - case MXSTREAMER_UNKNOWN: + case c_notificationEndAction: ret = FUN_10001510((MxEndActionNotificationParam&) p); break; - case APP_MESSAGE: - if (((MxAppNotificationParam&) p).GetUnknown18() == 0x20) + case c_notificationKeyPress: + if (((LegoEventNotificationParam&) p).GetKey() == 0x20) DeleteScript(); // Shutting down ret = 1; break; diff --git a/LEGO1/score.h b/LEGO1/score.h index 801816f3..612bba4c 100644 --- a/LEGO1/score.h +++ b/LEGO1/score.h @@ -1,9 +1,9 @@ #ifndef SCORE_H #define SCORE_H +#include "legoeventnotificationparam.h" #include "legoworld.h" #include "mxactionnotificationparam.h" -#include "mxappnotificationparam.h" #include "mxtype17notificationparam.h" #include "scorestate.h" @@ -28,6 +28,9 @@ public: return !strcmp(name, Score::ClassName()) || LegoWorld::IsA(name); } + // OFFSET: LEGO1 0x100011e0 TEMPLATE + // Helicopter::`scalar deleting destructor' + virtual MxResult InitFromMxDSObject(MxDSObject& p_dsObject) override; // vtable+18 virtual void Stop() override; // vtable+50 virtual MxBool VTable0x5c() override; // vtable+5c