Improve checks

This commit is contained in:
Henrik Rydgård 2023-12-18 09:12:44 +01:00
parent b2729507a1
commit 02eb10649d
4 changed files with 11 additions and 9 deletions

View file

@ -248,7 +248,9 @@ void GPU_GLES::BeginHostFrame() {
textureCache_->StartFrame(); textureCache_->StartFrame();
// Save the cache from time to time. TODO: How often? We save on exit, so shouldn't need to do this all that often. // Save the cache from time to time. TODO: How often? We save on exit, so shouldn't need to do this all that often.
if (shaderCachePath_.Valid() && (gpuStats.numFlips & 32767) == 0 && coreState == CORE_RUNNING) {
const int saveShaderCacheFrameInterval = 32767; // power of 2 - 1. About every 10 minutes at 60fps.
if (shaderCachePath_.Valid() && !(gpuStats.numFlips & saveShaderCacheFrameInterval) && coreState == CORE_RUNNING) {
shaderManagerGL_->SaveCache(shaderCachePath_, &drawEngine_); shaderManagerGL_->SaveCache(shaderCachePath_, &drawEngine_);
} }
shaderManagerGL_->DirtyLastShader(); shaderManagerGL_->DirtyLastShader();

View file

@ -279,7 +279,7 @@ void CtrlDisplayListView::PromptBreakpointCond() {
void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{ {
if (!validDisplayList) { if (!validDisplayList || !gpuDebug) {
return; return;
} }
@ -310,7 +310,7 @@ void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
{ {
if (!validDisplayList) { if (!validDisplayList || !gpuDebug) {
return; return;
} }
@ -319,12 +319,6 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
HMENU menu = GetContextMenu(ContextMenuID::DISPLAYLISTVIEW); HMENU menu = GetContextMenu(ContextMenuID::DISPLAYLISTVIEW);
EnableMenuItem(menu, ID_GEDBG_SETCOND, GPUBreakpoints::IsAddressBreakpoint(curAddress) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(menu, ID_GEDBG_SETCOND, GPUBreakpoints::IsAddressBreakpoint(curAddress) ? MF_ENABLED : MF_GRAYED);
// We don't want to let the users play with deallocated or uninitialized debugging objects
GlobalUIState state = GetUIState();
if (state != UISTATE_INGAME && state != UISTATE_PAUSEMENU) {
return;
}
switch (TriggerContextMenu(ContextMenuID::DISPLAYLISTVIEW, wnd, ContextPoint::FromEvent(lParam))) switch (TriggerContextMenu(ContextMenuID::DISPLAYLISTVIEW, wnd, ContextPoint::FromEvent(lParam)))
{ {
case ID_DISASM_GOTOINMEMORYVIEW: case ID_DISASM_GOTOINMEMORYVIEW:

View file

@ -56,6 +56,10 @@ public:
list = displayList; list = displayList;
gotoAddr(list.pc); gotoAddr(list.pc);
} }
void clearDisplayList()
{
validDisplayList = false;
}
void scrollWindow(int lines) void scrollWindow(int lines)
{ {

View file

@ -87,6 +87,8 @@ static void UpdateDisplayListTab(GEDebuggerTab *tab, TabControl *tabs, GETabPosi
DisplayList list; DisplayList list;
if (gpuDebug != nullptr && gpuDebug->GetCurrentDisplayList(list)) { if (gpuDebug != nullptr && gpuDebug->GetCurrentDisplayList(list)) {
view->setDisplayList(list); view->setDisplayList(list);
} else {
view->clearDisplayList();
} }
} }