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. // Used by thread mode.
void Run() void Run()
{ {
int checkInterrupt = 0;
gdsp_running = true; gdsp_running = true;
while (!(g_dsp.cr & CR_HALT)) while (!(g_dsp.cr & CR_HALT) && gdsp_running)
{ {
// Are we running? // Automatically let the other threads work if we're idle skipping
if (DSPHost_Running() && !DSPHost_OnThread()) if(DSPAnalyzer::code_flags[g_dsp.pc] & DSPAnalyzer::CODE_IDLE_SKIP)
break; Common::YieldCPU();
// This number (500) is completely arbitrary. TODO: tweak. Step();
RunCycles(500);
if (!gdsp_running) // Turns out the less you check for external interrupts, the more
break; // sound you hear, and it becomes slower
checkInterrupt++;
if(checkInterrupt == 500) { // <-- A completely arbitrary number. TODO: tweak
DSPCore_CheckExternalInterrupt();
checkInterrupt = 0;
}
} }
gdsp_running = false; gdsp_running = false;
} }
@ -184,6 +189,8 @@ int RunCycles(int cycles)
return 0; return 0;
Step(); Step();
cycles--; cycles--;
if (cycles < 0)
return 0;
} }
DSPCore_CheckExternalInterrupt(); DSPCore_CheckExternalInterrupt();
@ -198,6 +205,8 @@ int RunCycles(int cycles)
return 0; return 0;
Step(); Step();
cycles--; cycles--;
if (cycles < 0)
return 0;
} }
// Now, run the rest of the block without idle skipping. It might trip into // Now, run the rest of the block without idle skipping. It might trip into