mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add two new core states, rename RUNNING to RUNNING_CPU and similar for stepping.
This commit is contained in:
parent
4c0a4dadac
commit
96c4a10e8c
25 changed files with 74 additions and 70 deletions
|
@ -133,15 +133,15 @@ bool Core_MustRunBehind() {
|
|||
}
|
||||
|
||||
bool Core_IsStepping() {
|
||||
return coreState == CORE_STEPPING || coreState == CORE_POWERDOWN;
|
||||
return coreState == CORE_STEPPING_CPU || coreState == CORE_POWERDOWN;
|
||||
}
|
||||
|
||||
bool Core_IsActive() {
|
||||
return coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME || coreStatePending;
|
||||
return coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME || coreStatePending;
|
||||
}
|
||||
|
||||
bool Core_IsInactive() {
|
||||
return coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME && !coreStatePending;
|
||||
return coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME && !coreStatePending;
|
||||
}
|
||||
|
||||
static inline void Core_StateProcessed() {
|
||||
|
@ -226,7 +226,7 @@ bool UpdateScreenScale(int width, int height) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Used by Windows, SDL, Qt.
|
||||
// Used by Windows, SDL, Qt. Doesn't belong in this file.
|
||||
void Core_RunLoop(GraphicsContext *ctx) {
|
||||
if (windowHidden && g_Config.bPauseWhenMinimized) {
|
||||
sleep_ms(16, "window-hidden");
|
||||
|
@ -340,7 +340,7 @@ void Core_ProcessStepping(MIPSDebugInterface *cpu) {
|
|||
|
||||
// Check if there's any pending save state actions.
|
||||
SaveState::Process();
|
||||
if (coreState != CORE_STEPPING) {
|
||||
if (coreState != CORE_STEPPING_CPU) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ void Core_ProcessStepping(MIPSDebugInterface *cpu) {
|
|||
// Need to check inside the lock to avoid races.
|
||||
std::lock_guard<std::mutex> guard(g_stepMutex);
|
||||
|
||||
if (coreState != CORE_STEPPING || g_stepCommand.empty()) {
|
||||
if (coreState != CORE_STEPPING_CPU || g_stepCommand.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -396,8 +396,8 @@ bool Core_Run(GraphicsContext *ctx) {
|
|||
}
|
||||
|
||||
switch (coreState) {
|
||||
case CORE_RUNNING:
|
||||
case CORE_STEPPING:
|
||||
case CORE_RUNNING_CPU:
|
||||
case CORE_STEPPING_CPU:
|
||||
// enter a fast runloop
|
||||
Core_RunLoop(ctx);
|
||||
if (coreState == CORE_POWERDOWN) {
|
||||
|
@ -444,7 +444,7 @@ void Core_Break(const char *reason, u32 relatedAddress) {
|
|||
g_stepCommand.relatedAddr = relatedAddress;
|
||||
steppingCounter++;
|
||||
_assert_msg_(reason != nullptr, "No reason specified for break");
|
||||
Core_UpdateState(CORE_STEPPING);
|
||||
Core_UpdateState(CORE_STEPPING_CPU);
|
||||
}
|
||||
System_Notify(SystemNotification::DEBUG_MODE_CHANGE);
|
||||
}
|
||||
|
@ -453,13 +453,13 @@ void Core_Break(const char *reason, u32 relatedAddress) {
|
|||
void Core_Resume() {
|
||||
// Clear the exception if we resume.
|
||||
Core_ResetException();
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
System_Notify(SystemNotification::DEBUG_MODE_CHANGE);
|
||||
}
|
||||
|
||||
// Should be called from the EmuThread.
|
||||
bool Core_NextFrame() {
|
||||
if (coreState == CORE_RUNNING) {
|
||||
if (coreState == CORE_RUNNING_CPU) {
|
||||
coreState = CORE_NEXTFRAME;
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -227,7 +227,7 @@ static void GenericStreamBuffer(DebuggerRequest &req, std::function<bool(const G
|
|||
if (!currentDebugMIPS->isAlive()) {
|
||||
return req.Fail("CPU not started");
|
||||
}
|
||||
if (coreState != CORE_STEPPING && !GPUStepping::IsStepping()) {
|
||||
if (coreState != CORE_STEPPING_CPU && !GPUStepping::IsStepping()) {
|
||||
return req.Fail("Neither CPU or GPU is stepping");
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ void SteppingBroadcaster::Broadcast(net::WebSocketServer *ws) {
|
|||
if (PSP_IsInited()) {
|
||||
int steppingCounter = Core_GetSteppingCounter();
|
||||
// We ignore CORE_POWERDOWN as a stepping state.
|
||||
if (coreState == CORE_STEPPING && steppingCounter != lastCounter_) {
|
||||
if (coreState == CORE_STEPPING_CPU && steppingCounter != lastCounter_) {
|
||||
ws->Send(CPUSteppingEvent(Core_GetSteppingReason()));
|
||||
} else if (prevState_ == CORE_STEPPING && coreState != CORE_STEPPING && Core_IsActive()) {
|
||||
} else if (prevState_ == CORE_STEPPING_CPU && coreState != CORE_STEPPING_CPU && Core_IsActive()) {
|
||||
ws->Send(R"({"event":"cpu.resume"})");
|
||||
}
|
||||
lastCounter_ = steppingCounter;
|
||||
|
|
|
@ -97,7 +97,7 @@ static u32 JitMemCheck(u32 pc) {
|
|||
u32 addr = currentMIPS->r[MIPS_GET_RS(op)] + offset;
|
||||
|
||||
g_breakpoints.ExecOpMemCheck(addr, pc);
|
||||
return coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
return coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
}
|
||||
|
||||
namespace MIPSComp
|
||||
|
|
|
@ -88,7 +88,7 @@ static u32 JitMemCheck(u32 pc) {
|
|||
u32 addr = currentMIPS->r[MIPS_GET_RS(op)] + offset;
|
||||
|
||||
g_breakpoints.ExecOpMemCheck(addr, pc);
|
||||
return coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
return coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
}
|
||||
|
||||
namespace MIPSComp
|
||||
|
|
|
@ -69,11 +69,11 @@ u32 IRRunBreakpoint(u32 pc) {
|
|||
return 0;
|
||||
|
||||
// Did we already hit one?
|
||||
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME)
|
||||
if (coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME)
|
||||
return 1;
|
||||
|
||||
g_breakpoints.ExecBreakPoint(pc);
|
||||
return coreState != CORE_RUNNING ? 1 : 0;
|
||||
return coreState != CORE_RUNNING_CPU ? 1 : 0;
|
||||
}
|
||||
|
||||
u32 IRRunMemCheck(u32 pc, u32 addr) {
|
||||
|
@ -83,11 +83,11 @@ u32 IRRunMemCheck(u32 pc, u32 addr) {
|
|||
return 0;
|
||||
|
||||
// Did we already hit one?
|
||||
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME)
|
||||
if (coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME)
|
||||
return 1;
|
||||
|
||||
g_breakpoints.ExecOpMemCheck(addr, pc);
|
||||
return coreState != CORE_RUNNING ? 1 : 0;
|
||||
return coreState != CORE_RUNNING_CPU ? 1 : 0;
|
||||
}
|
||||
|
||||
void IRApplyRounding(MIPSState *mips) {
|
||||
|
@ -1148,7 +1148,7 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst) {
|
|||
{
|
||||
MIPSOpcode op(inst->constant);
|
||||
CallSyscall(op);
|
||||
if (coreState != CORE_RUNNING)
|
||||
if (coreState != CORE_RUNNING_CPU)
|
||||
CoreTiming::ForceCheck();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ template <uint32_t alignment>
|
|||
u32 RunValidateAddress(u32 pc, u32 addr, u32 isWrite) {
|
||||
const auto toss = [&](MemoryExceptionType t) {
|
||||
Core_MemoryException(addr, alignment, pc, t);
|
||||
return coreState != CORE_RUNNING ? 1 : 0;
|
||||
return coreState != CORE_RUNNING_CPU ? 1 : 0;
|
||||
};
|
||||
|
||||
if (!Memory::IsValidRange(addr, alignment)) {
|
||||
|
|
|
@ -167,7 +167,7 @@ uint32_t IRNativeBackend::DoIRInst(uint64_t value) {
|
|||
int IRNativeBackend::ReportBadAddress(uint32_t addr, uint32_t alignment, uint32_t isWrite) {
|
||||
const auto toss = [&](MemoryExceptionType t) {
|
||||
Core_MemoryException(addr, alignment, currentMIPS->pc, t);
|
||||
return coreState != CORE_RUNNING ? 1 : 0;
|
||||
return coreState != CORE_RUNNING_CPU ? 1 : 0;
|
||||
};
|
||||
|
||||
if (!Memory::IsValidRange(addr, alignment)) {
|
||||
|
|
|
@ -378,7 +378,7 @@ void MIPSState::InvalidateICache(u32 address, int length) {
|
|||
void MIPSState::ClearJitCache() {
|
||||
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
||||
if (MIPSComp::jit) {
|
||||
if (coreState == CORE_RUNNING || insideJit) {
|
||||
if (coreState == CORE_RUNNING_CPU || insideJit) {
|
||||
pendingClears.emplace_back(0, 0);
|
||||
hasPendingClears = true;
|
||||
CoreTiming::ForceCheck();
|
||||
|
|
|
@ -970,7 +970,7 @@ void MIPSInterpret(MIPSOpcode op) {
|
|||
static inline void RunUntilFast() {
|
||||
MIPSState *curMips = currentMIPS;
|
||||
// NEVER stop in a delay slot!
|
||||
while (curMips->downcount >= 0 && coreState == CORE_RUNNING) {
|
||||
while (curMips->downcount >= 0 && coreState == CORE_RUNNING_CPU) {
|
||||
do {
|
||||
// Replacements and similar are processed here, intentionally.
|
||||
MIPSOpcode op = MIPSOpcode(Memory::Read_U32(curMips->pc));
|
||||
|
@ -994,7 +994,7 @@ static void RunUntilWithChecks(u64 globalTicks) {
|
|||
// NEVER stop in a delay slot!
|
||||
bool hasBPs = g_breakpoints.HasBreakPoints();
|
||||
bool hasMCs = g_breakpoints.HasMemChecks();
|
||||
while (curMips->downcount >= 0 && coreState == CORE_RUNNING) {
|
||||
while (curMips->downcount >= 0 && coreState == CORE_RUNNING_CPU) {
|
||||
do {
|
||||
// Replacements and similar are processed here, intentionally.
|
||||
MIPSOpcode op = MIPSOpcode(Memory::Read_U32(curMips->pc));
|
||||
|
@ -1022,7 +1022,7 @@ static void RunUntilWithChecks(u64 globalTicks) {
|
|||
g_breakpoints.ExecMemCheck(addr, true, sz, curMips->pc, "interpret");
|
||||
|
||||
// If it tripped, bail without running.
|
||||
if (coreState == CORE_STEPPING)
|
||||
if (coreState == CORE_STEPPING_CPU)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ static void RunUntilWithChecks(u64 globalTicks) {
|
|||
|
||||
int MIPSInterpret_RunUntil(u64 globalTicks) {
|
||||
MIPSState *curMips = currentMIPS;
|
||||
while (coreState == CORE_RUNNING) {
|
||||
while (coreState == CORE_RUNNING_CPU) {
|
||||
CoreTiming::Advance();
|
||||
|
||||
uint64_t ticksLeft = globalTicks - CoreTiming::GetTicks();
|
||||
|
|
|
@ -97,12 +97,12 @@ static u32 JitMemCheck(u32 addr, u32 pc) {
|
|||
return 0;
|
||||
|
||||
// Did we already hit one?
|
||||
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME)
|
||||
if (coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME)
|
||||
return 1;
|
||||
|
||||
// Note: pc may be the delay slot.
|
||||
g_breakpoints.ExecOpMemCheck(addr, pc);
|
||||
return coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
return coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME ? 0 : 1;
|
||||
}
|
||||
|
||||
static void JitLogMiss(MIPSOpcode op)
|
||||
|
|
|
@ -328,7 +328,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
|
|||
if (PSP_CoreParameter().startBreak) {
|
||||
Core_Break("start-break");
|
||||
} else {
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
}
|
||||
} else {
|
||||
coreState = CORE_BOOT_ERROR;
|
||||
|
@ -489,7 +489,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
|
|||
if (PSP_CoreParameter().startBreak) {
|
||||
Core_Break("start-break");
|
||||
} else {
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
}
|
||||
} else {
|
||||
coreState = CORE_BOOT_ERROR;
|
||||
|
@ -519,7 +519,7 @@ bool Load_PSP_GE_Dump(FileLoader *fileLoader, std::string *error_string) {
|
|||
if (PSP_CoreParameter().startBreak) {
|
||||
Core_Break("start-break");
|
||||
} else {
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
}
|
||||
} else {
|
||||
coreState = CORE_BOOT_ERROR;
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace SaveState
|
|||
if (g_Config.iRewindSnapshotInterval <= 0) {
|
||||
return;
|
||||
}
|
||||
if (coreState != CORE_RUNNING) {
|
||||
if (coreState != CORE_RUNNING_CPU) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ bool coreCollectDebugStats = false;
|
|||
static int coreCollectDebugStatsCounter = 0;
|
||||
|
||||
// This can be read and written from ANYWHERE.
|
||||
volatile CoreState coreState = CORE_STEPPING;
|
||||
volatile CoreState coreState = CORE_STEPPING_CPU;
|
||||
// If true, core state has been changed, but JIT has probably not noticed yet.
|
||||
volatile bool coreStatePending = false;
|
||||
|
||||
|
@ -388,7 +388,7 @@ void UpdateLoadedFile(FileLoader *fileLoader) {
|
|||
}
|
||||
|
||||
void Core_UpdateState(CoreState newState) {
|
||||
if ((coreState == CORE_RUNNING || coreState == CORE_NEXTFRAME) && newState != CORE_RUNNING)
|
||||
if ((coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME) && newState != CORE_RUNNING_CPU)
|
||||
coreStatePending = true;
|
||||
coreState = newState;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ void PSP_Shutdown() {
|
|||
|
||||
// Make sure things know right away that PSP memory, etc. is going away.
|
||||
pspIsQuitting = !pspIsRebooting;
|
||||
if (coreState == CORE_RUNNING)
|
||||
if (coreState == CORE_RUNNING_CPU)
|
||||
Core_Stop();
|
||||
|
||||
if (g_Config.bFuncHashMap) {
|
||||
|
@ -622,9 +622,9 @@ void PSP_RunLoopWhileState() {
|
|||
int blockTicks = usToCycles(1000000 / 10);
|
||||
|
||||
// Run until CORE_NEXTFRAME
|
||||
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING) {
|
||||
while (coreState == CORE_RUNNING_CPU || coreState == CORE_STEPPING_CPU) {
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
if (coreState == CORE_STEPPING) {
|
||||
if (coreState == CORE_STEPPING_CPU) {
|
||||
// Keep the UI responsive.
|
||||
break;
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ void PSP_RunLoopWhileState() {
|
|||
void PSP_RunLoopUntil(u64 globalticks) {
|
||||
if (coreState == CORE_POWERDOWN || coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR) {
|
||||
return;
|
||||
} else if (coreState == CORE_STEPPING) {
|
||||
} else if (coreState == CORE_STEPPING_CPU) {
|
||||
Core_ProcessStepping(currentDebugMIPS);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -111,11 +111,11 @@ bool CreateSysDirectories();
|
|||
// RUNNING must be at 0, NEXTFRAME must be at 1.
|
||||
enum CoreState {
|
||||
// Emulation is running normally.
|
||||
CORE_RUNNING = 0,
|
||||
CORE_RUNNING_CPU = 0,
|
||||
// Emulation was running normally, just reached the end of a frame.
|
||||
CORE_NEXTFRAME = 1,
|
||||
// Emulation is paused, CPU thread is sleeping.
|
||||
CORE_STEPPING, // Can be used for recoverable runtime errors (ignored memory exceptions)
|
||||
CORE_STEPPING_CPU, // Can be used for recoverable runtime errors (ignored memory exceptions)
|
||||
// Core is being powered up.
|
||||
CORE_POWERUP,
|
||||
// Core is being powered down.
|
||||
|
@ -124,6 +124,10 @@ enum CoreState {
|
|||
CORE_BOOT_ERROR,
|
||||
// Unrecoverable runtime error. Recoverable errors should use CORE_STEPPING.
|
||||
CORE_RUNTIME_ERROR,
|
||||
// Stepping the GPU. When done, will switch over to STEPPING_CPU.
|
||||
CORE_STEPPING_GE,
|
||||
// Running the GPU. When done, will switch over to RUNNING_CPU.
|
||||
CORE_RUNNING_GE,
|
||||
};
|
||||
|
||||
extern bool coreCollectDebugStats;
|
||||
|
|
|
@ -136,7 +136,7 @@ struct ThreadEventQueue : public B {
|
|||
inline bool ShouldSyncThread(bool force) {
|
||||
if (!HasEvents())
|
||||
return false;
|
||||
if (coreState != CORE_RUNNING && !force)
|
||||
if (coreState != CORE_RUNNING_CPU && !force)
|
||||
return false;
|
||||
|
||||
// Don't run if it's not running, but wait for startup.
|
||||
|
|
|
@ -154,7 +154,7 @@ static void StopStepping() {
|
|||
|
||||
bool SingleStep() {
|
||||
std::unique_lock<std::mutex> guard(pauseLock);
|
||||
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING) {
|
||||
if (coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING_CPU) {
|
||||
// Shutting down, don't try to step.
|
||||
actionComplete = true;
|
||||
actionWait.notify_all();
|
||||
|
@ -174,7 +174,7 @@ bool SingleStep() {
|
|||
|
||||
bool EnterStepping() {
|
||||
std::unique_lock<std::mutex> guard(pauseLock);
|
||||
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING) {
|
||||
if (coreState != CORE_RUNNING_CPU && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING_CPU) {
|
||||
// Shutting down, don't try to step.
|
||||
actionComplete = true;
|
||||
actionWait.notify_all();
|
||||
|
@ -212,7 +212,7 @@ int GetSteppingCounter() {
|
|||
}
|
||||
|
||||
static bool GetBuffer(const GPUDebugBuffer *&buffer, PauseAction type, const GPUDebugBuffer &resultBuffer) {
|
||||
if (!isStepping && coreState != CORE_STEPPING) {
|
||||
if (!isStepping && coreState != CORE_STEPPING_CPU) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ bool GPU_GetCurrentClut(const GPUDebugBuffer *&buffer) {
|
|||
}
|
||||
|
||||
bool GPU_SetCmdValue(u32 op) {
|
||||
if (!isStepping && coreState != CORE_STEPPING) {
|
||||
if (!isStepping && coreState != CORE_STEPPING_CPU) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ bool GPU_SetCmdValue(u32 op) {
|
|||
}
|
||||
|
||||
bool GPU_FlushDrawing() {
|
||||
if (!isStepping && coreState != CORE_STEPPING) {
|
||||
if (!isStepping && coreState != CORE_STEPPING_CPU) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void GPU_GLES::BeginHostFrame() {
|
|||
// Save the cache from time to time. TODO: How often? We save on exit, so shouldn't need to do this all that often.
|
||||
|
||||
const int saveShaderCacheFrameInterval = 32767; // power of 2 - 1. About every 10 minutes at 60fps.
|
||||
if (shaderCachePath_.Valid() && !(gpuStats.numFlips & saveShaderCacheFrameInterval) && coreState == CORE_RUNNING) {
|
||||
if (shaderCachePath_.Valid() && !(gpuStats.numFlips & saveShaderCacheFrameInterval) && coreState == CORE_RUNNING_CPU) {
|
||||
shaderManagerGL_->SaveCache(shaderCachePath_, &drawEngine_);
|
||||
}
|
||||
shaderManagerGL_->DirtyLastShader();
|
||||
|
|
|
@ -195,7 +195,7 @@ EmuScreen::EmuScreen(const Path &filename)
|
|||
// Make sure we don't leave it at powerdown after the last game.
|
||||
// TODO: This really should be handled elsewhere if it isn't.
|
||||
if (coreState == CORE_POWERDOWN)
|
||||
coreState = CORE_STEPPING;
|
||||
coreState = CORE_STEPPING_CPU;
|
||||
|
||||
OnDevMenu.Handle(this, &EmuScreen::OnDevTools);
|
||||
OnChatMenu.Handle(this, &EmuScreen::OnChat);
|
||||
|
@ -678,7 +678,7 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
|
|||
break;
|
||||
case VIRTKEY_FASTFORWARD:
|
||||
if (down) {
|
||||
if (coreState == CORE_STEPPING) {
|
||||
if (coreState == CORE_STEPPING_CPU) {
|
||||
Core_Resume();
|
||||
}
|
||||
PSP_CoreParameter().fastForward = true;
|
||||
|
@ -1261,7 +1261,7 @@ UI::EventReturn EmuScreen::OnResume(UI::EventParams ¶ms) {
|
|||
if (coreState == CoreState::CORE_RUNTIME_ERROR) {
|
||||
// Force it!
|
||||
Memory::MemFault_IgnoreLastCrash();
|
||||
coreState = CoreState::CORE_RUNNING;
|
||||
coreState = CoreState::CORE_RUNNING_CPU;
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -1566,10 +1566,10 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
|
|||
switch (coreState) {
|
||||
case CORE_NEXTFRAME:
|
||||
// Reached the end of the frame, all good. Set back to running for the next frame
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
flags |= ScreenRenderFlags::HANDLED_THROTTLING;
|
||||
break;
|
||||
case CORE_STEPPING:
|
||||
case CORE_STEPPING_CPU:
|
||||
case CORE_RUNTIME_ERROR:
|
||||
{
|
||||
// If there's an exception, display information.
|
||||
|
@ -1719,7 +1719,7 @@ bool EmuScreen::hasVisibleUI() {
|
|||
return true;
|
||||
|
||||
// Exception information.
|
||||
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING) {
|
||||
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING_CPU) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1784,7 +1784,7 @@ void EmuScreen::renderUI() {
|
|||
ctx->Flush();
|
||||
}
|
||||
|
||||
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING) {
|
||||
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING_CPU) {
|
||||
const MIPSExceptionInfo &info = Core_GetExceptionInfo();
|
||||
if (info.type != MIPSExceptionType::NONE) {
|
||||
DrawCrashDump(ctx, gamePath_);
|
||||
|
|
|
@ -47,7 +47,7 @@ void GamepadUpdateOpacity(float force) {
|
|||
g_gamepadOpacity = force;
|
||||
return;
|
||||
}
|
||||
if (coreState != CORE_RUNNING) {
|
||||
if (coreState != CORE_RUNNING_CPU) {
|
||||
g_gamepadOpacity = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause, bool showPau
|
|||
if (fastForward) {
|
||||
fastForward->SetAngle(180.0f);
|
||||
fastForward->OnChange.Add([](UI::EventParams &e) {
|
||||
if (e.a && coreState == CORE_STEPPING) {
|
||||
if (e.a && coreState == CORE_STEPPING_CPU) {
|
||||
Core_Resume();
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
|
|
|
@ -753,7 +753,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
|
|||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
if (ImGui::BeginMenu("Debug")) {
|
||||
if (coreState == CoreState::CORE_STEPPING) {
|
||||
if (coreState == CoreState::CORE_STEPPING_CPU) {
|
||||
if (ImGui::MenuItem("Run")) {
|
||||
Core_Resume();
|
||||
}
|
||||
|
@ -945,14 +945,14 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(coreState != CORE_STEPPING);
|
||||
ImGui::BeginDisabled(coreState != CORE_STEPPING_CPU);
|
||||
if (ImGui::SmallButton("Run")) {
|
||||
Core_Resume();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(coreState != CORE_RUNNING);
|
||||
ImGui::BeginDisabled(coreState != CORE_RUNNING_CPU);
|
||||
if (ImGui::SmallButton("Pause")) {
|
||||
Core_Break("Pause");
|
||||
}
|
||||
|
|
|
@ -133,13 +133,13 @@ bool RunTests() {
|
|||
INFO_LOG(Log::System, "Test: Entering runloop.");
|
||||
while (true) {
|
||||
int blockTicks = (int)usToCycles(1000000 / 10);
|
||||
while (coreState == CORE_RUNNING) {
|
||||
while (coreState == CORE_RUNNING_CPU) {
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
}
|
||||
// Hopefully coreState is now CORE_NEXTFRAME
|
||||
if (coreState == CORE_NEXTFRAME) {
|
||||
// set back to running for the next frame
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
} else if (coreState == CORE_POWERDOWN) {
|
||||
INFO_LOG(Log::System, "Finished running test %s", testName.c_str());
|
||||
break;
|
||||
|
|
|
@ -241,18 +241,18 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
|||
|
||||
bool passed = true;
|
||||
double deadline = time_now_d() + opt.timeout;
|
||||
coreState = coreParameter.startBreak ? CORE_STEPPING : CORE_RUNNING;
|
||||
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING)
|
||||
coreState = coreParameter.startBreak ? CORE_STEPPING_CPU : CORE_RUNNING_CPU;
|
||||
while (coreState == CORE_RUNNING_CPU || coreState == CORE_STEPPING_CPU)
|
||||
{
|
||||
int blockTicks = (int)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) {
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
headlessHost->SwapBuffers();
|
||||
}
|
||||
if (coreState == CORE_STEPPING && !coreParameter.startBreak) {
|
||||
if (coreState == CORE_STEPPING_CPU && !coreParameter.startBreak) {
|
||||
break;
|
||||
}
|
||||
if (time_now_d() > deadline) {
|
||||
|
|
|
@ -1354,7 +1354,7 @@ namespace Libretro
|
|||
|
||||
gpu->BeginHostFrame();
|
||||
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
PSP_RunLoopUntil(UINT64_MAX);
|
||||
|
||||
gpu->EndHostFrame();
|
||||
|
|
|
@ -69,9 +69,9 @@ double ExecCPUTest(bool clearCache = true) {
|
|||
do {
|
||||
for (int j = 0; j < 1000; ++j) {
|
||||
currentMIPS->pc = PSP_GetUserMemoryBase();
|
||||
coreState = CORE_RUNNING;
|
||||
coreState = CORE_RUNNING_CPU;
|
||||
|
||||
while (coreState == CORE_RUNNING) {
|
||||
while (coreState == CORE_RUNNING_CPU) {
|
||||
mipsr4k.RunLoopUntil(blockTicks);
|
||||
}
|
||||
++total;
|
||||
|
|
Loading…
Add table
Reference in a new issue