Merge pull request #4565 from degasus/DSPHLE

DSPHLE: Seperate HLE construction and initialization.
This commit is contained in:
flacs 2016-12-26 15:21:42 +01:00 committed by GitHub
commit d07d9ba499
14 changed files with 46 additions and 14 deletions

View File

@ -77,6 +77,7 @@ void DSPHLE::SetUCode(u32 _crc)
m_pUCode = nullptr; m_pUCode = nullptr;
m_MailHandler.Clear(); m_MailHandler.Clear();
m_pUCode = UCodeFactory(_crc, this, m_wii); m_pUCode = UCodeFactory(_crc, this, m_wii);
m_pUCode->Initialize();
} }
// TODO do it better? // TODO do it better?
@ -90,6 +91,7 @@ void DSPHLE::SwapUCode(u32 _crc)
{ {
m_lastUCode = m_pUCode; m_lastUCode = m_pUCode;
m_pUCode = UCodeFactory(_crc, this, m_wii); m_pUCode = UCodeFactory(_crc, this, m_wii);
m_pUCode->Initialize();
} }
else else
{ {

View File

@ -18,10 +18,6 @@
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc), m_cmdlist_size(0) AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc), m_cmdlist_size(0)
{ {
INFO_LOG(DSPHLE, "Instantiating AXUCode: crc=%08x", crc); INFO_LOG(DSPHLE, "Instantiating AXUCode: crc=%08x", crc);
m_mail_handler.PushMail(DSP_INIT);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
LoadResamplingCoefficients();
} }
AXUCode::~AXUCode() AXUCode::~AXUCode()
@ -29,6 +25,14 @@ AXUCode::~AXUCode()
m_mail_handler.Clear(); m_mail_handler.Clear();
} }
void AXUCode::Initialize()
{
m_mail_handler.PushMail(DSP_INIT);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
LoadResamplingCoefficients();
}
void AXUCode::LoadResamplingCoefficients() void AXUCode::LoadResamplingCoefficients()
{ {
m_coeffs_available = false; m_coeffs_available = false;

View File

@ -55,6 +55,7 @@ public:
AXUCode(DSPHLE* dsphle, u32 crc); AXUCode(DSPHLE* dsphle, u32 crc);
virtual ~AXUCode(); virtual ~AXUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;

View File

@ -12,7 +12,6 @@
CARDUCode::CARDUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc) CARDUCode::CARDUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
{ {
INFO_LOG(DSPHLE, "CARDUCode - initialized"); INFO_LOG(DSPHLE, "CARDUCode - initialized");
m_mail_handler.PushMail(DSP_INIT);
} }
CARDUCode::~CARDUCode() CARDUCode::~CARDUCode()
@ -20,6 +19,11 @@ CARDUCode::~CARDUCode()
m_mail_handler.Clear(); m_mail_handler.Clear();
} }
void CARDUCode::Initialize()
{
m_mail_handler.PushMail(DSP_INIT);
}
void CARDUCode::Update() void CARDUCode::Update()
{ {
// check if we have to sent something // check if we have to sent something

View File

@ -12,6 +12,7 @@ public:
CARDUCode(DSPHLE* dsphle, u32 crc); CARDUCode(DSPHLE* dsphle, u32 crc);
virtual ~CARDUCode(); virtual ~CARDUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;
}; };

View File

@ -84,7 +84,6 @@ void ProcessGBACrypto(u32 address)
GBAUCode::GBAUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc) GBAUCode::GBAUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
{ {
m_mail_handler.PushMail(DSP_INIT);
} }
GBAUCode::~GBAUCode() GBAUCode::~GBAUCode()
@ -92,6 +91,11 @@ GBAUCode::~GBAUCode()
m_mail_handler.Clear(); m_mail_handler.Clear();
} }
void GBAUCode::Initialize()
{
m_mail_handler.PushMail(DSP_INIT);
}
void GBAUCode::Update() void GBAUCode::Update()
{ {
// check if we have to send something // check if we have to send something

View File

@ -16,6 +16,7 @@ struct GBAUCode : public UCodeInterface
GBAUCode(DSPHLE* dsphle, u32 crc); GBAUCode(DSPHLE* dsphle, u32 crc);
virtual ~GBAUCode(); virtual ~GBAUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;
}; };

View File

@ -10,13 +10,17 @@
INITUCode::INITUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc) INITUCode::INITUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
{ {
INFO_LOG(DSPHLE, "INITUCode - initialized"); INFO_LOG(DSPHLE, "INITUCode - initialized");
m_mail_handler.PushMail(0x80544348);
} }
INITUCode::~INITUCode() INITUCode::~INITUCode()
{ {
} }
void INITUCode::Initialize()
{
m_mail_handler.PushMail(0x80544348);
}
void INITUCode::Init() void INITUCode::Init()
{ {
} }

View File

@ -12,6 +12,7 @@ public:
INITUCode(DSPHLE* dsphle, u32 crc); INITUCode(DSPHLE* dsphle, u32 crc);
virtual ~INITUCode(); virtual ~INITUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;
void Init(); void Init();

View File

@ -22,14 +22,18 @@ ROMUCode::ROMUCode(DSPHLE* dsphle, u32 crc)
: UCodeInterface(dsphle, crc), m_current_ucode(), m_boot_task_num_steps(0), m_next_parameter(0) : UCodeInterface(dsphle, crc), m_current_ucode(), m_boot_task_num_steps(0), m_next_parameter(0)
{ {
INFO_LOG(DSPHLE, "UCode_Rom - initialized"); INFO_LOG(DSPHLE, "UCode_Rom - initialized");
m_mail_handler.Clear();
m_mail_handler.PushMail(0x8071FEED);
} }
ROMUCode::~ROMUCode() ROMUCode::~ROMUCode()
{ {
} }
void ROMUCode::Initialize()
{
m_mail_handler.Clear();
m_mail_handler.PushMail(0x8071FEED);
}
void ROMUCode::Update() void ROMUCode::Update()
{ {
} }

View File

@ -12,6 +12,7 @@ public:
ROMUCode(DSPHLE* dsphle, u32 crc); ROMUCode(DSPHLE* dsphle, u32 crc);
virtual ~ROMUCode(); virtual ~ROMUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;

View File

@ -73,6 +73,7 @@ public:
} }
virtual ~UCodeInterface() {} virtual ~UCodeInterface() {}
virtual void Initialize() = 0;
virtual void HandleMail(u32 mail) = 0; virtual void HandleMail(u32 mail) = 0;
virtual void Update() = 0; virtual void Update() = 0;

View File

@ -118,7 +118,15 @@ ZeldaUCode::ZeldaUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
m_renderer.SetFlags(m_flags); m_renderer.SetFlags(m_flags);
INFO_LOG(DSPHLE, "Zelda UCode loaded, crc=%08x, flags=%08x", crc, m_flags); INFO_LOG(DSPHLE, "Zelda UCode loaded, crc=%08x, flags=%08x", crc, m_flags);
}
ZeldaUCode::~ZeldaUCode()
{
m_mail_handler.Clear();
}
void ZeldaUCode::Initialize()
{
if (m_flags & LIGHT_PROTOCOL) if (m_flags & LIGHT_PROTOCOL)
{ {
m_mail_handler.PushMail(0x88881111); m_mail_handler.PushMail(0x88881111);
@ -130,11 +138,6 @@ ZeldaUCode::ZeldaUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
} }
} }
ZeldaUCode::~ZeldaUCode()
{
m_mail_handler.Clear();
}
void ZeldaUCode::Update() void ZeldaUCode::Update()
{ {
if (NeedsResumeMail()) if (NeedsResumeMail())

View File

@ -188,6 +188,7 @@ public:
ZeldaUCode(DSPHLE* dsphle, u32 crc); ZeldaUCode(DSPHLE* dsphle, u32 crc);
virtual ~ZeldaUCode(); virtual ~ZeldaUCode();
void Initialize() override;
void HandleMail(u32 mail) override; void HandleMail(u32 mail) override;
void Update() override; void Update() override;