DSPLLE: Amend variable casing

This commit is contained in:
Lioncash 2017-01-18 12:31:26 -05:00
parent 0f70650e93
commit cf1c194b88
2 changed files with 55 additions and 55 deletions

View file

@ -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

View file

@ -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