mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #4684 from lioncash/dsp-emu
DSPEmulator: Amend variable casing
This commit is contained in:
commit
f94bd7d865
@ -19,14 +19,14 @@ public:
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual void DoState(PointerWrap& p) = 0;
|
||||
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) = 0;
|
||||
virtual void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) = 0;
|
||||
|
||||
virtual void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short) = 0;
|
||||
virtual void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) = 0;
|
||||
virtual unsigned short DSP_ReadMailBoxHigh(bool _CPUMailbox) = 0;
|
||||
virtual unsigned short DSP_ReadMailBoxLow(bool _CPUMailbox) = 0;
|
||||
virtual unsigned short DSP_ReadControlRegister() = 0;
|
||||
virtual unsigned short DSP_WriteControlRegister(unsigned short) = 0;
|
||||
virtual void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) = 0;
|
||||
virtual void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) = 0;
|
||||
virtual u16 DSP_ReadMailBoxHigh(bool cpu_mailbox) = 0;
|
||||
virtual u16 DSP_ReadMailBoxLow(bool cpu_mailbox) = 0;
|
||||
virtual u16 DSP_ReadControlRegister() = 0;
|
||||
virtual u16 DSP_WriteControlRegister(u16 value) = 0;
|
||||
virtual void DSP_Update(int cycles) = 0;
|
||||
virtual void DSP_StopSoundStream() = 0;
|
||||
virtual u32 DSP_UpdateRate() = 0;
|
||||
|
@ -23,16 +23,16 @@ DSPHLE::DSPHLE()
|
||||
bool DSPHLE::Initialize(bool wii, bool dsp_thread)
|
||||
{
|
||||
m_wii = wii;
|
||||
m_pUCode = nullptr;
|
||||
m_lastUCode = nullptr;
|
||||
m_bHalt = false;
|
||||
m_bAssertInt = false;
|
||||
m_ucode = nullptr;
|
||||
m_last_ucode = nullptr;
|
||||
m_halt = false;
|
||||
m_assert_interrupt = false;
|
||||
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
m_dsp_control.DSPHalt = 1;
|
||||
m_dsp_control.DSPInit = 1;
|
||||
|
||||
m_dspState.Reset();
|
||||
m_dsp_state.Reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -43,14 +43,14 @@ void DSPHLE::DSP_StopSoundStream()
|
||||
|
||||
void DSPHLE::Shutdown()
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = nullptr;
|
||||
delete m_ucode;
|
||||
m_ucode = nullptr;
|
||||
}
|
||||
|
||||
void DSPHLE::DSP_Update(int cycles)
|
||||
{
|
||||
if (m_pUCode != nullptr)
|
||||
m_pUCode->Update();
|
||||
if (m_ucode != nullptr)
|
||||
m_ucode->Update();
|
||||
}
|
||||
|
||||
u32 DSPHLE::DSP_UpdateRate()
|
||||
@ -60,56 +60,56 @@ u32 DSPHLE::DSP_UpdateRate()
|
||||
return SystemTimers::GetTicksPerSecond() / 1000;
|
||||
}
|
||||
|
||||
void DSPHLE::SendMailToDSP(u32 _uMail)
|
||||
void DSPHLE::SendMailToDSP(u32 mail)
|
||||
{
|
||||
if (m_pUCode != nullptr)
|
||||
if (m_ucode != nullptr)
|
||||
{
|
||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", mail);
|
||||
m_ucode->HandleMail(mail);
|
||||
}
|
||||
}
|
||||
|
||||
UCodeInterface* DSPHLE::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
return m_ucode;
|
||||
}
|
||||
|
||||
void DSPHLE::SetUCode(u32 _crc)
|
||||
void DSPHLE::SetUCode(u32 crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
delete m_ucode;
|
||||
|
||||
m_pUCode = nullptr;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
||||
m_pUCode->Initialize();
|
||||
m_ucode = nullptr;
|
||||
m_mail_handler.Clear();
|
||||
m_ucode = UCodeFactory(crc, this, m_wii);
|
||||
m_ucode->Initialize();
|
||||
}
|
||||
|
||||
// TODO do it better?
|
||||
// Assumes that every odd call to this func is by the persistent ucode.
|
||||
// Even callers are deleted.
|
||||
void DSPHLE::SwapUCode(u32 _crc)
|
||||
void DSPHLE::SwapUCode(u32 crc)
|
||||
{
|
||||
m_MailHandler.Clear();
|
||||
m_mail_handler.Clear();
|
||||
|
||||
if (m_lastUCode == nullptr)
|
||||
if (m_last_ucode == nullptr)
|
||||
{
|
||||
m_lastUCode = m_pUCode;
|
||||
m_pUCode = UCodeFactory(_crc, this, m_wii);
|
||||
m_pUCode->Initialize();
|
||||
m_last_ucode = m_ucode;
|
||||
m_ucode = UCodeFactory(crc, this, m_wii);
|
||||
m_ucode->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = m_lastUCode;
|
||||
m_lastUCode = nullptr;
|
||||
delete m_ucode;
|
||||
m_ucode = m_last_ucode;
|
||||
m_last_ucode = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPHLE::DoState(PointerWrap& p)
|
||||
{
|
||||
bool isHLE = true;
|
||||
p.Do(isHLE);
|
||||
if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ)
|
||||
bool is_hle = true;
|
||||
p.Do(is_hle);
|
||||
if (!is_hle && p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.",
|
||||
3000);
|
||||
@ -117,33 +117,33 @@ void DSPHLE::DoState(PointerWrap& p)
|
||||
return;
|
||||
}
|
||||
|
||||
p.DoPOD(m_DSPControl);
|
||||
p.DoPOD(m_dspState);
|
||||
p.DoPOD(m_dsp_control);
|
||||
p.DoPOD(m_dsp_state);
|
||||
|
||||
int ucode_crc = UCodeInterface::GetCRC(m_pUCode);
|
||||
int ucode_crc = UCodeInterface::GetCRC(m_ucode);
|
||||
int ucode_crc_beforeLoad = ucode_crc;
|
||||
int lastucode_crc = UCodeInterface::GetCRC(m_lastUCode);
|
||||
int lastucode_crc_beforeLoad = lastucode_crc;
|
||||
int last_ucode_crc = UCodeInterface::GetCRC(m_last_ucode);
|
||||
int last_ucode_crc_before_load = last_ucode_crc;
|
||||
|
||||
p.Do(ucode_crc);
|
||||
p.Do(lastucode_crc);
|
||||
p.Do(last_ucode_crc);
|
||||
|
||||
// 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_wii);
|
||||
UCodeInterface* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ?
|
||||
m_lastUCode :
|
||||
UCodeFactory(lastucode_crc, this, m_wii);
|
||||
(ucode_crc == ucode_crc_beforeLoad) ? m_ucode : UCodeFactory(ucode_crc, this, m_wii);
|
||||
UCodeInterface* last_ucode = (last_ucode_crc != last_ucode_crc_before_load) ?
|
||||
m_last_ucode :
|
||||
UCodeFactory(last_ucode_crc, this, m_wii);
|
||||
|
||||
if (ucode)
|
||||
ucode->DoState(p);
|
||||
if (lastucode)
|
||||
lastucode->DoState(p);
|
||||
if (last_ucode)
|
||||
last_ucode->DoState(p);
|
||||
|
||||
// if a different type of ucode was being used when the savestate was created,
|
||||
// discard it if we're not loading, otherwise discard the old one and keep the new one.
|
||||
if (ucode != m_pUCode)
|
||||
if (ucode != m_ucode)
|
||||
{
|
||||
if (p.GetMode() != PointerWrap::MODE_READ)
|
||||
{
|
||||
@ -151,32 +151,32 @@ void DSPHLE::DoState(PointerWrap& p)
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = ucode;
|
||||
delete m_ucode;
|
||||
m_ucode = ucode;
|
||||
}
|
||||
}
|
||||
if (lastucode != m_lastUCode)
|
||||
if (last_ucode != m_last_ucode)
|
||||
{
|
||||
if (p.GetMode() != PointerWrap::MODE_READ)
|
||||
{
|
||||
delete lastucode;
|
||||
delete last_ucode;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_lastUCode;
|
||||
m_lastUCode = lastucode;
|
||||
delete m_last_ucode;
|
||||
m_last_ucode = last_ucode;
|
||||
}
|
||||
}
|
||||
|
||||
m_MailHandler.DoState(p);
|
||||
m_mail_handler.DoState(p);
|
||||
}
|
||||
|
||||
// Mailbox functions
|
||||
unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
||||
u16 DSPHLE::DSP_ReadMailBoxHigh(bool cpu_mailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
return (m_dspState.CPUMailbox >> 16) & 0xFFFF;
|
||||
return (m_dsp_state.cpu_mailbox >> 16) & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -184,11 +184,11 @@ unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
||||
u16 DSPHLE::DSP_ReadMailBoxLow(bool cpu_mailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
return m_dspState.CPUMailbox & 0xFFFF;
|
||||
return m_dsp_state.cpu_mailbox & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -196,60 +196,60 @@ unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
||||
}
|
||||
}
|
||||
|
||||
void DSPHLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short _Value)
|
||||
void DSPHLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
||||
m_dsp_state.cpu_mailbox = (m_dsp_state.cpu_mailbox & 0xFFFF) | (value << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
||||
}
|
||||
}
|
||||
|
||||
void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
|
||||
void DSPHLE::DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
||||
SendMailToDSP(m_dspState.CPUMailbox);
|
||||
m_dsp_state.cpu_mailbox = (m_dsp_state.cpu_mailbox & 0xFFFF0000) | value;
|
||||
SendMailToDSP(m_dsp_state.cpu_mailbox);
|
||||
// Mail sent so clear MSB to show that it is progressed
|
||||
m_dspState.CPUMailbox &= 0x7FFFFFFF;
|
||||
m_dsp_state.cpu_mailbox &= 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
||||
}
|
||||
}
|
||||
|
||||
// Other DSP functions
|
||||
u16 DSPHLE::DSP_WriteControlRegister(unsigned short _Value)
|
||||
u16 DSPHLE::DSP_WriteControlRegister(u16 value)
|
||||
{
|
||||
DSP::UDSPControl Temp(_Value);
|
||||
DSP::UDSPControl temp(value);
|
||||
|
||||
if (Temp.DSPReset)
|
||||
if (temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
temp.DSPReset = 0;
|
||||
}
|
||||
if (Temp.DSPInit == 0)
|
||||
if (temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
temp.DSPInitCode = 0;
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
return m_DSPControl.Hex;
|
||||
m_dsp_control.Hex = temp.Hex;
|
||||
return m_dsp_control.Hex;
|
||||
}
|
||||
|
||||
u16 DSPHLE::DSP_ReadControlRegister()
|
||||
{
|
||||
return m_DSPControl.Hex;
|
||||
return m_dsp_control.Hex;
|
||||
}
|
||||
|
||||
void DSPHLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
void DSPHLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
|
||||
{
|
||||
}
|
||||
} // namespace HLE
|
||||
|
@ -26,51 +26,51 @@ public:
|
||||
void Shutdown() override;
|
||||
bool IsLLE() override { return false; }
|
||||
void DoState(PointerWrap& p) override;
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
|
||||
void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) override;
|
||||
|
||||
void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short) override;
|
||||
void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) override;
|
||||
unsigned short DSP_ReadMailBoxHigh(bool _CPUMailbox) override;
|
||||
unsigned short DSP_ReadMailBoxLow(bool _CPUMailbox) override;
|
||||
unsigned short DSP_ReadControlRegister() override;
|
||||
unsigned short DSP_WriteControlRegister(unsigned short) override;
|
||||
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
|
||||
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;
|
||||
u16 DSP_ReadMailBoxHigh(bool cpu_mailbox) override;
|
||||
u16 DSP_ReadMailBoxLow(bool cpu_mailbox) override;
|
||||
u16 DSP_ReadControlRegister() override;
|
||||
u16 DSP_WriteControlRegister(u16 value) override;
|
||||
void DSP_Update(int cycles) override;
|
||||
void DSP_StopSoundStream() override;
|
||||
u32 DSP_UpdateRate() override;
|
||||
|
||||
CMailHandler& AccessMailHandler() { return m_MailHandler; }
|
||||
CMailHandler& AccessMailHandler() { return m_mail_handler; }
|
||||
// Formerly DSPHandler
|
||||
UCodeInterface* GetUCode();
|
||||
void SetUCode(u32 _crc);
|
||||
void SwapUCode(u32 _crc);
|
||||
void SetUCode(u32 crc);
|
||||
void SwapUCode(u32 crc);
|
||||
|
||||
private:
|
||||
void SendMailToDSP(u32 _uMail);
|
||||
void SendMailToDSP(u32 mail);
|
||||
|
||||
// Fake mailbox utility
|
||||
struct DSPState
|
||||
{
|
||||
u32 CPUMailbox;
|
||||
u32 DSPMailbox;
|
||||
u32 cpu_mailbox;
|
||||
u32 dsp_mailbox;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
CPUMailbox = 0x00000000;
|
||||
DSPMailbox = 0x00000000;
|
||||
cpu_mailbox = 0x00000000;
|
||||
dsp_mailbox = 0x00000000;
|
||||
}
|
||||
|
||||
DSPState() { Reset(); }
|
||||
};
|
||||
DSPState m_dspState;
|
||||
DSPState m_dsp_state;
|
||||
|
||||
UCodeInterface* m_pUCode;
|
||||
UCodeInterface* m_lastUCode;
|
||||
UCodeInterface* m_ucode;
|
||||
UCodeInterface* m_last_ucode;
|
||||
|
||||
DSP::UDSPControl m_DSPControl;
|
||||
CMailHandler m_MailHandler;
|
||||
DSP::UDSPControl m_dsp_control;
|
||||
CMailHandler m_mail_handler;
|
||||
|
||||
bool m_bHalt;
|
||||
bool m_bAssertInt;
|
||||
bool m_halt;
|
||||
bool m_assert_interrupt;
|
||||
};
|
||||
} // namespace HLE
|
||||
} // namespace DSP
|
||||
|
@ -31,9 +31,9 @@ namespace DSP
|
||||
{
|
||||
namespace LLE
|
||||
{
|
||||
static Common::Event dspEvent;
|
||||
static Common::Event ppcEvent;
|
||||
static bool requestDisableThread;
|
||||
static Common::Event s_dsp_event;
|
||||
static Common::Event s_ppc_event;
|
||||
static bool s_request_disable_thread;
|
||||
|
||||
DSPLLE::DSPLLE() = default;
|
||||
|
||||
@ -83,12 +83,12 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
|
||||
{
|
||||
Common::SetCurrentThreadName("DSP thread");
|
||||
|
||||
while (dsp_lle->m_bIsRunning.IsSet())
|
||||
while (dsp_lle->m_is_running.IsSet())
|
||||
{
|
||||
const int cycles = static_cast<int>(dsp_lle->m_cycle_count.load());
|
||||
if (cycles > 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> dsp_thread_lock(dsp_lle->m_csDSPThreadActive);
|
||||
std::lock_guard<std::mutex> dsp_thread_lock(dsp_lle->m_dsp_thread_mutex);
|
||||
if (g_dsp_jit)
|
||||
{
|
||||
DSPCore_RunCycles(cycles);
|
||||
@ -101,8 +101,8 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
|
||||
}
|
||||
else
|
||||
{
|
||||
ppcEvent.Set();
|
||||
dspEvent.Wait();
|
||||
s_ppc_event.Set();
|
||||
s_dsp_event.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ static bool FillDSPInitOptions(DSPInitOptions* opts)
|
||||
|
||||
bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||
{
|
||||
requestDisableThread = false;
|
||||
s_request_disable_thread = false;
|
||||
|
||||
DSPInitOptions opts;
|
||||
if (!FillDSPInitOptions(&opts))
|
||||
@ -169,7 +169,7 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||
dsp_thread = false;
|
||||
|
||||
m_wii = wii;
|
||||
m_bDSPThread = dsp_thread;
|
||||
m_is_dsp_on_thread = dsp_thread;
|
||||
|
||||
// DSPLLE directly accesses the fastmem arena.
|
||||
// TODO: The fastmem arena is only supposed to be used by the JIT:
|
||||
@ -181,8 +181,8 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||
|
||||
if (dsp_thread)
|
||||
{
|
||||
m_bIsRunning.Set(true);
|
||||
m_hDSPThread = std::thread(DSPThread, this);
|
||||
m_is_running.Set(true);
|
||||
m_dsp_thread = std::thread(DSPThread, this);
|
||||
}
|
||||
|
||||
Host_RefreshDSPDebuggerWindow();
|
||||
@ -191,12 +191,12 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||
|
||||
void DSPLLE::DSP_StopSoundStream()
|
||||
{
|
||||
if (m_bDSPThread)
|
||||
if (m_is_dsp_on_thread)
|
||||
{
|
||||
m_bIsRunning.Clear();
|
||||
ppcEvent.Set();
|
||||
dspEvent.Set();
|
||||
m_hDSPThread.join();
|
||||
m_is_running.Clear();
|
||||
s_ppc_event.Set();
|
||||
s_dsp_event.Set();
|
||||
m_dsp_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,13 +205,13 @@ void DSPLLE::Shutdown()
|
||||
DSPCore_Shutdown();
|
||||
}
|
||||
|
||||
u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag)
|
||||
u16 DSPLLE::DSP_WriteControlRegister(u16 value)
|
||||
{
|
||||
DSP::Interpreter::WriteCR(_uFlag);
|
||||
DSP::Interpreter::WriteCR(value);
|
||||
|
||||
if (_uFlag & 2)
|
||||
if (value & 2)
|
||||
{
|
||||
if (!m_bDSPThread)
|
||||
if (!m_is_dsp_on_thread)
|
||||
{
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
DSPCore_CheckExceptions();
|
||||
@ -220,7 +220,7 @@ u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag)
|
||||
{
|
||||
// External interrupt pending: this is the zelda ucode.
|
||||
// Disable the DSP thread because there is no performance gain.
|
||||
requestDisableThread = true;
|
||||
s_request_disable_thread = true;
|
||||
|
||||
DSPCore_SetExternalInterrupt(true);
|
||||
}
|
||||
@ -234,19 +234,19 @@ u16 DSPLLE::DSP_ReadControlRegister()
|
||||
return DSP::Interpreter::ReadCR();
|
||||
}
|
||||
|
||||
u16 DSPLLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
|
||||
u16 DSPLLE::DSP_ReadMailBoxHigh(bool cpu_mailbox)
|
||||
{
|
||||
return gdsp_mbox_read_h(_CPUMailbox ? MAILBOX_CPU : MAILBOX_DSP);
|
||||
return gdsp_mbox_read_h(cpu_mailbox ? MAILBOX_CPU : MAILBOX_DSP);
|
||||
}
|
||||
|
||||
u16 DSPLLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
|
||||
u16 DSPLLE::DSP_ReadMailBoxLow(bool cpu_mailbox)
|
||||
{
|
||||
return gdsp_mbox_read_l(_CPUMailbox ? MAILBOX_CPU : MAILBOX_DSP);
|
||||
return gdsp_mbox_read_l(cpu_mailbox ? MAILBOX_CPU : MAILBOX_DSP);
|
||||
}
|
||||
|
||||
void DSPLLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, u16 _uHighMail)
|
||||
void DSPLLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
if (gdsp_mbox_peek(MAILBOX_CPU) & 0x80000000)
|
||||
{
|
||||
@ -254,13 +254,13 @@ void DSPLLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, u16 _uHighMail)
|
||||
}
|
||||
|
||||
#if PROFILE
|
||||
if ((_uHighMail) == 0xBABE)
|
||||
if (value == 0xBABE)
|
||||
{
|
||||
ProfilerStart();
|
||||
}
|
||||
#endif
|
||||
|
||||
gdsp_mbox_write_h(MAILBOX_CPU, _uHighMail);
|
||||
gdsp_mbox_write_h(MAILBOX_CPU, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -268,11 +268,11 @@ void DSPLLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, u16 _uHighMail)
|
||||
}
|
||||
}
|
||||
|
||||
void DSPLLE::DSP_WriteMailBoxLow(bool _CPUMailbox, u16 _uLowMail)
|
||||
void DSPLLE::DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
if (cpu_mailbox)
|
||||
{
|
||||
gdsp_mbox_write_l(MAILBOX_CPU, _uLowMail);
|
||||
gdsp_mbox_write_l(MAILBOX_CPU, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -305,19 +305,19 @@ void DSPLLE::DSP_Update(int cycles)
|
||||
soundStream->Update();
|
||||
}
|
||||
*/
|
||||
if (m_bDSPThread)
|
||||
if (m_is_dsp_on_thread)
|
||||
{
|
||||
if (requestDisableThread || Core::g_want_determinism)
|
||||
if (s_request_disable_thread || Core::g_want_determinism)
|
||||
{
|
||||
DSP_StopSoundStream();
|
||||
m_bDSPThread = false;
|
||||
requestDisableThread = false;
|
||||
m_is_dsp_on_thread = false;
|
||||
s_request_disable_thread = false;
|
||||
SConfig::GetInstance().bDSPThread = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're not on a thread, run cycles here.
|
||||
if (!m_bDSPThread)
|
||||
if (!m_is_dsp_on_thread)
|
||||
{
|
||||
// ~1/6th as many cycles as the period PPC-side.
|
||||
DSPCore_RunCycles(dsp_cycles);
|
||||
@ -325,9 +325,9 @@ void DSPLLE::DSP_Update(int cycles)
|
||||
else
|
||||
{
|
||||
// Wait for DSP thread to complete its cycle. Note: this logic should be thought through.
|
||||
ppcEvent.Wait();
|
||||
s_ppc_event.Wait();
|
||||
m_cycle_count.fetch_add(dsp_cycles);
|
||||
dspEvent.Set();
|
||||
s_dsp_event.Set();
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,12 +336,12 @@ u32 DSPLLE::DSP_UpdateRate()
|
||||
return 12600; // TO BE TWEAKED
|
||||
}
|
||||
|
||||
void DSPLLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
void DSPLLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
|
||||
{
|
||||
if (doLock)
|
||||
m_csDSPThreadActive.lock();
|
||||
if (do_lock)
|
||||
m_dsp_thread_mutex.lock();
|
||||
else
|
||||
m_csDSPThreadActive.unlock();
|
||||
m_dsp_thread_mutex.unlock();
|
||||
}
|
||||
} // namespace LLE
|
||||
} // namespace DSP
|
||||
|
@ -27,25 +27,25 @@ public:
|
||||
void Shutdown() override;
|
||||
bool IsLLE() override { return true; }
|
||||
void DoState(PointerWrap& p) override;
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
|
||||
void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) override;
|
||||
|
||||
void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short) override;
|
||||
void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) override;
|
||||
unsigned short DSP_ReadMailBoxHigh(bool _CPUMailbox) override;
|
||||
unsigned short DSP_ReadMailBoxLow(bool _CPUMailbox) override;
|
||||
unsigned short DSP_ReadControlRegister() override;
|
||||
unsigned short DSP_WriteControlRegister(unsigned short) override;
|
||||
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
|
||||
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;
|
||||
u16 DSP_ReadMailBoxHigh(bool cpu_mailbox) override;
|
||||
u16 DSP_ReadMailBoxLow(bool cpu_mailbox) override;
|
||||
u16 DSP_ReadControlRegister() override;
|
||||
u16 DSP_WriteControlRegister(u16 value) override;
|
||||
void DSP_Update(int cycles) override;
|
||||
void DSP_StopSoundStream() override;
|
||||
u32 DSP_UpdateRate() override;
|
||||
|
||||
private:
|
||||
static void DSPThread(DSPLLE* lpParameter);
|
||||
static void DSPThread(DSPLLE* dsp_lle);
|
||||
|
||||
std::thread m_hDSPThread;
|
||||
std::mutex m_csDSPThreadActive;
|
||||
bool m_bDSPThread = false;
|
||||
Common::Flag m_bIsRunning;
|
||||
std::thread m_dsp_thread;
|
||||
std::mutex m_dsp_thread_mutex;
|
||||
bool m_is_dsp_on_thread = false;
|
||||
Common::Flag m_is_running;
|
||||
std::atomic<u32> m_cycle_count{};
|
||||
};
|
||||
} // namespace LLE
|
||||
|
Loading…
Reference in New Issue
Block a user