mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Simplifications
This commit is contained in:
1 parent
29ad21effb
commit
b24ce4bd14
4 files changed
+19
-63
No files matched your search
+4
-7
@@ -213,16 +213,13 @@ void Core_RunLoopUntil(u64 globalticks) {
|
||||
case DLResult::DebugBreak:
|
||||
GPUStepping::EnterStepping(coreState);
|
||||
break;
|
||||
case DLResult::Error:
|
||||
// We should elegantly report the error somehow, or I guess ignore it.
|
||||
hleFinishSyscallAfterGe();
|
||||
coreState = preGeCoreState;
|
||||
break;
|
||||
case DLResult::Done:
|
||||
// Done executing for now
|
||||
|
||||
case DLResult::Error: // We should elegantly report the error somehow, or I guess ignore it.
|
||||
case DLResult::Done: // Done executing for now
|
||||
hleFinishSyscallAfterGe();
|
||||
coreState = preGeCoreState;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not a valid return value.
|
||||
_dbg_assert_(false);
|
||||
|
||||
@@ -63,10 +63,9 @@ BreakAction MemCheck::Apply(u32 addr, bool write, int size, u32 pc) {
|
||||
BreakAction MemCheck::Action(u32 addr, bool write, int size, u32 pc, const char *reason) {
|
||||
// Conditions have always already been checked if we get here.
|
||||
Log(addr, write, size, pc, reason);
|
||||
if ((result & BREAK_ACTION_PAUSE) && coreState != CORE_POWERUP) {
|
||||
if (result & BREAK_ACTION_PAUSE) {
|
||||
Core_Break(BreakReason::MemoryBreakpoint, start);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -291,7 +290,7 @@ BreakAction BreakpointManager::ExecBreakPoint(u32 addr) {
|
||||
NOTICE_LOG(Log::JIT, "BKP PC=%08x: %s", addr, formatted.c_str());
|
||||
}
|
||||
}
|
||||
if ((info.result & BREAK_ACTION_PAUSE) && coreState != CORE_POWERUP) {
|
||||
if (info.result & BREAK_ACTION_PAUSE) {
|
||||
Core_Break(BreakReason::CpuBreakpoint, info.addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ private:
|
||||
void Write(u32 handle, const u8 *buf, size_t bytes);
|
||||
|
||||
void EventResult(u32 handle, const AsyncIOResult &result);
|
||||
|
||||
bool threadEnabled_ = false;
|
||||
bool eventsRunning_ = false;
|
||||
bool eventsHaveRun_ = false;
|
||||
|
||||
+12
-53
@@ -68,6 +68,7 @@ void MainThread_Stop() {
|
||||
// Already stopped?
|
||||
UpdateUIState(UISTATE_EXIT);
|
||||
Core_Stop();
|
||||
_dbg_assert_(mainThread.joinable());
|
||||
mainThread.join();
|
||||
}
|
||||
|
||||
@@ -75,52 +76,6 @@ bool MainThread_Ready() {
|
||||
return g_inLoop;
|
||||
}
|
||||
|
||||
static bool Run(GraphicsContext *ctx) {
|
||||
System_Notify(SystemNotification::DISASSEMBLY);
|
||||
while (true) {
|
||||
if (GetUIState() != UISTATE_INGAME) {
|
||||
Core_StateProcessed();
|
||||
if (GetUIState() == UISTATE_EXIT) {
|
||||
// Not sure why we do a final frame here?
|
||||
NativeFrame(ctx);
|
||||
return false;
|
||||
}
|
||||
NativeFrame(ctx);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (coreState) {
|
||||
case CORE_RUNNING_CPU:
|
||||
case CORE_STEPPING_CPU:
|
||||
case CORE_RUNNING_GE: // Shouldn't be in this state between frames
|
||||
case CORE_STEPPING_GE: // This is OK though.
|
||||
// enter a fast runloop
|
||||
NativeFrame(ctx);
|
||||
if (coreState == CORE_POWERDOWN) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case CORE_POWERUP:
|
||||
case CORE_POWERDOWN:
|
||||
// Need to step the loop.
|
||||
NativeFrame(ctx);
|
||||
return true;
|
||||
|
||||
case CORE_RUNTIME_ERROR:
|
||||
// Need to step the loop.
|
||||
NativeFrame(ctx);
|
||||
break;
|
||||
|
||||
case CORE_BOOT_ERROR:
|
||||
// Exit loop!!
|
||||
return true;
|
||||
|
||||
case CORE_NEXTFRAME:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EmuThreadFunc(GraphicsContext *graphicsContext) {
|
||||
SetCurrentThreadName("EmuThread");
|
||||
|
||||
@@ -133,9 +88,14 @@ static void EmuThreadFunc(GraphicsContext *graphicsContext) {
|
||||
while (emuThreadState != (int)EmuThreadState::QUIT_REQUESTED) {
|
||||
// We're here again, so the game quit. Restart Run() which controls the UI.
|
||||
// This way they can load a new game.
|
||||
if (!Core_IsActive())
|
||||
if (!Core_IsActive()) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
if (!Run(g_graphicsContext)) {
|
||||
}
|
||||
|
||||
Core_StateProcessed();
|
||||
NativeFrame(graphicsContext);
|
||||
|
||||
if (GetUIState() == UISTATE_EXIT) {
|
||||
emuThreadState = (int)EmuThreadState::QUIT_REQUESTED;
|
||||
}
|
||||
}
|
||||
@@ -343,16 +303,15 @@ void MainThreadFunc() {
|
||||
// This way they can load a new game.
|
||||
if (!Core_IsActive())
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
Run(g_graphicsContext);
|
||||
if (coreState == CORE_BOOT_ERROR) {
|
||||
break;
|
||||
}
|
||||
Core_StateProcessed();
|
||||
NativeFrame(graphicsContext);
|
||||
}
|
||||
}
|
||||
Core_Stop();
|
||||
if (!useEmuThread) {
|
||||
// Process the shutdown. Without this, non-GL delays 800ms on shutdown.
|
||||
Run(g_graphicsContext);
|
||||
Core_StateProcessed();
|
||||
NativeFrame(graphicsContext);
|
||||
}
|
||||
Core_WaitInactive();
|
||||
|
||||
|
||||
Reference in new issue
Block a user