summaryrefslogtreecommitdiffstats
path: root/src/hid_core/hid_core.h
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2024-01-05 03:37:43 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2024-01-05 18:41:15 +0100
commitee847f8ff0b1b0aec39c1b78c010bc0c08a0a613 (patch)
tree3b95cbb74be05f0ce7a007353f1f9f95e1ed3901 /src/hid_core/hid_core.h
parentMerge pull request #12437 from ameerj/gl-amd-fixes (diff)
downloadyuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.gz
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.bz2
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.lz
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.xz
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.zst
yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.zip
Diffstat (limited to 'src/hid_core/hid_core.h')
-rw-r--r--src/hid_core/hid_core.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/hid_core/hid_core.h b/src/hid_core/hid_core.h
new file mode 100644
index 000000000..dae29c506
--- /dev/null
+++ b/src/hid_core/hid_core.h
@@ -0,0 +1,89 @@
+// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+
+#include "common/common_funcs.h"
+#include "hid_core/hid_types.h"
+
+namespace Core::HID {
+class EmulatedConsole;
+class EmulatedController;
+class EmulatedDevices;
+} // namespace Core::HID
+
+namespace Core::HID {
+
+class HIDCore {
+public:
+ explicit HIDCore();
+ ~HIDCore();
+
+ YUZU_NON_COPYABLE(HIDCore);
+ YUZU_NON_MOVEABLE(HIDCore);
+
+ EmulatedController* GetEmulatedController(NpadIdType npad_id_type);
+ const EmulatedController* GetEmulatedController(NpadIdType npad_id_type) const;
+
+ EmulatedController* GetEmulatedControllerByIndex(std::size_t index);
+ const EmulatedController* GetEmulatedControllerByIndex(std::size_t index) const;
+
+ EmulatedConsole* GetEmulatedConsole();
+ const EmulatedConsole* GetEmulatedConsole() const;
+
+ EmulatedDevices* GetEmulatedDevices();
+ const EmulatedDevices* GetEmulatedDevices() const;
+
+ void SetSupportedStyleTag(NpadStyleTag style_tag);
+ NpadStyleTag GetSupportedStyleTag() const;
+
+ /// Counts the connected players from P1-P8
+ s8 GetPlayerCount() const;
+
+ /// Returns the first connected npad id
+ NpadIdType GetFirstNpadId() const;
+
+ /// Returns the first disconnected npad id
+ NpadIdType GetFirstDisconnectedNpadId() const;
+
+ /// Sets the npad id of the last active controller
+ void SetLastActiveController(NpadIdType npad_id);
+
+ /// Returns the npad id of the last controller that pushed a button
+ NpadIdType GetLastActiveController() const;
+
+ /// Sets all emulated controllers into configuring mode.
+ void EnableAllControllerConfiguration();
+
+ /// Sets all emulated controllers into normal mode.
+ void DisableAllControllerConfiguration();
+
+ /// Reloads all input devices from settings
+ void ReloadInputDevices();
+
+ /// Removes all callbacks from input common
+ void UnloadInputDevices();
+
+ /// Number of emulated controllers
+ static constexpr std::size_t available_controllers{10};
+
+private:
+ std::unique_ptr<EmulatedController> player_1;
+ std::unique_ptr<EmulatedController> player_2;
+ std::unique_ptr<EmulatedController> player_3;
+ std::unique_ptr<EmulatedController> player_4;
+ std::unique_ptr<EmulatedController> player_5;
+ std::unique_ptr<EmulatedController> player_6;
+ std::unique_ptr<EmulatedController> player_7;
+ std::unique_ptr<EmulatedController> player_8;
+ std::unique_ptr<EmulatedController> other;
+ std::unique_ptr<EmulatedController> handheld;
+ std::unique_ptr<EmulatedConsole> console;
+ std::unique_ptr<EmulatedDevices> devices;
+ NpadStyleTag supported_style_tag{NpadStyleSet::All};
+ NpadIdType last_active_controller{NpadIdType::Handheld};
+};
+
+} // namespace Core::HID