From 3a659fc724b6033b000c266c4e8310225b99bc3e Mon Sep 17 00:00:00 2001 From: Erik Abair Date: Mon, 7 Feb 2022 13:22:30 -0800 Subject: [PATCH] Allow toggle of nv2a pgraph traces via the F9 key. --- ui/xui/menubar.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/xui/menubar.cc b/ui/xui/menubar.cc index f0b6c1d5c2..3e6499a46e 100644 --- a/ui/xui/menubar.cc +++ b/ui/xui/menubar.cc @@ -29,6 +29,10 @@ #include "update.hh" #include "../xemu-os-utils.h" +extern "C" { +#include "trace/control.h" +} + extern float g_main_menu_height; // FIXME #ifdef CONFIG_RENDERDOC @@ -71,6 +75,16 @@ void ProcessKeyboardShortcuts(void) ActionScreenshot(); } + if (ImGui::IsKeyPressed(ImGuiKey_F9)) { + // TODO: Look up current state of nv2a traces and init this var. + static bool pgraph_trace_state = false; + pgraph_trace_state = !pgraph_trace_state; + static const char *nv2a_pgraph_enable = "nv2a_pgraph_*"; + static const char *nv2a_pgraph_disable = "-nv2a_pgraph_*"; + trace_enable_events(pgraph_trace_state ? nv2a_pgraph_enable : + nv2a_pgraph_disable); + } + #ifdef CONFIG_RENDERDOC if (ImGui::IsKeyPressed(ImGuiKey_F10) && nv2a_dbg_renderdoc_available()) { nv2a_dbg_renderdoc_capture_frames(1);