Core/DSPHLE: Construct accelerator in AX and AXWii constructors.

This fixes an issue introduced by 3b0444be6b
where the m_accelerator would not be initialized when loading a savestate if
the current UCode mismatched the UCode in the savestate, leading to a crash.
This commit is contained in:
Admiral H. Curtiss 2024-02-12 04:12:44 +01:00
parent aa66842172
commit f0d363eea7
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 16 additions and 8 deletions

View File

@ -27,9 +27,15 @@
namespace DSP::HLE
{
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc, bool dummy) : UCodeInterface(dsphle, crc)
{
}
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : AXUCode(dsphle, crc, false)
{
INFO_LOG_FMT(DSPHLE, "Instantiating AXUCode: crc={:08x}", crc);
m_accelerator = std::make_unique<HLEAccelerator>(dsphle->GetSystem().GetDSP());
}
AXUCode::~AXUCode() = default;
@ -37,8 +43,6 @@ AXUCode::~AXUCode() = default;
void AXUCode::Initialize()
{
InitializeShared();
m_accelerator = std::make_unique<HLEAccelerator>(m_dsphle->GetSystem().GetDSP());
}
void AXUCode::InitializeShared()

View File

@ -110,6 +110,9 @@ protected:
std::unique_ptr<Accelerator> m_accelerator;
// Constructs without any GC-specific state, so it can be used by the deriving AXWii.
AXUCode(DSPHLE* dsphle, u32 crc, bool dummy);
void InitializeShared();
bool LoadResamplingCoefficients(bool require_same_checksum, u32 desired_checksum);

View File

@ -20,21 +20,22 @@
namespace DSP::HLE
{
AXWiiUCode::AXWiiUCode(DSPHLE* dsphle, u32 crc) : AXUCode(dsphle, crc), m_last_main_volume(0x8000)
AXWiiUCode::AXWiiUCode(DSPHLE* dsphle, u32 crc)
: AXUCode(dsphle, crc, false), m_last_main_volume(0x8000)
{
INFO_LOG_FMT(DSPHLE, "Instantiating AXWiiUCode: crc={:08x}", crc);
for (u16& volume : m_last_aux_volumes)
volume = 0x8000;
INFO_LOG_FMT(DSPHLE, "Instantiating AXWiiUCode");
m_old_axwii = (crc == 0xfa450138) || (crc == 0x7699af32);
m_accelerator = std::make_unique<HLEAccelerator>(dsphle->GetSystem().GetDSP());
}
void AXWiiUCode::Initialize()
{
InitializeShared();
m_accelerator = std::make_unique<HLEAccelerator>(m_dsphle->GetSystem().GetDSP());
}
void AXWiiUCode::HandleCommandList()