diff --git a/DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp b/DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp index 0e3ffe562..af543553b 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp @@ -11,8 +11,8 @@ struct ITweakTargeting : public ITweak virtual float GetCurrLockOnEnterDuration() const=0; virtual float GetCurrLockOnSwitchDuration() const=0; virtual float GetLockConfirmScale() const=0; - virtual float GetNextLockOnExitDuration() const=0; virtual float GetNextLockOnEnterDuration() const=0; + virtual float GetNextLockOnExitDuration() const=0; virtual float GetNextLockOnSwitchDuration() const=0; virtual float GetSeekerScale() const=0; virtual float GetSeekerAngleSpeed() const=0; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp index a9e862b13..79af49560 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp @@ -185,7 +185,7 @@ struct CTweakGui final : ITweakGui Value x364_; CTweakGui() = default; - CTweakGui(athena::io::IStreamReader& r) { this->read(r); } + CTweakGui(athena::io::IStreamReader& r) { this->read(r); FixupValues(); } float GetMapAlphaInterpolant() const { return x8_mapAlphaInterp; } float GetPauseBlurFactor() const { return xc_pauseBlurFactor; } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index 430c0072b..e948189f5 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -13,8 +13,8 @@ struct CTweakTargeting final : public ITweakTargeting Value xc_currLockOnEnterDuration; Value x10_currLockOnSwitchDuration; Value x14_lockConfirmScale; - Value x18_nextLockOnExitDuration; - Value x1c_nextLockOnEnterDuration; + Value x18_nextLockOnEnterDuration; + Value x1c_nextLockOnExitDuration; Value x20_nextLockOnSwitchDuration; Value x24_seekerScale; Value x28_seekerAngleSpeed; @@ -157,8 +157,8 @@ struct CTweakTargeting final : public ITweakTargeting float GetCurrLockOnEnterDuration() const { return xc_currLockOnEnterDuration; } float GetCurrLockOnSwitchDuration() const { return x10_currLockOnSwitchDuration; } float GetLockConfirmScale() const { return x14_lockConfirmScale; } - float GetNextLockOnExitDuration() const { return x18_nextLockOnExitDuration; } - float GetNextLockOnEnterDuration() const { return x1c_nextLockOnEnterDuration; } + float GetNextLockOnEnterDuration() const { return x18_nextLockOnEnterDuration; } + float GetNextLockOnExitDuration() const { return x1c_nextLockOnExitDuration; } float GetNextLockOnSwitchDuration() const { return x20_nextLockOnSwitchDuration; } float GetSeekerScale() const { return x24_seekerScale; } float GetSeekerAngleSpeed() const { return x28_seekerAngleSpeed; } diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index af8ac60ed..9e826f71f 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -299,7 +299,7 @@ bool ViewManager::proc() gfxQ->execute(); if (g_ResFactory) g_ResFactory->AsyncIdle(); - if (!m_skipWait && hecl::com_developer->toBoolean()) + if (!m_skipWait || !hecl::com_developer->toBoolean()) m_mainWindow->waitForRetrace(m_voiceEngine.get()); CBooModel::ClearModelUniformCounters(); CGraphics::TickRenderTimings(); diff --git a/NESEmulator/CNESEmulator.cpp b/NESEmulator/CNESEmulator.cpp index f3eb4f060..dd08f3ddd 100644 --- a/NESEmulator/CNESEmulator.cpp +++ b/NESEmulator/CNESEmulator.cpp @@ -326,6 +326,8 @@ void CNESEmulator::DeinitializeEmulator() CNESEmulator::~CNESEmulator() { + if (m_dvdReq) + m_dvdReq->PostCancelRequest(); if (EmulatorInst) DeinitializeEmulator(); if (emuNesROM) diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index 2f8ab10fc..9ef3f59fd 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -15,6 +15,12 @@ CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak) x28_27_stashedInARAM = false; } +CPakFile::~CPakFile() +{ + if (x30_dvdReq) + x30_dvdReq->PostCancelRequest(); +} + const SObjectTag* CPakFile::GetResIdByName(std::string_view name) const { for (const std::pair& p : x54_nameList) diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp index 6e0f3ef22..edfbd1f6f 100644 --- a/Runtime/CPakFile.hpp +++ b/Runtime/CPakFile.hpp @@ -70,6 +70,7 @@ private: void Warmup(); public: CPakFile(std::string_view filename, bool buildDepList, bool worldPak); + ~CPakFile(); const std::vector>& GetNameList() const { return x54_nameList; } const std::vector& GetDepList() const { return x64_depList; } const SObjectTag* GetResIdByName(std::string_view name) const; diff --git a/Runtime/CResFactory.cpp b/Runtime/CResFactory.cpp index 295c438c7..097371414 100644 --- a/Runtime/CResFactory.cpp +++ b/Runtime/CResFactory.cpp @@ -38,8 +38,9 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran bool CResFactory::PumpResource(SLoadingData& data) { - if (data.x8_dvdReq->IsComplete()) + if (data.x8_dvdReq && data.x8_dvdReq->IsComplete()) { + data.x8_dvdReq.reset(); *data.xc_targetPtr = x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize, data.m_compressed, data.x18_cvXfer, @@ -109,7 +110,8 @@ void CResFactory::CancelBuild(const SObjectTag& tag) auto search = m_loadMap.find(tag); if (search != m_loadMap.end()) { - search->second->x8_dvdReq->PostCancelRequest(); + if (search->second->x8_dvdReq) + search->second->x8_dvdReq->PostCancelRequest(); m_loadList.erase(search->second); m_loadMap.erase(search); } diff --git a/Runtime/Graphics/CLineRenderer.cpp b/Runtime/Graphics/CLineRenderer.cpp index 49a28583d..73a0a98c2 100644 --- a/Runtime/Graphics/CLineRenderer.cpp +++ b/Runtime/Graphics/CLineRenderer.cpp @@ -24,7 +24,8 @@ hecl::UniformBufferPool CLineRenderer::s_uniformPoo CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts, - const boo::ObjToken& texture, bool additive) + const boo::ObjToken& texture, + bool additive, bool zTest) : m_mode(mode), m_maxVerts(maxVerts) { if (maxVerts < 2) @@ -55,11 +56,12 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory); - CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive); + CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest); } CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, - const boo::ObjToken& texture, bool additive) + const boo::ObjToken& texture, + bool additive, bool zTest) : m_mode(mode), m_maxVerts(maxVerts) { if (maxVerts < 2) @@ -90,9 +92,9 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory); - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { - CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive); + CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest); return true; }); } diff --git a/Runtime/Graphics/CLineRenderer.hpp b/Runtime/Graphics/CLineRenderer.hpp index c04884e0c..9b2e80e90 100644 --- a/Runtime/Graphics/CLineRenderer.hpp +++ b/Runtime/Graphics/CLineRenderer.hpp @@ -73,8 +73,10 @@ public: boo::ObjToken m_shaderBind; CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, - EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, bool additive); - CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, bool additive); + EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, + bool additive, bool zTest = false); + CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, + bool additive, bool zTest = false); CLineRenderer(CLineRenderer&&) = default; void Reset(); diff --git a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp index 1efe7b6d6..22e047ef3 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp @@ -9,6 +9,12 @@ boo::ObjToken CLineRendererShaders::m_texAdditive; boo::ObjToken CLineRendererShaders::m_noTexAlpha; boo::ObjToken CLineRendererShaders::m_noTexAdditive; +boo::ObjToken CLineRendererShaders::m_texAlphaZ; +boo::ObjToken CLineRendererShaders::m_texAdditiveZ; + +boo::ObjToken CLineRendererShaders::m_noTexAlphaZ; +boo::ObjToken CLineRendererShaders::m_noTexAdditiveZ; + boo::ObjToken CLineRendererShaders::m_texVtxFmt; boo::ObjToken CLineRendererShaders::m_noTexVtxFmt; @@ -57,6 +63,10 @@ void CLineRendererShaders::Shutdown() m_texAdditive.reset(); m_noTexAlpha.reset(); m_noTexAdditive.reset(); + m_texAlphaZ.reset(); + m_texAdditiveZ.reset(); + m_noTexAlphaZ.reset(); + m_noTexAdditiveZ.reset(); m_texVtxFmt.reset(); m_noTexVtxFmt.reset(); } @@ -64,22 +74,42 @@ void CLineRendererShaders::Shutdown() void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer, const boo::ObjToken& texture, - bool additive) + bool additive, bool zTest) { boo::ObjToken pipeline; - if (texture) + if (zTest) { - if (additive) - pipeline = m_texAdditive; + if (texture) + { + if (additive) + pipeline = m_texAdditiveZ; + else + pipeline = m_texAlphaZ; + } else - pipeline = m_texAlpha; + { + if (additive) + pipeline = m_noTexAdditiveZ; + else + pipeline = m_noTexAlphaZ; + } } else { - if (additive) - pipeline = m_noTexAdditive; + if (texture) + { + if (additive) + pipeline = m_texAdditive; + else + pipeline = m_texAlpha; + } else - pipeline = m_noTexAlpha; + { + if (additive) + pipeline = m_noTexAdditive; + else + pipeline = m_noTexAlpha; + } } m_bindFactory->BuildShaderDataBinding(ctx, renderer, pipeline, texture); diff --git a/Runtime/Graphics/Shaders/CLineRendererShaders.hpp b/Runtime/Graphics/Shaders/CLineRendererShaders.hpp index a510a073e..f7a4112cb 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShaders.hpp +++ b/Runtime/Graphics/Shaders/CLineRendererShaders.hpp @@ -30,6 +30,12 @@ private: static boo::ObjToken m_noTexAlpha; static boo::ObjToken m_noTexAdditive; + static boo::ObjToken m_texAlphaZ; + static boo::ObjToken m_texAdditiveZ; + + static boo::ObjToken m_noTexAlphaZ; + static boo::ObjToken m_noTexAdditiveZ; + static boo::ObjToken m_texVtxFmt; static boo::ObjToken m_noTexVtxFmt; @@ -52,7 +58,7 @@ public: static void Initialize(); static void Shutdown(); static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer, - const boo::ObjToken& texture, bool additive); + const boo::ObjToken& texture, bool additive, bool zTest); }; } diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp index 844ca7cb2..578b7518a 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp @@ -160,6 +160,23 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo: boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + m_texAlphaZ = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_texAdditiveZ = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, 1, TexNames, 1, UniNames, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAlphaZ = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAdditiveZ = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + return new struct OGLLineDataBindingFactory; } @@ -235,6 +252,23 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo: boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + m_texAlphaZ = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_texAdditiveZ = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAlphaZ = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAdditiveZ = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + return new struct VulkanLineDataBindingFactory; } #endif diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp index d6853609d..f4897efde 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp @@ -161,6 +161,27 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo: boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + m_texAlphaZ = ctx.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, nullptr, nullptr, + nullptr, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_texAdditiveZ = ctx.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, nullptr, nullptr, + nullptr, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAlphaZ = ctx.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, nullptr, nullptr, + nullptr, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAdditiveZ = ctx.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, nullptr, nullptr, + nullptr, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + return new struct HLSLLineDataBindingFactory; } diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp index 32a8c1f78..9e5aa5b64 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp @@ -173,6 +173,23 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo: boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + m_texAlphaZ = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_texAdditiveZ = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAlphaZ = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + m_noTexAdditiveZ = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + boo::Primitive::TriStrips, boo::ZTest::LEqual, + false, true, false, boo::CullMode::None); + return new struct MetalLineDataBindingFactory; } diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index 48b0c815b..e0e6e8bfa 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -59,9 +59,9 @@ CCompoundTargetReticle::SScanReticuleRenderer::SScanReticuleRenderer() { for (int i=0 ; i<2 ; ++i) { - m_lineRenderers[i].emplace(ctx, CLineRenderer::EPrimitiveMode::Lines, 8, nullptr, true); + m_lineRenderers[i].emplace(ctx, CLineRenderer::EPrimitiveMode::Lines, 8, nullptr, true, true); for (int j=0 ; j<4 ; ++j) - m_stripRenderers[i][j].emplace(ctx, CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true); + m_stripRenderers[i][j].emplace(ctx, CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true, true); } return true; }); @@ -415,13 +415,13 @@ void CCompoundTargetReticle::UpdateNextLockOnGroup(float dt, const CStateManager nextTargetId = mgr.GetPlayer().GetOrbitTargetId(); if (nextTargetId != xf2_nextTargetId) { - if (xf2_nextTargetId == kInvalidUniqueId) + if (nextTargetId == kInvalidUniqueId) { x194_nextGroupA = x174_nextGroupInterp; x1b4_nextGroupB = CTargetReticleRenderState(kInvalidUniqueId, 1.f, (x20_prevState == EReticleState::XRay || x20_prevState == EReticleState::Thermal) ? x100_laggingTargetPos : xf4_targetPos, 0.f, 1.f, true); - x1d4_nextGroupDur = x1d8_nextGroupTimer = g_tweakTargeting->GetNextLockOnEnterDuration(); + x1d4_nextGroupDur = x1d8_nextGroupTimer = g_tweakTargeting->GetNextLockOnExitDuration(); xf2_nextTargetId = nextTargetId; } else @@ -430,7 +430,7 @@ void CCompoundTargetReticle::UpdateNextLockOnGroup(float dt, const CStateManager x1b4_nextGroupB = CTargetReticleRenderState(nextTargetId, 1.f, zeus::CVector3f::skZero, 1.f, IsGrappleTarget(nextTargetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, true); x1d4_nextGroupDur = x1d8_nextGroupTimer = xf2_nextTargetId == kInvalidUniqueId ? - g_tweakTargeting->GetNextLockOnExitDuration() : + g_tweakTargeting->GetNextLockOnEnterDuration() : g_tweakTargeting->GetNextLockOnSwitchDuration(); xf2_nextTargetId = nextTargetId; } diff --git a/Runtime/GuiSys/CHudDecoInterface.cpp b/Runtime/GuiSys/CHudDecoInterface.cpp index 900e823ff..fe3d27a92 100644 --- a/Runtime/GuiSys/CHudDecoInterface.cpp +++ b/Runtime/GuiSys/CHudDecoInterface.cpp @@ -199,6 +199,7 @@ void CHudDecoInterfaceScan::SetFrameColorValue(float v) void CHudDecoInterfaceScan::InitializeFlatFrame() { x10_loadedScanHudFlat = x4_scanHudFlat.GetObj(); + x10_loadedScanHudFlat->SetMaxAspect(1.33f); x10_loadedScanHudFlat->GetFrameCamera()->SetO2WTransform(zeus::CTransform::Translate(x20c_camPos)); x258_flat_basewidget_scanguage = x10_loadedScanHudFlat->FindWidget("basewidget_scanguage"); x258_flat_basewidget_scanguage->SetVisibility(false, ETraversalMode::Children); diff --git a/Runtime/GuiSys/CRasterFont.hpp b/Runtime/GuiSys/CRasterFont.hpp index 9977ffe6f..b556b02bb 100644 --- a/Runtime/GuiSys/CRasterFont.hpp +++ b/Runtime/GuiSys/CRasterFont.hpp @@ -109,6 +109,8 @@ class CRasterFont if (chr == xc_glyphs[i].first) break; + if (i == xc_glyphs.size()) + return nullptr; return &xc_glyphs[i].second; } diff --git a/Runtime/GuiSys/CScanDisplay.cpp b/Runtime/GuiSys/CScanDisplay.cpp index 09713664e..a896933aa 100644 --- a/Runtime/GuiSys/CScanDisplay.cpp +++ b/Runtime/GuiSys/CScanDisplay.cpp @@ -81,6 +81,7 @@ CScanDisplay::CScanDisplay(const CGuiFrame& selHud) x0_dataDot = g_SimplePool->GetObj("TXTR_DataDot"); for (int i=0 ; i<4 ; ++i) xbc_dataDots.emplace_back(x0_dataDot); + x170_paneStates.resize(4); } void CScanDisplay::ProcessInput(const CFinalInput& input) @@ -340,10 +341,13 @@ void CScanDisplay::Update(float dt, float scanningTime) if (x1b4_scanComplete || x14_scannableInfo->GetCategory() == 0) { xc_state = EScanState::ViewingScan; + x1b0_aPulse = x1a4_xAlpha = 1.f; CSfxManager::SfxStart(1417, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); } else { + xc_state = EScanState::DownloadComplete; + x1b0_aPulse = x1a4_xAlpha = 1.f; xa8_message->TextSupport().SetText(std::u16string(g_MainStringTable->GetString(29)) + g_MainStringTable->GetString(x14_scannableInfo->GetCategory() + 30) + g_MainStringTable->GetString(30)); diff --git a/Runtime/MP1/CGBASupport.cpp b/Runtime/MP1/CGBASupport.cpp index 2c8050212..23585bb5c 100644 --- a/Runtime/MP1/CGBASupport.cpp +++ b/Runtime/MP1/CGBASupport.cpp @@ -36,6 +36,12 @@ CGBASupport::CGBASupport() x30_dvdReq = AsyncRead(x2c_buffer.get(), x28_fileSize); } +CGBASupport::~CGBASupport() +{ + if (x30_dvdReq) + x30_dvdReq->PostCancelRequest(); +} + u8 CGBASupport::CalculateFusionJBusChecksum(const u8* data, size_t len) { u32 sum = -1; diff --git a/Runtime/MP1/CGBASupport.hpp b/Runtime/MP1/CGBASupport.hpp index f2a0d7c2e..fb0405df7 100644 --- a/Runtime/MP1/CGBASupport.hpp +++ b/Runtime/MP1/CGBASupport.hpp @@ -40,6 +40,7 @@ public: static void GlobalPoll(); CGBASupport(); + ~CGBASupport(); bool PollResponse(); void Update(float dt); bool IsReady(); diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp index 3aacefba7..4e3173df5 100644 --- a/Runtime/MP1/CPauseScreen.cpp +++ b/Runtime/MP1/CPauseScreen.cpp @@ -29,6 +29,12 @@ CPauseScreen::CPauseScreen(ESubScreen subscreen, x7c_screens.resize(2); } +CPauseScreen::~CPauseScreen() +{ + if (x60_loadTok) + x60_loadTok->PostCancelRequest(); +} + std::unique_ptr CPauseScreen::BuildPauseSubScreen(ESubScreen subscreen, const CStateManager& mgr, CGuiFrame& frame) const diff --git a/Runtime/MP1/CPauseScreen.hpp b/Runtime/MP1/CPauseScreen.hpp index 5092f21f5..84b7cdfdd 100644 --- a/Runtime/MP1/CPauseScreen.hpp +++ b/Runtime/MP1/CPauseScreen.hpp @@ -64,6 +64,7 @@ private: void TransitionComplete(); public: CPauseScreen(ESubScreen subscreen, const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp); + ~CPauseScreen(); void ProcessControllerInput(const CStateManager& mgr, const CFinalInput& input); void Update(float dt, const CStateManager& mgr, CRandom16& rand, CArchitectureQueue& archQueue); void PreDraw(); diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 4062f73a6..4ccd8a109 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -495,6 +495,9 @@ CGameArea::CGameArea(CAssetId mreaId) CGameArea::~CGameArea() { + for (auto& lt : xf8_loadTransactions) + lt->PostCancelRequest(); + if (xf0_24_postConstructed) RemoveStaticGeometry(); else diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 4822a3f3b..186ed6e49 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -4674,7 +4674,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan) { rstl::reserved_vector nearList; - TUniqueId bestId = kInvalidUniqueId; + TUniqueId idOut = kInvalidUniqueId; eyeToOrbit.normalize(); mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr()); @@ -4708,7 +4708,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, eyeToOrbit.normalize(); CRayCastResult result = - mgr.RayWorldIntersection(bestId, eyePos, eyeToOrbit, eyeToOrbitMag, + mgr.RayWorldIntersection(idOut, eyePos, eyeToOrbit, eyeToOrbitMag, LineOfSightFilter, nearList); if (result.IsInvalid()) { @@ -4730,7 +4730,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, if (posInBoxMagSq < minPosInBoxMagSq) { rstl::reserved_vector nearList; - TUniqueId bestId = kInvalidUniqueId; + TUniqueId idOut = kInvalidUniqueId; eyeToOrbit.normalize(); mgr.BuildNearList(nearList, eyePos, eyeToOrbit, eyeToOrbitMag, OccluderFilter, act.GetPtr()); @@ -4765,7 +4765,7 @@ TUniqueId CPlayer::FindBestOrbitableObject(const std::vector& ids, eyeToOrbit.normalize(); CRayCastResult result = - mgr.RayWorldIntersection(bestId, eyePos, eyeToOrbit, eyeToOrbitMag, + mgr.RayWorldIntersection(idOut, eyePos, eyeToOrbit, eyeToOrbitMag, LineOfSightFilter, nearList); if (result.IsInvalid()) { @@ -4960,6 +4960,8 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) } else { +#else + m_deferredOrbitObject = ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input); #endif if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitFar, input)) OrbitPoint(EPlayerOrbitType::Far, mgr); @@ -4996,8 +4998,9 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) UpdateOrbitSelection(input, mgr); break; case EPlayerOrbitState::OrbitPoint: - if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input)) + if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input) || m_deferredOrbitObject) { + m_deferredOrbitObject = false; SetOrbitTargetId(FindOrbitTargetId(mgr), mgr); if (x310_orbitTargetId != kInvalidUniqueId) { @@ -5033,8 +5036,9 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) UpdateOrbitPosition(g_tweakPlayer->GetOrbitNormalDistance(int(x308_orbitType)), mgr); break; case EPlayerOrbitState::OrbitCarcass: - if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input)) + if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input) || m_deferredOrbitObject) { + m_deferredOrbitObject = false; SetOrbitTargetId(FindOrbitTargetId(mgr), mgr); if (x310_orbitTargetId != kInvalidUniqueId) { @@ -5063,6 +5067,8 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) { switch (x304_orbitState) { + case EPlayerOrbitState::NoOrbit: + break; case EPlayerOrbitState::OrbitObject: if (TCastToConstPtr point = mgr.GetObjectById(x310_orbitTargetId)) BreakGrapple(EPlayerOrbitRequest::Default, mgr); diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index a777f49b5..8624aecf7 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -241,6 +241,7 @@ private: EPlayerZoneType x334_orbitType = EPlayerZoneType::Ellipse; u32 x338_ = 1; TUniqueId x33c_orbitNextTargetId = kInvalidUniqueId; + bool m_deferredOrbitObject = false; float x340_ = 0.f; std::vector x344_nearbyOrbitObjects; std::vector x354_onScreenOrbitObjects; diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index dec625953..20dc64e72 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -25,6 +25,12 @@ CDummyWorld::CDummyWorld(CAssetId mlvlId, bool loadMap) : x4_loadMap(loadMap), x x30_loadToken = g_ResFactory->LoadResourceAsync(tag, x34_loadBuf.get()); } +CDummyWorld::~CDummyWorld() +{ + if (x30_loadToken) + x30_loadToken->PostCancelRequest(); +} + CAssetId CDummyWorld::IGetWorldAssetId() const { return xc_mlvlId; } CAssetId CDummyWorld::IGetStringTableAssetId() const { return x10_strgId; } diff --git a/Runtime/World/CWorld.hpp b/Runtime/World/CWorld.hpp index 9d8bb7129..91c731075 100644 --- a/Runtime/World/CWorld.hpp +++ b/Runtime/World/CWorld.hpp @@ -56,6 +56,7 @@ class CDummyWorld : public IWorld TAreaId x3c_curAreaId = kInvalidAreaId; public: CDummyWorld(CAssetId mlvlId, bool loadMap); + ~CDummyWorld(); CAssetId IGetWorldAssetId() const; CAssetId IGetStringTableAssetId() const; CAssetId IGetSaveWorldAssetId() const;