From 5cbcfc90389fabd62f3e280d7d207d7d1209e7ff Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 6 Nov 2020 22:03:45 -0800 Subject: [PATCH] Minor cleanup and fixes --- DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp | 1 + DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp | 1 + Runtime/MP1/CSlideShow.cpp | 15 ++++++++++----- Runtime/MP1/CSlideShow.hpp | 1 + 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp b/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp index ab506b4e4..934206614 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp @@ -5,6 +5,7 @@ namespace DataSpec { struct ITweakSlideShow : ITweak { + virtual std::string_view GetPakName() const = 0; virtual std::string_view GetFont() const = 0; virtual const zeus::CColor& GetFontColor() const = 0; virtual const zeus::CColor& GetOutlineColor() const = 0; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp index 40fa76a98..7b379947e 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp @@ -28,6 +28,7 @@ struct CTweakSlideShow final : ITweakSlideShow { CTweakSlideShow() = default; CTweakSlideShow(athena::io::IStreamReader& in) { read(in); } + std::string_view GetPakName() const override { return x4_pakName; } std::string_view GetFont() const override { return x14_fontAssetName; } const zeus::CColor& GetFontColor() const override { return x24_fontColor; } const zeus::CColor& GetOutlineColor() const override { return x28_outlineColor; } diff --git a/Runtime/MP1/CSlideShow.cpp b/Runtime/MP1/CSlideShow.cpp index 12b86fa14..3a11c4fd0 100644 --- a/Runtime/MP1/CSlideShow.cpp +++ b/Runtime/MP1/CSlideShow.cpp @@ -13,6 +13,7 @@ bool AreAllDepsLoaded(const std::vector>& deps) { } // Anonymous namespace CSlideShow::CSlideShow() : CIOWin("SlideShow"), x130_(g_tweakSlideShow->GetX54()) { + g_ResFactory->GetResLoader()->AddPakFileAsync(g_tweakSlideShow->GetPakName(), false, false); const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont()); if (font) { CGuiTextProperties propsA(false, true, EJustification::Center, EVerticalJustification::Bottom); @@ -55,6 +56,9 @@ CSlideShow::CSlideShow() : CIOWin("SlideShow"), x130_(g_tweakSlideShow->GetX54() } } +CSlideShow::~CSlideShow() { + //TODO: Remove pak from loader +} bool CSlideShow::LoadTXTRDep(std::string_view name) { const SObjectTag* dgrpTag = g_ResFactory->GetResourceIdByName(name); if (dgrpTag && dgrpTag->type == FOURCC('DGRP')) { @@ -74,11 +78,11 @@ CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CA switch (x14_phase) { case Phase::Zero: { - // if (!g_resLoader->AreAllPaksLoaded()) - //{ - // g_resLoader->AsyncIdlePakLoading(); - // return EMessageReturn::Exit; - //} + if (!g_ResFactory->GetResLoader()->AreAllPaksLoaded()) + { + g_ResFactory->GetResLoader()->AsyncIdlePakLoading(); + return EMessageReturn::Exit; + } x14_phase = Phase::One; [[fallthrough]]; } @@ -138,6 +142,7 @@ void CSlideShow::Draw() { } u32 CSlideShow::SlideShowGalleryFlags() { + return 1 | 2 | 4 | 8; u32 ret = 0; if (!g_GameState) return ret; diff --git a/Runtime/MP1/CSlideShow.hpp b/Runtime/MP1/CSlideShow.hpp index 0c6d9ecab..99207d6c9 100644 --- a/Runtime/MP1/CSlideShow.hpp +++ b/Runtime/MP1/CSlideShow.hpp @@ -101,6 +101,7 @@ private: public: CSlideShow(); + ~CSlideShow(); EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; bool GetIsContinueDraw() const override { return false; } void Draw() override;