summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-01 21:17:53 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:26 +0100
commit77fa4d4bf60526826ef8b53ee3870f7d2a761976 (patch)
tree3c6c07d535bd912ed085be9b826103a6eabe718f /src
parentsettings: Fix Debug controller type options (diff)
downloadyuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.gz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.bz2
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.lz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.xz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.zst
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/input.h2
-rw-r--r--src/core/hid/emulated_console.cpp5
-rw-r--r--src/core/hid/emulated_controller.cpp5
-rw-r--r--src/core/hid/emulated_devices.cpp5
-rw-r--r--src/core/hid/hid_core.cpp3
-rw-r--r--src/core/hid/hid_core.h10
-rw-r--r--src/core/hid/input_converter.h12
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp2
-rw-r--r--src/core/hle/service/hid/controllers/console_sixaxis.cpp1
-rw-r--r--src/core/hle/service/hid/controllers/debug_pad.cpp1
-rw-r--r--src/core/hle/service/hid/controllers/gesture.h5
-rw-r--r--src/core/hle/service/hid/controllers/keyboard.cpp1
-rw-r--r--src/core/hle/service/hid/controllers/mouse.cpp1
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp2
-rw-r--r--src/core/hle/service/hid/controllers/npad.h6
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.h1
-rw-r--r--src/input_common/drivers/keyboard.cpp6
-rw-r--r--src/input_common/drivers/keyboard.h7
-rw-r--r--src/input_common/drivers/mouse.cpp5
-rw-r--r--src/input_common/drivers/mouse.h5
-rw-r--r--src/input_common/drivers/touch_screen.cpp6
-rw-r--r--src/input_common/drivers/touch_screen.h8
-rw-r--r--src/input_common/input_engine.cpp5
-rw-r--r--src/yuzu/applets/qt_controller.cpp1
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp5
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.h1
-rw-r--r--src/yuzu/debugger/controller.h3
-rw-r--r--src/yuzu/main.cpp1
28 files changed, 73 insertions, 42 deletions
diff --git a/src/common/input.h b/src/common/input.h
index 16b1e6f1b..12acd8785 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -29,7 +29,7 @@ enum class InputType {
Ir,
};
-enum class BatteryLevel {
+enum class BatteryLevel : u32 {
None,
Empty,
Critical,
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp
index 012909954..dfbaa3f8c 100644
--- a/src/core/hid/emulated_console.cpp
+++ b/src/core/hid/emulated_console.cpp
@@ -209,10 +209,11 @@ int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
void EmulatedConsole::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // namespace Core::HID
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 9a1864279..7bab00bb1 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -993,10 +993,11 @@ int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) {
void EmulatedController::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // namespace Core::HID
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp
index c76a86b6c..e97470240 100644
--- a/src/core/hid/emulated_devices.cpp
+++ b/src/core/hid/emulated_devices.cpp
@@ -362,10 +362,11 @@ int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) {
void EmulatedDevices::DeleteCallback(int key) {
std::lock_guard lock{mutex};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // namespace Core::HID
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp
index 3cb26e1e7..741a69c3c 100644
--- a/src/core/hid/hid_core.cpp
+++ b/src/core/hid/hid_core.cpp
@@ -3,6 +3,9 @@
// Refer to the license.txt file included.
#include "common/assert.h"
+#include "core/hid/emulated_console.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
namespace Core::HID {
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h
index a4a66a3a4..1fe2fd89b 100644
--- a/src/core/hid/hid_core.h
+++ b/src/core/hid/hid_core.h
@@ -6,9 +6,13 @@
#include <memory>
-#include "core/hid/emulated_console.h"
-#include "core/hid/emulated_controller.h"
-#include "core/hid/emulated_devices.h"
+#include "core/hid/hid_types.h"
+
+namespace Core::HID {
+class EmulatedConsole;
+class EmulatedController;
+class EmulatedDevices;
+} // namespace Core::HID
namespace Core::HID {
diff --git a/src/core/hid/input_converter.h b/src/core/hid/input_converter.h
index b38e657b0..2a722b39f 100644
--- a/src/core/hid/input_converter.h
+++ b/src/core/hid/input_converter.h
@@ -4,9 +4,17 @@
#pragma once
-namespace Input {
+namespace Common::Input {
struct CallbackStatus;
-};
+enum class BatteryLevel : u32;
+using BatteryStatus = BatteryLevel;
+struct AnalogStatus;
+struct ButtonStatus;
+struct MotionStatus;
+struct StickStatus;
+struct TouchStatus;
+struct TriggerStatus;
+}; // namespace Common::Input
namespace Core::HID {
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 658265a00..374e0c7f4 100644
--- a/src/core/hle/service/am/applets/applet_controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -10,6 +10,8 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/frontend/applets/controller.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/hid_core.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applets/applet_controller.h"
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
index 1d351fde0..2bebcf0d0 100644
--- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp
+++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp
@@ -5,6 +5,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
+#include "core/hid/emulated_console.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h"
namespace Service::HID {
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp
index b009ed086..86b95f2c8 100644
--- a/src/core/hle/service/hid/controllers/debug_pad.cpp
+++ b/src/core/hle/service/hid/controllers/debug_pad.cpp
@@ -7,6 +7,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
+#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/debug_pad.h"
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h
index 58139a5cf..9bffde438 100644
--- a/src/core/hle/service/hid/controllers/gesture.h
+++ b/src/core/hle/service/hid/controllers/gesture.h
@@ -8,13 +8,10 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/point.h"
+#include "core/hid/emulated_console.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h"
-namespace Core::HID {
-class EmulatedController;
-} // namespace Core::HID
-
namespace Service::HID {
class Controller_Gesture final : public ControllerBase {
public:
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp
index 60dc62f2c..acea68e24 100644
--- a/src/core/hle/service/hid/controllers/keyboard.cpp
+++ b/src/core/hle/service/hid/controllers/keyboard.cpp
@@ -7,6 +7,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
+#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/keyboard.h"
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp
index 7ec75e8c8..21f7e48bb 100644
--- a/src/core/hle/service/hid/controllers/mouse.cpp
+++ b/src/core/hle/service/hid/controllers/mouse.cpp
@@ -7,6 +7,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/emu_window.h"
+#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/mouse.h"
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 9f82f872a..0b5a23696 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -12,6 +12,8 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
+#include "core/hid/emulated_controller.h"
+#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/k_writable_event.h"
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 4a9c9cc1a..871d245fd 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -12,11 +12,15 @@
#include "common/common_types.h"
#include "common/quaternion.h"
#include "common/settings.h"
-#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h"
+namespace Core::HID {
+class EmulatedController;
+enum class ControllerTriggerType;
+} // namespace Core::HID
+
namespace Kernel {
class KEvent;
class KReadableEvent;
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h
index fa4dfa1a2..50dadd25f 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.h
+++ b/src/core/hle/service/hid/controllers/touchscreen.h
@@ -9,6 +9,7 @@
#include "common/common_types.h"
#include "common/point.h"
#include "common/swap.h"
+#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h"
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp
index 85a781a30..549704e89 100644
--- a/src/input_common/drivers/keyboard.cpp
+++ b/src/input_common/drivers/keyboard.cpp
@@ -7,6 +7,12 @@
namespace InputCommon {
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
+
Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}
diff --git a/src/input_common/drivers/keyboard.h b/src/input_common/drivers/keyboard.h
index 58df15050..46fe78576 100644
--- a/src/input_common/drivers/keyboard.h
+++ b/src/input_common/drivers/keyboard.h
@@ -32,13 +32,6 @@ public:
/// Used for automapping features
std::vector<Common::ParamPackage> GetInputDevices() const override;
-
-private:
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
};
} // namespace InputCommon
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index 1c32b54be..afa92b458 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -14,6 +14,11 @@
namespace InputCommon {
constexpr int touch_axis_x = 10;
constexpr int touch_axis_y = 11;
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h
index cf0918409..1be362b94 100644
--- a/src/input_common/drivers/mouse.h
+++ b/src/input_common/drivers/mouse.h
@@ -62,11 +62,6 @@ private:
void UpdateThread(std::stop_token stop_token);
void StopPanning();
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
Common::Vec2<int> mouse_origin;
Common::Vec2<int> last_mouse_position;
Common::Vec2<float> last_mouse_change;
diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp
index e13835e9f..377c9ee2b 100644
--- a/src/input_common/drivers/touch_screen.cpp
+++ b/src/input_common/drivers/touch_screen.cpp
@@ -7,6 +7,12 @@
namespace InputCommon {
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
+
TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}
diff --git a/src/input_common/drivers/touch_screen.h b/src/input_common/drivers/touch_screen.h
index d297d253c..0f4cd0e7a 100644
--- a/src/input_common/drivers/touch_screen.h
+++ b/src/input_common/drivers/touch_screen.h
@@ -37,14 +37,8 @@ public:
*/
void TouchReleased(std::size_t finger);
+ /// Resets all inputs to their initial value
void ReleaseAllTouch();
-
-private:
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
};
} // namespace InputCommon
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 965a2bdf1..139d8d2e6 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -353,11 +353,12 @@ void InputEngine::SetMappingCallback(MappingCallback callback) {
void InputEngine::DeleteCallback(int key) {
std::lock_guard lock{mutex_callback};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // namespace InputCommon
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index e9cb578b4..9c6377cf0 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -10,6 +10,7 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/hid/emulated_controller.h"
+#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/lock.h"
#include "core/hle/service/hid/controllers/npad.h"
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index 99c4f13c3..7e71a0f58 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -2594,9 +2594,8 @@ void PlayerControlPreview::DrawArrowButton(QPainter& p, const QPointF center,
arrow_button[point] = center + QPointF(up_arrow_x * size, -up_arrow_y * size);
break;
case Direction::Left:
- // Compiler doesn't optimize this correctly
- arrow_button[point] = center + QPointF(up_arrow_button[point * 2 + 1] * size,
- up_arrow_button[point * 2 + 0] * size);
+ // Compiler doesn't optimize this correctly check why
+ arrow_button[point] = center + QPointF(up_arrow_y * size, up_arrow_x * size);
break;
case Direction::None:
break;
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h
index 430e4f4f4..acc53a9e3 100644
--- a/src/yuzu/configuration/configure_input_player_widget.h
+++ b/src/yuzu/configuration/configure_input_player_widget.h
@@ -9,6 +9,7 @@
#include <QPointer>
#include "common/input.h"
#include "common/settings.h"
+#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h
index ba4185a4b..d08643baa 100644
--- a/src/yuzu/debugger/controller.h
+++ b/src/yuzu/debugger/controller.h
@@ -21,7 +21,8 @@ class System;
namespace Core::HID {
class EmulatedController;
-}
+enum class ControllerTriggerType;
+} // namespace Core::HID
class ControllerDialog : public QWidget {
Q_OBJECT
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 56db337a4..7c95851b3 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -26,6 +26,7 @@
#include "core/frontend/applets/controller.h"
#include "core/frontend/applets/general_frontend.h"
#include "core/frontend/applets/software_keyboard.h"
+#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/am/applet_ae.h"