Fix discrepancy between stepping and running across frame endings. Add some more menu options in the ImDebugger

This commit is contained in:
Henrik Rydgård committed 2024-12-10 01:06:04 +01:00
1 parent 43af3128e0
commit c842e3f137
5 files changed
+26 -16

No files matched your search

+3 -1
View File
@@ -70,11 +70,13 @@ public:
bool bFirstRun;
bool bGameSpecific = false;
bool bUpdatedInstanceCounter = false;
bool bBrowse; // show a file browser on startup. TODO: Does anyone use this?
int iRunCount; // To be used to for example check for updates every 10 runs and things like that.
// Debugger
bool bAutoRun; // start immediately
bool bBrowse; // when opening the emulator, immediately show a file browser
bool bBreakOnFrameTimeout; // not saved
// General
bool bScreenshotsAsPNG;
+5 -2
View File
@@ -430,12 +430,15 @@ void Core_Resume() {
// Should be called from the EmuThread.
bool Core_NextFrame() {
CoreState coreState = ::coreState;
_dbg_assert_(coreState != CORE_STEPPING_GE && coreState != CORE_RUNNING_GE);
if (coreState == CORE_RUNNING_CPU) {
coreState = CORE_NEXTFRAME;
if (coreState == CORE_RUNNING_CPU || coreState == CORE_STEPPING_CPU) {
::coreState = CORE_NEXTFRAME;
return true;
} else {
ERROR_LOG(Log::System, "Core_NextFrame called with core state %s", CoreStateToString(coreState));
return false;
}
}
+11 -11
View File
@@ -97,7 +97,7 @@ void GPUCommon::Reinitialize() {
memset(dls, 0, sizeof(dls));
for (int i = 0; i < DisplayListMaxCount; ++i) {
dls[i].state = PSP_GE_DL_STATE_NONE;
dls[i].waitTicks = 0;
dls[i].waitUntilTicks = 0;
}
nextListID = 0;
@@ -273,7 +273,7 @@ int GPUCommon::ListSync(int listid, int mode) {
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
}
if (dl.waitTicks > CoreTiming::GetTicks()) {
if (dl.waitUntilTicks > CoreTiming::GetTicks()) {
__GeWaitCurrentThread(GPU_SYNC_LIST, listid, "GeListSync");
}
return PSP_GE_LIST_COMPLETED;
@@ -409,7 +409,7 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<Ps
id = possibleID;
break;
}
if (possibleList.state == PSP_GE_DL_STATE_COMPLETED && possibleList.waitTicks < currentTicks) {
if (possibleList.state == PSP_GE_DL_STATE_COMPLETED && possibleList.waitUntilTicks < currentTicks) {
id = possibleID;
}
}
@@ -432,7 +432,7 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<Ps
dl.stackptr = 0;
dl.signal = PSP_GE_SIGNAL_NONE;
dl.interrupted = false;
dl.waitTicks = (u64)-1;
dl.waitUntilTicks = (u64)-1;
dl.interruptsEnabled = interruptsEnabled_;
dl.started = false;
dl.offsetAddr = 0;
@@ -489,7 +489,7 @@ u32 GPUCommon::DequeueList(int listid) {
else
dlQueue.remove(listid);
dl.waitTicks = 0;
dl.waitUntilTicks = 0;
__GeTriggerWait(GPU_SYNC_LIST, listid);
CheckDrawSync();
@@ -1176,9 +1176,9 @@ void GPUCommon::Execute_End(u32 op, u32 diff) {
currentList->pendingInterrupt = true;
} else {
currentList->state = PSP_GE_DL_STATE_COMPLETED;
currentList->waitTicks = startingTicks + cyclesExecuted;
busyTicks = std::max(busyTicks, currentList->waitTicks);
__GeTriggerSync(GPU_SYNC_LIST, currentList->id, currentList->waitTicks);
currentList->waitUntilTicks = startingTicks + cyclesExecuted;
busyTicks = std::max(busyTicks, currentList->waitUntilTicks);
__GeTriggerSync(GPU_SYNC_LIST, currentList->id, currentList->waitUntilTicks);
}
break;
}
@@ -1419,7 +1419,7 @@ struct DisplayList_v1 {
DisplayListStackEntry stack[32];
int stackptr;
bool interrupted;
u64 waitTicks;
u64 waitUntilTicks;
bool interruptsEnabled;
bool pendingInterrupt;
bool started;
@@ -1440,7 +1440,7 @@ struct DisplayList_v2 {
DisplayListStackEntry stack[32];
int stackptr;
bool interrupted;
u64 waitTicks;
u64 waitUntilTicks;
bool interruptsEnabled;
bool pendingInterrupt;
bool started;
@@ -1547,7 +1547,7 @@ void GPUCommon::InterruptEnd(int listid) {
gstate.Restore(dl.context);
ReapplyGfxState();
}
dl.waitTicks = 0;
dl.waitUntilTicks = 0;
__GeTriggerWait(GPU_SYNC_LIST, listid);
// Make sure the list isn't still queued since it's now completed.
+2 -2
View File
@@ -125,7 +125,7 @@ struct DisplayList {
DisplayListStackEntry stack[32];
int stackptr;
bool interrupted;
u64 waitTicks;
u64 waitUntilTicks;
bool interruptsEnabled;
bool pendingInterrupt;
bool started;
@@ -371,7 +371,7 @@ public:
s64 GetListTicks(int listid) const {
if (listid >= 0 && listid < DisplayListMaxCount) {
return dls[listid].waitTicks;
return dls[listid].waitUntilTicks;
}
return -1;
}
+5
View File
@@ -860,7 +860,11 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
}
ImGui::Separator();
ImGui::MenuItem("Ignore bad memory accesses", nullptr, &g_Config.bIgnoreBadMemAccess);
ImGui::MenuItem("Break on frame timeout", nullptr, &g_Config.bBreakOnFrameTimeout);
ImGui::MenuItem("Don't break on start", nullptr, &g_Config.bAutoRun); // should really invert this bool!
ImGui::MenuItem("Fast memory", nullptr, &g_Config.bFastMemory);
ImGui::Separator();
/*
// Symbol stuff. Move to separate menu?
// Doesn't quite seem to work yet.
@@ -891,6 +895,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
if (ImGui::MenuItem("Take screenshot")) {
g_TakeScreenshot = true;
}
ImGui::MenuItem("Save screenshot as .png", nullptr, &g_Config.bScreenshotsAsPNG);
if (ImGui::MenuItem("Restart graphics")) {
System_PostUIMessage(UIMessage::RESTART_GRAPHICS);
}