Add a function to run the CPU core.

This commit is contained in:
Unknown W. Brackets 2013-08-04 15:22:30 -07:00
parent f7a39d1b12
commit b17b23f1f2
6 changed files with 14 additions and 15 deletions

View File

@ -34,9 +34,6 @@ enum GPUCore {
struct CoreParameter
{
CoreParameter() : collectEmuLog(0), unthrottle(false), fpsLimit(0), updateRecent(true) {}
// 0 = Interpreter
// 1 = Jit
// 2 = JitIL
CPUCore cpuCore;
GPUCore gpuCore;
bool enableSound; // there aren't multiple sound cores.

View File

@ -150,6 +150,14 @@ void PSP_Shutdown()
currentCPU = 0;
}
void PSP_RunLoopUntil(u64 globalticks) {
mipsr4k.RunLoopUntil(globalticks);
}
void PSP_RunLoopFor(int cycles) {
PSP_RunLoopUntil(CoreTiming::GetTicks() + cycles);
}
CoreParameter &PSP_CoreParameter()
{
return coreParameter;

View File

@ -41,8 +41,8 @@ extern GlobalUIState globalUIState;
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string);
bool PSP_IsInited();
void PSP_Shutdown();
void PSP_HWAdvance(int cycles);
void PSP_SWI();
void PSP_RunLoopUntil(u64 globalticks);
void PSP_RunLoopFor(int cycles);
void GetSysDirectories(std::string &memstickpath, std::string &flash0path);

View File

@ -34,7 +34,6 @@
#include "Core/Core.h"
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/MIPS/MIPS.h"
#include "GPU/GPUState.h"
#include "GPU/GPUInterface.h"
#include "Core/HLE/sceCtrl.h"
@ -477,8 +476,7 @@ void EmuScreen::render() {
// Run until CORE_NEXTFRAME
while (coreState == CORE_RUNNING) {
u64 nowTicks = CoreTiming::GetTicks();
mipsr4k.RunLoopUntil(nowTicks + blockTicks);
PSP_RunLoopFor(blockTicks);
}
// Hopefully coreState is now CORE_NEXTFRAME
if (coreState == CORE_NEXTFRAME) {

View File

@ -99,8 +99,7 @@ void RunTests()
while (true) {
int blockTicks = usToCycles(1000000 / 10);
while (coreState == CORE_RUNNING) {
u64 nowTicks = CoreTiming::GetTicks();
mipsr4k.RunLoopUntil(nowTicks + blockTicks);
PSP_RunLoopFor(blockTicks);
}
// Hopefully coreState is now CORE_NEXTFRAME
if (coreState == CORE_NEXTFRAME) {

View File

@ -9,7 +9,6 @@
#include "Core/CoreTiming.h"
#include "Core/System.h"
#include "Core/HLE/sceUtility.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Host.h"
#include "Log.h"
#include "LogManager.h"
@ -229,10 +228,8 @@ int main(int argc, const char* argv[])
coreState = CORE_RUNNING;
while (coreState == CORE_RUNNING)
{
// Run for a frame at a time, just because.
u64 nowTicks = CoreTiming::GetTicks();
u64 frameTicks = usToCycles(1000000/60);
mipsr4k.RunLoopUntil(nowTicks + frameTicks);
int blockTicks = usToCycles(1000000 / 10);
PSP_RunLoopFor(blockTicks);
// If we were rendering, this might be a nice time to do something about it.
if (coreState == CORE_NEXTFRAME) {