From ea4ec28acc1eaf9eabe5cd6b068c08fcf6a73b52 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 25 Jul 2015 12:34:15 -0700 Subject: [PATCH] Adding --show_profiler to show profiler by default, changing hotkey to F3. --- src/xenia/app/emulator_window.cc | 6 +++++- src/xenia/kernel/xboxkrnl_io.cc | 6 +++--- src/xenia/profiling.cc | 8 +++++++- src/xenia/xbox.h | 6 +++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 0acd6e2ab..eda77b866 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -80,6 +80,10 @@ bool EmulatorWindow::Initialize() { CpuTimeScalarSetDouble(); } break; + case 0x72: { // F3 + Profiler::ToggleDisplay(); + } break; + case 0x73: { // VK_F4 GpuTraceFrame(); } break; @@ -135,7 +139,7 @@ bool EmulatorWindow::Initialize() { cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator)); { cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, - L"Toggle Profiler &Display", L"Tab", + L"Toggle Profiler &Display", L"F3", []() { Profiler::ToggleDisplay(); })); cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, L"&Pause/Resume Profiler", L"`", diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index 3d4434713..e8729c9f7 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -619,9 +619,9 @@ dword_result_t NtQueryDirectoryFile( file_name ? file_name->to_string(kernel_memory()->virtual_membase()) : ""; if (file) { X_FILE_DIRECTORY_INFORMATION dir_info = {0}; - result = file->QueryDirectory( - file_info_ptr, length, !name.empty() ? name.c_str() : nullptr, - restart_scan != 0); + result = file->QueryDirectory(file_info_ptr, length, + !name.empty() ? name.c_str() : nullptr, + restart_scan != 0); if (XSUCCEEDED(result)) { info = length; } diff --git a/src/xenia/profiling.cc b/src/xenia/profiling.cc index 468170bef..2c099ff8b 100644 --- a/src/xenia/profiling.cc +++ b/src/xenia/profiling.cc @@ -9,6 +9,8 @@ #include "xenia/base/logging.h" +#include + #define MICROPROFILE_ENABLED 1 #define MICROPROFILEUI_ENABLED 1 #define MICROPROFILE_IMPL 1 @@ -27,6 +29,8 @@ #include "xenia/profiling.h" +DEFINE_bool(show_profiler, false, "Show profiling UI by default."); + namespace xe { std::unique_ptr Profiler::display_ = nullptr; @@ -57,7 +61,9 @@ void Profiler::Initialize() { g_MicroProfileUI.bShowSpikes = true; g_MicroProfileUI.nOpacityBackground = 0x40u << 24; g_MicroProfileUI.nOpacityForeground = 0xc0u << 24; - MicroProfileSetDisplayMode(1); + if (FLAGS_show_profiler) { + MicroProfileSetDisplayMode(1); + } #else MicroProfileSetForceEnable(true); MicroProfileSetEnableAllGroups(true); diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index aa2724913..8a4990fa4 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -363,9 +363,9 @@ struct X_EX_TITLE_TERMINATE_REGISTRATION { static_assert_size(X_EX_TITLE_TERMINATE_REGISTRATION, 16); struct X_OBJECT_ATTRIBUTES { - xe::be root_directory; // 0x0 - xe::be name_ptr; // 0x4 PANSI_STRING - xe::be attributes; // 0xC + xe::be root_directory; // 0x0 + xe::be name_ptr; // 0x4 PANSI_STRING + xe::be attributes; // 0xC }; #pragma pack(pop)