summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-09-21 03:19:28 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:23 +0100
commit8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59 (patch)
treec2081b25cc641cc64038a01570283b82b03b6c3b
parentsettings: Cleanup settings (diff)
downloadyuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar.gz
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar.bz2
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar.lz
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar.xz
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.tar.zst
yuzu-8fff6d6c67dbdaed8be639b0daeb9afdf8e53d59.zip
-rw-r--r--src/yuzu/applets/qt_controller.cpp6
-rw-r--r--src/yuzu/applets/qt_controller.h5
-rw-r--r--src/yuzu/applets/qt_software_keyboard.cpp91
-rw-r--r--src/yuzu/applets/qt_software_keyboard.h12
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp3
5 files changed, 68 insertions, 49 deletions
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index bf8445a89..4dd577a18 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -6,8 +6,11 @@
#include <thread>
#include "common/assert.h"
+#include "common/param_package.h"
#include "common/string_util.h"
#include "core/core.h"
+#include "core/hid/emulated_controller.h
+#include "core/hid/hid_types.h
#include "core/hle/lock.h"
#include "core/hle/service/hid/controllers/npad.h"
#include "core/hle/service/hid/hid.h"
@@ -48,7 +51,8 @@ void UpdateController(Settings::ControllerType controller_type, std::size_t npad
->GetAppletResource()
->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
- npad.UpdateControllerAt(npad.MapSettingsTypeToNPad(controller_type), npad_index, connected);
+ npad.UpdateControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(controller_type),
+ npad_index, connected);
}
// Returns true if the given controller type is compatible with the given parameters.
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h
index 037325f50..98060e6f8 100644
--- a/src/yuzu/applets/qt_controller.h
+++ b/src/yuzu/applets/qt_controller.h
@@ -31,6 +31,10 @@ namespace Ui {
class QtControllerSelectorDialog;
}
+namespace Core {
+class System;
+}
+
class QtControllerSelectorDialog final : public QDialog {
Q_OBJECT
@@ -102,6 +106,7 @@ private:
Core::Frontend::ControllerParameters parameters;
InputCommon::InputSubsystem* input_subsystem;
+ Core::System& system;
std::unique_ptr<InputProfiles> input_profiles;
diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp
index a83a11a95..7e8731232 100644
--- a/src/yuzu/applets/qt_software_keyboard.cpp
+++ b/src/yuzu/applets/qt_software_keyboard.cpp
@@ -10,7 +10,8 @@
#include "common/settings.h"
#include "common/string_util.h"
#include "core/core.h"
-#include "core/frontend/input_interpreter.h"
+#include "core/hid/hid_types.h"
+#include "core/hid/input_interpreter.h"
#include "ui_qt_software_keyboard.h"
#include "yuzu/applets/qt_software_keyboard.h"
#include "yuzu/main.h"
@@ -484,7 +485,7 @@ void QtSoftwareKeyboardDialog::open() {
void QtSoftwareKeyboardDialog::reject() {
// Pressing the ESC key in a dialog calls QDialog::reject().
// We will override this behavior to the "Cancel" action on the software keyboard.
- TranslateButtonPress(HIDButton::X);
+ TranslateButtonPress(Core::HID::NpadButton::X);
}
void QtSoftwareKeyboardDialog::keyPressEvent(QKeyEvent* event) {
@@ -722,7 +723,7 @@ void QtSoftwareKeyboardDialog::SetTextDrawType() {
connect(
ui->line_edit_osk, &QLineEdit::returnPressed, this,
- [this] { TranslateButtonPress(HIDButton::Plus); }, Qt::QueuedConnection);
+ [this] { TranslateButtonPress(Core::HID::NpadButton::Plus); }, Qt::QueuedConnection);
ui->line_edit_osk->setPlaceholderText(
QString::fromStdU16String(initialize_parameters.guide_text));
@@ -1208,9 +1209,9 @@ void QtSoftwareKeyboardDialog::SetupMouseHover() {
}
}
-template <HIDButton... T>
+template <Core::HID::NpadButton... T>
void QtSoftwareKeyboardDialog::HandleButtonPressedOnce() {
- const auto f = [this](HIDButton button) {
+ const auto f = [this](Core::HID::NpadButton button) {
if (input_interpreter->IsButtonPressedOnce(button)) {
TranslateButtonPress(button);
}
@@ -1219,9 +1220,9 @@ void QtSoftwareKeyboardDialog::HandleButtonPressedOnce() {
(f(T), ...);
}
-template <HIDButton... T>
+template <Core::HID::NpadButton... T>
void QtSoftwareKeyboardDialog::HandleButtonHold() {
- const auto f = [this](HIDButton button) {
+ const auto f = [this](Core::HID::NpadButton button) {
if (input_interpreter->IsButtonHeld(button)) {
TranslateButtonPress(button);
}
@@ -1230,9 +1231,9 @@ void QtSoftwareKeyboardDialog::HandleButtonHold() {
(f(T), ...);
}
-void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
+void QtSoftwareKeyboardDialog::TranslateButtonPress(Core::HID::NpadButton button) {
switch (button) {
- case HIDButton::A:
+ case Core::HID::NpadButton::A:
switch (bottom_osk_index) {
case BottomOSKIndex::LowerCase:
case BottomOSKIndex::UpperCase:
@@ -1245,7 +1246,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
break;
}
break;
- case HIDButton::B:
+ case Core::HID::NpadButton::B:
switch (bottom_osk_index) {
case BottomOSKIndex::LowerCase:
ui->button_backspace->click();
@@ -1260,7 +1261,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
break;
}
break;
- case HIDButton::X:
+ case Core::HID::NpadButton::X:
if (is_inline) {
emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
} else {
@@ -1271,7 +1272,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
emit SubmitNormalText(SwkbdResult::Cancel, std::move(text));
}
break;
- case HIDButton::Y:
+ case Core::HID::NpadButton::Y:
switch (bottom_osk_index) {
case BottomOSKIndex::LowerCase:
ui->button_space->click();
@@ -1284,8 +1285,8 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
break;
}
break;
- case HIDButton::LStick:
- case HIDButton::RStick:
+ case Core::HID::NpadButton::StickL:
+ case Core::HID::NpadButton::StickR:
switch (bottom_osk_index) {
case BottomOSKIndex::LowerCase:
ui->button_shift->click();
@@ -1298,13 +1299,13 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
break;
}
break;
- case HIDButton::L:
+ case Core::HID::NpadButton::L:
MoveTextCursorDirection(Direction::Left);
break;
- case HIDButton::R:
+ case Core::HID::NpadButton::R:
MoveTextCursorDirection(Direction::Right);
break;
- case HIDButton::Plus:
+ case Core::HID::NpadButton::Plus:
switch (bottom_osk_index) {
case BottomOSKIndex::LowerCase:
ui->button_ok->click();
@@ -1319,24 +1320,24 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
break;
}
break;
- case HIDButton::DLeft:
- case HIDButton::LStickLeft:
- case HIDButton::RStickLeft:
+ case Core::HID::NpadButton::Left:
+ case Core::HID::NpadButton::StickLLeft:
+ case Core::HID::NpadButton::StickRLeft:
MoveButtonDirection(Direction::Left);
break;
- case HIDButton::DUp:
- case HIDButton::LStickUp:
- case HIDButton::RStickUp:
+ case Core::HID::NpadButton::Up:
+ case Core::HID::NpadButton::StickLUp:
+ case Core::HID::NpadButton::StickRUp:
MoveButtonDirection(Direction::Up);
break;
- case HIDButton::DRight:
- case HIDButton::LStickRight:
- case HIDButton::RStickRight:
+ case Core::HID::NpadButton::Right:
+ case Core::HID::NpadButton::StickLRight:
+ case Core::HID::NpadButton::StickRRight:
MoveButtonDirection(Direction::Right);
break;
- case HIDButton::DDown:
- case HIDButton::LStickDown:
- case HIDButton::RStickDown:
+ case Core::HID::NpadButton::Down:
+ case Core::HID::NpadButton::StickLDown:
+ case Core::HID::NpadButton::StickRDown:
MoveButtonDirection(Direction::Down);
break;
default:
@@ -1467,19 +1468,25 @@ void QtSoftwareKeyboardDialog::InputThread() {
while (input_thread_running) {
input_interpreter->PollInput();
- HandleButtonPressedOnce<HIDButton::A, HIDButton::B, HIDButton::X, HIDButton::Y,
- HIDButton::LStick, HIDButton::RStick, HIDButton::L, HIDButton::R,
- HIDButton::Plus, HIDButton::DLeft, HIDButton::DUp,
- HIDButton::DRight, HIDButton::DDown, HIDButton::LStickLeft,
- HIDButton::LStickUp, HIDButton::LStickRight, HIDButton::LStickDown,
- HIDButton::RStickLeft, HIDButton::RStickUp, HIDButton::RStickRight,
- HIDButton::RStickDown>();
-
- HandleButtonHold<HIDButton::B, HIDButton::L, HIDButton::R, HIDButton::DLeft, HIDButton::DUp,
- HIDButton::DRight, HIDButton::DDown, HIDButton::LStickLeft,
- HIDButton::LStickUp, HIDButton::LStickRight, HIDButton::LStickDown,
- HIDButton::RStickLeft, HIDButton::RStickUp, HIDButton::RStickRight,
- HIDButton::RStickDown>();
+ HandleButtonPressedOnce<
+ Core::HID::NpadButton::A, Core::HID::NpadButton::B, Core::HID::NpadButton::X,
+ Core::HID::NpadButton::Y, Core::HID::NpadButton::StickL, Core::HID::NpadButton::StickR,
+ Core::HID::NpadButton::L, Core::HID::NpadButton::R, Core::HID::NpadButton::Plus,
+ Core::HID::NpadButton::Left, Core::HID::NpadButton::Up, Core::HID::NpadButton::Right,
+ Core::HID::NpadButton::Down, Core::HID::NpadButton::StickLLeft,
+ Core::HID::NpadButton::StickLUp, Core::HID::NpadButton::StickLRight,
+ Core::HID::NpadButton::StickLDown, Core::HID::NpadButton::StickRLeft,
+ Core::HID::NpadButton::StickRUp, Core::HID::NpadButton::StickRRight,
+ Core::HID::NpadButton::StickRDown>();
+
+ HandleButtonHold<Core::HID::NpadButton::B, Core::HID::NpadButton::L,
+ Core::HID::NpadButton::R, Core::HID::NpadButton::Left,
+ Core::HID::NpadButton::Up, Core::HID::NpadButton::Right,
+ Core::HID::NpadButton::Down, Core::HID::NpadButton::StickLLeft,
+ Core::HID::NpadButton::StickLUp, Core::HID::NpadButton::StickLRight,
+ Core::HID::NpadButton::StickLDown, Core::HID::NpadButton::StickRLeft,
+ Core::HID::NpadButton::StickRUp, Core::HID::NpadButton::StickRRight,
+ Core::HID::NpadButton::StickRDown>();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
diff --git a/src/yuzu/applets/qt_software_keyboard.h b/src/yuzu/applets/qt_software_keyboard.h
index 592d9c085..b030cdcf7 100644
--- a/src/yuzu/applets/qt_software_keyboard.h
+++ b/src/yuzu/applets/qt_software_keyboard.h
@@ -14,14 +14,16 @@
#include "core/frontend/applets/software_keyboard.h"
-enum class HIDButton : u8;
-
class InputInterpreter;
namespace Core {
class System;
}
+namespace Core::HID {
+enum class NpadButton : u64;
+}
+
namespace Ui {
class QtSoftwareKeyboardDialog;
}
@@ -146,7 +148,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();
/**
@@ -154,7 +156,7 @@ private:
*
* @tparam HIDButton The list of buttons that can be converted into keyboard input.
*/
- template <HIDButton... T>
+ template <Core::HID::NpadButton... T>
void HandleButtonHold();
/**
@@ -162,7 +164,7 @@ private:
*
* @param button The button press to process.
*/
- void TranslateButtonPress(HIDButton button);
+ void TranslateButtonPress(Core::HID::NpadButton button);
/**
* Moves the focus of a button in a certain direction.
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp
index 24d72a496..8e190f9fe 100644
--- a/src/yuzu/applets/qt_web_browser.cpp
+++ b/src/yuzu/applets/qt_web_browser.cpp
@@ -14,9 +14,10 @@
#endif
#include "common/fs/path_util.h"
+#include "common/param_package.h"
#include "core/core.h"
#include "core/hid/input_interpreter.h"
-#include "input_common/keyboard.h"
+#include "input_common/drivers/keyboard.h"
#include "input_common/main.h"
#include "yuzu/applets/qt_web_browser.h"
#include "yuzu/applets/qt_web_browser_scripts.h"