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:
XTra.KrazzY 2010-03-18 06:20:52 +00:00
parent d9714c3c9d
commit 14bb53dcc6
1 changed files with 18 additions and 9 deletions

View File

@ -101,18 +101,23 @@ void Step()
// Used by thread mode.
void Run()
{
int checkInterrupt = 0;
gdsp_running = true;
while (!(g_dsp.cr & CR_HALT))
while (!(g_dsp.cr & CR_HALT) && gdsp_running)
{
// Are we running?
if (DSPHost_Running() && !DSPHost_OnThread())
break;
// 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