mirror of https://github.com/AxioDL/metaforce.git
Fix CMemoryCardSys shutdown crash
This commit is contained in:
parent
eb955c53ec
commit
12c6163e32
|
@ -585,4 +585,10 @@ void CMemoryCardSys::CommitToDisk(kabufuda::ECardSlot port)
|
||||||
card.commit();
|
card.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMemoryCardSys::Shutdown()
|
||||||
|
{
|
||||||
|
UnmountCard(kabufuda::ECardSlot::SlotA);
|
||||||
|
UnmountCard(kabufuda::ECardSlot::SlotB);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ class CMemoryCardSys
|
||||||
std::vector<std::pair<ResId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
|
std::vector<std::pair<ResId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
|
||||||
std::experimental::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
|
std::experimental::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
|
||||||
std::vector<std::pair<ResId, CSaveWorld::EScanCategory>> x20_scanStates;
|
std::vector<std::pair<ResId, CSaveWorld::EScanCategory>> x20_scanStates;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static kabufuda::SystemString ResolveDolphinCardPath(kabufuda::ECardSlot slot);
|
static kabufuda::SystemString ResolveDolphinCardPath(kabufuda::ECardSlot slot);
|
||||||
|
|
||||||
|
@ -174,6 +175,7 @@ public:
|
||||||
static ECardResult FormatCard(kabufuda::ECardSlot port);
|
static ECardResult FormatCard(kabufuda::ECardSlot port);
|
||||||
|
|
||||||
static void CommitToDisk(kabufuda::ECardSlot port);
|
static void CommitToDisk(kabufuda::ECardSlot port);
|
||||||
|
static void Shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "CTexture.hpp"
|
#include "CTexture.hpp"
|
||||||
#include "CModel.hpp"
|
#include "CModel.hpp"
|
||||||
#include "Particle/CParticleGen.hpp"
|
#include "Particle/CParticleGen.hpp"
|
||||||
|
#include "Particle/CDecal.hpp"
|
||||||
|
#include "Particle/CElementGen.hpp"
|
||||||
#include "CMetroidModelInstance.hpp"
|
#include "CMetroidModelInstance.hpp"
|
||||||
#include "Collision/CAreaOctTree.hpp"
|
#include "Collision/CAreaOctTree.hpp"
|
||||||
|
|
||||||
|
@ -652,6 +654,8 @@ void CBooRenderer::SetThermal(bool thermal, float level, const zeus::CColor& col
|
||||||
x318_29_thermalVisor = thermal;
|
x318_29_thermalVisor = thermal;
|
||||||
x2f0_thermalVisorLevel = level;
|
x2f0_thermalVisorLevel = level;
|
||||||
x2f4_thermColor = color;
|
x2f4_thermColor = color;
|
||||||
|
CDecal::SetMoveRedToAlphaBuffer(false);
|
||||||
|
CElementGen::SetMoveRedToAlphaBuffer(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::SetThermalColdScale(float scale)
|
void CBooRenderer::SetThermalColdScale(float scale)
|
||||||
|
@ -680,6 +684,8 @@ void CBooRenderer::DoThermalBlendCold()
|
||||||
|
|
||||||
m_thermColdFilter.setShift(x2a8_thermalRand.Next() % 32);
|
m_thermColdFilter.setShift(x2a8_thermalRand.Next() % 32);
|
||||||
m_thermColdFilter.draw();
|
m_thermColdFilter.draw();
|
||||||
|
CElementGen::SetMoveRedToAlphaBuffer(true);
|
||||||
|
CDecal::SetMoveRedToAlphaBuffer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DoThermalBlendHot()
|
void CBooRenderer::DoThermalBlendHot()
|
||||||
|
|
|
@ -66,6 +66,7 @@ void CGameArchitectureSupport::UpdateTicks()
|
||||||
void CGameArchitectureSupport::Update()
|
void CGameArchitectureSupport::Update()
|
||||||
{
|
{
|
||||||
g_GameState->GetWorldTransitionManager()->TouchModels();
|
g_GameState->GetWorldTransitionManager()->TouchModels();
|
||||||
|
x30_inputGenerator.Update(1 / 60.f, x4_archQueue);
|
||||||
x4_archQueue.Push(MakeMsg::CreateFrameBegin(EArchMsgTarget::Game, x78_));
|
x4_archQueue.Push(MakeMsg::CreateFrameBegin(EArchMsgTarget::Game, x78_));
|
||||||
x58_ioWinManager.PumpMessages(x4_archQueue);
|
x58_ioWinManager.PumpMessages(x4_archQueue);
|
||||||
}
|
}
|
||||||
|
@ -282,6 +283,7 @@ void CMain::ShutdownSubsystems()
|
||||||
CDecalManager::Shutdown();
|
CDecalManager::Shutdown();
|
||||||
CElementGen::Shutdown();
|
CElementGen::Shutdown();
|
||||||
CAnimData::FreeCache();
|
CAnimData::FreeCache();
|
||||||
|
CMemoryCardSys::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMain::Shutdown()
|
void CMain::Shutdown()
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
CRandom16 CDecal::sDecalRandom(99);
|
||||||
|
bool CDecal::sMoveRedToAphaBuffer = false;
|
||||||
|
|
||||||
CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf)
|
CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf)
|
||||||
: x0_description(desc),
|
: x0_description(desc),
|
||||||
|
@ -11,11 +13,25 @@ CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf
|
||||||
{
|
{
|
||||||
CGlobalRandom gr(sDecalRandom);
|
CGlobalRandom gr(sDecalRandom);
|
||||||
|
|
||||||
InitQuad(x3c_decalQuad1, x0_description.GetObj()->x0_Quad);
|
x5c_31_quad1Invalid = InitQuad(x3c_decalQuad1, x0_description.GetObj()->x0_Quad);
|
||||||
InitQuad(x48_decalQuad2, x0_description.GetObj()->x1c_Quad);
|
x5c_30_quad2Invalid = InitQuad(x48_decalQuad2, x0_description.GetObj()->x1c_Quad);
|
||||||
|
|
||||||
|
CDecalDescription* d = x0_description.GetObj();
|
||||||
|
if (d->x38_DMDL)
|
||||||
|
{
|
||||||
|
if (d->x48_DLFT)
|
||||||
|
d->x48_DLFT->GetValue(0, x54_lifetime);
|
||||||
|
else
|
||||||
|
x54_lifetime = 0x7FFFFF;
|
||||||
|
|
||||||
|
if (d->x50_DMRT)
|
||||||
|
d->x50_DMRT->GetValue(0, x60_rotation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x5c_29_modelInvalid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecal::InitQuad(CDecal::CQuadDecal& quad, const CDecalDescription::SQuadDescr& desc)
|
bool CDecal::InitQuad(CDecal::CQuadDecal& quad, const CDecalDescription::SQuadDescr& desc)
|
||||||
{
|
{
|
||||||
if (desc.x14_TEX)
|
if (desc.x14_TEX)
|
||||||
{
|
{
|
||||||
|
@ -26,18 +42,34 @@ void CDecal::InitQuad(CDecal::CQuadDecal& quad, const CDecalDescription::SQuadDe
|
||||||
if (desc.x8_ROT)
|
if (desc.x8_ROT)
|
||||||
{
|
{
|
||||||
desc.x8_ROT->GetValue(0, quad.x8_rotation);
|
desc.x8_ROT->GetValue(0, quad.x8_rotation);
|
||||||
u32 r0 = (quad._dummy >> 25) & 1;
|
quad.x0_24_invalid = desc.x8_ROT->IsConstant();
|
||||||
r0 &= desc.x8_ROT->IsConstant();
|
|
||||||
quad._dummy = (quad._dummy & ~0x80) | ((r0 << 7) & 0x80);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc.x4_SZE)
|
if (desc.x4_SZE)
|
||||||
{
|
{
|
||||||
|
quad.x0_24_invalid = desc.x4_SZE->IsConstant();
|
||||||
|
float size = 1.f;
|
||||||
|
desc.x4_SZE->GetValue(0, size);
|
||||||
|
quad.x0_24_invalid = size <= 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desc.xc_OFF)
|
||||||
|
quad.x0_24_invalid = desc.xc_OFF->IsFastConstant();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
quad.x0_24_ = false;
|
quad.x0_24_invalid = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDecal::SetGlobalSeed(u16 seed)
|
||||||
|
{
|
||||||
|
sDecalRandom.SetSeed(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDecal::SetMoveRedToAlphaBuffer(bool move)
|
||||||
|
{
|
||||||
|
sMoveRedToAphaBuffer = move;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x0_24_ : 1;
|
bool x0_24_invalid : 1;
|
||||||
};
|
};
|
||||||
u32 _dummy = 0;
|
u32 _dummy = 0;
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
: x4_lifetime(i),
|
: x4_lifetime(i),
|
||||||
x8_rotation(f)
|
x8_rotation(f)
|
||||||
{
|
{
|
||||||
x0_24_ = true;
|
x0_24_invalid = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
|
@ -39,11 +39,20 @@ private:
|
||||||
zeus::CTransform xc_transform;
|
zeus::CTransform xc_transform;
|
||||||
CQuadDecal x3c_decalQuad1;
|
CQuadDecal x3c_decalQuad1;
|
||||||
CQuadDecal x48_decalQuad2;
|
CQuadDecal x48_decalQuad2;
|
||||||
u32 x54_ = 0;
|
s32 x54_lifetime = 0;
|
||||||
u32 x58_ = 0;
|
s32 x58_frameIdx = 0;
|
||||||
u32 x5c_ = 0;
|
union
|
||||||
zeus::CVector3f x60_;
|
{
|
||||||
void InitQuad(CQuadDecal&, const CDecalDescription::SQuadDescr&);
|
struct
|
||||||
|
{
|
||||||
|
bool x5c_31_quad1Invalid : 1;
|
||||||
|
bool x5c_30_quad2Invalid : 1;
|
||||||
|
bool x5c_29_modelInvalid : 1;
|
||||||
|
};
|
||||||
|
u32 x5c_dummy = 0;
|
||||||
|
};
|
||||||
|
zeus::CVector3f x60_rotation;
|
||||||
|
bool InitQuad(CQuadDecal&, const CDecalDescription::SQuadDescr&);
|
||||||
public:
|
public:
|
||||||
CDecal(const TToken<CDecalDescription>&, const zeus::CTransform&);
|
CDecal(const TToken<CDecalDescription>&, const zeus::CTransform&);
|
||||||
bool IsDone() const;
|
bool IsDone() const;
|
||||||
|
|
|
@ -21,7 +21,7 @@ int CElementGen::g_ParticleAliveCount;
|
||||||
int CElementGen::g_ParticleSystemAliveCount;
|
int CElementGen::g_ParticleSystemAliveCount;
|
||||||
s32 CElementGen::g_FreeIndex;
|
s32 CElementGen::g_FreeIndex;
|
||||||
bool CElementGen::g_StaticListInitialized = false;
|
bool CElementGen::g_StaticListInitialized = false;
|
||||||
bool CElementGen::g_MoveRedToAlphaBuffer = false;
|
bool CElementGen::sMoveRedToAlphaBuffer = false;
|
||||||
CElementGen::CParticle* CElementGen::g_currentParticle = nullptr;
|
CElementGen::CParticle* CElementGen::g_currentParticle = nullptr;
|
||||||
static rstl::reserved_vector<CElementGen::CParticle, MAX_GLOBAL_PARTICLES> g_StaticParticleList;
|
static rstl::reserved_vector<CElementGen::CParticle, MAX_GLOBAL_PARTICLES> g_StaticParticleList;
|
||||||
static rstl::reserved_vector<u16, MAX_GLOBAL_PARTICLES> g_StaticFreeList;
|
static rstl::reserved_vector<u16, MAX_GLOBAL_PARTICLES> g_StaticFreeList;
|
||||||
|
@ -1273,7 +1273,7 @@ void CElementGen::RenderModels()
|
||||||
|
|
||||||
if (desc->x45_24_x31_26_PMUS)
|
if (desc->x45_24_x31_26_PMUS)
|
||||||
{
|
{
|
||||||
if (g_MoveRedToAlphaBuffer && desc->x44_31_x31_25_PMAB && desc->x54_x40_TEXR)
|
if (sMoveRedToAlphaBuffer && desc->x44_31_x31_25_PMAB && desc->x54_x40_TEXR)
|
||||||
moveRedToAlphaBuffer = true;
|
moveRedToAlphaBuffer = true;
|
||||||
|
|
||||||
if (desc->x44_31_x31_25_PMAB)
|
if (desc->x44_31_x31_25_PMAB)
|
||||||
|
@ -1638,7 +1638,7 @@ void CElementGen::RenderParticles()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool moveRedToAlphaBuffer = false;
|
bool moveRedToAlphaBuffer = false;
|
||||||
if (g_MoveRedToAlphaBuffer && x224_26_AAPH)
|
if (sMoveRedToAlphaBuffer && x224_26_AAPH)
|
||||||
moveRedToAlphaBuffer = true;
|
moveRedToAlphaBuffer = true;
|
||||||
|
|
||||||
if (moveRedToAlphaBuffer)
|
if (moveRedToAlphaBuffer)
|
||||||
|
@ -2321,4 +2321,9 @@ void CElementGen::Reset()
|
||||||
x225_28_warmedUp = false;
|
x225_28_warmedUp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CElementGen::SetMoveRedToAlphaBuffer(bool move)
|
||||||
|
{
|
||||||
|
sMoveRedToAlphaBuffer = move;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ public:
|
||||||
static bool g_StaticListInitialized;
|
static bool g_StaticListInitialized;
|
||||||
static int g_ParticleAliveCount;
|
static int g_ParticleAliveCount;
|
||||||
static int g_ParticleSystemAliveCount;
|
static int g_ParticleSystemAliveCount;
|
||||||
static bool g_MoveRedToAlphaBuffer;
|
static bool sMoveRedToAlphaBuffer;
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
|
@ -239,6 +239,8 @@ public:
|
||||||
bool GetParticleEmission() const;
|
bool GetParticleEmission() const;
|
||||||
void DestroyParticles();
|
void DestroyParticles();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
static void SetMoveRedToAlphaBuffer(bool);
|
||||||
};
|
};
|
||||||
ENABLE_BITWISE_ENUM(CElementGen::EOptionalSystemFlags)
|
ENABLE_BITWISE_ENUM(CElementGen::EOptionalSystemFlags)
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct SParticleModel
|
||||||
SParticleModel() = default;
|
SParticleModel() = default;
|
||||||
SParticleModel(CToken&& tok, bool found)
|
SParticleModel(CToken&& tok, bool found)
|
||||||
: m_token(std::move(tok)), m_found(found) {}
|
: m_token(std::move(tok)), m_found(found) {}
|
||||||
|
operator bool() const { return m_found; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SChildGeneratorDesc
|
struct SChildGeneratorDesc
|
||||||
|
@ -41,6 +42,7 @@ struct SChildGeneratorDesc
|
||||||
SChildGeneratorDesc() = default;
|
SChildGeneratorDesc() = default;
|
||||||
SChildGeneratorDesc(CToken&& tok, bool found)
|
SChildGeneratorDesc(CToken&& tok, bool found)
|
||||||
: m_token(std::move(tok)), m_found(found) {}
|
: m_token(std::move(tok)), m_found(found) {}
|
||||||
|
operator bool() const { return m_found; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SSwooshGeneratorDesc
|
struct SSwooshGeneratorDesc
|
||||||
|
@ -51,6 +53,7 @@ struct SSwooshGeneratorDesc
|
||||||
SSwooshGeneratorDesc() = default;
|
SSwooshGeneratorDesc() = default;
|
||||||
SSwooshGeneratorDesc(CToken&& tok, bool found)
|
SSwooshGeneratorDesc(CToken&& tok, bool found)
|
||||||
: m_token(std::move(tok)), m_found(found) {}
|
: m_token(std::move(tok)), m_found(found) {}
|
||||||
|
operator bool() const { return m_found; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SElectricGeneratorDesc
|
struct SElectricGeneratorDesc
|
||||||
|
@ -61,6 +64,7 @@ struct SElectricGeneratorDesc
|
||||||
SElectricGeneratorDesc() = default;
|
SElectricGeneratorDesc() = default;
|
||||||
SElectricGeneratorDesc(CToken&& tok, bool found)
|
SElectricGeneratorDesc(CToken&& tok, bool found)
|
||||||
: m_token(std::move(tok)), m_found(found) {}
|
: m_token(std::move(tok)), m_found(found) {}
|
||||||
|
operator bool() const { return m_found; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CParticleDataFactory
|
class CParticleDataFactory
|
||||||
|
|
Loading…
Reference in New Issue