mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
DSPLLE: Amend variable casing
This commit is contained in:
@ -31,9 +31,9 @@ namespace DSP
|
|||||||
{
|
{
|
||||||
namespace LLE
|
namespace LLE
|
||||||
{
|
{
|
||||||
static Common::Event dspEvent;
|
static Common::Event s_dsp_event;
|
||||||
static Common::Event ppcEvent;
|
static Common::Event s_ppc_event;
|
||||||
static bool requestDisableThread;
|
static bool s_request_disable_thread;
|
||||||
|
|
||||||
DSPLLE::DSPLLE() = default;
|
DSPLLE::DSPLLE() = default;
|
||||||
|
|
||||||
@ -83,12 +83,12 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
|
|||||||
{
|
{
|
||||||
Common::SetCurrentThreadName("DSP thread");
|
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());
|
const int cycles = static_cast<int>(dsp_lle->m_cycle_count.load());
|
||||||
if (cycles > 0)
|
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)
|
if (g_dsp_jit)
|
||||||
{
|
{
|
||||||
DSPCore_RunCycles(cycles);
|
DSPCore_RunCycles(cycles);
|
||||||
@ -101,8 +101,8 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ppcEvent.Set();
|
s_ppc_event.Set();
|
||||||
dspEvent.Wait();
|
s_dsp_event.Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ static bool FillDSPInitOptions(DSPInitOptions* opts)
|
|||||||
|
|
||||||
bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
||||||
{
|
{
|
||||||
requestDisableThread = false;
|
s_request_disable_thread = false;
|
||||||
|
|
||||||
DSPInitOptions opts;
|
DSPInitOptions opts;
|
||||||
if (!FillDSPInitOptions(&opts))
|
if (!FillDSPInitOptions(&opts))
|
||||||
@ -169,7 +169,7 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
|||||||
dsp_thread = false;
|
dsp_thread = false;
|
||||||
|
|
||||||
m_wii = wii;
|
m_wii = wii;
|
||||||
m_bDSPThread = dsp_thread;
|
m_is_dsp_on_thread = dsp_thread;
|
||||||
|
|
||||||
// DSPLLE directly accesses the fastmem arena.
|
// DSPLLE directly accesses the fastmem arena.
|
||||||
// TODO: The fastmem arena is only supposed to be used by the JIT:
|
// 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)
|
if (dsp_thread)
|
||||||
{
|
{
|
||||||
m_bIsRunning.Set(true);
|
m_is_running.Set(true);
|
||||||
m_hDSPThread = std::thread(DSPThread, this);
|
m_dsp_thread = std::thread(DSPThread, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Host_RefreshDSPDebuggerWindow();
|
Host_RefreshDSPDebuggerWindow();
|
||||||
@ -191,12 +191,12 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
|
|||||||
|
|
||||||
void DSPLLE::DSP_StopSoundStream()
|
void DSPLLE::DSP_StopSoundStream()
|
||||||
{
|
{
|
||||||
if (m_bDSPThread)
|
if (m_is_dsp_on_thread)
|
||||||
{
|
{
|
||||||
m_bIsRunning.Clear();
|
m_is_running.Clear();
|
||||||
ppcEvent.Set();
|
s_ppc_event.Set();
|
||||||
dspEvent.Set();
|
s_dsp_event.Set();
|
||||||
m_hDSPThread.join();
|
m_dsp_thread.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,13 +205,13 @@ void DSPLLE::Shutdown()
|
|||||||
DSPCore_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_CheckExternalInterrupt();
|
||||||
DSPCore_CheckExceptions();
|
DSPCore_CheckExceptions();
|
||||||
@ -220,7 +220,7 @@ u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag)
|
|||||||
{
|
{
|
||||||
// External interrupt pending: this is the zelda ucode.
|
// External interrupt pending: this is the zelda ucode.
|
||||||
// Disable the DSP thread because there is no performance gain.
|
// Disable the DSP thread because there is no performance gain.
|
||||||
requestDisableThread = true;
|
s_request_disable_thread = true;
|
||||||
|
|
||||||
DSPCore_SetExternalInterrupt(true);
|
DSPCore_SetExternalInterrupt(true);
|
||||||
}
|
}
|
||||||
@ -234,19 +234,19 @@ u16 DSPLLE::DSP_ReadControlRegister()
|
|||||||
return DSP::Interpreter::ReadCR();
|
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)
|
if (gdsp_mbox_peek(MAILBOX_CPU) & 0x80000000)
|
||||||
{
|
{
|
||||||
@ -254,13 +254,13 @@ void DSPLLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, u16 _uHighMail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PROFILE
|
#if PROFILE
|
||||||
if ((_uHighMail) == 0xBABE)
|
if (value == 0xBABE)
|
||||||
{
|
{
|
||||||
ProfilerStart();
|
ProfilerStart();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gdsp_mbox_write_h(MAILBOX_CPU, _uHighMail);
|
gdsp_mbox_write_h(MAILBOX_CPU, value);
|
||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -305,19 +305,19 @@ void DSPLLE::DSP_Update(int cycles)
|
|||||||
soundStream->Update();
|
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();
|
DSP_StopSoundStream();
|
||||||
m_bDSPThread = false;
|
m_is_dsp_on_thread = false;
|
||||||
requestDisableThread = false;
|
s_request_disable_thread = false;
|
||||||
SConfig::GetInstance().bDSPThread = false;
|
SConfig::GetInstance().bDSPThread = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're not on a thread, run cycles here.
|
// 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.
|
// ~1/6th as many cycles as the period PPC-side.
|
||||||
DSPCore_RunCycles(dsp_cycles);
|
DSPCore_RunCycles(dsp_cycles);
|
||||||
@ -325,9 +325,9 @@ void DSPLLE::DSP_Update(int cycles)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Wait for DSP thread to complete its cycle. Note: this logic should be thought through.
|
// 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);
|
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
|
return 12600; // TO BE TWEAKED
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPLLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
void DSPLLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
|
||||||
{
|
{
|
||||||
if (doLock)
|
if (do_lock)
|
||||||
m_csDSPThreadActive.lock();
|
m_dsp_thread_mutex.lock();
|
||||||
else
|
else
|
||||||
m_csDSPThreadActive.unlock();
|
m_dsp_thread_mutex.unlock();
|
||||||
}
|
}
|
||||||
} // namespace LLE
|
} // namespace LLE
|
||||||
} // namespace DSP
|
} // namespace DSP
|
||||||
|
@ -27,25 +27,25 @@ public:
|
|||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
bool IsLLE() override { return true; }
|
bool IsLLE() override { return true; }
|
||||||
void DoState(PointerWrap& p) override;
|
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_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
|
||||||
void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) override;
|
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;
|
||||||
unsigned short DSP_ReadMailBoxHigh(bool _CPUMailbox) override;
|
u16 DSP_ReadMailBoxHigh(bool cpu_mailbox) override;
|
||||||
unsigned short DSP_ReadMailBoxLow(bool _CPUMailbox) override;
|
u16 DSP_ReadMailBoxLow(bool cpu_mailbox) override;
|
||||||
unsigned short DSP_ReadControlRegister() override;
|
u16 DSP_ReadControlRegister() override;
|
||||||
unsigned short DSP_WriteControlRegister(unsigned short) override;
|
u16 DSP_WriteControlRegister(u16 value) override;
|
||||||
void DSP_Update(int cycles) override;
|
void DSP_Update(int cycles) override;
|
||||||
void DSP_StopSoundStream() override;
|
void DSP_StopSoundStream() override;
|
||||||
u32 DSP_UpdateRate() override;
|
u32 DSP_UpdateRate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void DSPThread(DSPLLE* lpParameter);
|
static void DSPThread(DSPLLE* dsp_lle);
|
||||||
|
|
||||||
std::thread m_hDSPThread;
|
std::thread m_dsp_thread;
|
||||||
std::mutex m_csDSPThreadActive;
|
std::mutex m_dsp_thread_mutex;
|
||||||
bool m_bDSPThread = false;
|
bool m_is_dsp_on_thread = false;
|
||||||
Common::Flag m_bIsRunning;
|
Common::Flag m_is_running;
|
||||||
std::atomic<u32> m_cycle_count{};
|
std::atomic<u32> m_cycle_count{};
|
||||||
};
|
};
|
||||||
} // namespace LLE
|
} // namespace LLE
|
||||||
|
Reference in New Issue
Block a user