DSPEmulator: Move common variable into base class
This commit is contained in:
parent
3c822f2c55
commit
aaa1da5abc
|
@ -15,7 +15,7 @@ public:
|
|||
virtual ~DSPEmulator() {}
|
||||
virtual bool IsLLE() = 0;
|
||||
|
||||
virtual bool Initialize(bool bWii, bool bDSPThread) = 0;
|
||||
virtual bool Initialize(bool wii, bool dsp_thread) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual void DoState(PointerWrap& p) = 0;
|
||||
|
@ -30,6 +30,9 @@ public:
|
|||
virtual void DSP_Update(int cycles) = 0;
|
||||
virtual void DSP_StopSoundStream() = 0;
|
||||
virtual u32 DSP_UpdateRate() = 0;
|
||||
|
||||
protected:
|
||||
bool m_wii = false;
|
||||
};
|
||||
|
||||
std::unique_ptr<DSPEmulator> CreateDSPEmulator(bool hle);
|
||||
|
|
|
@ -16,9 +16,9 @@ DSPHLE::DSPHLE()
|
|||
{
|
||||
}
|
||||
|
||||
bool DSPHLE::Initialize(bool bWii, bool bDSPThread)
|
||||
bool DSPHLE::Initialize(bool wii, bool dsp_thread)
|
||||
{
|
||||
m_bWii = bWii;
|
||||
m_wii = wii;
|
||||
m_pUCode = nullptr;
|
||||
m_lastUCode = nullptr;
|
||||
m_bHalt = false;
|
||||
|
@ -76,7 +76,7 @@ void DSPHLE::SetUCode(u32 _crc)
|
|||
|
||||
m_pUCode = nullptr;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, this, m_bWii);
|
||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
||||
}
|
||||
|
||||
// TODO do it better?
|
||||
|
@ -89,7 +89,7 @@ void DSPHLE::SwapUCode(u32 _crc)
|
|||
if (m_lastUCode == nullptr)
|
||||
{
|
||||
m_lastUCode = m_pUCode;
|
||||
m_pUCode = UCodeFactory(_crc, this, m_bWii);
|
||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -125,10 +125,10 @@ void DSPHLE::DoState(PointerWrap& p)
|
|||
// if a different type of ucode was being used when the savestate was created,
|
||||
// we have to reconstruct the old type of ucode so that we have a valid thing to call DoState on.
|
||||
UCodeInterface* ucode =
|
||||
(ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory(ucode_crc, this, m_bWii);
|
||||
(ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory(ucode_crc, this, m_wii);
|
||||
UCodeInterface* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ?
|
||||
m_lastUCode :
|
||||
UCodeFactory(lastucode_crc, this, m_bWii);
|
||||
UCodeFactory(lastucode_crc, this, m_wii);
|
||||
|
||||
if (ucode)
|
||||
ucode->DoState(p);
|
||||
|
|
|
@ -17,7 +17,7 @@ class DSPHLE : public DSPEmulator
|
|||
public:
|
||||
DSPHLE();
|
||||
|
||||
bool Initialize(bool bWii, bool bDSPThread) override;
|
||||
bool Initialize(bool wii, bool dsp_thread) override;
|
||||
void Shutdown() override;
|
||||
bool IsLLE() override { return false; }
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
@ -42,9 +42,6 @@ public:
|
|||
private:
|
||||
void SendMailToDSP(u32 _uMail);
|
||||
|
||||
// Declarations and definitions
|
||||
bool m_bWii;
|
||||
|
||||
// Fake mailbox utility
|
||||
struct DSPState
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "Core/NetPlayProto.h"
|
||||
|
||||
DSPLLE::DSPLLE()
|
||||
: m_hDSPThread(), m_csDSPThreadActive(), m_bWii(false), m_bDSPThread(false),
|
||||
m_bIsRunning(false), m_cycle_count(0)
|
||||
: m_hDSPThread(), m_csDSPThreadActive(), m_bDSPThread(false), m_bIsRunning(false),
|
||||
m_cycle_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ static bool FillDSPInitOptions(DSPInitOptions* opts)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
|
||||
bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||
{
|
||||
requestDisableThread = false;
|
||||
|
||||
|
@ -167,10 +167,10 @@ bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
|
|||
|
||||
// needs to be after DSPCore_Init for the dspjit ptr
|
||||
if (Core::g_want_determinism || !g_dsp_jit)
|
||||
bDSPThread = false;
|
||||
dsp_thread = false;
|
||||
|
||||
m_bWii = bWii;
|
||||
m_bDSPThread = bDSPThread;
|
||||
m_wii = wii;
|
||||
m_bDSPThread = dsp_thread;
|
||||
|
||||
// DSPLLE directly accesses the fastmem arena.
|
||||
// TODO: The fastmem arena is only supposed to be used by the JIT:
|
||||
|
@ -180,7 +180,7 @@ bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
|
|||
|
||||
InitInstructionTable();
|
||||
|
||||
if (bDSPThread)
|
||||
if (dsp_thread)
|
||||
{
|
||||
m_bIsRunning.Set(true);
|
||||
m_hDSPThread = std::thread(DSPThread, this);
|
||||
|
|
|
@ -18,7 +18,7 @@ class DSPLLE : public DSPEmulator
|
|||
public:
|
||||
DSPLLE();
|
||||
|
||||
bool Initialize(bool bWii, bool bDSPThread) override;
|
||||
bool Initialize(bool wii, bool dsp_thread) override;
|
||||
void Shutdown() override;
|
||||
bool IsLLE() override { return true; }
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
@ -39,7 +39,6 @@ private:
|
|||
|
||||
std::thread m_hDSPThread;
|
||||
std::mutex m_csDSPThreadActive;
|
||||
bool m_bWii;
|
||||
bool m_bDSPThread;
|
||||
Common::Flag m_bIsRunning;
|
||||
std::atomic<u32> m_cycle_count;
|
||||
|
|
Loading…
Reference in New Issue