2018-01-15 03:24:50 +01:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2015-01-19 00:07:48 +01:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
#include <array>
|
|
|
|
#include "common/common_types.h"
|
2016-09-18 02:38:01 +02:00
|
|
|
#include "common/logging/log.h"
|
2018-08-28 18:30:33 +02:00
|
|
|
#include "core/core.h"
|
2018-01-15 10:21:02 +01:00
|
|
|
#include "core/core_timing.h"
|
2018-07-24 12:03:24 +02:00
|
|
|
#include "core/core_timing_util.h"
|
2018-07-18 20:06:33 +02:00
|
|
|
#include "core/frontend/emu_window.h"
|
2018-01-15 10:21:02 +01:00
|
|
|
#include "core/frontend/input.h"
|
2018-01-15 03:24:50 +01:00
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/kernel/client_port.h"
|
|
|
|
#include "core/hle/kernel/client_session.h"
|
2018-11-27 00:34:07 +01:00
|
|
|
#include "core/hle/kernel/readable_event.h"
|
2018-01-15 03:24:50 +01:00
|
|
|
#include "core/hle/kernel/shared_memory.h"
|
2018-11-27 00:34:07 +01:00
|
|
|
#include "core/hle/kernel/writable_event.h"
|
2016-09-21 08:52:38 +02:00
|
|
|
#include "core/hle/service/hid/hid.h"
|
2018-07-26 14:39:25 +02:00
|
|
|
#include "core/hle/service/hid/irs.h"
|
2018-07-26 14:50:32 +02:00
|
|
|
#include "core/hle/service/hid/xcd.h"
|
2016-09-20 17:21:23 +02:00
|
|
|
#include "core/hle/service/service.h"
|
2018-08-24 05:20:33 +02:00
|
|
|
#include "core/settings.h"
|
2015-03-09 05:14:59 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
#include "core/hle/service/hid/controllers/controller_base.h"
|
|
|
|
#include "core/hle/service/hid/controllers/debug_pad.h"
|
|
|
|
#include "core/hle/service/hid/controllers/gesture.h"
|
|
|
|
#include "core/hle/service/hid/controllers/keyboard.h"
|
|
|
|
#include "core/hle/service/hid/controllers/mouse.h"
|
|
|
|
#include "core/hle/service/hid/controllers/npad.h"
|
|
|
|
#include "core/hle/service/hid/controllers/stubbed.h"
|
|
|
|
#include "core/hle/service/hid/controllers/touchscreen.h"
|
|
|
|
#include "core/hle/service/hid/controllers/xpad.h"
|
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
namespace Service::HID {
|
2015-01-19 00:07:48 +01:00
|
|
|
|
2018-01-15 10:21:02 +01:00
|
|
|
// Updating period for each HID device.
|
2018-10-18 12:04:45 +02:00
|
|
|
// TODO(ogniK): Find actual polling rate of hid
|
|
|
|
constexpr u64 pad_update_ticks = CoreTiming::BASE_CLOCK_RATE / 66;
|
2018-07-15 21:47:41 +02:00
|
|
|
constexpr u64 accelerometer_update_ticks = CoreTiming::BASE_CLOCK_RATE / 100;
|
|
|
|
constexpr u64 gyroscope_update_ticks = CoreTiming::BASE_CLOCK_RATE / 100;
|
2018-10-06 05:14:42 +02:00
|
|
|
constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000;
|
|
|
|
enum class HidController : std::size_t {
|
2018-10-05 16:23:21 +02:00
|
|
|
DebugPad,
|
|
|
|
Touchscreen,
|
|
|
|
Mouse,
|
|
|
|
Keyboard,
|
|
|
|
XPad,
|
|
|
|
Unknown1,
|
|
|
|
Unknown2,
|
|
|
|
Unknown3,
|
|
|
|
SixAxisSensor,
|
|
|
|
NPad,
|
|
|
|
Gesture,
|
|
|
|
|
2018-10-06 05:14:42 +02:00
|
|
|
MaxControllers,
|
2018-10-05 16:23:21 +02:00
|
|
|
};
|
2018-01-15 10:21:02 +01:00
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
class IAppletResource final : public ServiceFramework<IAppletResource> {
|
|
|
|
public:
|
|
|
|
IAppletResource() : ServiceFramework("IAppletResource") {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
2015-01-19 00:07:48 +01:00
|
|
|
|
2018-08-28 18:30:33 +02:00
|
|
|
auto& kernel = Core::System::GetInstance().Kernel();
|
2018-01-15 03:24:50 +01:00
|
|
|
shared_mem = Kernel::SharedMemory::Create(
|
2018-10-05 16:23:21 +02:00
|
|
|
kernel, nullptr, SHARED_MEMORY_SIZE, Kernel::MemoryPermission::ReadWrite,
|
2018-08-28 18:30:33 +02:00
|
|
|
Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "HID:SharedMemory");
|
2018-01-15 10:21:02 +01:00
|
|
|
|
2018-10-06 05:14:42 +02:00
|
|
|
MakeController<Controller_DebugPad>(HidController::DebugPad);
|
|
|
|
MakeController<Controller_Touchscreen>(HidController::Touchscreen);
|
|
|
|
MakeController<Controller_Mouse>(HidController::Mouse);
|
|
|
|
MakeController<Controller_Keyboard>(HidController::Keyboard);
|
|
|
|
MakeController<Controller_XPad>(HidController::XPad);
|
|
|
|
MakeController<Controller_Stubbed>(HidController::Unknown1);
|
|
|
|
MakeController<Controller_Stubbed>(HidController::Unknown2);
|
|
|
|
MakeController<Controller_Stubbed>(HidController::Unknown3);
|
|
|
|
MakeController<Controller_Stubbed>(HidController::SixAxisSensor);
|
|
|
|
MakeController<Controller_NPad>(HidController::NPad);
|
|
|
|
MakeController<Controller_Gesture>(HidController::Gesture);
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
// Homebrew doesn't try to activate some controllers, so we activate them by default
|
2018-10-06 05:14:42 +02:00
|
|
|
GetController<Controller_NPad>(HidController::NPad).ActivateController();
|
|
|
|
GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController();
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
GetController<Controller_Stubbed>(HidController::Unknown1).SetCommonHeaderOffset(0x4c00);
|
|
|
|
GetController<Controller_Stubbed>(HidController::Unknown2).SetCommonHeaderOffset(0x4e00);
|
|
|
|
GetController<Controller_Stubbed>(HidController::Unknown3).SetCommonHeaderOffset(0x5000);
|
|
|
|
|
2018-01-15 10:21:02 +01:00
|
|
|
// Register update callbacks
|
|
|
|
pad_update_event = CoreTiming::RegisterEvent(
|
|
|
|
"HID::UpdatePadCallback",
|
2018-10-05 16:23:21 +02:00
|
|
|
[this](u64 userdata, int cycles_late) { UpdateControllers(userdata, cycles_late); });
|
2018-01-15 10:21:02 +01:00
|
|
|
|
|
|
|
// TODO(shinyquagsire23): Other update callbacks? (accel, gyro?)
|
|
|
|
|
|
|
|
CoreTiming::ScheduleEvent(pad_update_ticks, pad_update_event);
|
2018-11-02 02:35:49 +01:00
|
|
|
|
|
|
|
ReloadInputDevices();
|
2018-01-15 03:24:50 +01:00
|
|
|
}
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
void ActivateController(HidController controller) {
|
|
|
|
controllers[static_cast<size_t>(controller)]->ActivateController();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeactivateController(HidController controller) {
|
|
|
|
controllers[static_cast<size_t>(controller)]->DeactivateController();
|
|
|
|
}
|
|
|
|
|
2018-10-06 05:14:42 +02:00
|
|
|
template <typename T>
|
|
|
|
void MakeController(HidController controller) {
|
|
|
|
controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>();
|
|
|
|
}
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
template <typename T>
|
|
|
|
T& GetController(HidController controller) {
|
|
|
|
return static_cast<T&>(*controllers[static_cast<size_t>(controller)]);
|
|
|
|
}
|
|
|
|
|
2018-03-04 16:34:25 +01:00
|
|
|
~IAppletResource() {
|
|
|
|
CoreTiming::UnscheduleEvent(pad_update_event, 0);
|
|
|
|
}
|
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
private:
|
|
|
|
void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
|
2018-11-26 07:06:13 +01:00
|
|
|
LOG_DEBUG(Service_HID, "called");
|
|
|
|
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
2018-01-15 03:24:50 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushCopyObjects(shared_mem);
|
|
|
|
}
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
void UpdateControllers(u64 userdata, int cycles_late) {
|
2018-10-06 05:14:42 +02:00
|
|
|
const bool should_reload = Settings::values.is_device_reload_pending.exchange(false);
|
2018-10-05 16:23:21 +02:00
|
|
|
for (const auto& controller : controllers) {
|
|
|
|
if (should_reload) {
|
|
|
|
controller->OnLoadInputDevices();
|
2018-05-07 17:06:02 +02:00
|
|
|
}
|
2018-10-05 16:23:21 +02:00
|
|
|
controller->OnUpdate(shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
|
2018-01-16 11:14:27 +01:00
|
|
|
}
|
2018-01-15 10:21:02 +01:00
|
|
|
|
|
|
|
CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
|
|
|
|
}
|
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
// Handle to shared memory region designated to HID service
|
|
|
|
Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
|
2018-01-15 10:21:02 +01:00
|
|
|
|
|
|
|
// CoreTiming update events
|
|
|
|
CoreTiming::EventType* pad_update_event;
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)>
|
|
|
|
controllers{};
|
2018-01-15 03:24:50 +01:00
|
|
|
};
|
|
|
|
|
2018-02-04 23:06:14 +01:00
|
|
|
class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> {
|
|
|
|
public:
|
|
|
|
IActiveVibrationDeviceList() : ServiceFramework("IActiveVibrationDeviceList") {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IActiveVibrationDeviceList::ActivateVibrationDevice, "ActivateVibrationDevice"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ActivateVibrationDevice(Kernel::HLERequestContext& ctx) {
|
2018-11-26 07:06:13 +01:00
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called");
|
|
|
|
|
2018-02-04 23:06:14 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
class Hid final : public ServiceFramework<Hid> {
|
|
|
|
public:
|
|
|
|
Hid() : ServiceFramework("hid") {
|
2018-08-12 11:57:31 +02:00
|
|
|
// clang-format off
|
2018-01-15 03:24:50 +01:00
|
|
|
static const FunctionInfo functions[] = {
|
2018-02-05 04:24:20 +01:00
|
|
|
{0, &Hid::CreateAppletResource, "CreateAppletResource"},
|
|
|
|
{1, &Hid::ActivateDebugPad, "ActivateDebugPad"},
|
2018-02-06 03:53:11 +01:00
|
|
|
{11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"},
|
2018-02-15 15:22:11 +01:00
|
|
|
{21, &Hid::ActivateMouse, "ActivateMouse"},
|
|
|
|
{31, &Hid::ActivateKeyboard, "ActivateKeyboard"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{32, nullptr, "SendKeyboardLockKeyEvent"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{40, nullptr, "AcquireXpadIdEventHandle"},
|
|
|
|
{41, nullptr, "ReleaseXpadIdEventHandle"},
|
2018-10-05 16:23:21 +02:00
|
|
|
{51, &Hid::ActivateXpad, "ActivateXpad"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{55, nullptr, "GetXpadIds"},
|
|
|
|
{56, nullptr, "ActivateJoyXpad"},
|
|
|
|
{58, nullptr, "GetJoyXpadLifoHandle"},
|
|
|
|
{59, nullptr, "GetJoyXpadIds"},
|
|
|
|
{60, nullptr, "ActivateSixAxisSensor"},
|
|
|
|
{61, nullptr, "DeactivateSixAxisSensor"},
|
|
|
|
{62, nullptr, "GetSixAxisSensorLifoHandle"},
|
|
|
|
{63, nullptr, "ActivateJoySixAxisSensor"},
|
|
|
|
{64, nullptr, "DeactivateJoySixAxisSensor"},
|
|
|
|
{65, nullptr, "GetJoySixAxisSensorLifoHandle"},
|
2018-02-05 04:24:20 +01:00
|
|
|
{66, &Hid::StartSixAxisSensor, "StartSixAxisSensor"},
|
2018-09-18 16:56:02 +02:00
|
|
|
{67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{68, nullptr, "IsSixAxisSensorFusionEnabled"},
|
|
|
|
{69, nullptr, "EnableSixAxisSensorFusion"},
|
|
|
|
{70, nullptr, "SetSixAxisSensorFusionParameters"},
|
|
|
|
{71, nullptr, "GetSixAxisSensorFusionParameters"},
|
|
|
|
{72, nullptr, "ResetSixAxisSensorFusionParameters"},
|
|
|
|
{73, nullptr, "SetAccelerometerParameters"},
|
|
|
|
{74, nullptr, "GetAccelerometerParameters"},
|
|
|
|
{75, nullptr, "ResetAccelerometerParameters"},
|
|
|
|
{76, nullptr, "SetAccelerometerPlayMode"},
|
|
|
|
{77, nullptr, "GetAccelerometerPlayMode"},
|
|
|
|
{78, nullptr, "ResetAccelerometerPlayMode"},
|
2018-02-15 15:22:11 +01:00
|
|
|
{79, &Hid::SetGyroscopeZeroDriftMode, "SetGyroscopeZeroDriftMode"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{80, nullptr, "GetGyroscopeZeroDriftMode"},
|
|
|
|
{81, nullptr, "ResetGyroscopeZeroDriftMode"},
|
2018-07-30 19:06:21 +02:00
|
|
|
{82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{83, nullptr, "IsFirmwareUpdateAvailableForSixAxisSensor"},
|
2018-09-18 17:13:58 +02:00
|
|
|
{91, &Hid::ActivateGesture, "ActivateGesture"},
|
2018-02-05 04:24:20 +01:00
|
|
|
{100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"},
|
2018-03-31 22:05:45 +02:00
|
|
|
{101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"},
|
2018-02-05 04:24:20 +01:00
|
|
|
{102, &Hid::SetSupportedNpadIdType, "SetSupportedNpadIdType"},
|
|
|
|
{103, &Hid::ActivateNpad, "ActivateNpad"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{104, nullptr, "DeactivateNpad"},
|
2018-08-12 11:57:31 +02:00
|
|
|
{106, &Hid::AcquireNpadStyleSetUpdateEventHandle, "AcquireNpadStyleSetUpdateEventHandle"},
|
2018-08-12 11:56:25 +02:00
|
|
|
{107, &Hid::DisconnectNpad, "DisconnectNpad"},
|
2018-04-13 16:05:03 +02:00
|
|
|
{108, &Hid::GetPlayerLedPattern, "GetPlayerLedPattern"},
|
2018-09-19 15:25:00 +02:00
|
|
|
{109, &Hid::ActivateNpadWithRevision, "ActivateNpadWithRevision"},
|
2018-02-06 03:53:11 +01:00
|
|
|
{120, &Hid::SetNpadJoyHoldType, "SetNpadJoyHoldType"},
|
2018-02-07 13:11:17 +01:00
|
|
|
{121, &Hid::GetNpadJoyHoldType, "GetNpadJoyHoldType"},
|
2018-08-12 11:57:31 +02:00
|
|
|
{122, &Hid::SetNpadJoyAssignmentModeSingleByDefault, "SetNpadJoyAssignmentModeSingleByDefault"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{123, nullptr, "SetNpadJoyAssignmentModeSingleByDefault"},
|
2018-03-25 09:14:57 +02:00
|
|
|
{124, &Hid::SetNpadJoyAssignmentModeDual, "SetNpadJoyAssignmentModeDual"},
|
2018-07-30 19:06:21 +02:00
|
|
|
{125, &Hid::MergeSingleJoyAsDualJoy, "MergeSingleJoyAsDualJoy"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{126, nullptr, "StartLrAssignmentMode"},
|
|
|
|
{127, nullptr, "StopLrAssignmentMode"},
|
2018-02-06 08:26:33 +01:00
|
|
|
{128, &Hid::SetNpadHandheldActivationMode, "SetNpadHandheldActivationMode"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{129, nullptr, "GetNpadHandheldActivationMode"},
|
|
|
|
{130, nullptr, "SwapNpadAssignment"},
|
|
|
|
{131, nullptr, "IsUnintendedHomeButtonInputProtectionEnabled"},
|
|
|
|
{132, nullptr, "EnableUnintendedHomeButtonInputProtection"},
|
2018-05-30 20:09:21 +02:00
|
|
|
{133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
|
2018-02-14 01:05:06 +01:00
|
|
|
{200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"},
|
2018-02-15 15:22:11 +01:00
|
|
|
{201, &Hid::SendVibrationValue, "SendVibrationValue"},
|
|
|
|
{202, &Hid::GetActualVibrationValue, "GetActualVibrationValue"},
|
2018-02-04 23:06:14 +01:00
|
|
|
{203, &Hid::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{204, nullptr, "PermitVibration"},
|
|
|
|
{205, nullptr, "IsVibrationPermitted"},
|
2018-02-14 01:05:06 +01:00
|
|
|
{206, &Hid::SendVibrationValues, "SendVibrationValues"},
|
2018-05-30 20:09:21 +02:00
|
|
|
{207, nullptr, "SendVibrationGcErmCommand"},
|
|
|
|
{208, nullptr, "GetActualVibrationGcErmCommand"},
|
2018-10-10 15:58:47 +02:00
|
|
|
{209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
|
|
|
{210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
2018-09-18 16:52:20 +02:00
|
|
|
{300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
|
|
|
|
{301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{302, nullptr, "StopConsoleSixAxisSensor"},
|
2018-05-30 20:09:21 +02:00
|
|
|
{303, nullptr, "ActivateSevenSixAxisSensor"},
|
|
|
|
{304, nullptr, "StartSevenSixAxisSensor"},
|
|
|
|
{305, nullptr, "StopSevenSixAxisSensor"},
|
|
|
|
{306, nullptr, "InitializeSevenSixAxisSensor"},
|
|
|
|
{307, nullptr, "FinalizeSevenSixAxisSensor"},
|
|
|
|
{308, nullptr, "SetSevenSixAxisSensorFusionStrength"},
|
|
|
|
{309, nullptr, "GetSevenSixAxisSensorFusionStrength"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{310, nullptr, "ResetSevenSixAxisSensorTimestamp"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{400, nullptr, "IsUsbFullKeyControllerEnabled"},
|
|
|
|
{401, nullptr, "EnableUsbFullKeyController"},
|
|
|
|
{402, nullptr, "IsUsbFullKeyControllerConnected"},
|
2018-05-30 20:09:21 +02:00
|
|
|
{403, nullptr, "HasBattery"},
|
|
|
|
{404, nullptr, "HasLeftRightBattery"},
|
|
|
|
{405, nullptr, "GetNpadInterfaceType"},
|
|
|
|
{406, nullptr, "GetNpadLeftRightInterfaceType"},
|
|
|
|
{500, nullptr, "GetPalmaConnectionHandle"},
|
|
|
|
{501, nullptr, "InitializePalma"},
|
|
|
|
{502, nullptr, "AcquirePalmaOperationCompleteEvent"},
|
|
|
|
{503, nullptr, "GetPalmaOperationInfo"},
|
|
|
|
{504, nullptr, "PlayPalmaActivity"},
|
|
|
|
{505, nullptr, "SetPalmaFrModeType"},
|
|
|
|
{506, nullptr, "ReadPalmaStep"},
|
|
|
|
{507, nullptr, "EnablePalmaStep"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{508, nullptr, "ResetPalmaStep"},
|
|
|
|
{509, nullptr, "ReadPalmaApplicationSection"},
|
|
|
|
{510, nullptr, "WritePalmaApplicationSection"},
|
|
|
|
{511, nullptr, "ReadPalmaUniqueCode"},
|
|
|
|
{512, nullptr, "SetPalmaUniqueCodeInvalid"},
|
|
|
|
{513, nullptr, "WritePalmaActivityEntry"},
|
|
|
|
{514, nullptr, "WritePalmaRgbLedPatternEntry"},
|
|
|
|
{515, nullptr, "WritePalmaWaveEntry"},
|
|
|
|
{516, nullptr, "SetPalmaDataBaseIdentificationVersion"},
|
|
|
|
{517, nullptr, "GetPalmaDataBaseIdentificationVersion"},
|
|
|
|
{518, nullptr, "SuspendPalmaFeature"},
|
|
|
|
{519, nullptr, "GetPalmaOperationResult"},
|
|
|
|
{520, nullptr, "ReadPalmaPlayLog"},
|
|
|
|
{521, nullptr, "ResetPalmaPlayLog"},
|
2018-11-16 15:40:18 +01:00
|
|
|
{522, &Hid::SetIsPalmaAllConnectable, "SetIsPalmaAllConnectable"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{523, nullptr, "SetIsPalmaPairedConnectable"},
|
|
|
|
{524, nullptr, "PairPalma"},
|
2018-11-16 15:40:18 +01:00
|
|
|
{525, &Hid::SetPalmaBoostMode, "SetPalmaBoostMode"},
|
2018-04-10 19:17:22 +02:00
|
|
|
{1000, nullptr, "SetNpadCommunicationMode"},
|
|
|
|
{1001, nullptr, "GetNpadCommunicationMode"},
|
2018-01-15 03:24:50 +01:00
|
|
|
};
|
2018-08-12 11:57:31 +02:00
|
|
|
// clang-format on
|
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
~Hid() = default;
|
|
|
|
|
|
|
|
private:
|
2018-01-22 23:41:31 +01:00
|
|
|
std::shared_ptr<IAppletResource> applet_resource;
|
2018-10-17 15:11:47 +02:00
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
void CreateAppletResource(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-01-22 23:41:31 +01:00
|
|
|
if (applet_resource == nullptr) {
|
|
|
|
applet_resource = std::make_shared<IAppletResource>();
|
2018-01-22 21:27:55 +01:00
|
|
|
}
|
|
|
|
|
2018-01-24 01:52:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2018-01-22 23:41:31 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-24 01:43:59 +01:00
|
|
|
rb.PushIpcInterface<IAppletResource>(applet_resource);
|
2018-01-15 03:24:50 +01:00
|
|
|
}
|
2018-02-04 23:06:14 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
void ActivateXpad(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto basic_xpad_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}",
|
|
|
|
basic_xpad_id, applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::XPad);
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
void ActivateDebugPad(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::DebugPad);
|
2018-02-05 04:24:20 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-06 03:53:11 +01:00
|
|
|
void ActivateTouchScreen(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::Touchscreen);
|
2018-02-06 03:53:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
void ActivateMouse(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::Mouse);
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActivateKeyboard(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::Keyboard);
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ActivateGesture(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto unknown{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, unknown={}, applet_resource_user_id={}", unknown,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::Gesture);
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActivateNpadWithRevision(Kernel::HLERequestContext& ctx) {
|
|
|
|
// Should have no effect with how our npad sets up the data
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto unknown{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, unknown={}, applet_resource_user_id={}", unknown,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::NPad);
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-02-15 15:22:11 +01:00
|
|
|
}
|
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
void StartSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
2018-10-11 17:56:49 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto handle{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto handle{rp.Pop<u32>()};
|
|
|
|
const auto drift_mode{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID,
|
|
|
|
"(STUBBED) called, handle={}, drift_mode={}, applet_resource_user_id={}",
|
|
|
|
handle, drift_mode, applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-07-30 19:06:21 +02:00
|
|
|
void IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto handle{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-08-08 08:32:38 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
2018-07-30 19:06:21 +02:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
// TODO (Hexagon12): Properly implement reading gyroscope values from controllers.
|
|
|
|
rb.Push(true);
|
|
|
|
}
|
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto supported_styleset{rp.Pop<u32>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, supported_styleset={}", supported_styleset);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.SetSupportedStyleSet({supported_styleset});
|
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-03-31 22:05:45 +02:00
|
|
|
void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
|
|
|
|
|
2018-03-31 22:05:45 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
rb.Push<u32>(controller.GetSupportedStyleSet().raw);
|
2018-03-31 22:05:45 +02:00
|
|
|
}
|
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.SetSupportedNPadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
|
2018-02-05 04:24:20 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActivateNpad(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-05 04:24:20 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
applet_resource->ActivateController(HidController::NPad);
|
2018-02-05 04:24:20 +01:00
|
|
|
}
|
|
|
|
|
2018-02-07 13:11:17 +01:00
|
|
|
void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
|
2018-10-12 07:28:00 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto npad_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
const auto unknown{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}, unknown={}",
|
|
|
|
npad_id, applet_resource_user_id, unknown);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-07 13:11:17 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.GetStyleSetChangedEvent());
|
2018-02-07 13:11:17 +01:00
|
|
|
}
|
|
|
|
|
2018-08-12 11:56:25 +02:00
|
|
|
void DisconnectNpad(Kernel::HLERequestContext& ctx) {
|
2018-10-07 11:17:04 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto npad_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-07 11:17:04 +02:00
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.DisconnectNPad(npad_id);
|
2018-08-12 11:56:25 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-04-13 16:05:03 +02:00
|
|
|
void GetPlayerLedPattern(Kernel::HLERequestContext& ctx) {
|
2018-10-10 12:38:43 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto npad_id{rp.Pop<u32>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-10 12:38:43 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2018-04-13 16:05:03 +02:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-10 12:38:43 +02:00
|
|
|
rb.PushRaw<u64>(applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.GetLedPattern(npad_id)
|
|
|
|
.raw);
|
2018-04-13 16:05:03 +02:00
|
|
|
}
|
|
|
|
|
2018-02-06 03:53:11 +01:00
|
|
|
void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
const auto hold_type{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, hold_type={}",
|
|
|
|
applet_resource_user_id, hold_type);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
|
|
|
auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
|
2018-10-05 16:23:21 +02:00
|
|
|
controller.SetHoldType(Controller_NPad::NpadHoldType{hold_type});
|
|
|
|
|
2018-02-06 03:53:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-07 13:11:17 +01:00
|
|
|
void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-06 05:14:42 +02:00
|
|
|
const auto& controller =
|
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad);
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2018-02-07 13:11:17 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
rb.Push<u64>(static_cast<u64>(controller.GetHoldType()));
|
2018-02-07 13:11:17 +01:00
|
|
|
}
|
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) {
|
2018-10-12 07:28:00 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto npad_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, npad_id={}, applet_resource_user_id={}",
|
|
|
|
npad_id, applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-10-10 15:58:47 +02:00
|
|
|
void BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-10 15:58:47 +02:00
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.SetVibrationEnabled(true);
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EndPermitVibrationSession(Kernel::HLERequestContext& ctx) {
|
2018-11-26 07:06:13 +01:00
|
|
|
LOG_DEBUG(Service_HID, "called");
|
|
|
|
|
2018-10-10 15:58:47 +02:00
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.SetVibrationEnabled(false);
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
void SendVibrationValue(Kernel::HLERequestContext& ctx) {
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto controller_id{rp.Pop<u32>()};
|
|
|
|
const auto vibration_values{rp.PopRaw<Controller_NPad::Vibration>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, controller_id={}, applet_resource_user_id={}",
|
|
|
|
controller_id, applet_resource_user_id);
|
2018-10-05 16:23:21 +02:00
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.VibrateController({controller_id}, {vibration_values});
|
2018-02-15 15:22:11 +01:00
|
|
|
}
|
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
void SendVibrationValues(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-06 05:14:42 +02:00
|
|
|
const auto controllers = ctx.ReadBuffer(0);
|
|
|
|
const auto vibrations = ctx.ReadBuffer(1);
|
2018-10-05 16:23:21 +02:00
|
|
|
|
|
|
|
std::vector<u32> controller_list(controllers.size() / sizeof(u32));
|
|
|
|
std::vector<Controller_NPad::Vibration> vibration_list(vibrations.size() /
|
|
|
|
sizeof(Controller_NPad::Vibration));
|
|
|
|
|
|
|
|
std::memcpy(controller_list.data(), controllers.data(), controllers.size());
|
|
|
|
std::memcpy(vibration_list.data(), vibrations.data(), vibrations.size());
|
|
|
|
std::transform(controller_list.begin(), controller_list.end(), controller_list.begin(),
|
|
|
|
[](u32 controller_id) { return controller_id - 3; });
|
|
|
|
|
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.VibrateController(controller_list, vibration_list);
|
|
|
|
|
2018-02-15 15:22:11 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetActualVibrationValue(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto controller_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, controller_id={}, applet_resource_user_id={}",
|
|
|
|
controller_id, applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 6};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushRaw<Controller_NPad::Vibration>(
|
|
|
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
|
|
|
.GetLastVibration());
|
2018-02-15 15:22:11 +01:00
|
|
|
}
|
|
|
|
|
2018-03-25 09:14:57 +02:00
|
|
|
void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) {
|
2018-10-05 16:23:21 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto npad_id{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-10-05 16:23:21 +02:00
|
|
|
auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
|
|
|
|
controller.SetNpadMode(npad_id, Controller_NPad::NPadAssignments::Dual);
|
|
|
|
|
2018-03-25 09:14:57 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-07-30 19:06:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto unknown_1{rp.Pop<u32>()};
|
|
|
|
const auto unknown_2{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID,
|
|
|
|
"(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}",
|
|
|
|
unknown_1, unknown_2, applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-07-30 19:06:21 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-03-25 09:14:57 +02:00
|
|
|
}
|
|
|
|
|
2018-02-06 08:26:33 +01:00
|
|
|
void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) {
|
2018-10-10 12:38:43 +02:00
|
|
|
IPC::RequestParser rp{ctx};
|
2018-12-21 19:37:39 +01:00
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
const auto mode{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, mode={}",
|
|
|
|
applet_resource_user_id, mode);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-02-06 08:26:33 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2018-02-14 01:05:06 +01:00
|
|
|
void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
|
2018-11-26 07:06:13 +01:00
|
|
|
LOG_DEBUG(Service_HID, "called");
|
|
|
|
|
2018-02-14 01:05:06 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-10-05 16:23:21 +02:00
|
|
|
rb.Push<u32>(1);
|
|
|
|
rb.Push<u32>(0);
|
2018-02-14 01:05:06 +01:00
|
|
|
}
|
|
|
|
|
2018-02-04 23:06:14 +01:00
|
|
|
void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
|
2018-11-26 07:06:13 +01:00
|
|
|
LOG_DEBUG(Service_HID, "called");
|
|
|
|
|
2018-02-04 23:06:14 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IActiveVibrationDeviceList>();
|
|
|
|
}
|
2018-02-14 01:05:06 +01:00
|
|
|
|
2018-09-18 16:52:20 +02:00
|
|
|
void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-09-18 16:52:20 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto handle{rp.Pop<u32>()};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, handle={}, applet_resource_user_id={}", handle,
|
|
|
|
applet_resource_user_id);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-09-18 16:52:20 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
2018-09-18 16:56:02 +02:00
|
|
|
|
|
|
|
void StopSixAxisSensor(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto handle{rp.Pop<u32>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, handle={}", handle);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-09-18 16:56:02 +02:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
2018-11-16 15:40:18 +01:00
|
|
|
|
|
|
|
void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
|
|
const auto unknown{rp.Pop<u32>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, unknown={}",
|
|
|
|
applet_resource_user_id, unknown);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-11-16 15:40:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
|
2018-12-21 19:37:39 +01:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const auto unknown{rp.Pop<u32>()};
|
|
|
|
|
|
|
|
LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}", unknown);
|
2018-11-26 07:06:13 +01:00
|
|
|
|
2018-11-16 15:40:18 +01:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
2018-01-15 03:24:50 +01:00
|
|
|
};
|
2015-01-19 00:07:48 +01:00
|
|
|
|
2018-07-26 14:56:16 +02:00
|
|
|
class HidDbg final : public ServiceFramework<HidDbg> {
|
|
|
|
public:
|
|
|
|
explicit HidDbg() : ServiceFramework{"hid:dbg"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "DeactivateDebugPad"},
|
|
|
|
{1, nullptr, "SetDebugPadAutoPilotState"},
|
|
|
|
{2, nullptr, "UnsetDebugPadAutoPilotState"},
|
|
|
|
{10, nullptr, "DeactivateTouchScreen"},
|
|
|
|
{11, nullptr, "SetTouchScreenAutoPilotState"},
|
|
|
|
{12, nullptr, "UnsetTouchScreenAutoPilotState"},
|
|
|
|
{20, nullptr, "DeactivateMouse"},
|
|
|
|
{21, nullptr, "SetMouseAutoPilotState"},
|
|
|
|
{22, nullptr, "UnsetMouseAutoPilotState"},
|
|
|
|
{30, nullptr, "DeactivateKeyboard"},
|
|
|
|
{31, nullptr, "SetKeyboardAutoPilotState"},
|
|
|
|
{32, nullptr, "UnsetKeyboardAutoPilotState"},
|
|
|
|
{50, nullptr, "DeactivateXpad"},
|
|
|
|
{51, nullptr, "SetXpadAutoPilotState"},
|
|
|
|
{52, nullptr, "UnsetXpadAutoPilotState"},
|
|
|
|
{60, nullptr, "DeactivateJoyXpad"},
|
|
|
|
{91, nullptr, "DeactivateGesture"},
|
|
|
|
{110, nullptr, "DeactivateHomeButton"},
|
|
|
|
{111, nullptr, "SetHomeButtonAutoPilotState"},
|
|
|
|
{112, nullptr, "UnsetHomeButtonAutoPilotState"},
|
|
|
|
{120, nullptr, "DeactivateSleepButton"},
|
|
|
|
{121, nullptr, "SetSleepButtonAutoPilotState"},
|
|
|
|
{122, nullptr, "UnsetSleepButtonAutoPilotState"},
|
|
|
|
{123, nullptr, "DeactivateInputDetector"},
|
|
|
|
{130, nullptr, "DeactivateCaptureButton"},
|
|
|
|
{131, nullptr, "SetCaptureButtonAutoPilotState"},
|
|
|
|
{132, nullptr, "UnsetCaptureButtonAutoPilotState"},
|
|
|
|
{133, nullptr, "SetShiftAccelerometerCalibrationValue"},
|
|
|
|
{134, nullptr, "GetShiftAccelerometerCalibrationValue"},
|
|
|
|
{135, nullptr, "SetShiftGyroscopeCalibrationValue"},
|
|
|
|
{136, nullptr, "GetShiftGyroscopeCalibrationValue"},
|
|
|
|
{140, nullptr, "DeactivateConsoleSixAxisSensor"},
|
|
|
|
{141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"},
|
|
|
|
{142, nullptr, "DeactivateSevenSixAxisSensor"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{143, nullptr, "GetConsoleSixAxisSensorCountStates"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{201, nullptr, "ActivateFirmwareUpdate"},
|
|
|
|
{202, nullptr, "DeactivateFirmwareUpdate"},
|
|
|
|
{203, nullptr, "StartFirmwareUpdate"},
|
|
|
|
{204, nullptr, "GetFirmwareUpdateStage"},
|
|
|
|
{205, nullptr, "GetFirmwareVersion"},
|
|
|
|
{206, nullptr, "GetDestinationFirmwareVersion"},
|
|
|
|
{207, nullptr, "DiscardFirmwareInfoCacheForRevert"},
|
|
|
|
{208, nullptr, "StartFirmwareUpdateForRevert"},
|
|
|
|
{209, nullptr, "GetAvailableFirmwareVersionForRevert"},
|
|
|
|
{210, nullptr, "IsFirmwareUpdatingDevice"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{211, nullptr, "StartFirmwareUpdateIndividual"},
|
|
|
|
{215, nullptr, "SetUsbFirmwareForceUpdateEnabled"},
|
|
|
|
{216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{221, nullptr, "UpdateControllerColor"},
|
|
|
|
{222, nullptr, "ConnectUsbPadsAsync"},
|
|
|
|
{223, nullptr, "DisconnectUsbPadsAsync"},
|
|
|
|
{224, nullptr, "UpdateDesignInfo"},
|
|
|
|
{225, nullptr, "GetUniquePadDriverState"},
|
|
|
|
{226, nullptr, "GetSixAxisSensorDriverStates"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{227, nullptr, "GetRxPacketHistory"},
|
|
|
|
{228, nullptr, "AcquireOperationEventHandle"},
|
|
|
|
{229, nullptr, "ReadSerialFlash"},
|
|
|
|
{230, nullptr, "WriteSerialFlash"},
|
|
|
|
{231, nullptr, "GetOperationResult"},
|
|
|
|
{232, nullptr, "EnableShipmentMode"},
|
|
|
|
{233, nullptr, "ClearPairingInfo"},
|
|
|
|
{234, nullptr, "GetUniquePadDeviceTypeSetInternal"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{301, nullptr, "GetAbstractedPadHandles"},
|
|
|
|
{302, nullptr, "GetAbstractedPadState"},
|
|
|
|
{303, nullptr, "GetAbstractedPadsState"},
|
|
|
|
{321, nullptr, "SetAutoPilotVirtualPadState"},
|
|
|
|
{322, nullptr, "UnsetAutoPilotVirtualPadState"},
|
|
|
|
{323, nullptr, "UnsetAllAutoPilotVirtualPadState"},
|
|
|
|
{350, nullptr, "AddRegisteredDevice"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{400, nullptr, "DisableExternalMcuOnNxDevice"},
|
|
|
|
{401, nullptr, "DisableRailDeviceFiltering"},
|
2018-07-26 14:56:16 +02:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class HidSys final : public ServiceFramework<HidSys> {
|
|
|
|
public:
|
|
|
|
explicit HidSys() : ServiceFramework{"hid:sys"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{31, nullptr, "SendKeyboardLockKeyEvent"},
|
|
|
|
{101, nullptr, "AcquireHomeButtonEventHandle"},
|
|
|
|
{111, nullptr, "ActivateHomeButton"},
|
|
|
|
{121, nullptr, "AcquireSleepButtonEventHandle"},
|
|
|
|
{131, nullptr, "ActivateSleepButton"},
|
|
|
|
{141, nullptr, "AcquireCaptureButtonEventHandle"},
|
|
|
|
{151, nullptr, "ActivateCaptureButton"},
|
|
|
|
{210, nullptr, "AcquireNfcDeviceUpdateEventHandle"},
|
|
|
|
{211, nullptr, "GetNpadsWithNfc"},
|
|
|
|
{212, nullptr, "AcquireNfcActivateEventHandle"},
|
|
|
|
{213, nullptr, "ActivateNfc"},
|
|
|
|
{214, nullptr, "GetXcdHandleForNpadWithNfc"},
|
|
|
|
{215, nullptr, "IsNfcActivated"},
|
|
|
|
{230, nullptr, "AcquireIrSensorEventHandle"},
|
|
|
|
{231, nullptr, "ActivateIrSensor"},
|
|
|
|
{301, nullptr, "ActivateNpadSystem"},
|
|
|
|
{303, nullptr, "ApplyNpadSystemCommonPolicy"},
|
|
|
|
{304, nullptr, "EnableAssigningSingleOnSlSrPress"},
|
|
|
|
{305, nullptr, "DisableAssigningSingleOnSlSrPress"},
|
|
|
|
{306, nullptr, "GetLastActiveNpad"},
|
|
|
|
{307, nullptr, "GetNpadSystemExtStyle"},
|
|
|
|
{308, nullptr, "ApplyNpadSystemCommonPolicyFull"},
|
|
|
|
{309, nullptr, "GetNpadFullKeyGripColor"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{310, nullptr, "GetMaskedSupportedNpadStyleSet"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{311, nullptr, "SetNpadPlayerLedBlinkingDevice"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{312, nullptr, "SetSupportedNpadStyleSetAll"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{321, nullptr, "GetUniquePadsFromNpad"},
|
|
|
|
{322, nullptr, "GetIrSensorState"},
|
|
|
|
{323, nullptr, "GetXcdHandleForNpadWithIrSensor"},
|
|
|
|
{500, nullptr, "SetAppletResourceUserId"},
|
|
|
|
{501, nullptr, "RegisterAppletResourceUserId"},
|
|
|
|
{502, nullptr, "UnregisterAppletResourceUserId"},
|
|
|
|
{503, nullptr, "EnableAppletToGetInput"},
|
|
|
|
{504, nullptr, "SetAruidValidForVibration"},
|
|
|
|
{505, nullptr, "EnableAppletToGetSixAxisSensor"},
|
|
|
|
{510, nullptr, "SetVibrationMasterVolume"},
|
|
|
|
{511, nullptr, "GetVibrationMasterVolume"},
|
|
|
|
{512, nullptr, "BeginPermitVibrationSession"},
|
|
|
|
{513, nullptr, "EndPermitVibrationSession"},
|
|
|
|
{520, nullptr, "EnableHandheldHids"},
|
|
|
|
{521, nullptr, "DisableHandheldHids"},
|
|
|
|
{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"},
|
|
|
|
{541, nullptr, "GetPlayReportControllerUsages"},
|
|
|
|
{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"},
|
|
|
|
{543, nullptr, "GetRegisteredDevicesOld"},
|
|
|
|
{544, nullptr, "AcquireConnectionTriggerTimeoutEvent"},
|
|
|
|
{545, nullptr, "SendConnectionTrigger"},
|
|
|
|
{546, nullptr, "AcquireDeviceRegisteredEventForControllerSupport"},
|
|
|
|
{547, nullptr, "GetAllowedBluetoothLinksCount"},
|
|
|
|
{548, nullptr, "GetRegisteredDevices"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{549, nullptr, "GetConnectableRegisteredDevices"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{700, nullptr, "ActivateUniquePad"},
|
|
|
|
{702, nullptr, "AcquireUniquePadConnectionEventHandle"},
|
|
|
|
{703, nullptr, "GetUniquePadIds"},
|
|
|
|
{751, nullptr, "AcquireJoyDetachOnBluetoothOffEventHandle"},
|
|
|
|
{800, nullptr, "ListSixAxisSensorHandles"},
|
|
|
|
{801, nullptr, "IsSixAxisSensorUserCalibrationSupported"},
|
|
|
|
{802, nullptr, "ResetSixAxisSensorCalibrationValues"},
|
|
|
|
{803, nullptr, "StartSixAxisSensorUserCalibration"},
|
|
|
|
{804, nullptr, "CancelSixAxisSensorUserCalibration"},
|
|
|
|
{805, nullptr, "GetUniquePadBluetoothAddress"},
|
|
|
|
{806, nullptr, "DisconnectUniquePad"},
|
|
|
|
{807, nullptr, "GetUniquePadType"},
|
|
|
|
{808, nullptr, "GetUniquePadInterface"},
|
|
|
|
{809, nullptr, "GetUniquePadSerialNumber"},
|
|
|
|
{810, nullptr, "GetUniquePadControllerNumber"},
|
|
|
|
{811, nullptr, "GetSixAxisSensorUserCalibrationStage"},
|
|
|
|
{821, nullptr, "StartAnalogStickManualCalibration"},
|
|
|
|
{822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"},
|
|
|
|
{823, nullptr, "CancelAnalogStickManualCalibration"},
|
|
|
|
{824, nullptr, "ResetAnalogStickManualCalibration"},
|
|
|
|
{825, nullptr, "GetAnalogStickState"},
|
|
|
|
{826, nullptr, "GetAnalogStickManualCalibrationStage"},
|
|
|
|
{827, nullptr, "IsAnalogStickButtonPressed"},
|
|
|
|
{828, nullptr, "IsAnalogStickInReleasePosition"},
|
|
|
|
{829, nullptr, "IsAnalogStickInCircumference"},
|
|
|
|
{850, nullptr, "IsUsbFullKeyControllerEnabled"},
|
|
|
|
{851, nullptr, "EnableUsbFullKeyController"},
|
|
|
|
{852, nullptr, "IsUsbConnected"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{870, nullptr, "IsHandheldButtonPressedOnConsoleMode"},
|
2018-07-26 14:56:16 +02:00
|
|
|
{900, nullptr, "ActivateInputDetector"},
|
|
|
|
{901, nullptr, "NotifyInputDetector"},
|
|
|
|
{1000, nullptr, "InitializeFirmwareUpdate"},
|
|
|
|
{1001, nullptr, "GetFirmwareVersion"},
|
|
|
|
{1002, nullptr, "GetAvailableFirmwareVersion"},
|
|
|
|
{1003, nullptr, "IsFirmwareUpdateAvailable"},
|
|
|
|
{1004, nullptr, "CheckFirmwareUpdateRequired"},
|
|
|
|
{1005, nullptr, "StartFirmwareUpdate"},
|
|
|
|
{1006, nullptr, "AbortFirmwareUpdate"},
|
|
|
|
{1007, nullptr, "GetFirmwareUpdateState"},
|
|
|
|
{1008, nullptr, "ActivateAudioControl"},
|
|
|
|
{1009, nullptr, "AcquireAudioControlEventHandle"},
|
|
|
|
{1010, nullptr, "GetAudioControlStates"},
|
|
|
|
{1011, nullptr, "DeactivateAudioControl"},
|
|
|
|
{1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"},
|
|
|
|
{1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"},
|
|
|
|
{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"},
|
|
|
|
{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"},
|
|
|
|
{1100, nullptr, "GetHidbusSystemServiceObject"},
|
2018-10-19 09:57:14 +02:00
|
|
|
{1120, nullptr, "SetFirmwareHotfixUpdateSkipEnabled"},
|
|
|
|
{1130, nullptr, "InitializeUsbFirmwareUpdate"},
|
|
|
|
{1131, nullptr, "FinalizeUsbFirmwareUpdate"},
|
|
|
|
{1132, nullptr, "CheckUsbFirmwareUpdateRequired"},
|
|
|
|
{1133, nullptr, "StartUsbFirmwareUpdate"},
|
|
|
|
{1134, nullptr, "GetUsbFirmwareUpdateState"},
|
2018-07-26 14:56:16 +02:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class HidTmp final : public ServiceFramework<HidTmp> {
|
|
|
|
public:
|
|
|
|
explicit HidTmp() : ServiceFramework{"hid:tmp"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class HidBus final : public ServiceFramework<HidBus> {
|
|
|
|
public:
|
|
|
|
explicit HidBus() : ServiceFramework{"hidbus"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{1, nullptr, "GetBusHandle"},
|
|
|
|
{2, nullptr, "IsExternalDeviceConnected"},
|
|
|
|
{3, nullptr, "Initialize"},
|
|
|
|
{4, nullptr, "Finalize"},
|
|
|
|
{5, nullptr, "EnableExternalDevice"},
|
|
|
|
{6, nullptr, "GetExternalDeviceId"},
|
|
|
|
{7, nullptr, "SendCommandAsync"},
|
|
|
|
{8, nullptr, "GetSendCommandAsynceResult"},
|
|
|
|
{9, nullptr, "SetEventForSendCommandAsycResult"},
|
|
|
|
{10, nullptr, "GetSharedMemoryHandle"},
|
|
|
|
{11, nullptr, "EnableJoyPollingReceiveMode"},
|
|
|
|
{12, nullptr, "DisableJoyPollingReceiveMode"},
|
|
|
|
{13, nullptr, "GetPollingData"},
|
2018-10-21 22:51:44 +02:00
|
|
|
{14, nullptr, "SetStatusManagerType"},
|
2018-07-26 14:56:16 +02:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-09 00:57:41 +02:00
|
|
|
void ReloadInputDevices() {
|
|
|
|
Settings::values.is_device_reload_pending.store(true);
|
|
|
|
}
|
2015-01-19 00:07:48 +01:00
|
|
|
|
2018-01-15 03:24:50 +01:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
|
|
|
std::make_shared<Hid>()->InstallAsService(service_manager);
|
2018-07-26 14:56:16 +02:00
|
|
|
std::make_shared<HidBus>()->InstallAsService(service_manager);
|
|
|
|
std::make_shared<HidDbg>()->InstallAsService(service_manager);
|
|
|
|
std::make_shared<HidSys>()->InstallAsService(service_manager);
|
|
|
|
std::make_shared<HidTmp>()->InstallAsService(service_manager);
|
|
|
|
|
2018-07-26 14:39:25 +02:00
|
|
|
std::make_shared<IRS>()->InstallAsService(service_manager);
|
|
|
|
std::make_shared<IRS_SYS>()->InstallAsService(service_manager);
|
2018-07-26 14:56:16 +02:00
|
|
|
|
2018-07-26 14:50:32 +02:00
|
|
|
std::make_shared<XCD_SYS>()->InstallAsService(service_manager);
|
2018-01-15 03:24:50 +01:00
|
|
|
}
|
|
|
|
|
2018-04-20 03:41:44 +02:00
|
|
|
} // namespace Service::HID
|