core: Register HID

This commit is contained in:
german77 2021-09-20 19:44:34 -05:00 committed by Narr the Reg
parent c3f54ff232
commit 967cca10ff
3 changed files with 25 additions and 4 deletions

View file

@ -27,6 +27,7 @@
#include "core/file_sys/vfs_concat.h" #include "core/file_sys/vfs_concat.h"
#include "core/file_sys/vfs_real.h" #include "core/file_sys/vfs_real.h"
#include "core/hardware_interrupt_manager.h" #include "core/hardware_interrupt_manager.h"
#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_scheduler.h" #include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
@ -126,7 +127,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
struct System::Impl { struct System::Impl {
explicit Impl(System& system) explicit Impl(System& system)
: kernel{system}, fs_controller{system}, memory{system}, : kernel{system}, fs_controller{system}, memory{system}, hid_core{},
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
SystemResultStatus Run() { SystemResultStatus Run() {
@ -391,6 +392,7 @@ struct System::Impl {
std::unique_ptr<Hardware::InterruptManager> interrupt_manager; std::unique_ptr<Hardware::InterruptManager> interrupt_manager;
std::unique_ptr<Core::DeviceMemory> device_memory; std::unique_ptr<Core::DeviceMemory> device_memory;
Core::Memory::Memory memory; Core::Memory::Memory memory;
Core::HID::HIDCore hid_core;
CpuManager cpu_manager; CpuManager cpu_manager;
std::atomic_bool is_powered_on{}; std::atomic_bool is_powered_on{};
bool exit_lock = false; bool exit_lock = false;
@ -615,6 +617,14 @@ const Kernel::KernelCore& System::Kernel() const {
return impl->kernel; return impl->kernel;
} }
HID::HIDCore& System::HIDCore() {
return impl->hid_core;
}
const HID::HIDCore& System::HIDCore() const {
return impl->hid_core;
}
Timing::CoreTiming& System::CoreTiming() { Timing::CoreTiming& System::CoreTiming() {
return impl->core_timing; return impl->core_timing;
} }
@ -825,8 +835,6 @@ void System::ApplySettings() {
if (IsPoweredOn()) { if (IsPoweredOn()) {
Renderer().RefreshBaseSettings(); Renderer().RefreshBaseSettings();
} }
Service::HID::ReloadInputDevices();
} }
} // namespace Core } // namespace Core

View file

@ -89,6 +89,10 @@ namespace Core::Hardware {
class InterruptManager; class InterruptManager;
} }
namespace Core::HID {
class HIDCore;
}
namespace Core { namespace Core {
class ARM_Interface; class ARM_Interface;
@ -285,6 +289,12 @@ public:
/// Provides a constant reference to the kernel instance. /// Provides a constant reference to the kernel instance.
[[nodiscard]] const Kernel::KernelCore& Kernel() const; [[nodiscard]] const Kernel::KernelCore& Kernel() const;
/// Gets a mutable reference to the HID interface
[[nodiscard]] HID::HIDCore& HIDCore();
/// Gets an immutable reference to the HID interface.
[[nodiscard]] const HID::HIDCore& HIDCore() const;
/// Provides a reference to the internal PerfStats instance. /// Provides a reference to the internal PerfStats instance.
[[nodiscard]] Core::PerfStats& GetPerfStats(); [[nodiscard]] Core::PerfStats& GetPerfStats();

View file

@ -26,6 +26,7 @@
#include "core/frontend/applets/controller.h" #include "core/frontend/applets/controller.h"
#include "core/frontend/applets/general_frontend.h" #include "core/frontend/applets/general_frontend.h"
#include "core/frontend/applets/software_keyboard.h" #include "core/frontend/applets/software_keyboard.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h" #include "core/hle/service/am/applet_oe.h"
@ -227,6 +228,8 @@ GMainWindow::GMainWindow()
ConnectMenuEvents(); ConnectMenuEvents();
ConnectWidgetEvents(); ConnectWidgetEvents();
Core::System::GetInstance().HIDCore().ReloadInputDevices();
const auto branch_name = std::string(Common::g_scm_branch); const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc); const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id); 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
QString GMainWindow::GetTasStateDescription() const { QString GMainWindow::GetTasStateDescription() const {
auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
switch (tas_status) { switch (tas_status) {
case InputCommon::TasInput::TasState::Running: case InputCommon::TasInput::TasState::Running :
return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames);
case InputCommon::TasInput::TasState::Recording: case InputCommon::TasInput::TasState::Recording:
return tr("TAS state: Recording %1").arg(total_tas_frames); return tr("TAS state: Recording %1").arg(total_tas_frames);