summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
6#include <thread> 6#include <thread>
7 7
8#include "common/assert.h" 8#include "common/assert.h"
9#include "common/param_package.h"
9#include "common/string_util.h" 10#include "common/string_util.h"
10#include "core/core.h" 11#include "core/core.h"
12#include "core/hid/emulated_controller.h
13#include "core/hid/hid_types.h
11#include "core/hle/lock.h" 14#include "core/hle/lock.h"
12#include "core/hle/service/hid/controllers/npad.h" 15#include "core/hle/service/hid/controllers/npad.h"
13#include "core/hle/service/hid/hid.h" 16#include "core/hle/service/hid/hid.h"
@@ -48,7 +51,8 @@ void UpdateController(Settings::ControllerType controller_type, std::size_t npad
48 ->GetAppletResource() 51 ->GetAppletResource()
49 ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); 52 ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
50 53
51 npad.UpdateControllerAt(npad.MapSettingsTypeToNPad(controller_type), npad_index, connected); 54 npad.UpdateControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(controller_type),
55 npad_index, connected);
52} 56}
53 57
54// Returns true if the given controller type is compatible with the given parameters. 58// 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 {
31class QtControllerSelectorDialog; 31class QtControllerSelectorDialog;
32} 32}
33 33
34namespace Core {
35class System;
36}
37
34class QtControllerSelectorDialog final : public QDialog { 38class QtControllerSelectorDialog final : public QDialog {
35 Q_OBJECT 39 Q_OBJECT
36 40
@@ -102,6 +106,7 @@ private:
102 Core::Frontend::ControllerParameters parameters; 106 Core::Frontend::ControllerParameters parameters;
103 107
104 InputCommon::InputSubsystem* input_subsystem; 108 InputCommon::InputSubsystem* input_subsystem;
109 Core::System& system;
105 110
106 std::unique_ptr<InputProfiles> input_profiles; 111 std::unique_ptr<InputProfiles> input_profiles;
107 112
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 @@
10#include "common/settings.h" 10#include "common/settings.h"
11#include "common/string_util.h" 11#include "common/string_util.h"
12#include "core/core.h" 12#include "core/core.h"
13#include "core/frontend/input_interpreter.h" 13#include "core/hid/hid_types.h"
14#include "core/hid/input_interpreter.h"
14#include "ui_qt_software_keyboard.h" 15#include "ui_qt_software_keyboard.h"
15#include "yuzu/applets/qt_software_keyboard.h" 16#include "yuzu/applets/qt_software_keyboard.h"
16#include "yuzu/main.h" 17#include "yuzu/main.h"
@@ -484,7 +485,7 @@ void QtSoftwareKeyboardDialog::open() {
484void QtSoftwareKeyboardDialog::reject() { 485void QtSoftwareKeyboardDialog::reject() {
485 // Pressing the ESC key in a dialog calls QDialog::reject(). 486 // Pressing the ESC key in a dialog calls QDialog::reject().
486 // We will override this behavior to the "Cancel" action on the software keyboard. 487 // We will override this behavior to the "Cancel" action on the software keyboard.
487 TranslateButtonPress(HIDButton::X); 488 TranslateButtonPress(Core::HID::NpadButton::X);
488} 489}
489 490
490void QtSoftwareKeyboardDialog::keyPressEvent(QKeyEvent* event) { 491void QtSoftwareKeyboardDialog::keyPressEvent(QKeyEvent* event) {
@@ -722,7 +723,7 @@ void QtSoftwareKeyboardDialog::SetTextDrawType() {
722 723
723 connect( 724 connect(
724 ui->line_edit_osk, &QLineEdit::returnPressed, this, 725 ui->line_edit_osk, &QLineEdit::returnPressed, this,
725 [this] { TranslateButtonPress(HIDButton::Plus); }, Qt::QueuedConnection); 726 [this] { TranslateButtonPress(Core::HID::NpadButton::Plus); }, Qt::QueuedConnection);
726 727
727 ui->line_edit_osk->setPlaceholderText( 728 ui->line_edit_osk->setPlaceholderText(
728 QString::fromStdU16String(initialize_parameters.guide_text)); 729 QString::fromStdU16String(initialize_parameters.guide_text));
@@ -1208,9 +1209,9 @@ void QtSoftwareKeyboardDialog::SetupMouseHover() {
1208 } 1209 }
1209} 1210}
1210 1211
1211template <HIDButton... T> 1212template <Core::HID::NpadButton... T>
1212void QtSoftwareKeyboardDialog::HandleButtonPressedOnce() { 1213void QtSoftwareKeyboardDialog::HandleButtonPressedOnce() {
1213 const auto f = [this](HIDButton button) { 1214 const auto f = [this](Core::HID::NpadButton button) {
1214 if (input_interpreter->IsButtonPressedOnce(button)) { 1215 if (input_interpreter->IsButtonPressedOnce(button)) {
1215 TranslateButtonPress(button); 1216 TranslateButtonPress(button);
1216 } 1217 }
@@ -1219,9 +1220,9 @@ void QtSoftwareKeyboardDialog::HandleButtonPressedOnce() {
1219 (f(T), ...); 1220 (f(T), ...);
1220} 1221}
1221 1222
1222template <HIDButton... T> 1223template <Core::HID::NpadButton... T>
1223void QtSoftwareKeyboardDialog::HandleButtonHold() { 1224void QtSoftwareKeyboardDialog::HandleButtonHold() {
1224 const auto f = [this](HIDButton button) { 1225 const auto f = [this](Core::HID::NpadButton button) {
1225 if (input_interpreter->IsButtonHeld(button)) { 1226 if (input_interpreter->IsButtonHeld(button)) {
1226 TranslateButtonPress(button); 1227 TranslateButtonPress(button);
1227 } 1228 }
@@ -1230,9 +1231,9 @@ void QtSoftwareKeyboardDialog::HandleButtonHold() {
1230 (f(T), ...); 1231 (f(T), ...);
1231} 1232}
1232 1233
1233void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) { 1234void QtSoftwareKeyboardDialog::TranslateButtonPress(Core::HID::NpadButton button) {
1234 switch (button) { 1235 switch (button) {
1235 case HIDButton::A: 1236 case Core::HID::NpadButton::A:
1236 switch (bottom_osk_index) { 1237 switch (bottom_osk_index) {
1237 case BottomOSKIndex::LowerCase: 1238 case BottomOSKIndex::LowerCase:
1238 case BottomOSKIndex::UpperCase: 1239 case BottomOSKIndex::UpperCase:
@@ -1245,7 +1246,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1245 break; 1246 break;
1246 } 1247 }
1247 break; 1248 break;
1248 case HIDButton::B: 1249 case Core::HID::NpadButton::B:
1249 switch (bottom_osk_index) { 1250 switch (bottom_osk_index) {
1250 case BottomOSKIndex::LowerCase: 1251 case BottomOSKIndex::LowerCase:
1251 ui->button_backspace->click(); 1252 ui->button_backspace->click();
@@ -1260,7 +1261,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1260 break; 1261 break;
1261 } 1262 }
1262 break; 1263 break;
1263 case HIDButton::X: 1264 case Core::HID::NpadButton::X:
1264 if (is_inline) { 1265 if (is_inline) {
1265 emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position); 1266 emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
1266 } else { 1267 } else {
@@ -1271,7 +1272,7 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1271 emit SubmitNormalText(SwkbdResult::Cancel, std::move(text)); 1272 emit SubmitNormalText(SwkbdResult::Cancel, std::move(text));
1272 } 1273 }
1273 break; 1274 break;
1274 case HIDButton::Y: 1275 case Core::HID::NpadButton::Y:
1275 switch (bottom_osk_index) { 1276 switch (bottom_osk_index) {
1276 case BottomOSKIndex::LowerCase: 1277 case BottomOSKIndex::LowerCase:
1277 ui->button_space->click(); 1278 ui->button_space->click();
@@ -1284,8 +1285,8 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1284 break; 1285 break;
1285 } 1286 }
1286 break; 1287 break;
1287 case HIDButton::LStick: 1288 case Core::HID::NpadButton::StickL:
1288 case HIDButton::RStick: 1289 case Core::HID::NpadButton::StickR:
1289 switch (bottom_osk_index) { 1290 switch (bottom_osk_index) {
1290 case BottomOSKIndex::LowerCase: 1291 case BottomOSKIndex::LowerCase:
1291 ui->button_shift->click(); 1292 ui->button_shift->click();
@@ -1298,13 +1299,13 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1298 break; 1299 break;
1299 } 1300 }
1300 break; 1301 break;
1301 case HIDButton::L: 1302 case Core::HID::NpadButton::L:
1302 MoveTextCursorDirection(Direction::Left); 1303 MoveTextCursorDirection(Direction::Left);
1303 break; 1304 break;
1304 case HIDButton::R: 1305 case Core::HID::NpadButton::R:
1305 MoveTextCursorDirection(Direction::Right); 1306 MoveTextCursorDirection(Direction::Right);
1306 break; 1307 break;
1307 case HIDButton::Plus: 1308 case Core::HID::NpadButton::Plus:
1308 switch (bottom_osk_index) { 1309 switch (bottom_osk_index) {
1309 case BottomOSKIndex::LowerCase: 1310 case BottomOSKIndex::LowerCase:
1310 ui->button_ok->click(); 1311 ui->button_ok->click();
@@ -1319,24 +1320,24 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1319 break; 1320 break;
1320 } 1321 }
1321 break; 1322 break;
1322 case HIDButton::DLeft: 1323 case Core::HID::NpadButton::Left:
1323 case HIDButton::LStickLeft: 1324 case Core::HID::NpadButton::StickLLeft:
1324 case HIDButton::RStickLeft: 1325 case Core::HID::NpadButton::StickRLeft:
1325 MoveButtonDirection(Direction::Left); 1326 MoveButtonDirection(Direction::Left);
1326 break; 1327 break;
1327 case HIDButton::DUp: 1328 case Core::HID::NpadButton::Up:
1328 case HIDButton::LStickUp: 1329 case Core::HID::NpadButton::StickLUp:
1329 case HIDButton::RStickUp: 1330 case Core::HID::NpadButton::StickRUp:
1330 MoveButtonDirection(Direction::Up); 1331 MoveButtonDirection(Direction::Up);
1331 break; 1332 break;
1332 case HIDButton::DRight: 1333 case Core::HID::NpadButton::Right:
1333 case HIDButton::LStickRight: 1334 case Core::HID::NpadButton::StickLRight:
1334 case HIDButton::RStickRight: 1335 case Core::HID::NpadButton::StickRRight:
1335 MoveButtonDirection(Direction::Right); 1336 MoveButtonDirection(Direction::Right);
1336 break; 1337 break;
1337 case HIDButton::DDown: 1338 case Core::HID::NpadButton::Down:
1338 case HIDButton::LStickDown: 1339 case Core::HID::NpadButton::StickLDown:
1339 case HIDButton::RStickDown: 1340 case Core::HID::NpadButton::StickRDown:
1340 MoveButtonDirection(Direction::Down); 1341 MoveButtonDirection(Direction::Down);
1341 break; 1342 break;
1342 default: 1343 default:
@@ -1467,19 +1468,25 @@ void QtSoftwareKeyboardDialog::InputThread() {
1467 while (input_thread_running) { 1468 while (input_thread_running) {
1468 input_interpreter->PollInput(); 1469 input_interpreter->PollInput();
1469 1470
1470 HandleButtonPressedOnce<HIDButton::A, HIDButton::B, HIDButton::X, HIDButton::Y, 1471 HandleButtonPressedOnce<
1471 HIDButton::LStick, HIDButton::RStick, HIDButton::L, HIDButton::R, 1472 Core::HID::NpadButton::A, Core::HID::NpadButton::B, Core::HID::NpadButton::X,
1472 HIDButton::Plus, HIDButton::DLeft, HIDButton::DUp, 1473 Core::HID::NpadButton::Y, Core::HID::NpadButton::StickL, Core::HID::NpadButton::StickR,
1473 HIDButton::DRight, HIDButton::DDown, HIDButton::LStickLeft, 1474 Core::HID::NpadButton::L, Core::HID::NpadButton::R, Core::HID::NpadButton::Plus,
1474 HIDButton::LStickUp, HIDButton::LStickRight, HIDButton::LStickDown, 1475 Core::HID::NpadButton::Left, Core::HID::NpadButton::Up, Core::HID::NpadButton::Right,
1475 HIDButton::RStickLeft, HIDButton::RStickUp, HIDButton::RStickRight, 1476 Core::HID::NpadButton::Down, Core::HID::NpadButton::StickLLeft,
1476 HIDButton::RStickDown>(); 1477 Core::HID::NpadButton::StickLUp, Core::HID::NpadButton::StickLRight,
1477 1478 Core::HID::NpadButton::StickLDown, Core::HID::NpadButton::StickRLeft,
1478 HandleButtonHold<HIDButton::B, HIDButton::L, HIDButton::R, HIDButton::DLeft, HIDButton::DUp, 1479 Core::HID::NpadButton::StickRUp, Core::HID::NpadButton::StickRRight,
1479 HIDButton::DRight, HIDButton::DDown, HIDButton::LStickLeft, 1480 Core::HID::NpadButton::StickRDown>();
1480 HIDButton::LStickUp, HIDButton::LStickRight, HIDButton::LStickDown, 1481
1481 HIDButton::RStickLeft, HIDButton::RStickUp, HIDButton::RStickRight, 1482 HandleButtonHold<Core::HID::NpadButton::B, Core::HID::NpadButton::L,
1482 HIDButton::RStickDown>(); 1483 Core::HID::NpadButton::R, Core::HID::NpadButton::Left,
1484 Core::HID::NpadButton::Up, Core::HID::NpadButton::Right,
1485 Core::HID::NpadButton::Down, Core::HID::NpadButton::StickLLeft,
1486 Core::HID::NpadButton::StickLUp, Core::HID::NpadButton::StickLRight,
1487 Core::HID::NpadButton::StickLDown, Core::HID::NpadButton::StickRLeft,
1488 Core::HID::NpadButton::StickRUp, Core::HID::NpadButton::StickRRight,
1489 Core::HID::NpadButton::StickRDown>();
1483 1490
1484 std::this_thread::sleep_for(std::chrono::milliseconds(50)); 1491 std::this_thread::sleep_for(std::chrono::milliseconds(50));
1485 } 1492 }
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 @@
14 14
15#include "core/frontend/applets/software_keyboard.h" 15#include "core/frontend/applets/software_keyboard.h"
16 16
17enum class HIDButton : u8;
18
19class InputInterpreter; 17class InputInterpreter;
20 18
21namespace Core { 19namespace Core {
22class System; 20class System;
23} 21}
24 22
23namespace Core::HID {
24enum class NpadButton : u64;
25}
26
25namespace Ui { 27namespace Ui {
26class QtSoftwareKeyboardDialog; 28class QtSoftwareKeyboardDialog;
27} 29}
@@ -146,7 +148,7 @@ private:
146 * 148 *
147 * @tparam HIDButton The list of buttons that can be converted into keyboard input. 149 * @tparam HIDButton The list of buttons that can be converted into keyboard input.
148 */ 150 */
149 template <HIDButton... T> 151 template <Core::HID::NpadButton... T>
150 void HandleButtonPressedOnce(); 152 void HandleButtonPressedOnce();
151 153
152 /** 154 /**
@@ -154,7 +156,7 @@ private:
154 * 156 *
155 * @tparam HIDButton The list of buttons that can be converted into keyboard input. 157 * @tparam HIDButton The list of buttons that can be converted into keyboard input.
156 */ 158 */
157 template <HIDButton... T> 159 template <Core::HID::NpadButton... T>
158 void HandleButtonHold(); 160 void HandleButtonHold();
159 161
160 /** 162 /**
@@ -162,7 +164,7 @@ private:
162 * 164 *
163 * @param button The button press to process. 165 * @param button The button press to process.
164 */ 166 */
165 void TranslateButtonPress(HIDButton button); 167 void TranslateButtonPress(Core::HID::NpadButton button);
166 168
167 /** 169 /**
168 * Moves the focus of a button in a certain direction. 170 * 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 @@
14#endif 14#endif
15 15
16#include "common/fs/path_util.h" 16#include "common/fs/path_util.h"
17#include "common/param_package.h"
17#include "core/core.h" 18#include "core/core.h"
18#include "core/hid/input_interpreter.h" 19#include "core/hid/input_interpreter.h"
19#include "input_common/keyboard.h" 20#include "input_common/drivers/keyboard.h"
20#include "input_common/main.h" 21#include "input_common/main.h"
21#include "yuzu/applets/qt_web_browser.h" 22#include "yuzu/applets/qt_web_browser.h"
22#include "yuzu/applets/qt_web_browser_scripts.h" 23#include "yuzu/applets/qt_web_browser_scripts.h"