summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar german772021-09-20 19:44:34 -0500
committerGravatar Narr the Reg2021-11-24 20:30:23 -0600
commit967cca10ff5721cc942f557c3e0a20c07f5aa45e (patch)
tree464abf622ab259581a04ffea6ad99330cfc27eb8 /src
parentcore/hid: Add emulated controllers (diff)
downloadyuzu-967cca10ff5721cc942f557c3e0a20c07f5aa45e.tar.gz
yuzu-967cca10ff5721cc942f557c3e0a20c07f5aa45e.tar.xz
yuzu-967cca10ff5721cc942f557c3e0a20c07f5aa45e.zip
core: Register HID
Diffstat (limited to 'src')
-rw-r--r--src/core/core.cpp14
-rw-r--r--src/core/core.h10
-rw-r--r--src/yuzu/main.cpp5
3 files changed, 25 insertions, 4 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 07448fd29..473ab9f81 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -27,6 +27,7 @@
27#include "core/file_sys/vfs_concat.h" 27#include "core/file_sys/vfs_concat.h"
28#include "core/file_sys/vfs_real.h" 28#include "core/file_sys/vfs_real.h"
29#include "core/hardware_interrupt_manager.h" 29#include "core/hardware_interrupt_manager.h"
30#include "core/hid/hid_core.h"
30#include "core/hle/kernel/k_process.h" 31#include "core/hle/kernel/k_process.h"
31#include "core/hle/kernel/k_scheduler.h" 32#include "core/hle/kernel/k_scheduler.h"
32#include "core/hle/kernel/kernel.h" 33#include "core/hle/kernel/kernel.h"
@@ -126,7 +127,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
126 127
127struct System::Impl { 128struct System::Impl {
128 explicit Impl(System& system) 129 explicit Impl(System& system)
129 : kernel{system}, fs_controller{system}, memory{system}, 130 : kernel{system}, fs_controller{system}, memory{system}, hid_core{},
130 cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} 131 cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
131 132
132 SystemResultStatus Run() { 133 SystemResultStatus Run() {
@@ -391,6 +392,7 @@ struct System::Impl {
391 std::unique_ptr<Hardware::InterruptManager> interrupt_manager; 392 std::unique_ptr<Hardware::InterruptManager> interrupt_manager;
392 std::unique_ptr<Core::DeviceMemory> device_memory; 393 std::unique_ptr<Core::DeviceMemory> device_memory;
393 Core::Memory::Memory memory; 394 Core::Memory::Memory memory;
395 Core::HID::HIDCore hid_core;
394 CpuManager cpu_manager; 396 CpuManager cpu_manager;
395 std::atomic_bool is_powered_on{}; 397 std::atomic_bool is_powered_on{};
396 bool exit_lock = false; 398 bool exit_lock = false;
@@ -615,6 +617,14 @@ const Kernel::KernelCore& System::Kernel() const {
615 return impl->kernel; 617 return impl->kernel;
616} 618}
617 619
620HID::HIDCore& System::HIDCore() {
621 return impl->hid_core;
622}
623
624const HID::HIDCore& System::HIDCore() const {
625 return impl->hid_core;
626}
627
618Timing::CoreTiming& System::CoreTiming() { 628Timing::CoreTiming& System::CoreTiming() {
619 return impl->core_timing; 629 return impl->core_timing;
620} 630}
@@ -825,8 +835,6 @@ void System::ApplySettings() {
825 if (IsPoweredOn()) { 835 if (IsPoweredOn()) {
826 Renderer().RefreshBaseSettings(); 836 Renderer().RefreshBaseSettings();
827 } 837 }
828
829 Service::HID::ReloadInputDevices();
830} 838}
831 839
832} // namespace Core 840} // namespace Core
diff --git a/src/core/core.h b/src/core/core.h
index 01bc0a2c7..5a031efb0 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -89,6 +89,10 @@ namespace Core::Hardware {
89class InterruptManager; 89class InterruptManager;
90} 90}
91 91
92namespace Core::HID {
93class HIDCore;
94}
95
92namespace Core { 96namespace Core {
93 97
94class ARM_Interface; 98class ARM_Interface;
@@ -285,6 +289,12 @@ public:
285 /// Provides a constant reference to the kernel instance. 289 /// Provides a constant reference to the kernel instance.
286 [[nodiscard]] const Kernel::KernelCore& Kernel() const; 290 [[nodiscard]] const Kernel::KernelCore& Kernel() const;
287 291
292 /// Gets a mutable reference to the HID interface
293 [[nodiscard]] HID::HIDCore& HIDCore();
294
295 /// Gets an immutable reference to the HID interface.
296 [[nodiscard]] const HID::HIDCore& HIDCore() const;
297
288 /// Provides a reference to the internal PerfStats instance. 298 /// Provides a reference to the internal PerfStats instance.
289 [[nodiscard]] Core::PerfStats& GetPerfStats(); 299 [[nodiscard]] Core::PerfStats& GetPerfStats();
290 300
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7f36f6e2f..19cb5313f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -26,6 +26,7 @@
26#include "core/frontend/applets/controller.h" 26#include "core/frontend/applets/controller.h"
27#include "core/frontend/applets/general_frontend.h" 27#include "core/frontend/applets/general_frontend.h"
28#include "core/frontend/applets/software_keyboard.h" 28#include "core/frontend/applets/software_keyboard.h"
29#include "core/hid/hid_core.h"
29#include "core/hle/service/acc/profile_manager.h" 30#include "core/hle/service/acc/profile_manager.h"
30#include "core/hle/service/am/applet_ae.h" 31#include "core/hle/service/am/applet_ae.h"
31#include "core/hle/service/am/applet_oe.h" 32#include "core/hle/service/am/applet_oe.h"
@@ -227,6 +228,8 @@ GMainWindow::GMainWindow()
227 ConnectMenuEvents(); 228 ConnectMenuEvents();
228 ConnectWidgetEvents(); 229 ConnectWidgetEvents();
229 230
231 Core::System::GetInstance().HIDCore().ReloadInputDevices();
232
230 const auto branch_name = std::string(Common::g_scm_branch); 233 const auto branch_name = std::string(Common::g_scm_branch);
231 const auto description = std::string(Common::g_scm_desc); 234 const auto description = std::string(Common::g_scm_desc);
232 const auto build_id = std::string(Common::g_build_id); 235 const auto build_id = std::string(Common::g_build_id);
@@ -2969,7 +2972,7 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
2969QString GMainWindow::GetTasStateDescription() const { 2972QString GMainWindow::GetTasStateDescription() const {
2970 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); 2973 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
2971 switch (tas_status) { 2974 switch (tas_status) {
2972 case InputCommon::TasInput::TasState::Running: 2975 case InputCommon::TasInput::TasState::Running :
2973 return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); 2976 return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames);
2974 case InputCommon::TasInput::TasState::Recording: 2977 case InputCommon::TasInput::TasState::Recording:
2975 return tr("TAS state: Recording %1").arg(total_tas_frames); 2978 return tr("TAS state: Recording %1").arg(total_tas_frames);