Numerous uninitialized memory fixes

This commit is contained in:
Jack Andersen 2019-04-06 19:14:48 -10:00
parent b72cc490e8
commit 3a0d2930fa
48 changed files with 112 additions and 79 deletions

View File

@ -44,7 +44,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake" "${CMAKE_SOUR
find_package(Sanitizers) find_package(Sanitizers)
# Don't cotire when using clang-cl # 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) include(cotire)
endif() endif()
@ -130,8 +130,15 @@ else()
message(STATUS "Building with x87 Vector ISA") message(STATUS "Building with x87 Vector ISA")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -Werror=implicit-fallthrough \ if(URDE_MSAN)
-Wno-unknown-warning-option -Wno-lto-type-mismatch -fno-exceptions -fno-rtti -Werror") 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) if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations")

View File

@ -4,6 +4,7 @@
#include "zeus/CMatrix3f.hpp" #include "zeus/CMatrix3f.hpp"
#include "zeus/CQuaternion.hpp" #include "zeus/CQuaternion.hpp"
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
#include <unordered_map>
namespace DataSpec::DNAANIM { namespace DataSpec::DNAANIM {

View File

@ -777,8 +777,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::Read>(athena::io::IStreamReader& read
if (sectionCount > 1) { if (sectionCount > 1) {
atUint32 additiveAnimCount = reader.readUint32Big(); atUint32 additiveAnimCount = reader.readUint32Big();
reader.enumerate(additiveAnims, additiveAnimCount); reader.enumerate(additiveAnims, additiveAnimCount);
floatA = reader.readFloatBig(); additiveDefaultFadeInDur = reader.readFloatBig();
floatB = reader.readFloatBig(); additiveDefaultFadeOutDur = reader.readFloatBig();
} }
halfTransitions.clear(); halfTransitions.clear();
@ -818,8 +818,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& wri
if (sectionCount > 1) { if (sectionCount > 1) {
writer.writeUint32Big(additiveAnims.size()); writer.writeUint32Big(additiveAnims.size());
writer.enumerate(additiveAnims); writer.enumerate(additiveAnims);
writer.writeFloatBig(floatA); writer.writeFloatBig(additiveDefaultFadeInDur);
writer.writeFloatBig(floatB); writer.writeFloatBig(additiveDefaultFadeOutDur);
} }
if (sectionCount > 2) { if (sectionCount > 2) {
@ -886,8 +886,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader&
additiveAnims.clear(); additiveAnims.clear();
if (sectionCount > 1) { if (sectionCount > 1) {
reader.enumerate("additiveAnims", additiveAnims); reader.enumerate("additiveAnims", additiveAnims);
floatA = reader.readFloat("floatA"); additiveDefaultFadeInDur = reader.readFloat("additiveDefaultFadeInDur");
floatB = reader.readFloat("floatB"); additiveDefaultFadeOutDur = reader.readFloat("additiveDefaultFadeOutDur");
} }
halfTransitions.clear(); halfTransitions.clear();
@ -922,8 +922,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter&
if (sectionCount > 1) { if (sectionCount > 1) {
writer.enumerate("additiveAnims", additiveAnims); writer.enumerate("additiveAnims", additiveAnims);
writer.writeFloat("floatA", floatA); writer.writeFloat("additiveDefaultFadeInDur", additiveDefaultFadeInDur);
writer.writeFloat("floatB", floatB); writer.writeFloat("additiveDefaultFadeOutDur", additiveDefaultFadeOutDur);
} }
if (sectionCount > 2) { if (sectionCount > 2) {

View File

@ -327,13 +327,13 @@ struct ANCS : BigDNA {
struct AdditiveAnimationInfo : BigDNA { struct AdditiveAnimationInfo : BigDNA {
AT_DECL_DNA_YAML AT_DECL_DNA_YAML
Value<atUint32> animIdx; Value<atUint32> animIdx;
Value<float> unk1; Value<float> fadeInDur;
Value<float> unk2; Value<float> fadeOutDur;
}; };
std::vector<AdditiveAnimationInfo> additiveAnims; std::vector<AdditiveAnimationInfo> additiveAnims;
float floatA = 0.0; float additiveDefaultFadeInDur = 0.0;
float floatB = 0.0; float additiveDefaultFadeOutDur = 0.0;
struct HalfTransition : BigDNA { struct HalfTransition : BigDNA {
AT_DECL_DNA_YAML AT_DECL_DNA_YAML

View File

@ -363,8 +363,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
if (sectionCount > 1) { if (sectionCount > 1) {
atUint32 additiveAnimCount = reader.readUint32Big(); atUint32 additiveAnimCount = reader.readUint32Big();
reader.enumerate(additiveAnims, additiveAnimCount); reader.enumerate(additiveAnims, additiveAnimCount);
floatA = reader.readFloatBig(); additiveDefaultFadeInDur = reader.readFloatBig();
floatB = reader.readFloatBig(); additiveDefaultFadeOutDur = reader.readFloatBig();
} }
halfTransitions.clear(); halfTransitions.clear();
@ -404,8 +404,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::Write>(typename Write::StreamT& write
if (sectionCount > 1) { if (sectionCount > 1) {
writer.writeUint32Big(additiveAnims.size()); writer.writeUint32Big(additiveAnims.size());
writer.enumerate(additiveAnims); writer.enumerate(additiveAnims);
writer.writeFloatBig(floatA); writer.writeFloatBig(additiveDefaultFadeInDur);
writer.writeFloatBig(floatB); writer.writeFloatBig(additiveDefaultFadeOutDur);
} }
if (sectionCount > 2) { if (sectionCount > 2) {
@ -472,8 +472,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT&
additiveAnims.clear(); additiveAnims.clear();
if (sectionCount > 1) { if (sectionCount > 1) {
reader.enumerate("additiveAnims", additiveAnims); reader.enumerate("additiveAnims", additiveAnims);
floatA = reader.readFloat("floatA"); additiveDefaultFadeInDur = reader.readFloat("additiveDefaultFadeInDur");
floatB = reader.readFloat("floatB"); additiveDefaultFadeOutDur = reader.readFloat("additiveDefaultFadeOutDur");
} }
halfTransitions.clear(); halfTransitions.clear();
@ -508,8 +508,8 @@ void ANCS::AnimationSet::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::Stream
if (sectionCount > 1) { if (sectionCount > 1) {
writer.enumerate("additiveAnims", additiveAnims); writer.enumerate("additiveAnims", additiveAnims);
writer.writeFloat("floatA", floatA); writer.writeFloat("additiveDefaultFadeInDur", additiveDefaultFadeInDur);
writer.writeFloat("floatB", floatB); writer.writeFloat("additiveDefaultFadeOutDur", additiveDefaultFadeOutDur);
} }
if (sectionCount > 2) { if (sectionCount > 2) {

View File

@ -103,8 +103,8 @@ struct ANCS : BigDNA {
std::vector<MP1AnimationSet::AdditiveAnimationInfo> additiveAnims; std::vector<MP1AnimationSet::AdditiveAnimationInfo> additiveAnims;
float floatA = 0.0; float additiveDefaultFadeInDur = 0.0;
float floatB = 0.0; float additiveDefaultFadeOutDur = 0.0;
std::vector<MP1AnimationSet::HalfTransition> halfTransitions; std::vector<MP1AnimationSet::HalfTransition> halfTransitions;

View File

@ -353,7 +353,9 @@ bool ViewManager::proc() {
gfxQ->execute(); gfxQ->execute();
if (g_ResFactory) if (g_ResFactory)
g_ResFactory->AsyncIdle(); g_ResFactory->AsyncIdle();
#ifndef URDE_MSAN
m_voiceEngine->pumpAndMixVoices(); m_voiceEngine->pumpAndMixVoices();
#endif
if (!m_skipWait || !hecl::com_developer->toBoolean()) if (!m_skipWait || !hecl::com_developer->toBoolean())
m_mainWindow->waitForRetrace(); m_mainWindow->waitForRetrace();
CBooModel::ClearModelUniformCounters(); CBooModel::ClearModelUniformCounters();

View File

@ -41,12 +41,14 @@ extern "C" {
#define DEBUG_KEY 0 #define DEBUG_KEY 0
#define DEBUG_LOAD_INFO 1 #define DEBUG_LOAD_INFO 1
#if 0
#ifndef _WIN32 #ifndef _WIN32
std::chrono::steady_clock::time_point s_tp = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point s_tp = std::chrono::steady_clock::now();
static std::chrono::milliseconds::rep GetTickCount() { static std::chrono::milliseconds::rep GetTickCount() {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - s_tp).count(); return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - s_tp).count();
} }
#endif #endif
#endif
static const char* VERSION_STRING = "fixNES Alpha v1.0.5"; static const char* VERSION_STRING = "fixNES Alpha v1.0.5";
static char window_title[256]; static char window_title[256];

View File

@ -604,12 +604,14 @@ void CSfxManager::Update(float dt) {
} }
} }
#ifndef URDE_MSAN
for (const CSfxHandle& handle : chanObj.x48_handles) { for (const CSfxHandle& handle : chanObj.x48_handles) {
if (handle->IsPlaying()) if (handle->IsPlaying())
continue; continue;
if (handle->Ready() && handle->IsInArea()) if (handle->Ready() && handle->IsInArea())
handle->Play(); handle->Play();
} }
#endif
m_doUpdate = false; m_doUpdate = false;
} }

View File

@ -113,8 +113,8 @@ public:
, x14_26_looped(looped) , x14_26_looped(looped)
, x14_27_inArea(true) , x14_27_inArea(true)
, x14_28_isReleased(false) , x14_28_isReleased(false)
, m_isClosed(false) , x14_29_useAcoustics(useAcoustics)
, x14_29_useAcoustics(useAcoustics) {} , m_isClosed(false) {}
}; };
class CSfxEmitterWrapper : public CBaseSfxWrapper { class CSfxEmitterWrapper : public CBaseSfxWrapper {

View File

@ -129,10 +129,10 @@ public:
static const CArchMsgParmVoidPtr& GetParmDeleteIOWin(const CArchitectureMessage& msg) { static const CArchMsgParmVoidPtr& GetParmDeleteIOWin(const CArchitectureMessage& msg) {
return *msg.GetParm<CArchMsgParmVoidPtr>(); return *msg.GetParm<CArchMsgParmVoidPtr>();
} }
static CArchitectureMessage CreateFrameBegin(EArchMsgTarget target, const s32& a) { static CArchitectureMessage CreateFrameBegin(EArchMsgTarget target, s32 a) {
return CArchitectureMessage(target, EArchMsgType::FrameBegin, std::make_shared<CArchMsgParmInt32>(a)); return CArchitectureMessage(target, EArchMsgType::FrameBegin, std::make_shared<CArchMsgParmInt32>(a));
} }
static CArchitectureMessage CreateFrameEnd(EArchMsgTarget target, const s32& a) { static CArchitectureMessage CreateFrameEnd(EArchMsgTarget target, s32 a) {
return CArchitectureMessage(target, EArchMsgType::FrameEnd, std::make_shared<CArchMsgParmInt32>(a)); return CArchitectureMessage(target, EArchMsgType::FrameEnd, std::make_shared<CArchMsgParmInt32>(a));
} }
/* URDE Messages */ /* URDE Messages */

View File

@ -6,6 +6,7 @@
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#include <unordered_map>
namespace urde { namespace urde {

View File

@ -13,6 +13,7 @@ public:
float x0_fadeIn, x4_fadeOut, x8_volume; float x0_fadeIn, x4_fadeOut, x8_volume;
std::string xc_fileName; std::string xc_fileName;
CAssetId x1c_res; CAssetId x1c_res;
Audio() = default;
Audio(float fadeIn, float fadeOut, float vol, std::string_view fileName, u32 handle) 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) {} : x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {}
float GetFadeIn() const { return x0_fadeIn; } float GetFadeIn() const { return x0_fadeIn; }

View File

@ -992,7 +992,7 @@ bool CStateManager::GetVisSetForArea(TAreaId a, TAreaId b, CPVSVisSet& setOut) c
TAreaId connArea = dock.GetConnectedAreaId(i); TAreaId connArea = dock.GetConnectedAreaId(i);
if (connArea == a) { if (connArea == a) {
const auto& verts = dock.GetPlaneVertices(); 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 (hasClosestDock)
if ((dockCenter - viewPoint).magSquared() >= (closestDockPoint - viewPoint).magSquared()) if ((dockCenter - viewPoint).magSquared() >= (closestDockPoint - viewPoint).magSquared())
continue; continue;

View File

@ -96,8 +96,7 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
} }
if (i < x10_treeNodes.size() - 1) { if (i < x10_treeNodes.size() - 1) {
node = CTreeUtils::GetTransitionTree(node, CAnimTreeNode::Cast(std::move(x10_treeNodes[i + 1]->Clone())), node = CTreeUtils::GetTransitionTree(node, CAnimTreeNode::Cast(x10_treeNodes[i + 1]->Clone()), x0_animCtx);
x0_animCtx);
} }
} }
} }

View File

@ -44,7 +44,6 @@ public:
public: public:
CNode() = default; CNode() = default;
CNode(const CNode&) = default;
CNode(const zeus::CTransform&, const zeus::CVector3f&, std::unique_ptr<CNode>&&, std::unique_ptr<CNode>&&, CNode(const zeus::CTransform&, const zeus::CVector3f&, std::unique_ptr<CNode>&&, std::unique_ptr<CNode>&&,
std::unique_ptr<CLeafData>&&); std::unique_ptr<CLeafData>&&);
CNode(CInputStream&); CNode(CInputStream&);

View File

@ -48,6 +48,7 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type,
x24_model_ghost = static_cast<CGuiModel*>(x0_baseHud.FindWidget(hecl::Format("%sghost", ModelNames[int(x4_type)]))); x24_model_ghost = static_cast<CGuiModel*>(x0_baseHud.FindWidget(hecl::Format("%sghost", ModelNames[int(x4_type)])));
x28_menuItems.resize(4);
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
SMenuItem& item = x28_menuItems[i]; SMenuItem& item = x28_menuItems[i];
item.x0_model_loz = static_cast<CGuiModel*>( item.x0_model_loz = static_cast<CGuiModel*>(

View File

@ -6,7 +6,7 @@
namespace urde { namespace urde {
CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store) { CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store) {
u32 magic; u32 magic = 0;
in.readBytesToBuf(&magic, 4); in.readBytesToBuf(&magic, 4);
if (magic != SBIG('FONT')) if (magic != SBIG('FONT'))
return; return;

View File

@ -153,10 +153,10 @@ struct CFinalInput {
CFinalInput ScaleAnalogueSticks(float leftDiv, float rightDiv) const; 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 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 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 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 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; } bool AKey(char k) const { return DKey(k) ? 1.f : 0.f; }

View File

@ -127,7 +127,7 @@ class CGameArchitectureSupport
CInputGenerator x30_inputGenerator; CInputGenerator x30_inputGenerator;
CGuiSys x44_guiSys; CGuiSys x44_guiSys;
CIOWinManager x58_ioWinManager; CIOWinManager x58_ioWinManager;
s32 x78_gameFrameCount; s32 x78_gameFrameCount = 0;
enum class EAudioLoadStatus { Loading, Loaded, Uninitialized }; enum class EAudioLoadStatus { Loading, Loaded, Uninitialized };
EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized; EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized;

View File

@ -51,7 +51,7 @@ public:
void Think(float, CStateManager&); void Think(float, CStateManager&);
const CDamageVulnerability* GetDamageVulnerability() const; const CDamageVulnerability* GetDamageVulnerability() const;
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
const CWeaponMode& mode) const { const CWeaponMode& mode, EProjectileAttrib) const {
return GetDamageVulnerability()->WeaponHits(mode, false) ? EWeaponCollisionResponseTypes::AtomicBeta return GetDamageVulnerability()->WeaponHits(mode, false) ? EWeaponCollisionResponseTypes::AtomicBeta
: EWeaponCollisionResponseTypes::AtomicBetaReflect; : EWeaponCollisionResponseTypes::AtomicBetaReflect;
} }

View File

@ -13,12 +13,11 @@ CFlickerBat::CFlickerBat(TUniqueId uid, std::string_view name, CPatterned::EFlav
EColliderType colType, bool b1, const CActorParameters& actParms, bool b2) EColliderType colType, bool b1, const CActorParameters& actParms, bool b2)
: CPatterned(ECharacter::FlickerBat, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer, : CPatterned(ECharacter::FlickerBat, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small) colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small)
, x574_state(EFlickerBatState(b1))
, x580_24_wasInXray(false) , x580_24_wasInXray(false)
, x580_25_heardShot(false) , x580_25_heardShot(false)
, x580_26_inLOS(false) , x580_26_inLOS(false)
, x580_27_enableLOSCheck(b2) , x580_27_enableLOSCheck(b2) {
, x574_state(EFlickerBatState(b1)) {
SetupPlayerCollision(b1); SetupPlayerCollision(b1);
x3d8_xDamageThreshold = 0.f; x3d8_xDamageThreshold = 0.f;
x402_27_noXrayModel = false; x402_27_noXrayModel = false;
@ -140,7 +139,7 @@ void CFlickerBat::Death(CStateManager& mgr, const zeus::CVector3f& direction, ES
CPatterned::Death(mgr, direction, state); 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 || return (GetFlickerBatState() == EFlickerBatState::Visible || GetFlickerBatState() == EFlickerBatState::FadeIn ||
mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay); mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay);
} }

View File

@ -35,7 +35,7 @@ public:
void Touch(CActor&, CStateManager&); void Touch(CActor&, CStateManager&);
void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float dt); void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float dt);
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state); 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 Patrol(CStateManager&, EStateMsg, float);
void Attack(CStateManager&, EStateMsg, float); void Attack(CStateManager&, EStateMsg, float);
void Shuffle(CStateManager&, EStateMsg, float); void Shuffle(CStateManager&, EStateMsg, float);

View File

@ -31,8 +31,8 @@ CPuddleSpore::CPuddleSpore(TUniqueId uid, std::string_view name, EFlavorType fla
, x590_halfExtent(pInfo.GetHalfExtent()) , x590_halfExtent(pInfo.GetHalfExtent())
, x594_height(pInfo.GetHeight()) , x594_height(pInfo.GetHeight())
, x5a0_(CalculateBoundingBox(), GetMaterialList()) , x5a0_(CalculateBoundingBox(), GetMaterialList())
, x5ec_projectileInfo(weapon, dInfo)
, x5d0_(g_SimplePool->GetObj({SBIG('PART'), glowFx})) , x5d0_(g_SimplePool->GetObj({SBIG('PART'), glowFx}))
, x5ec_projectileInfo(weapon, dInfo)
, x614_24(false) , x614_24(false)
, x614_25(false) { , x614_25(false) {
x5dc_elemGens.reserve(kEyeCount); x5dc_elemGens.reserve(kEyeCount);

View File

@ -86,7 +86,7 @@ void CPuffer::Touch(CActor& act, CStateManager& mgr) {
x401_30_pendingDeath = true; 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); CPatterned::Death(mgr, vec, state);
mgr.ApplyDamageToWorld(GetUniqueId(), *this, GetTranslation(), x59c_explosionDamage, mgr.ApplyDamageToWorld(GetUniqueId(), *this, GetTranslation(), x59c_explosionDamage,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {})); CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}));

View File

@ -33,6 +33,6 @@ public:
void Think(float, CStateManager&); void Think(float, CStateManager&);
rstl::optional<zeus::CAABox> GetTouchBounds() const; rstl::optional<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor&, CStateManager&); void Touch(CActor&, CStateManager&);
void Death(CStateManager&, zeus::CVector3f&, EScriptObjectState); void Death(CStateManager&, const zeus::CVector3f&, EScriptObjectState);
}; };
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -33,7 +33,7 @@ public:
bool x5c_24_DMAB : 1; bool x5c_24_DMAB : 1;
bool x5c_25_DMOO : 1; bool x5c_25_DMOO : 1;
}; };
u8 dummy = 0; u32 dummy = 0;
}; };
}; };

View File

@ -30,6 +30,6 @@ public:
SSwooshGeneratorDesc x40_SSWH; SSwooshGeneratorDesc x40_SSWH;
SChildGeneratorDesc x50_GPSM; SChildGeneratorDesc x50_GPSM;
SChildGeneratorDesc x60_EPSM; SChildGeneratorDesc x60_EPSM;
bool x70_ZERY; bool x70_ZERY = false;
}; };
} // namespace urde } // namespace urde

View File

@ -60,7 +60,7 @@ public:
bool x30_30_ORNT : 1; bool x30_30_ORNT : 1;
bool x30_31_RSOP : 1; bool x30_31_RSOP : 1;
}; };
uint32_t dummy1 = 0; u32 dummy1 = 0;
}; };
std::unique_ptr<CIntElement> x48_x34_MBSP; std::unique_ptr<CIntElement> x48_x34_MBSP;
std::unique_ptr<CRealElement> x4c_x38_SIZE; std::unique_ptr<CRealElement> x4c_x38_SIZE;

View File

@ -22,7 +22,7 @@ bool CParticleDataFactory::GetBool(CInputStream& in) {
} }
FourCC CParticleDataFactory::GetClassID(CInputStream& in) { FourCC CParticleDataFactory::GetClassID(CInputStream& in) {
uint32_t val; u32 val = 0;
in.readBytesToBuf(&val, 4); in.readBytesToBuf(&val, 4);
return val; return val;
} }

View File

@ -42,7 +42,7 @@ public:
bool x45_25_ORNT : 1; bool x45_25_ORNT : 1;
bool x45_26_CRND : 1; bool x45_26_CRND : 1;
}; };
u16 dummy = 0; u32 dummy = 0;
}; };
CSwooshDescription() { x44_25_CROS = true; } CSwooshDescription() { x44_25_CROS = true; }

View File

@ -24,19 +24,19 @@ public:
std::unique_ptr<CVectorElement> x4_IVEC; std::unique_ptr<CVectorElement> x4_IVEC;
std::unique_ptr<CVectorElement> x8_PSOV; std::unique_ptr<CVectorElement> x8_PSOV;
std::unique_ptr<CModVectorElement> xc_PSVM; std::unique_ptr<CModVectorElement> xc_PSVM;
bool x10_VMD2; bool x10_VMD2 = false;
std::unique_ptr<CIntElement> x14_PSLT; std::unique_ptr<CIntElement> x14_PSLT;
std::unique_ptr<CVectorElement> x18_PSCL; std::unique_ptr<CVectorElement> x18_PSCL;
std::unique_ptr<CColorElement> x1c_PCOL; std::unique_ptr<CColorElement> x1c_PCOL;
std::unique_ptr<CVectorElement> x20_POFS; std::unique_ptr<CVectorElement> x20_POFS;
std::unique_ptr<CVectorElement> x24_OFST; std::unique_ptr<CVectorElement> x24_OFST;
bool x28_APSO; bool x28_APSO = false;
bool x29_HOMG; bool x29_HOMG = false;
bool x2a_AP11; bool x2a_AP11 = false;
bool x2b_AP21; bool x2b_AP21 = false;
bool x2c_AS11; bool x2c_AS11 = false;
bool x2d_AS12; bool x2d_AS12 = false;
bool x2e_AS13; bool x2e_AS13 = false;
std::unique_ptr<CRealElement> x30_TRAT; std::unique_ptr<CRealElement> x30_TRAT;
SChildGeneratorDesc x34_APSM; SChildGeneratorDesc x34_APSM;
SChildGeneratorDesc x44_APS2; SChildGeneratorDesc x44_APS2;

View File

@ -165,3 +165,9 @@ struct hash<urde::CAssetId> {
size_t operator()(const urde::CAssetId& id) const noexcept { return id.Value(); } size_t operator()(const urde::CAssetId& id) const noexcept { return id.Value(); }
}; };
} // namespace std } // namespace std
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
#define URDE_MSAN 1
#endif
#endif

View File

@ -110,14 +110,14 @@ zeus::CPlane CFishCloud::FindClosestPlane(const zeus::CAABox& aabb, const zeus::
zeus::CAABox::EBoxFaceId minFace = zeus::CAABox::EBoxFaceId::YMin; zeus::CAABox::EBoxFaceId minFace = zeus::CAABox::EBoxFaceId::YMin;
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
auto tri = aabb.getTri(zeus::CAABox::EBoxFaceId(i), 0); 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) { if (dist >= 0.f && dist < minDist) {
minDist = dist; minDist = dist;
minFace = zeus::CAABox::EBoxFaceId(i); minFace = zeus::CAABox::EBoxFaceId(i);
} }
} }
auto tri = aabb.getTri(minFace, 0); 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 { } else {
auto unPoint = GetTransform().transposeRotate(point - GetTranslation()); auto unPoint = GetTransform().transposeRotate(point - GetTranslation());
auto unAabb = GetUntransformedBoundingBox(); 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; zeus::CAABox::EBoxFaceId minFace = zeus::CAABox::EBoxFaceId::YMin;
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
auto tri = unAabb.getTri(zeus::CAABox::EBoxFaceId(i), 0); 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) { if (dist >= 0.f && dist < minDist) {
minDist = dist; minDist = dist;
minFace = zeus::CAABox::EBoxFaceId(i); minFace = zeus::CAABox::EBoxFaceId(i);
} }
} }
auto tri = unAabb.getTri(minFace, 0); 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]);
} }
} }

View File

@ -105,8 +105,8 @@ protected:
float x240_stepDownHeight; float x240_stepDownHeight;
float x244_restitutionCoefModifier = 0.f; float x244_restitutionCoefModifier = 0.f;
float x248_collisionAccuracyModifier = 1.f; float x248_collisionAccuracyModifier = 1.f;
u32 x24c_numTicksStuck; u32 x24c_numTicksStuck = 0;
u32 x250_numTicksPartialUpdate; u32 x250_numTicksPartialUpdate = 0;
public: public:
CPhysicsActor(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&, CPhysicsActor(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,

View File

@ -261,7 +261,7 @@ private:
EFootstepSfx x790_footstepSfxSel = EFootstepSfx::None; EFootstepSfx x790_footstepSfxSel = EFootstepSfx::None;
zeus::CVector3f x794_lastVelocity; zeus::CVector3f x794_lastVelocity;
CVisorSteam x7a0_visorSteam = CVisorSteam(0.f, 0.f, 0.f, CAssetId() /*kInvalidAssetId*/); 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; CAnimRes x7d0_animRes;
zeus::CVector3f x7d8_beamScale; zeus::CVector3f x7d8_beamScale;
bool x7e4_ = true; bool x7e4_ = true;

View File

@ -18,7 +18,6 @@ class CProjectedShadow {
float x98_ = 1.f; float x98_ = 1.f;
public: public:
CProjectedShadow() = default;
CProjectedShadow(u32, u32, bool); CProjectedShadow(u32, u32, bool);
zeus::CAABox CalculateRenderBounds(); zeus::CAABox CalculateRenderBounds();

View File

@ -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); CActor::AddToRenderer(frustum, mgr);
if (GetActive()) if (GetActive())
g_Renderer->AddParticleGen(*x114_particleGen); g_Renderer->AddParticleGen(*x114_particleGen);

View File

@ -26,7 +26,7 @@ public:
void Accept(IVisitor&); void Accept(IVisitor&);
void Think(float, CStateManager&); void Think(float, CStateManager&);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void AddToRenderer(const zeus::CFrustum&, CStateManager&) const; void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
void CalculateRenderBounds(); void CalculateRenderBounds();
rstl::optional<zeus::CAABox> GetTouchBounds() const; rstl::optional<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor&, CStateManager&); void Touch(CActor&, CStateManager&);

View File

@ -16,7 +16,7 @@ class CWorldShadow {
float x64_objHalfExtent = 1.f; float x64_objHalfExtent = 1.f;
zeus::CVector3f x68_objPos = {0.f, 1.f, 0.f}; zeus::CVector3f x68_objPos = {0.f, 1.f, 0.f};
zeus::CVector3f x74_lightPos; zeus::CVector3f x74_lightPos;
TAreaId x80_aid; TAreaId x80_aid = kInvalidAreaId;
s32 x84_lightIdx = -1; s32 x84_lightIdx = -1;
bool x88_blurReset = true; bool x88_blurReset = true;
#if CWORLDSHADOW_FEEDBACK #if CWORLDSHADOW_FEEDBACK

View File

@ -21,7 +21,7 @@ public:
u32 x0_referenceCount = 0; u32 x0_referenceCount = 0;
std::vector<SDockReference> x4_dockReferences; std::vector<SDockReference> x4_dockReferences;
rstl::reserved_vector<zeus::CVector3f, 4> x14_planeVertices; rstl::reserved_vector<zeus::CVector3f, 4> x14_planeVertices;
bool x48_isReferenced; bool x48_isReferenced = false;
public: public:
const rstl::reserved_vector<zeus::CVector3f, 4>& GetPlaneVertices() const { return x14_planeVertices; } const rstl::reserved_vector<zeus::CVector3f, 4>& GetPlaneVertices() const { return x14_planeVertices; }

View File

@ -1701,7 +1701,7 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int
rangeDelta.readBig(in); rangeDelta.readBig(in);
bool expl = in.readBool(); bool expl = in.readBool();
bool active = in.readBool(); bool active = in.readBool();
ERglFogMode realMode; ERglFogMode realMode = ERglFogMode::None;
if (mode == 0) if (mode == 0)
realMode = ERglFogMode::None; realMode = ERglFogMode::None;

View File

@ -477,8 +477,20 @@ public:
const_reverse_iterator crbegin() const noexcept { return rbegin(); } const_reverse_iterator crbegin() const noexcept { return rbegin(); }
const_reverse_iterator crend() const noexcept { return rend(); } const_reverse_iterator crend() const noexcept { return rend(); }
T& operator[](size_t idx) { return _value(idx); } T& operator[](size_t idx) {
const T& operator[](size_t idx) const { return _value(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);
}
}; };
/** /**

2
amuse

@ -1 +1 @@
Subproject commit e04603bb7dfcdcc59f7cb14a4122b5c22c966716 Subproject commit 1b100163692dd0f46b1824302e9dadd70f3fedb6

View File

@ -136,7 +136,7 @@ public:
// it to gmm::default_feedback_handler. // it to gmm::default_feedback_handler.
inline base_feedback_handler* feedback_manager::manage(enum Action action, base_feedback_handler *pHandler) { inline base_feedback_handler* feedback_manager::manage(enum Action action, base_feedback_handler *pHandler) {
static std::unique_ptr<base_feedback_handler> pHandler_ = static std::unique_ptr<base_feedback_handler> pHandler_ =
std::move(std::unique_ptr<base_feedback_handler>(new default_feedback_handler)); std::unique_ptr<base_feedback_handler>(new default_feedback_handler);
base_feedback_handler *rethandler = nullptr; base_feedback_handler *rethandler = nullptr;
switch(action) { switch(action) {
case SET: case SET:

2
hecl

@ -1 +1 @@
Subproject commit 05e4c65848d6ff7a08bc7bcc4371369a6735446e Subproject commit a80592249b8a6ace071249824a55a1e979ae3e3d

2
jbus

@ -1 +1 @@
Subproject commit e28b6551d012182ef96cbb8c5fdba881ab0fdecd Subproject commit 9dd968dd66dc65f7f17b1f4f11490cd208e2c00e

@ -1 +1 @@
Subproject commit ecea58334d51c163ec5d1a3ff26ba05f1deedbb9 Subproject commit b32f4975a8f0e5f282339b162069d1fbc15c298d