Skip to content

Commit

Permalink
Undo revert [UI/HID] ui::VirtualKey enum
Browse files Browse the repository at this point in the history
Undo reverting of commit [UI/HID] ui::VirtualKey enum

Minor clean up of some files to match base branch.
  • Loading branch information
AdrianCassar committed Dec 27, 2023
1 parent 4607ac1 commit f82822f
Show file tree
Hide file tree
Showing 24 changed files with 328 additions and 523 deletions.
43 changes: 0 additions & 43 deletions appveyor.yml

This file was deleted.

44 changes: 0 additions & 44 deletions azure-pipelines.yml

This file was deleted.

38 changes: 19 additions & 19 deletions src/xenia/app/emulator_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,41 +789,41 @@ void EmulatorWindow::OnKeyDown(ui::KeyEvent& e) {
return;
}

switch (e.key_code()) {
case 0x4F: { // o
switch (e.virtual_key()) {
case ui::VirtualKey::kO: {
if (!e.is_ctrl_pressed()) {
return;
}
FileOpen();
} break;
case 0x6A: { // numpad *
case ui::VirtualKey::kMultiply: {
CpuTimeScalarReset();
} break;
case 0x6D: { // numpad minus
case ui::VirtualKey::kSubtract: {
CpuTimeScalarSetHalf();
} break;
case 0x6B: { // numpad plus
case ui::VirtualKey::kAdd: {
CpuTimeScalarSetDouble();
} break;

case 0x72: { // F3
case ui::VirtualKey::kF3: {
Profiler::ToggleDisplay();
} break;

case 0x73: { // VK_F4
case ui::VirtualKey::kF4: {
GpuTraceFrame();
} break;
case 0x74: { // VK_F5
case ui::VirtualKey::kF5: {
GpuClearCaches();
} break;

case 0x75: { // VK_F6
case ui::VirtualKey::kF6: {
ToggleDisplayConfigDialog();
} break;
case 0x7A: { // VK_F11
case ui::VirtualKey::kF11: {
ToggleFullscreen();
} break;
case 0x1B: { // VK_ESCAPE
case ui::VirtualKey::kEscape: {
// Allow users to escape fullscreen (but not enter it).
if (!window_->IsFullscreen()) {
return;
Expand All @@ -832,36 +832,36 @@ void EmulatorWindow::OnKeyDown(ui::KeyEvent& e) {
} break;

#ifdef DEBUG
case 0x76: { // VK_F7
case ui::VirtualKey::kF7: {
// Save to file
// TODO: Choose path based on user input, or from options
// TODO: Spawn a new thread to do this.
emulator()->SaveToFile("test.sav");
} break;
case 0x77: { // VK_F8
case ui::VirtualKey::kF8: {
// Restore from file
// TODO: Choose path from user
// TODO: Spawn a new thread to do this.
emulator()->RestoreFromFile("test.sav");
} break;
#endif // #ifdef DEBUG

case 0x13: { // VK_PAUSE
case ui::VirtualKey::kPause: {
CpuBreakIntoDebugger();
} break;
case 0x03: { // VK_CANCEL
case ui::VirtualKey::kCancel: {
CpuBreakIntoHostDebugger();
} break;

case 0x70: { // VK_F1
case ui::VirtualKey::kF1: {
ShowFAQ();
} break;

case 0x71: { // VK_F2
ShowBuildCommit();
case ui::VirtualKey::kF2: {
ShowBuildCommit();
} break;

case 0x78: { // VK_F9
case ui::VirtualKey::kF9: {
RunPreviouslyPlayedTitle();
} break;

Expand Down
23 changes: 12 additions & 11 deletions src/xenia/base/profiling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "xenia/base/cvar.h"
#include "xenia/base/profiling.h"
#include "xenia/ui/ui_event.h"
#include "xenia/ui/virtual_key.h"
#include "xenia/ui/window.h"

#if XE_OPTION_PROFILING
Expand Down Expand Up @@ -127,18 +128,18 @@ void Profiler::ThreadEnter(const char* name) {

void Profiler::ThreadExit() { MicroProfileOnThreadExit(); }

void Profiler::ProfilerWindowInputListener::OnKeyDown(ui::KeyEvent& e, int key_code) {
void Profiler::ProfilerWindowInputListener::OnKeyDown(ui::KeyEvent& e) {
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
bool handled = true;
switch (key_code) {
case VK_OEM_3: // `
switch (e.virtual_key()) {
case ui::VirtualKey::kOem3: // `
MicroProfileTogglePause();
break;
#if XE_OPTION_PROFILING_UI
case VK_TAB:
case ui::VirtualKey::kTab:
ToggleDisplay();
break;
case 0x31: // 1
case ui::VirtualKey::k1:
MicroProfileModKey(1);
break;
#endif // XE_OPTION_PROFILING_UI
Expand All @@ -152,11 +153,11 @@ void Profiler::ProfilerWindowInputListener::OnKeyDown(ui::KeyEvent& e, int key_c
PostInputEvent();
}

void Profiler::ProfilerWindowInputListener::OnKeyUp(ui::KeyEvent& e, int key_code) {
void Profiler::ProfilerWindowInputListener::OnKeyUp(ui::KeyEvent& e) {
bool handled = true;
switch (key_code) {
switch (e.virtual_key()) {
#if XE_OPTION_PROFILING_UI
case 0x31: // 1
case ui::VirtualKey::k1:
MicroProfileModKey(0);
break;
#endif // XE_OPTION_PROFILING_UI
Expand Down Expand Up @@ -271,7 +272,7 @@ void Profiler::SetUserIO(size_t z_order, ui::Window* window,
#endif // XE_OPTION_PROFILING_UI
}

// Pass through mouse events.
// Pass through mouse events.
window_->on_mouse_down.AddListener([](ui::MouseEvent& e) {
if (Profiler::is_visible()) {
Profiler::ProfilerWindowInputListener::OnMouseDown(e);
Expand Down Expand Up @@ -300,13 +301,13 @@ void Profiler::SetUserIO(size_t z_order, ui::Window* window,
// Watch for toggle/mode keys and such.
window_->on_key_down.AddListener([](ui::KeyEvent& e) {
if (Profiler::is_visible()) {
Profiler::ProfilerWindowInputListener::OnKeyDown(e, e.key_code());
Profiler::ProfilerWindowInputListener::OnKeyDown(e);
e.set_handled(true);
}
});
window_->on_key_up.AddListener([](ui::KeyEvent& e) {
if (Profiler::is_visible()) {
Profiler::ProfilerWindowInputListener::OnKeyUp(e, e.key_code());
Profiler::ProfilerWindowInputListener::OnKeyUp(e);
e.set_handled(true);
}
});
Expand Down
5 changes: 3 additions & 2 deletions src/xenia/base/profiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "xenia/base/platform.h"
#include "xenia/base/string.h"
#include "xenia/ui/ui_drawer.h"
#include "xenia/ui/virtual_key.h"
#include "xenia/ui/window_listener.h"

#if XE_PLATFORM_WIN32
Expand Down Expand Up @@ -203,8 +204,8 @@ class Profiler {
#if XE_OPTION_PROFILING
class ProfilerWindowInputListener final : public ui::WindowInputListener {
public:
static void OnKeyDown(ui::KeyEvent& e, int key_code);
static void OnKeyUp(ui::KeyEvent& e, int key_code);
static void OnKeyDown(ui::KeyEvent& e);
static void OnKeyUp(ui::KeyEvent& e);
#if XE_OPTION_PROFILING_UI
static void OnMouseDown(ui::MouseEvent& e);
static void OnMouseMove(ui::MouseEvent& e);
Expand Down
5 changes: 3 additions & 2 deletions src/xenia/gpu/trace_viewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "xenia/ui/immediate_drawer.h"
#include "xenia/ui/presenter.h"
#include "xenia/ui/ui_event.h"
#include "xenia/ui/virtual_key.h"
#include "xenia/ui/window.h"
#include "xenia/ui/windowed_app_context.h"
#include "xenia/xbox.h"
Expand Down Expand Up @@ -167,8 +168,8 @@ void TraceViewer::TraceViewerWindowListener::OnClosing(xe::ui::UIEvent& e) {
}

void TraceViewer::TraceViewerWindowListener::OnKeyDown(xe::ui::KeyEvent& e) {
switch (e.key_code()) {
case 0x74: /* VK_F5 */
switch (e.virtual_key()) {
case xe::ui::VirtualKey::kF5:
trace_viewer_.graphics_system_->ClearCaches();
break;
default:
Expand Down
Loading

0 comments on commit f82822f

Please sign in to comment.