mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 07:30:05 +00:00
service: hid: Implement xpad calls
This commit is contained in:
parent
d86e88a622
commit
b9c7e5c2c8
@ -75,19 +75,19 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r
|
|||||||
{26, nullptr, "ActivateDebugMouse"},
|
{26, nullptr, "ActivateDebugMouse"},
|
||||||
{31, &IHidServer::ActivateKeyboard, "ActivateKeyboard"},
|
{31, &IHidServer::ActivateKeyboard, "ActivateKeyboard"},
|
||||||
{32, &IHidServer::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"},
|
{32, &IHidServer::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"},
|
||||||
{40, nullptr, "AcquireXpadIdEventHandle"},
|
{40, &IHidServer::AcquireXpadIdEventHandle, "AcquireXpadIdEventHandle"},
|
||||||
{41, nullptr, "ReleaseXpadIdEventHandle"},
|
{41, &IHidServer::ReleaseXpadIdEventHandle, "ReleaseXpadIdEventHandle"},
|
||||||
{51, &IHidServer::ActivateXpad, "ActivateXpad"},
|
{51, &IHidServer::ActivateXpad, "ActivateXpad"},
|
||||||
{55, &IHidServer::GetXpadIds, "GetXpadIds"},
|
{55, &IHidServer::GetXpadIds, "GetXpadIds"},
|
||||||
{56, nullptr, "ActivateJoyXpad"},
|
{56, &IHidServer::ActivateJoyXpad, "ActivateJoyXpad"},
|
||||||
{58, nullptr, "GetJoyXpadLifoHandle"},
|
{58, &IHidServer::GetJoyXpadLifoHandle, "GetJoyXpadLifoHandle"},
|
||||||
{59, nullptr, "GetJoyXpadIds"},
|
{59, &IHidServer::GetJoyXpadIds, "GetJoyXpadIds"},
|
||||||
{60, &IHidServer::ActivateSixAxisSensor, "ActivateSixAxisSensor"},
|
{60, &IHidServer::ActivateSixAxisSensor, "ActivateSixAxisSensor"},
|
||||||
{61, &IHidServer::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"},
|
{61, &IHidServer::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"},
|
||||||
{62, nullptr, "GetSixAxisSensorLifoHandle"},
|
{62, &IHidServer::GetSixAxisSensorLifoHandle, "GetSixAxisSensorLifoHandle"},
|
||||||
{63, nullptr, "ActivateJoySixAxisSensor"},
|
{63, &IHidServer::ActivateJoySixAxisSensor, "ActivateJoySixAxisSensor"},
|
||||||
{64, nullptr, "DeactivateJoySixAxisSensor"},
|
{64, &IHidServer::DeactivateJoySixAxisSensor, "DeactivateJoySixAxisSensor"},
|
||||||
{65, nullptr, "GetJoySixAxisSensorLifoHandle"},
|
{65, &IHidServer::GetJoySixAxisSensorLifoHandle, "GetJoySixAxisSensorLifoHandle"},
|
||||||
{66, &IHidServer::StartSixAxisSensor, "StartSixAxisSensor"},
|
{66, &IHidServer::StartSixAxisSensor, "StartSixAxisSensor"},
|
||||||
{67, &IHidServer::StopSixAxisSensor, "StopSixAxisSensor"},
|
{67, &IHidServer::StopSixAxisSensor, "StopSixAxisSensor"},
|
||||||
{68, &IHidServer::IsSixAxisSensorFusionEnabled, "IsSixAxisSensorFusionEnabled"},
|
{68, &IHidServer::IsSixAxisSensorFusionEnabled, "IsSixAxisSensorFusionEnabled"},
|
||||||
@ -284,6 +284,31 @@ void IHidServer::SendKeyboardLockKeyEvent(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IHidServer::AcquireXpadIdEventHandle(HLERequestContext& ctx) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Handle returned is null here
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::ReleaseXpadIdEventHandle(HLERequestContext& ctx) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
void IHidServer::ActivateXpad(HLERequestContext& ctx) {
|
void IHidServer::ActivateXpad(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
@ -295,41 +320,70 @@ void IHidServer::ActivateXpad(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
GetResourceManager()->ActivateController(HidController::XPad);
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}",
|
LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}",
|
||||||
parameters.basic_xpad_id, parameters.applet_resource_user_id);
|
parameters.basic_xpad_id, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::GetXpadIds(HLERequestContext& ctx) {
|
void IHidServer::GetXpadIds(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
LOG_DEBUG(Service_HID, "called");
|
||||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id);
|
// This function has been hardcoded since 10.0.0+
|
||||||
|
const std::array<u32, 4> basic_xpad_id{0, 1, 2, 3};
|
||||||
|
ctx.WriteBuffer(basic_xpad_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(0);
|
rb.Push<s64>(basic_xpad_id.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::ActivateJoyXpad(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetJoyXpadLifoHandle(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Handle returned is null here
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetJoyXpadIds(HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_HID, "called");
|
||||||
|
|
||||||
|
// This function has been hardcoded since 10.0.0+
|
||||||
|
const s64 basic_xpad_id_count{};
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push(basic_xpad_id_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) {
|
void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
struct Parameters {
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
u32 basic_xpad_id;
|
|
||||||
INSERT_PADDING_WORDS_NOINIT(1);
|
|
||||||
u64 applet_resource_user_id;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
// This function does nothing on 10.0.0+
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called, basic_xpad_id={}, applet_resource_user_id={}",
|
|
||||||
parameters.basic_xpad_id, parameters.applet_resource_user_id);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@ -337,24 +391,65 @@ void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
void IHidServer::DeactivateSixAxisSensor(HLERequestContext& ctx) {
|
void IHidServer::DeactivateSixAxisSensor(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
struct Parameters {
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
u32 basic_xpad_id;
|
|
||||||
INSERT_PADDING_WORDS_NOINIT(1);
|
|
||||||
u64 applet_resource_user_id;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
// This function does nothing on 10.0.0+
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called, basic_xpad_id={}, applet_resource_user_id={}",
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
parameters.basic_xpad_id, parameters.applet_resource_user_id);
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetSixAxisSensorLifoHandle(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IHidServer::ActivateJoySixAxisSensor(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::DeactivateJoySixAxisSensor(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto joy_xpad_id{rp.Pop<u32>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id);
|
||||||
|
|
||||||
|
// This function has been stubbed since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Handle returned is null here
|
||||||
|
}
|
||||||
|
|
||||||
void IHidServer::StartSixAxisSensor(HLERequestContext& ctx) {
|
void IHidServer::StartSixAxisSensor(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
|
@ -26,11 +26,19 @@ private:
|
|||||||
void ActivateMouse(HLERequestContext& ctx);
|
void ActivateMouse(HLERequestContext& ctx);
|
||||||
void ActivateKeyboard(HLERequestContext& ctx);
|
void ActivateKeyboard(HLERequestContext& ctx);
|
||||||
void SendKeyboardLockKeyEvent(HLERequestContext& ctx);
|
void SendKeyboardLockKeyEvent(HLERequestContext& ctx);
|
||||||
|
void AcquireXpadIdEventHandle(HLERequestContext& ctx);
|
||||||
|
void ReleaseXpadIdEventHandle(HLERequestContext& ctx);
|
||||||
void ActivateXpad(HLERequestContext& ctx);
|
void ActivateXpad(HLERequestContext& ctx);
|
||||||
void GetXpadIds(HLERequestContext& ctx);
|
void GetXpadIds(HLERequestContext& ctx);
|
||||||
|
void ActivateJoyXpad(HLERequestContext& ctx);
|
||||||
|
void GetJoyXpadLifoHandle(HLERequestContext& ctx);
|
||||||
void GetJoyXpadIds(HLERequestContext& ctx);
|
void GetJoyXpadIds(HLERequestContext& ctx);
|
||||||
void ActivateSixAxisSensor(HLERequestContext& ctx);
|
void ActivateSixAxisSensor(HLERequestContext& ctx);
|
||||||
void DeactivateSixAxisSensor(HLERequestContext& ctx);
|
void DeactivateSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void GetSixAxisSensorLifoHandle(HLERequestContext& ctx);
|
||||||
|
void ActivateJoySixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void DeactivateJoySixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx);
|
||||||
void StartSixAxisSensor(HLERequestContext& ctx);
|
void StartSixAxisSensor(HLERequestContext& ctx);
|
||||||
void StopSixAxisSensor(HLERequestContext& ctx);
|
void StopSixAxisSensor(HLERequestContext& ctx);
|
||||||
void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx);
|
void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user