diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c06f0469..136c222bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake" "${CMAKE_SOUR find_package(Sanitizers) # Don't cotire when using clang-cl -if(NOT MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") +if(NOT URDE_MSAN AND (NOT MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")) include(cotire) endif() @@ -130,8 +130,15 @@ else() message(STATUS "Building with x87 Vector ISA") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -Werror=implicit-fallthrough \ - -Wno-unknown-warning-option -Wno-lto-type-mismatch -fno-exceptions -fno-rtti -Werror") + if(URDE_MSAN) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -stdlib=libc++ -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ + -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-multichar -Werror=implicit-fallthrough \ + -Wno-unknown-warning-option -Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field \ + -fno-exceptions -fno-rtti -Werror") if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations") diff --git a/DataSpec/DNACommon/RigInverter.hpp b/DataSpec/DNACommon/RigInverter.hpp index a5fbfb503..ba0e4e616 100644 --- a/DataSpec/DNACommon/RigInverter.hpp +++ b/DataSpec/DNACommon/RigInverter.hpp @@ -4,6 +4,7 @@ #include "zeus/CMatrix3f.hpp" #include "zeus/CQuaternion.hpp" #include "hecl/hecl.hpp" +#include namespace DataSpec::DNAANIM { diff --git a/DataSpec/DNAMP1/ANCS.cpp b/DataSpec/DNAMP1/ANCS.cpp index 76abd3381..968c9798c 100644 --- a/DataSpec/DNAMP1/ANCS.cpp +++ b/DataSpec/DNAMP1/ANCS.cpp @@ -777,8 +777,8 @@ void ANCS::AnimationSet::Enumerate(athena::io::IStreamReader& read if (sectionCount > 1) { atUint32 additiveAnimCount = reader.readUint32Big(); reader.enumerate(additiveAnims, additiveAnimCount); - floatA = reader.readFloatBig(); - floatB = reader.readFloatBig(); + additiveDefaultFadeInDur = reader.readFloatBig(); + additiveDefaultFadeOutDur = reader.readFloatBig(); } halfTransitions.clear(); @@ -818,8 +818,8 @@ void ANCS::AnimationSet::Enumerate(athena::io::IStreamWriter& wri if (sectionCount > 1) { writer.writeUint32Big(additiveAnims.size()); writer.enumerate(additiveAnims); - writer.writeFloatBig(floatA); - writer.writeFloatBig(floatB); + writer.writeFloatBig(additiveDefaultFadeInDur); + writer.writeFloatBig(additiveDefaultFadeOutDur); } if (sectionCount > 2) { @@ -886,8 +886,8 @@ void ANCS::AnimationSet::Enumerate(athena::io::YAMLDocReader& additiveAnims.clear(); if (sectionCount > 1) { reader.enumerate("additiveAnims", additiveAnims); - floatA = reader.readFloat("floatA"); - floatB = reader.readFloat("floatB"); + additiveDefaultFadeInDur = reader.readFloat("additiveDefaultFadeInDur"); + additiveDefaultFadeOutDur = reader.readFloat("additiveDefaultFadeOutDur"); } halfTransitions.clear(); @@ -922,8 +922,8 @@ void ANCS::AnimationSet::Enumerate(athena::io::YAMLDocWriter& if (sectionCount > 1) { writer.enumerate("additiveAnims", additiveAnims); - writer.writeFloat("floatA", floatA); - writer.writeFloat("floatB", floatB); + writer.writeFloat("additiveDefaultFadeInDur", additiveDefaultFadeInDur); + writer.writeFloat("additiveDefaultFadeOutDur", additiveDefaultFadeOutDur); } if (sectionCount > 2) { diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index 89c2e7236..c98ad0d1e 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -327,13 +327,13 @@ struct ANCS : BigDNA { struct AdditiveAnimationInfo : BigDNA { AT_DECL_DNA_YAML Value animIdx; - Value unk1; - Value unk2; + Value fadeInDur; + Value fadeOutDur; }; std::vector additiveAnims; - float floatA = 0.0; - float floatB = 0.0; + float additiveDefaultFadeInDur = 0.0; + float additiveDefaultFadeOutDur = 0.0; struct HalfTransition : BigDNA { AT_DECL_DNA_YAML diff --git a/DataSpec/DNAMP2/ANCS.cpp b/DataSpec/DNAMP2/ANCS.cpp index dff5c519f..f8f4def77 100644 --- a/DataSpec/DNAMP2/ANCS.cpp +++ b/DataSpec/DNAMP2/ANCS.cpp @@ -363,8 +363,8 @@ void ANCS::AnimationSet::Enumerate(typename Read::StreamT& reader) if (sectionCount > 1) { atUint32 additiveAnimCount = reader.readUint32Big(); reader.enumerate(additiveAnims, additiveAnimCount); - floatA = reader.readFloatBig(); - floatB = reader.readFloatBig(); + additiveDefaultFadeInDur = reader.readFloatBig(); + additiveDefaultFadeOutDur = reader.readFloatBig(); } halfTransitions.clear(); @@ -404,8 +404,8 @@ void ANCS::AnimationSet::Enumerate(typename Write::StreamT& write if (sectionCount > 1) { writer.writeUint32Big(additiveAnims.size()); writer.enumerate(additiveAnims); - writer.writeFloatBig(floatA); - writer.writeFloatBig(floatB); + writer.writeFloatBig(additiveDefaultFadeInDur); + writer.writeFloatBig(additiveDefaultFadeOutDur); } if (sectionCount > 2) { @@ -472,8 +472,8 @@ void ANCS::AnimationSet::Enumerate(typename ReadYaml::StreamT& additiveAnims.clear(); if (sectionCount > 1) { reader.enumerate("additiveAnims", additiveAnims); - floatA = reader.readFloat("floatA"); - floatB = reader.readFloat("floatB"); + additiveDefaultFadeInDur = reader.readFloat("additiveDefaultFadeInDur"); + additiveDefaultFadeOutDur = reader.readFloat("additiveDefaultFadeOutDur"); } halfTransitions.clear(); @@ -508,8 +508,8 @@ void ANCS::AnimationSet::Enumerate(typename WriteYaml::Stream if (sectionCount > 1) { writer.enumerate("additiveAnims", additiveAnims); - writer.writeFloat("floatA", floatA); - writer.writeFloat("floatB", floatB); + writer.writeFloat("additiveDefaultFadeInDur", additiveDefaultFadeInDur); + writer.writeFloat("additiveDefaultFadeOutDur", additiveDefaultFadeOutDur); } if (sectionCount > 2) { diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index 3935c194c..9cb228279 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -103,8 +103,8 @@ struct ANCS : BigDNA { std::vector additiveAnims; - float floatA = 0.0; - float floatB = 0.0; + float additiveDefaultFadeInDur = 0.0; + float additiveDefaultFadeOutDur = 0.0; std::vector halfTransitions; diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 01e159804..7e99c35c6 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -353,7 +353,9 @@ bool ViewManager::proc() { gfxQ->execute(); if (g_ResFactory) g_ResFactory->AsyncIdle(); +#ifndef URDE_MSAN m_voiceEngine->pumpAndMixVoices(); +#endif if (!m_skipWait || !hecl::com_developer->toBoolean()) m_mainWindow->waitForRetrace(); CBooModel::ClearModelUniformCounters(); diff --git a/NESEmulator/CNESEmulator.cpp b/NESEmulator/CNESEmulator.cpp index 67d722a97..d98d4b5a9 100644 --- a/NESEmulator/CNESEmulator.cpp +++ b/NESEmulator/CNESEmulator.cpp @@ -41,12 +41,14 @@ extern "C" { #define DEBUG_KEY 0 #define DEBUG_LOAD_INFO 1 +#if 0 #ifndef _WIN32 std::chrono::steady_clock::time_point s_tp = std::chrono::steady_clock::now(); static std::chrono::milliseconds::rep GetTickCount() { return std::chrono::duration_cast(std::chrono::steady_clock::now() - s_tp).count(); } #endif +#endif static const char* VERSION_STRING = "fixNES Alpha v1.0.5"; static char window_title[256]; diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index efabd2a22..2101705f8 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -604,12 +604,14 @@ void CSfxManager::Update(float dt) { } } +#ifndef URDE_MSAN for (const CSfxHandle& handle : chanObj.x48_handles) { if (handle->IsPlaying()) continue; if (handle->Ready() && handle->IsInArea()) handle->Play(); } +#endif m_doUpdate = false; } diff --git a/Runtime/Audio/CSfxManager.hpp b/Runtime/Audio/CSfxManager.hpp index a2bffc775..af89114aa 100644 --- a/Runtime/Audio/CSfxManager.hpp +++ b/Runtime/Audio/CSfxManager.hpp @@ -113,8 +113,8 @@ public: , x14_26_looped(looped) , x14_27_inArea(true) , x14_28_isReleased(false) - , m_isClosed(false) - , x14_29_useAcoustics(useAcoustics) {} + , x14_29_useAcoustics(useAcoustics) + , m_isClosed(false) {} }; class CSfxEmitterWrapper : public CBaseSfxWrapper { diff --git a/Runtime/CArchitectureMessage.hpp b/Runtime/CArchitectureMessage.hpp index a1776752e..54d62c51c 100644 --- a/Runtime/CArchitectureMessage.hpp +++ b/Runtime/CArchitectureMessage.hpp @@ -129,10 +129,10 @@ public: static const CArchMsgParmVoidPtr& GetParmDeleteIOWin(const CArchitectureMessage& msg) { return *msg.GetParm(); } - static CArchitectureMessage CreateFrameBegin(EArchMsgTarget target, const s32& a) { + static CArchitectureMessage CreateFrameBegin(EArchMsgTarget target, s32 a) { return CArchitectureMessage(target, EArchMsgType::FrameBegin, std::make_shared(a)); } - static CArchitectureMessage CreateFrameEnd(EArchMsgTarget target, const s32& a) { + static CArchitectureMessage CreateFrameEnd(EArchMsgTarget target, s32 a) { return CArchitectureMessage(target, EArchMsgType::FrameEnd, std::make_shared(a)); } /* URDE Messages */ diff --git a/Runtime/CDvdFile.hpp b/Runtime/CDvdFile.hpp index ad4a495f0..48196ebea 100644 --- a/Runtime/CDvdFile.hpp +++ b/Runtime/CDvdFile.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace urde { diff --git a/Runtime/CInGameTweakManagerBase.hpp b/Runtime/CInGameTweakManagerBase.hpp index e73ec3275..7f066820f 100644 --- a/Runtime/CInGameTweakManagerBase.hpp +++ b/Runtime/CInGameTweakManagerBase.hpp @@ -13,6 +13,7 @@ public: float x0_fadeIn, x4_fadeOut, x8_volume; std::string xc_fileName; CAssetId x1c_res; + Audio() = default; Audio(float fadeIn, float fadeOut, float vol, std::string_view fileName, u32 handle) : x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {} float GetFadeIn() const { return x0_fadeIn; } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 4decef33c..0088ddee1 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -992,7 +992,7 @@ bool CStateManager::GetVisSetForArea(TAreaId a, TAreaId b, CPVSVisSet& setOut) c TAreaId connArea = dock.GetConnectedAreaId(i); if (connArea == a) { const auto& verts = dock.GetPlaneVertices(); - zeus::CVector3f dockCenter = (verts[0] + verts[1] + verts[2] + verts[4]) * 0.25f; + zeus::CVector3f dockCenter = (verts[0] + verts[1] + verts[2] + verts[3]) * 0.25f; if (hasClosestDock) if ((dockCenter - viewPoint).magSquared() >= (closestDockPoint - viewPoint).magSquared()) continue; diff --git a/Runtime/Character/CSequenceHelper.cpp b/Runtime/Character/CSequenceHelper.cpp index 0bdcc99d7..3df342eb3 100644 --- a/Runtime/Character/CSequenceHelper.cpp +++ b/Runtime/Character/CSequenceHelper.cpp @@ -96,8 +96,7 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() { } if (i < x10_treeNodes.size() - 1) { - node = CTreeUtils::GetTransitionTree(node, CAnimTreeNode::Cast(std::move(x10_treeNodes[i + 1]->Clone())), - x0_animCtx); + node = CTreeUtils::GetTransitionTree(node, CAnimTreeNode::Cast(x10_treeNodes[i + 1]->Clone()), x0_animCtx); } } } diff --git a/Runtime/Collision/COBBTree.hpp b/Runtime/Collision/COBBTree.hpp index 4ca0f8aa4..ac9eef5e8 100644 --- a/Runtime/Collision/COBBTree.hpp +++ b/Runtime/Collision/COBBTree.hpp @@ -44,7 +44,6 @@ public: public: CNode() = default; - CNode(const CNode&) = default; CNode(const zeus::CTransform&, const zeus::CVector3f&, std::unique_ptr&&, std::unique_ptr&&, std::unique_ptr&&); CNode(CInputStream&); diff --git a/Runtime/GuiSys/CHudVisorBeamMenu.cpp b/Runtime/GuiSys/CHudVisorBeamMenu.cpp index e95e6fd74..b6c250a50 100644 --- a/Runtime/GuiSys/CHudVisorBeamMenu.cpp +++ b/Runtime/GuiSys/CHudVisorBeamMenu.cpp @@ -48,6 +48,7 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type, x24_model_ghost = static_cast(x0_baseHud.FindWidget(hecl::Format("%sghost", ModelNames[int(x4_type)]))); + x28_menuItems.resize(4); for (int i = 0; i < 4; ++i) { SMenuItem& item = x28_menuItems[i]; item.x0_model_loz = static_cast( diff --git a/Runtime/GuiSys/CRasterFont.cpp b/Runtime/GuiSys/CRasterFont.cpp index 0628fa2b9..dbca8cc7f 100644 --- a/Runtime/GuiSys/CRasterFont.cpp +++ b/Runtime/GuiSys/CRasterFont.cpp @@ -6,7 +6,7 @@ namespace urde { CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store) { - u32 magic; + u32 magic = 0; in.readBytesToBuf(&magic, 4); if (magic != SBIG('FONT')) return; diff --git a/Runtime/Input/CFinalInput.hpp b/Runtime/Input/CFinalInput.hpp index 5ca623a3a..faa4d1628 100644 --- a/Runtime/Input/CFinalInput.hpp +++ b/Runtime/Input/CFinalInput.hpp @@ -153,10 +153,10 @@ struct CFinalInput { CFinalInput ScaleAnalogueSticks(float leftDiv, float rightDiv) const; - bool PKey(char k) const { return m_kbm && m_PCharKeys[k]; } + bool PKey(char k) const { return m_kbm && m_PCharKeys[int(k)]; } bool PSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_PSpecialKeys[int(k)]; } bool PMouseButton(boo::EMouseButton k) const { return m_kbm && m_PMouseButtons[int(k)]; } - bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[k]; } + bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[int(k)]; } bool DSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[int(k)]; } bool DMouseButton(boo::EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[int(k)]; } bool AKey(char k) const { return DKey(k) ? 1.f : 0.f; } diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index b0a5b057c..aaba279c5 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -127,7 +127,7 @@ class CGameArchitectureSupport CInputGenerator x30_inputGenerator; CGuiSys x44_guiSys; CIOWinManager x58_ioWinManager; - s32 x78_gameFrameCount; + s32 x78_gameFrameCount = 0; enum class EAudioLoadStatus { Loading, Loaded, Uninitialized }; EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized; diff --git a/Runtime/MP1/World/CAtomicBeta.hpp b/Runtime/MP1/World/CAtomicBeta.hpp index 544ecf177..10bdb2abc 100644 --- a/Runtime/MP1/World/CAtomicBeta.hpp +++ b/Runtime/MP1/World/CAtomicBeta.hpp @@ -51,7 +51,7 @@ public: void Think(float, CStateManager&); const CDamageVulnerability* GetDamageVulnerability() const; EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, - const CWeaponMode& mode) const { + const CWeaponMode& mode, EProjectileAttrib) const { return GetDamageVulnerability()->WeaponHits(mode, false) ? EWeaponCollisionResponseTypes::AtomicBeta : EWeaponCollisionResponseTypes::AtomicBetaReflect; } diff --git a/Runtime/MP1/World/CFlickerBat.cpp b/Runtime/MP1/World/CFlickerBat.cpp index c46e37628..c5b141bbd 100644 --- a/Runtime/MP1/World/CFlickerBat.cpp +++ b/Runtime/MP1/World/CFlickerBat.cpp @@ -13,12 +13,11 @@ CFlickerBat::CFlickerBat(TUniqueId uid, std::string_view name, CPatterned::EFlav EColliderType colType, bool b1, const CActorParameters& actParms, bool b2) : CPatterned(ECharacter::FlickerBat, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small) +, x574_state(EFlickerBatState(b1)) , x580_24_wasInXray(false) , x580_25_heardShot(false) , x580_26_inLOS(false) -, x580_27_enableLOSCheck(b2) -, x574_state(EFlickerBatState(b1)) { - +, x580_27_enableLOSCheck(b2) { SetupPlayerCollision(b1); x3d8_xDamageThreshold = 0.f; x402_27_noXrayModel = false; @@ -140,7 +139,7 @@ void CFlickerBat::Death(CStateManager& mgr, const zeus::CVector3f& direction, ES CPatterned::Death(mgr, direction, state); } -bool CFlickerBat::CanBeShot(CStateManager& mgr, int) { +bool CFlickerBat::CanBeShot(const CStateManager& mgr, int) { return (GetFlickerBatState() == EFlickerBatState::Visible || GetFlickerBatState() == EFlickerBatState::FadeIn || mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay); } diff --git a/Runtime/MP1/World/CFlickerBat.hpp b/Runtime/MP1/World/CFlickerBat.hpp index 62fc8a8d9..abaceac23 100644 --- a/Runtime/MP1/World/CFlickerBat.hpp +++ b/Runtime/MP1/World/CFlickerBat.hpp @@ -35,7 +35,7 @@ public: void Touch(CActor&, CStateManager&); void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float dt); void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state); - bool CanBeShot(CStateManager&, int); + bool CanBeShot(const CStateManager&, int); void Patrol(CStateManager&, EStateMsg, float); void Attack(CStateManager&, EStateMsg, float); void Shuffle(CStateManager&, EStateMsg, float); diff --git a/Runtime/MP1/World/CPuddleSpore.cpp b/Runtime/MP1/World/CPuddleSpore.cpp index 23c920826..6398908ee 100644 --- a/Runtime/MP1/World/CPuddleSpore.cpp +++ b/Runtime/MP1/World/CPuddleSpore.cpp @@ -31,8 +31,8 @@ CPuddleSpore::CPuddleSpore(TUniqueId uid, std::string_view name, EFlavorType fla , x590_halfExtent(pInfo.GetHalfExtent()) , x594_height(pInfo.GetHeight()) , x5a0_(CalculateBoundingBox(), GetMaterialList()) -, x5ec_projectileInfo(weapon, dInfo) , x5d0_(g_SimplePool->GetObj({SBIG('PART'), glowFx})) +, x5ec_projectileInfo(weapon, dInfo) , x614_24(false) , x614_25(false) { x5dc_elemGens.reserve(kEyeCount); diff --git a/Runtime/MP1/World/CPuffer.cpp b/Runtime/MP1/World/CPuffer.cpp index 527750fde..bd2e1dae8 100644 --- a/Runtime/MP1/World/CPuffer.cpp +++ b/Runtime/MP1/World/CPuffer.cpp @@ -86,7 +86,7 @@ void CPuffer::Touch(CActor& act, CStateManager& mgr) { x401_30_pendingDeath = true; } -void CPuffer::Death(CStateManager& mgr, zeus::CVector3f& vec, EScriptObjectState state) { +void CPuffer::Death(CStateManager& mgr, const zeus::CVector3f& vec, EScriptObjectState state) { CPatterned::Death(mgr, vec, state); mgr.ApplyDamageToWorld(GetUniqueId(), *this, GetTranslation(), x59c_explosionDamage, CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {})); diff --git a/Runtime/MP1/World/CPuffer.hpp b/Runtime/MP1/World/CPuffer.hpp index c61f03723..fbc7814a8 100644 --- a/Runtime/MP1/World/CPuffer.hpp +++ b/Runtime/MP1/World/CPuffer.hpp @@ -33,6 +33,6 @@ public: void Think(float, CStateManager&); rstl::optional GetTouchBounds() const; void Touch(CActor&, CStateManager&); - void Death(CStateManager&, zeus::CVector3f&, EScriptObjectState); + void Death(CStateManager&, const zeus::CVector3f&, EScriptObjectState); }; } // namespace urde::MP1 diff --git a/Runtime/Particle/CDecalDescription.hpp b/Runtime/Particle/CDecalDescription.hpp index 4ab48674d..105b70409 100644 --- a/Runtime/Particle/CDecalDescription.hpp +++ b/Runtime/Particle/CDecalDescription.hpp @@ -33,7 +33,7 @@ public: bool x5c_24_DMAB : 1; bool x5c_25_DMOO : 1; }; - u8 dummy = 0; + u32 dummy = 0; }; }; diff --git a/Runtime/Particle/CElectricDescription.hpp b/Runtime/Particle/CElectricDescription.hpp index 442511313..f8318f582 100644 --- a/Runtime/Particle/CElectricDescription.hpp +++ b/Runtime/Particle/CElectricDescription.hpp @@ -30,6 +30,6 @@ public: SSwooshGeneratorDesc x40_SSWH; SChildGeneratorDesc x50_GPSM; SChildGeneratorDesc x60_EPSM; - bool x70_ZERY; + bool x70_ZERY = false; }; } // namespace urde diff --git a/Runtime/Particle/CGenDescription.hpp b/Runtime/Particle/CGenDescription.hpp index 321710e7b..8fe04e09d 100644 --- a/Runtime/Particle/CGenDescription.hpp +++ b/Runtime/Particle/CGenDescription.hpp @@ -60,7 +60,7 @@ public: bool x30_30_ORNT : 1; bool x30_31_RSOP : 1; }; - uint32_t dummy1 = 0; + u32 dummy1 = 0; }; std::unique_ptr x48_x34_MBSP; std::unique_ptr x4c_x38_SIZE; diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index f464591bf..d4e5a8a38 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -22,7 +22,7 @@ bool CParticleDataFactory::GetBool(CInputStream& in) { } FourCC CParticleDataFactory::GetClassID(CInputStream& in) { - uint32_t val; + u32 val = 0; in.readBytesToBuf(&val, 4); return val; } diff --git a/Runtime/Particle/CSwooshDescription.hpp b/Runtime/Particle/CSwooshDescription.hpp index 1d4f86070..67dda3a90 100644 --- a/Runtime/Particle/CSwooshDescription.hpp +++ b/Runtime/Particle/CSwooshDescription.hpp @@ -42,7 +42,7 @@ public: bool x45_25_ORNT : 1; bool x45_26_CRND : 1; }; - u16 dummy = 0; + u32 dummy = 0; }; CSwooshDescription() { x44_25_CROS = true; } diff --git a/Runtime/Particle/CWeaponDescription.hpp b/Runtime/Particle/CWeaponDescription.hpp index b3d591ac8..9fb14e4a0 100644 --- a/Runtime/Particle/CWeaponDescription.hpp +++ b/Runtime/Particle/CWeaponDescription.hpp @@ -24,19 +24,19 @@ public: std::unique_ptr x4_IVEC; std::unique_ptr x8_PSOV; std::unique_ptr xc_PSVM; - bool x10_VMD2; + bool x10_VMD2 = false; std::unique_ptr x14_PSLT; std::unique_ptr x18_PSCL; std::unique_ptr x1c_PCOL; std::unique_ptr x20_POFS; std::unique_ptr x24_OFST; - bool x28_APSO; - bool x29_HOMG; - bool x2a_AP11; - bool x2b_AP21; - bool x2c_AS11; - bool x2d_AS12; - bool x2e_AS13; + bool x28_APSO = false; + bool x29_HOMG = false; + bool x2a_AP11 = false; + bool x2b_AP21 = false; + bool x2c_AS11 = false; + bool x2d_AS12 = false; + bool x2e_AS13 = false; std::unique_ptr x30_TRAT; SChildGeneratorDesc x34_APSM; SChildGeneratorDesc x44_APS2; diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index f16ddf26c..76de02359 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -165,3 +165,9 @@ struct hash { size_t operator()(const urde::CAssetId& id) const noexcept { return id.Value(); } }; } // namespace std + +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define URDE_MSAN 1 +#endif +#endif diff --git a/Runtime/World/CFishCloud.cpp b/Runtime/World/CFishCloud.cpp index bc1f705f5..225289712 100644 --- a/Runtime/World/CFishCloud.cpp +++ b/Runtime/World/CFishCloud.cpp @@ -110,14 +110,14 @@ zeus::CPlane CFishCloud::FindClosestPlane(const zeus::CAABox& aabb, const zeus:: zeus::CAABox::EBoxFaceId minFace = zeus::CAABox::EBoxFaceId::YMin; for (int i = 0; i < 6; ++i) { auto tri = aabb.getTri(zeus::CAABox::EBoxFaceId(i), 0); - float dist = zeus::CPlane(tri.x10_[0], tri.x10_[2], tri.x10_[1]).pointToPlaneDist(point); + float dist = zeus::CPlane(tri.x10_verts[0], tri.x10_verts[2], tri.x10_verts[1]).pointToPlaneDist(point); if (dist >= 0.f && dist < minDist) { minDist = dist; minFace = zeus::CAABox::EBoxFaceId(i); } } auto tri = aabb.getTri(minFace, 0); - return zeus::CPlane(tri.x10_[0], tri.x10_[2], tri.x10_[1]); + return zeus::CPlane(tri.x10_verts[0], tri.x10_verts[2], tri.x10_verts[1]); } else { auto unPoint = GetTransform().transposeRotate(point - GetTranslation()); auto unAabb = GetUntransformedBoundingBox(); @@ -125,14 +125,16 @@ zeus::CPlane CFishCloud::FindClosestPlane(const zeus::CAABox& aabb, const zeus:: zeus::CAABox::EBoxFaceId minFace = zeus::CAABox::EBoxFaceId::YMin; for (int i = 0; i < 6; ++i) { auto tri = unAabb.getTri(zeus::CAABox::EBoxFaceId(i), 0); - float dist = zeus::CPlane(tri.x10_[0], tri.x10_[2], tri.x10_[1]).pointToPlaneDist(unPoint); + float dist = zeus::CPlane(tri.x10_verts[0], tri.x10_verts[2], tri.x10_verts[1]).pointToPlaneDist(unPoint); if (dist >= 0.f && dist < minDist) { minDist = dist; minFace = zeus::CAABox::EBoxFaceId(i); } } auto tri = unAabb.getTri(minFace, 0); - return zeus::CPlane(GetTransform() * tri.x10_[0], GetTransform() * tri.x10_[2], GetTransform() * tri.x10_[1]); + return zeus::CPlane(GetTransform() * tri.x10_verts[0], + GetTransform() * tri.x10_verts[2], + GetTransform() * tri.x10_verts[1]); } } diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index ea16d7769..44a89e0eb 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -105,8 +105,8 @@ protected: float x240_stepDownHeight; float x244_restitutionCoefModifier = 0.f; float x248_collisionAccuracyModifier = 1.f; - u32 x24c_numTicksStuck; - u32 x250_numTicksPartialUpdate; + u32 x24c_numTicksStuck = 0; + u32 x250_numTicksPartialUpdate = 0; public: CPhysicsActor(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index b4577bbe1..8f59587ff 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -261,7 +261,7 @@ private: EFootstepSfx x790_footstepSfxSel = EFootstepSfx::None; zeus::CVector3f x794_lastVelocity; CVisorSteam x7a0_visorSteam = CVisorSteam(0.f, 0.f, 0.f, CAssetId() /*kInvalidAssetId*/); - CPlayerState::EPlayerSuit x7cc_transitionSuit; + CPlayerState::EPlayerSuit x7cc_transitionSuit = CPlayerState::EPlayerSuit::Invalid; CAnimRes x7d0_animRes; zeus::CVector3f x7d8_beamScale; bool x7e4_ = true; diff --git a/Runtime/World/CProjectedShadow.hpp b/Runtime/World/CProjectedShadow.hpp index 7aa87fc18..2282ac8db 100644 --- a/Runtime/World/CProjectedShadow.hpp +++ b/Runtime/World/CProjectedShadow.hpp @@ -18,7 +18,6 @@ class CProjectedShadow { float x98_ = 1.f; public: - CProjectedShadow() = default; CProjectedShadow(u32, u32, bool); zeus::CAABox CalculateRenderBounds(); diff --git a/Runtime/World/CScriptEMPulse.cpp b/Runtime/World/CScriptEMPulse.cpp index 67f1bb7e6..c6291779a 100644 --- a/Runtime/World/CScriptEMPulse.cpp +++ b/Runtime/World/CScriptEMPulse.cpp @@ -53,7 +53,7 @@ void CScriptEMPulse::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CS } } -void CScriptEMPulse::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) const { +void CScriptEMPulse::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const { CActor::AddToRenderer(frustum, mgr); if (GetActive()) g_Renderer->AddParticleGen(*x114_particleGen); diff --git a/Runtime/World/CScriptEMPulse.hpp b/Runtime/World/CScriptEMPulse.hpp index 20dd8c745..eeace6bc6 100644 --- a/Runtime/World/CScriptEMPulse.hpp +++ b/Runtime/World/CScriptEMPulse.hpp @@ -26,7 +26,7 @@ public: void Accept(IVisitor&); void Think(float, CStateManager&); void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); - void AddToRenderer(const zeus::CFrustum&, CStateManager&) const; + void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const; void CalculateRenderBounds(); rstl::optional GetTouchBounds() const; void Touch(CActor&, CStateManager&); diff --git a/Runtime/World/CWorldShadow.hpp b/Runtime/World/CWorldShadow.hpp index 5c9176d29..816899b98 100644 --- a/Runtime/World/CWorldShadow.hpp +++ b/Runtime/World/CWorldShadow.hpp @@ -16,7 +16,7 @@ class CWorldShadow { float x64_objHalfExtent = 1.f; zeus::CVector3f x68_objPos = {0.f, 1.f, 0.f}; zeus::CVector3f x74_lightPos; - TAreaId x80_aid; + TAreaId x80_aid = kInvalidAreaId; s32 x84_lightIdx = -1; bool x88_blurReset = true; #if CWORLDSHADOW_FEEDBACK diff --git a/Runtime/World/IGameArea.hpp b/Runtime/World/IGameArea.hpp index d18f09061..a0addc90d 100644 --- a/Runtime/World/IGameArea.hpp +++ b/Runtime/World/IGameArea.hpp @@ -21,7 +21,7 @@ public: u32 x0_referenceCount = 0; std::vector x4_dockReferences; rstl::reserved_vector x14_planeVertices; - bool x48_isReferenced; + bool x48_isReferenced = false; public: const rstl::reserved_vector& GetPlaneVertices() const { return x14_planeVertices; } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index b53cb0f6f..dec6f1214 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -1701,7 +1701,7 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int rangeDelta.readBig(in); bool expl = in.readBool(); bool active = in.readBool(); - ERglFogMode realMode; + ERglFogMode realMode = ERglFogMode::None; if (mode == 0) realMode = ERglFogMode::None; diff --git a/Runtime/rstl.hpp b/Runtime/rstl.hpp index 370f79b62..d760ff6d4 100644 --- a/Runtime/rstl.hpp +++ b/Runtime/rstl.hpp @@ -477,8 +477,20 @@ public: const_reverse_iterator crbegin() const noexcept { return rbegin(); } const_reverse_iterator crend() const noexcept { return rend(); } - T& operator[](size_t idx) { return _value(idx); } - const T& operator[](size_t idx) const { return _value(idx); } + T& operator[](size_t idx) { +#ifndef NDEBUG + if (idx >= x0_size) + Log.report(logvisor::Fatal, "out of bounds access on reserved_vector."); +#endif + return _value(idx); + } + const T& operator[](size_t idx) const { +#ifndef NDEBUG + if (idx >= x0_size) + Log.report(logvisor::Fatal, "out of bounds access on reserved_vector."); +#endif + return _value(idx); + } }; /** diff --git a/amuse b/amuse index e04603bb7..1b1001636 160000 --- a/amuse +++ b/amuse @@ -1 +1 @@ -Subproject commit e04603bb7dfcdcc59f7cb14a4122b5c22c966716 +Subproject commit 1b100163692dd0f46b1824302e9dadd70f3fedb6 diff --git a/gmm/gmm_feedback_management.h b/gmm/gmm_feedback_management.h index ae7347349..d401aa130 100644 --- a/gmm/gmm_feedback_management.h +++ b/gmm/gmm_feedback_management.h @@ -136,7 +136,7 @@ public: // it to gmm::default_feedback_handler. inline base_feedback_handler* feedback_manager::manage(enum Action action, base_feedback_handler *pHandler) { static std::unique_ptr pHandler_ = - std::move(std::unique_ptr(new default_feedback_handler)); + std::unique_ptr(new default_feedback_handler); base_feedback_handler *rethandler = nullptr; switch(action) { case SET: diff --git a/hecl b/hecl index 05e4c6584..a80592249 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 05e4c65848d6ff7a08bc7bcc4371369a6735446e +Subproject commit a80592249b8a6ace071249824a55a1e979ae3e3d diff --git a/jbus b/jbus index e28b6551d..9dd968dd6 160000 --- a/jbus +++ b/jbus @@ -1 +1 @@ -Subproject commit e28b6551d012182ef96cbb8c5fdba881ab0fdecd +Subproject commit 9dd968dd66dc65f7f17b1f4f11490cd208e2c00e diff --git a/specter b/specter index ecea58334..b32f4975a 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit ecea58334d51c163ec5d1a3ff26ba05f1deedbb9 +Subproject commit b32f4975a8f0e5f282339b162069d1fbc15c298d