From 822ebf9dfbbc41f97428330b61356ebeb2bf71a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:40:38 +0100 Subject: [PATCH 1/5] Use the correct culling function in the fast draw-continuation loop --- GPU/GPUCommonHW.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 2c1eba7f4da7..2e20702f6b7e 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1086,7 +1086,8 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { bool passCulling = onePassed || PASSES_CULLING; if (!passCulling) { // Do software culling. - if (drawEngineCommon_->TestBoundingBox(verts, inds, count, vertexType)) { + _dbg_assert_((vertexType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_NONE); + if (drawEngineCommon_->TestBoundingBoxFast(verts, count, vertexType)) { passCulling = true; } else { gpuStats.numCulledDraws++; From 49ff1af16a51c60b9f9b40fce296ca852f5064da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:44:08 +0100 Subject: [PATCH 2/5] CtrlDisplayListView: Zero the window ptr, do the delete. See #18510 --- Windows/GEDebugger/CtrlDisplayListView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Windows/GEDebugger/CtrlDisplayListView.cpp b/Windows/GEDebugger/CtrlDisplayListView.cpp index 7318beb80886..2d9e64239d32 100644 --- a/Windows/GEDebugger/CtrlDisplayListView.cpp +++ b/Windows/GEDebugger/CtrlDisplayListView.cpp @@ -77,8 +77,7 @@ LRESULT CALLBACK CtrlDisplayListView::wndProc(HWND hwnd, UINT msg, WPARAM wParam { CtrlDisplayListView *win = CtrlDisplayListView::getFrom(hwnd); - switch(msg) - { + switch(msg) { case WM_NCCREATE: // Allocate a new CustCtrl structure for this window. win = new CtrlDisplayListView(hwnd); @@ -86,6 +85,8 @@ LRESULT CALLBACK CtrlDisplayListView::wndProc(HWND hwnd, UINT msg, WPARAM wParam // Continue with window creation. return win != NULL; case WM_NCDESTROY: + SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); + delete win; break; case WM_SIZE: win->redraw(); From aeefa4a45a64588216f01d998ca9fa5b8413500c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:45:33 +0100 Subject: [PATCH 3/5] Better variable naming (foundBackgroundScreen) --- Common/UI/Screen.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index c5f1a7be7289..657aaddcca5b 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -167,14 +167,14 @@ ScreenRenderFlags ScreenManager::render() { // the EmuScreen or the actual global background screen. auto iter = stack_.end(); Screen *coveringScreen = nullptr; - Screen *backgroundScreen = nullptr; + Screen *foundBackgroundScreen = nullptr; bool first = true; do { --iter; - if (!backgroundScreen && iter->screen->canBeBackground(first)) { + if (!foundBackgroundScreen && iter->screen->canBeBackground(first)) { // There still might be a screen that wants to be background - generally the EmuScreen if present. layers.push_back(iter->screen); - backgroundScreen = iter->screen; + foundBackgroundScreen = iter->screen; } else if (!coveringScreen) { layers.push_back(iter->screen); } @@ -184,10 +184,9 @@ ScreenRenderFlags ScreenManager::render() { first = false; } while (iter != stack_.begin()); - // Confusing-looking expression, argh! Note the '_' - if (backgroundScreen_ && !backgroundScreen) { + if (backgroundScreen_ && !foundBackgroundScreen) { layers.push_back(backgroundScreen_); - backgroundScreen = backgroundScreen_; + foundBackgroundScreen = backgroundScreen_; } // OK, now we iterate backwards over our little pile of collected screens. From a094637ab1ceb348c5b51bd35af58ee4f5a13624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:46:41 +0100 Subject: [PATCH 4/5] Remove left-behind debug code --- Common/UI/ViewGroup.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 7fbb4aa7fd2d..6e6afda28c1a 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -495,10 +495,6 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v if (views_.empty()) return; - if (tag_ == "debug") { - tag_ = "debug"; - } - float sum = 0.0f; float maxOther = 0.0f; float totalWeight = 0.0f; @@ -670,10 +666,6 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v void LinearLayout::Layout() { const Bounds &bounds = bounds_; - if (tag_ == "debug") { - tag_ = "debug"; - } - Bounds itemBounds; float pos; From 99962b91e5ec7aab3a07a7e8aae982bc75541adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:52:28 +0100 Subject: [PATCH 5/5] Minor code simplification (ToMap instead of section->GetKeys) See #18442 --- Core/Config.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index a60d1dbedff2..1d97f5905095 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1893,19 +1893,14 @@ void PlayTimeTracker::Stop(const std::string &gameId) { void PlayTimeTracker::Load(const Section *section) { tracker_.clear(); - std::vector keys; - section->GetKeys(keys); - - for (auto key : keys) { - std::string value; - if (!section->Get(key.c_str(), &value, nullptr)) { - continue; - } + auto map = section->ToMap(); + for (const auto &iter : map) { + const std::string &value = iter.second; // Parse the string. PlayTime gameTime{}; if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, (long long *)&gameTime.lastTimePlayed)) { - tracker_[key] = gameTime; + tracker_[iter.first.c_str()] = gameTime; } } }