summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-09-21 03:50:32 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:24 +0100
commit1b82d5bb4f9440603e7af0af6abed7968aef37e4 (patch)
treec3115732bad334e652ee138e8edb559a1a2decce
parentcore/frontend: Update applets (diff)
downloadyuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar.gz
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar.bz2
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar.lz
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar.xz
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.tar.zst
yuzu-1b82d5bb4f9440603e7af0af6abed7968aef37e4.zip
-rw-r--r--src/yuzu/util/overlay_dialog.cpp27
-rw-r--r--src/yuzu/util/overlay_dialog.h10
2 files changed, 21 insertions, 16 deletions
diff --git a/src/yuzu/util/overlay_dialog.cpp b/src/yuzu/util/overlay_dialog.cpp
index 95b148545..c66dfbdff 100644
--- a/src/yuzu/util/overlay_dialog.cpp
+++ b/src/yuzu/util/overlay_dialog.cpp
@@ -6,7 +6,8 @@
#include <QScreen>
#include "core/core.h"
-#include "core/frontend/input_interpreter.h"
+#include "core/hid/hid_types.h"
+#include "core/hid/input_interpreter.h"
#include "ui_overlay_dialog.h"
#include "yuzu/util/overlay_dialog.h"
@@ -179,9 +180,9 @@ void OverlayDialog::MoveAndResizeWindow() {
QDialog::resize(width, height);
}
-template <HIDButton... T>
+template <Core::HID::NpadButton... T>
void OverlayDialog::HandleButtonPressedOnce() {
- const auto f = [this](HIDButton button) {
+ const auto f = [this](Core::HID::NpadButton button) {
if (input_interpreter->IsButtonPressedOnce(button)) {
TranslateButtonPress(button);
}
@@ -190,7 +191,7 @@ void OverlayDialog::HandleButtonPressedOnce() {
(f(T), ...);
}
-void OverlayDialog::TranslateButtonPress(HIDButton button) {
+void OverlayDialog::TranslateButtonPress(Core::HID::NpadButton button) {
QPushButton* left_button = use_rich_text ? ui->button_cancel_rich : ui->button_cancel;
QPushButton* right_button = use_rich_text ? ui->button_ok_rich : ui->button_ok_label;
@@ -198,20 +199,20 @@ void OverlayDialog::TranslateButtonPress(HIDButton button) {
// TODO (Morph): focusPrevious/NextChild() doesn't work well with the rich text dialog, fix it
switch (button) {
- case HIDButton::A:
- case HIDButton::B:
+ case Core::HID::NpadButton::A:
+ case Core::HID::NpadButton::B:
if (left_button->hasFocus()) {
left_button->click();
} else if (right_button->hasFocus()) {
right_button->click();
}
break;
- case HIDButton::DLeft:
- case HIDButton::LStickLeft:
+ case Core::HID::NpadButton::Left:
+ case Core::HID::NpadButton::StickLLeft:
focusPreviousChild();
break;
- case HIDButton::DRight:
- case HIDButton::LStickRight:
+ case Core::HID::NpadButton::Right:
+ case Core::HID::NpadButton::StickLRight:
focusNextChild();
break;
default:
@@ -241,8 +242,10 @@ void OverlayDialog::InputThread() {
while (input_thread_running) {
input_interpreter->PollInput();
- HandleButtonPressedOnce<HIDButton::A, HIDButton::B, HIDButton::DLeft, HIDButton::DRight,
- HIDButton::LStickLeft, HIDButton::LStickRight>();
+ HandleButtonPressedOnce<Core::HID::NpadButton::A, Core::HID::NpadButton::B,
+ Core::HID::NpadButton::Left, Core::HID::NpadButton::Right,
+ Core::HID::NpadButton::StickLLeft,
+ Core::HID::NpadButton::StickLRight>();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
diff --git a/src/yuzu/util/overlay_dialog.h b/src/yuzu/util/overlay_dialog.h
index e8c388bd0..d8a140ff3 100644
--- a/src/yuzu/util/overlay_dialog.h
+++ b/src/yuzu/util/overlay_dialog.h
@@ -13,14 +13,16 @@
#include "common/common_types.h"
-enum class HIDButton : u8;
-
class InputInterpreter;
namespace Core {
class System;
}
+namespace Core::HID {
+enum class NpadButton : u64;
+}
+
namespace Ui {
class OverlayDialog;
}
@@ -79,7 +81,7 @@ private:
*
* @tparam HIDButton The list of buttons that can be converted into keyboard input.
*/
- template <HIDButton... T>
+ template <Core::HID::NpadButton... T>
void HandleButtonPressedOnce();
/**
@@ -87,7 +89,7 @@ private:
*
* @param button The button press to process.
*/
- void TranslateButtonPress(HIDButton button);
+ void TranslateButtonPress(Core::HID::NpadButton button);
void StartInputThread();
void StopInputThread();