mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-07 10:50:26 +00:00
DSPLLE: Run the threaded mode a bit differently and with respect to idle loops.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5212 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d9714c3c9d
commit
14bb53dcc6
@ -101,18 +101,23 @@ void Step()
|
||||
// Used by thread mode.
|
||||
void Run()
|
||||
{
|
||||
int checkInterrupt = 0;
|
||||
gdsp_running = true;
|
||||
while (!(g_dsp.cr & CR_HALT))
|
||||
{
|
||||
// Are we running?
|
||||
if (DSPHost_Running() && !DSPHost_OnThread())
|
||||
break;
|
||||
while (!(g_dsp.cr & CR_HALT) && gdsp_running)
|
||||
{
|
||||
// Automatically let the other threads work if we're idle skipping
|
||||
if(DSPAnalyzer::code_flags[g_dsp.pc] & DSPAnalyzer::CODE_IDLE_SKIP)
|
||||
Common::YieldCPU();
|
||||
|
||||
// This number (500) is completely arbitrary. TODO: tweak.
|
||||
RunCycles(500);
|
||||
Step();
|
||||
|
||||
if (!gdsp_running)
|
||||
break;
|
||||
// Turns out the less you check for external interrupts, the more
|
||||
// sound you hear, and it becomes slower
|
||||
checkInterrupt++;
|
||||
if(checkInterrupt == 500) { // <-- A completely arbitrary number. TODO: tweak
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
checkInterrupt = 0;
|
||||
}
|
||||
}
|
||||
gdsp_running = false;
|
||||
}
|
||||
@ -184,6 +189,8 @@ int RunCycles(int cycles)
|
||||
return 0;
|
||||
Step();
|
||||
cycles--;
|
||||
if (cycles < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
@ -198,6 +205,8 @@ int RunCycles(int cycles)
|
||||
return 0;
|
||||
Step();
|
||||
cycles--;
|
||||
if (cycles < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Now, run the rest of the block without idle skipping. It might trip into
|
||||
|
Loading…
Reference in New Issue
Block a user