From 7dd2727780ff06c798f99f4bac259b9a579f096f Mon Sep 17 00:00:00 2001 From: jonschz Date: Sun, 2 Nov 2025 11:18:40 +0100 Subject: [PATCH] Fix BETA10 mismatches --- .../legoomni/include/legopathedgecontainer.h | 6 ++ LEGO1/lego/legoomni/src/actors/doors.cpp | 4 +- .../src/common/legoanimationmanager.cpp | 2 +- .../lego/legoomni/src/paths/legopathactor.cpp | 12 ++- LEGO1/library_msvc.h | 100 ++++++++++++++++++ LEGO1/realtime/realtimeview.cpp | 10 +- LEGO1/realtime/roi.h | 2 + LEGO1/viewmanager/viewmanager.cpp | 9 +- LEGO1/viewmanager/viewmanager.h | 1 + 9 files changed, 138 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathedgecontainer.h b/LEGO1/lego/legoomni/include/legopathedgecontainer.h index 5d6a79aa..bba8547b 100644 --- a/LEGO1/lego/legoomni/include/legopathedgecontainer.h +++ b/LEGO1/lego/legoomni/include/legopathedgecontainer.h @@ -106,4 +106,10 @@ struct LegoPathEdgeContainer : public list { MxU8 m_flags; // 0x38 }; +// SYNTHETIC: BETA10 0x10012080 +// LegoPathEdgeContainer::`scalar deleting destructor' + +// SYNTHETIC: BETA10 0x100120d0 +// LegoPathEdgeContainer::~LegoPathEdgeContainer + #endif // LEGOPATHEDGECONTAINER_H diff --git a/LEGO1/lego/legoomni/src/actors/doors.cpp b/LEGO1/lego/legoomni/src/actors/doors.cpp index 92ab5fc8..8fff7290 100644 --- a/LEGO1/lego/legoomni/src/actors/doors.cpp +++ b/LEGO1/lego/legoomni/src/actors/doors.cpp @@ -122,7 +122,9 @@ void Doors::ParseAction(char* p_extra) assert(m_ltDoor == NULL && m_rtDoor == NULL); assert(m_roi); - assert(!strncmp(m_roi->GetName(), "rcdor", 5)); + // clang-format off + assert(!strncmp( m_roi->GetName(), "rcdor", 5 )); + // clang-format on const CompoundObject* comp = m_roi->GetComp(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index f359d33a..6ad8cc85 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2833,7 +2833,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x actor->SetWorldSpeed(0.0f); } - LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); + const LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); if (location != NULL) { CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484); m_unk0x4cc.SetStartEnd(m_unk0x43c, m_unk0x484); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 0b9d019c..1cf40934 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -640,6 +640,7 @@ MxResult LegoPathActor::VTable0x9c() case 1: break; default: + assert(0); return FAILURE; } } @@ -656,10 +657,14 @@ MxResult LegoPathActor::VTable0x9c() if (local20 != 0) { Mx3DPointFloat local78; - Vector3& v1 = *m_destEdge->CWVertex(*m_boundary); - Vector3& v2 = *m_destEdge->CCWVertex(*m_boundary); + assert(m_boundary && m_destEdge); - LERP3(local34, v1, v2, m_unk0xe4); + Vector3* v1 = m_destEdge->CWVertex(*m_boundary); + Vector3* v2 = m_destEdge->CCWVertex(*m_boundary); + + assert(v1 && v2); + + LERP3(local34, *v1, *v2, m_unk0xe4); m_destEdge->GetFaceNormal(*m_boundary, local78); local48.EqualsCross(*m_boundary->GetUp(), local78); @@ -695,6 +700,7 @@ MxResult LegoPathActor::VTable0x9c() } if (VTable0x80(localc0, local84, local34, local48) != SUCCESS) { + MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName()); return FAILURE; } diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 04e9a674..5b4971d9 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -65,6 +65,9 @@ // LIBRARY: LEGO1 0x1008b680 // _strncmp +// LIBRARY: BETA10 0x100f9a80 +// strncmp + // LIBRARY: LEGO1 0x1008b6c0 // _atof @@ -718,6 +721,7 @@ // __fmode // GLOBAL: LEGO1 0x101028da +// GLOBAL: BETA10 0x101fbcca // __OP_POWjmptab // GLOBAL: LEGO1 0x1010292a @@ -841,6 +845,12 @@ // LIBRARY: BETA10 0x100f9420 // memcpy +// Issue: These symbols are inside `memcpy`. If enabled, the tail of the function mismatches. +// // GLOBAL: BETA10 0x100f9458 +// TrailingVecs +// // GLOBAL: BETA10 0x100f94f0 +// TrailingVecs_copydown + // LIBRARY: BETA10 0x100faa00 // memcmp @@ -877,6 +887,9 @@ // LIBRARY: BETA10 0x100ff82b // __ctrandisp1 +// LIBRARY: BETA10 0x100ff6ab +// __ctrandisp2 + // LIBRARY: BETA10 0x100f8a92 // operator delete @@ -943,6 +956,93 @@ // GLOBAL: LEGO1 0x100fd8ec // __newmode +// LIBRARY: BETA10 0x1018f410 +// _pow + +// GLOBAL: BETA10 0x101fa910 +// _assertstring + +// GLOBAL: BETA10 0x101fa940 +// dblnewline + +// GLOBAL: BETA10 0x101fa938 +// dotdotdot + +// GLOBAL: BETA10 0x101fa93c +// newline + +// LIBRARY: BETA10 0x100fbe10 +// doexit + +// LIBRARY: BETA10 0x100feeb0 +// xtoa + +// LIBRARY: BETA10 0x100ff330 +// flsall + +// GLOBAL: BETA10 0x101fbb08 +// rterrs + +// GLOBAL: BETA10 0x101faf64 +// __proc_attached + +// GLOBAL: BETA10 0x10211f6c +// _pRawDllMain + +// GLOBAL: BETA10 0x101fafa0 +// ctrlc_action + +// GLOBAL: BETA10 0x101fafa4 +// ctrlbreak_action + +// GLOBAL: BETA10 0x101fafa8 +// abort_action + +// GLOBAL: BETA10 0x101fafac +// term_action + +// GLOBAL: BETA10 0x101fbc18 +// _First_FPE_Indx + +// GLOBAL: BETA10 0x101fbc1c +// _Num_FPE + +// GLOBAL: BETA10 0x101fafe8 +// _crtAssertBusy + +// GLOBAL: BETA10 0x101fb01c +// pfnwsprintfA + +// GLOBAL: BETA10 0x10211f50 +// _pfnReportHook + +// GLOBAL: BETA10 0x101faff0 +// _CrtDbgMode + +// GLOBAL: BETA10 0x101fb000 +// _CrtDbgFile + +// LIBRARY: BETA10 0x100fc740 +// _CRT_INIT + +// LIBRARY: BETA10 0x100feb90 +// siglookup + +// LIBRARY: BETA10 0x10109920 +// $$$00001(2) + +// LIBRARY: BETA10 0x10100a70 +// _CrtDbgBreak + +// LIBRARY: BETA10 0x100fc650 +// _vsnprintf + +// LIBRARY: BETA10 0x1010cc20 +// _snprintf + +// LIBRARY: BETA10 0x10100fe0 +// CrtMessageWindow + // Cannot be handled right now due to anonymous pointer in struct. // We can annotate it on the original side, but we have no symbol on the recomp side. // We would need a way of annotating "the pointer at c_dfDIKeyboard+0x14 has orig address 0x10097f80". diff --git a/LEGO1/realtime/realtimeview.cpp b/LEGO1/realtime/realtimeview.cpp index 0145935c..fe117363 100644 --- a/LEGO1/realtime/realtimeview.cpp +++ b/LEGO1/realtime/realtimeview.cpp @@ -3,15 +3,19 @@ #include // GLOBAL: LEGO1 0x10109598 +// GLOBAL: BETA10 0x10211dc0 float g_userMaxLodPower; // GLOBAL: LEGO1 0x10101044 +// GLOBAL: BETA10 0x10204fd8 float g_userMaxBase = 4.0f; // GLOBAL: LEGO1 0x10101048 +// GLOBAL: BETA10 0x10204fdc float g_userMaxLod = 3.6f; // GLOBAL: LEGO1 0x1010104c +// GLOBAL: BETA10 0x10204fe0 float g_partsThreshold = 1000.0f; // FUNCTION: LEGO1 0x100a5dc0 @@ -27,6 +31,7 @@ RealtimeView::~RealtimeView() } // FUNCTION: LEGO1 0x100a5de0 +// FUNCTION: BETA10 0x10168874 void RealtimeView::SetUserMaxLOD(float p_lod) { g_userMaxLod = p_lod; @@ -34,25 +39,28 @@ void RealtimeView::SetUserMaxLOD(float p_lod) } // FUNCTION: LEGO1 0x100a5df0 +// FUNCTION: BETA10 0x10168891 void RealtimeView::SetPartsThreshold(float p_threshold) { g_partsThreshold = p_threshold; } // FUNCTION: LEGO1 0x100a5e00 +// FUNCTION: BETA10 0x101688a9 float RealtimeView::GetUserMaxLOD() { return g_userMaxLod; } // FUNCTION: LEGO1 0x100a5e10 +// FUNCTION: LEGO1 0x101688bf float RealtimeView::GetPartsThreshold() { return g_partsThreshold; } // FUNCTION: LEGO1 0x100a5e20 -// STUB: BETA10 0x101688d5 +// FUNCTION: BETA10 0x101688d5 void RealtimeView::UpdateMaxLOD() { g_userMaxLodPower = pow(g_userMaxBase, -g_userMaxLod); diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 25829f7e..73e837d6 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -20,11 +20,13 @@ class BoundingBox { // FUNCTION: BETA10 0x1004a7a0 const Vector3& Min() const { return min; } + // FUNCTION: BETA10 0x10174c30 Vector3& Min() { return min; } // FUNCTION: BETA10 0x1004a7c0 const Vector3& Max() const { return max; } + // FUNCTION: BETA10 0x10174c50 Vector3& Max() { return max; } private: diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index a35e6da4..bfdb1e44 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -9,6 +9,7 @@ DECOMP_SIZE_ASSERT(ViewManager, 0x1bc) // GLOBAL: LEGO1 0x100dbc78 +// GLOBAL: BETA10 0x101c3398 int g_boundingBoxCornerMap[8][3] = {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {1, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}; @@ -16,12 +17,15 @@ int g_boundingBoxCornerMap[8][3] = int g_planePointIndexMap[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6}; // GLOBAL: LEGO1 0x10101050 +// GLOBAL: BETA10 0x10205914 float g_LODScaleFactor = 4.0F; // GLOBAL: LEGO1 0x10101054 -float g_minLODThreshold = 0.00097656297; +// GLOBAL: BETA10 0x10205918 +float g_minLODThreshold = 1.0000005F / 1024; // GLOBAL: LEGO1 0x10101058 +// GLOBAL: BETA10 0x1020591c int g_maxLODLevels = 6; // GLOBAL: LEGO1 0x1010105c @@ -43,7 +47,7 @@ int userVisualCallback( LPDIRECT3DRMVIEWPORT view ) { - // This function calls (among others) into LegoBSP.cpp, which might no longer exist in BETA10 + // This function calls into LegoBSP.cpp, which has likely been removed in LEGO1 return 0; } @@ -401,6 +405,7 @@ inline int ViewManager::CalculateLODLevel(float p_maximumScale, float p_initialS return 0; } else { + // LINE: BETA10 0x10172c4d lodLevel = 1; } } diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 6b03619a..2c4bc0fc 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -47,6 +47,7 @@ class ViewManager { void Add(ViewROI* p_roi) { rois.push_back(p_roi); } // SYNTHETIC: LEGO1 0x100a6000 + // SYNTHETIC: BETA10 0x10174410 // ViewManager::`scalar deleting destructor' private: