mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Core: Process stepping on other platforms.
This includes Android.
This commit is contained in:
1 parent
c15ade3b1b
commit
2e2d8f2989
4 files changed
+29
-19
No files matched your search
+13
-11
@@ -239,6 +239,8 @@ void Core_UpdateSingleStep() {
|
||||
|
||||
void Core_SingleStep() {
|
||||
currentMIPS->SingleStep();
|
||||
if (coreState == CORE_STEPPING)
|
||||
steppingCounter++;
|
||||
}
|
||||
|
||||
static inline void CoreStateProcessed() {
|
||||
@@ -249,10 +251,14 @@ static inline void CoreStateProcessed() {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void Core_WaitStepping() {
|
||||
static inline bool Core_WaitStepping() {
|
||||
std::unique_lock<std::mutex> guard(m_hStepMutex);
|
||||
if (!singleStepPending && coreState == CORE_STEPPING)
|
||||
m_StepCond.wait(guard);
|
||||
|
||||
bool result = singleStepPending;
|
||||
singleStepPending = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Core_ProcessStepping() {
|
||||
@@ -268,12 +274,10 @@ void Core_ProcessStepping() {
|
||||
host->UpdateMemView();
|
||||
|
||||
// Need to check inside the lock to avoid races.
|
||||
Core_WaitStepping();
|
||||
bool doStep = Core_WaitStepping();
|
||||
|
||||
// We may still be stepping without singleStepPending to process a save state.
|
||||
if (singleStepPending && coreState == CORE_STEPPING) {
|
||||
singleStepPending = false;
|
||||
|
||||
if (doStep && coreState == CORE_STEPPING) {
|
||||
Core_SingleStep();
|
||||
// Update disasm dialog.
|
||||
host->UpdateDisassembly();
|
||||
@@ -298,15 +302,13 @@ void Core_Run(GraphicsContext *ctx) {
|
||||
|
||||
switch (coreState) {
|
||||
case CORE_RUNNING:
|
||||
case CORE_STEPPING:
|
||||
// enter a fast runloop
|
||||
Core_RunLoop(ctx);
|
||||
break;
|
||||
|
||||
// We should never get here on Android.
|
||||
case CORE_STEPPING:
|
||||
Core_ProcessStepping();
|
||||
if (coreState == CORE_POWERDOWN)
|
||||
if (coreState == CORE_POWERDOWN) {
|
||||
CoreStateProcessed();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case CORE_POWERUP:
|
||||
|
||||
@@ -430,10 +430,24 @@ void PSP_EndHostFrame() {
|
||||
}
|
||||
}
|
||||
|
||||
void PSP_RunLoopWhileState() {
|
||||
// We just run the CPU until we get to vblank. This will quickly sync up pretty nicely.
|
||||
// The actual number of cycles doesn't matter so much here as we will break due to CORE_NEXTFRAME, most of the time hopefully...
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
|
||||
// Run until CORE_NEXTFRAME
|
||||
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING) {
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
}
|
||||
}
|
||||
|
||||
void PSP_RunLoopUntil(u64 globalticks) {
|
||||
SaveState::Process();
|
||||
if (coreState == CORE_POWERDOWN || coreState == CORE_ERROR) {
|
||||
return;
|
||||
} else if (coreState == CORE_STEPPING) {
|
||||
Core_ProcessStepping();
|
||||
return;
|
||||
}
|
||||
|
||||
mipsr4k.RunLoopUntil(globalticks);
|
||||
|
||||
@@ -70,6 +70,7 @@ void PSP_Shutdown();
|
||||
|
||||
void PSP_BeginHostFrame();
|
||||
void PSP_EndHostFrame();
|
||||
void PSP_RunLoopWhileState();
|
||||
void PSP_RunLoopUntil(u64 globalticks);
|
||||
void PSP_RunLoopFor(int cycles);
|
||||
|
||||
|
||||
+1
-8
@@ -1193,14 +1193,7 @@ void EmuScreen::render() {
|
||||
|
||||
PSP_BeginHostFrame();
|
||||
|
||||
// We just run the CPU until we get to vblank. This will quickly sync up pretty nicely.
|
||||
// The actual number of cycles doesn't matter so much here as we will break due to CORE_NEXTFRAME, most of the time hopefully...
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
|
||||
// Run until CORE_NEXTFRAME
|
||||
while (coreState == CORE_RUNNING) {
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
}
|
||||
PSP_RunLoopWhileState();
|
||||
|
||||
// Hopefully coreState is now CORE_NEXTFRAME
|
||||
if (coreState == CORE_NEXTFRAME) {
|
||||
|
||||
Reference in new issue
Block a user