diff options
| -rw-r--r-- | src/core/hle/service/hid/hid_server.cpp | 167 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_server.h | 8 |
2 files changed, 139 insertions, 36 deletions
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 348dc98d9..2fb31cf47 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp | |||
| @@ -75,19 +75,19 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r | |||
| 75 | {26, nullptr, "ActivateDebugMouse"}, | 75 | {26, nullptr, "ActivateDebugMouse"}, |
| 76 | {31, &IHidServer::ActivateKeyboard, "ActivateKeyboard"}, | 76 | {31, &IHidServer::ActivateKeyboard, "ActivateKeyboard"}, |
| 77 | {32, &IHidServer::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, | 77 | {32, &IHidServer::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, |
| 78 | {40, nullptr, "AcquireXpadIdEventHandle"}, | 78 | {40, &IHidServer::AcquireXpadIdEventHandle, "AcquireXpadIdEventHandle"}, |
| 79 | {41, nullptr, "ReleaseXpadIdEventHandle"}, | 79 | {41, &IHidServer::ReleaseXpadIdEventHandle, "ReleaseXpadIdEventHandle"}, |
| 80 | {51, &IHidServer::ActivateXpad, "ActivateXpad"}, | 80 | {51, &IHidServer::ActivateXpad, "ActivateXpad"}, |
| 81 | {55, &IHidServer::GetXpadIds, "GetXpadIds"}, | 81 | {55, &IHidServer::GetXpadIds, "GetXpadIds"}, |
| 82 | {56, nullptr, "ActivateJoyXpad"}, | 82 | {56, &IHidServer::ActivateJoyXpad, "ActivateJoyXpad"}, |
| 83 | {58, nullptr, "GetJoyXpadLifoHandle"}, | 83 | {58, &IHidServer::GetJoyXpadLifoHandle, "GetJoyXpadLifoHandle"}, |
| 84 | {59, nullptr, "GetJoyXpadIds"}, | 84 | {59, &IHidServer::GetJoyXpadIds, "GetJoyXpadIds"}, |
| 85 | {60, &IHidServer::ActivateSixAxisSensor, "ActivateSixAxisSensor"}, | 85 | {60, &IHidServer::ActivateSixAxisSensor, "ActivateSixAxisSensor"}, |
| 86 | {61, &IHidServer::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"}, | 86 | {61, &IHidServer::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"}, |
| 87 | {62, nullptr, "GetSixAxisSensorLifoHandle"}, | 87 | {62, &IHidServer::GetSixAxisSensorLifoHandle, "GetSixAxisSensorLifoHandle"}, |
| 88 | {63, nullptr, "ActivateJoySixAxisSensor"}, | 88 | {63, &IHidServer::ActivateJoySixAxisSensor, "ActivateJoySixAxisSensor"}, |
| 89 | {64, nullptr, "DeactivateJoySixAxisSensor"}, | 89 | {64, &IHidServer::DeactivateJoySixAxisSensor, "DeactivateJoySixAxisSensor"}, |
| 90 | {65, nullptr, "GetJoySixAxisSensorLifoHandle"}, | 90 | {65, &IHidServer::GetJoySixAxisSensorLifoHandle, "GetJoySixAxisSensorLifoHandle"}, |
| 91 | {66, &IHidServer::StartSixAxisSensor, "StartSixAxisSensor"}, | 91 | {66, &IHidServer::StartSixAxisSensor, "StartSixAxisSensor"}, |
| 92 | {67, &IHidServer::StopSixAxisSensor, "StopSixAxisSensor"}, | 92 | {67, &IHidServer::StopSixAxisSensor, "StopSixAxisSensor"}, |
| 93 | {68, &IHidServer::IsSixAxisSensorFusionEnabled, "IsSixAxisSensorFusionEnabled"}, | 93 | {68, &IHidServer::IsSixAxisSensorFusionEnabled, "IsSixAxisSensorFusionEnabled"}, |
| @@ -284,6 +284,31 @@ void IHidServer::SendKeyboardLockKeyEvent(HLERequestContext& ctx) { | |||
| 284 | rb.Push(ResultSuccess); | 284 | rb.Push(ResultSuccess); |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | void IHidServer::AcquireXpadIdEventHandle(HLERequestContext& ctx) { | ||
| 288 | IPC::RequestParser rp{ctx}; | ||
| 289 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 290 | |||
| 291 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 292 | |||
| 293 | // This function has been stubbed since 10.0.0+ | ||
| 294 | |||
| 295 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 296 | rb.Push(ResultSuccess); | ||
| 297 | // Handle returned is null here | ||
| 298 | } | ||
| 299 | |||
| 300 | void IHidServer::ReleaseXpadIdEventHandle(HLERequestContext& ctx) { | ||
| 301 | IPC::RequestParser rp{ctx}; | ||
| 302 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 303 | |||
| 304 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 305 | |||
| 306 | // This function has been stubbed since 10.0.0+ | ||
| 307 | |||
| 308 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 309 | rb.Push(ResultSuccess); | ||
| 310 | } | ||
| 311 | |||
| 287 | void IHidServer::ActivateXpad(HLERequestContext& ctx) { | 312 | void IHidServer::ActivateXpad(HLERequestContext& ctx) { |
| 288 | IPC::RequestParser rp{ctx}; | 313 | IPC::RequestParser rp{ctx}; |
| 289 | struct Parameters { | 314 | struct Parameters { |
| @@ -295,41 +320,70 @@ void IHidServer::ActivateXpad(HLERequestContext& ctx) { | |||
| 295 | 320 | ||
| 296 | const auto parameters{rp.PopRaw<Parameters>()}; | 321 | const auto parameters{rp.PopRaw<Parameters>()}; |
| 297 | 322 | ||
| 298 | GetResourceManager()->ActivateController(HidController::XPad); | ||
| 299 | |||
| 300 | LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}", | 323 | LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}", |
| 301 | parameters.basic_xpad_id, parameters.applet_resource_user_id); | 324 | parameters.basic_xpad_id, parameters.applet_resource_user_id); |
| 302 | 325 | ||
| 326 | // This function has been stubbed since 10.0.0+ | ||
| 327 | |||
| 303 | IPC::ResponseBuilder rb{ctx, 2}; | 328 | IPC::ResponseBuilder rb{ctx, 2}; |
| 304 | rb.Push(ResultSuccess); | 329 | rb.Push(ResultSuccess); |
| 305 | } | 330 | } |
| 306 | 331 | ||
| 307 | void IHidServer::GetXpadIds(HLERequestContext& ctx) { | 332 | void IHidServer::GetXpadIds(HLERequestContext& ctx) { |
| 333 | LOG_DEBUG(Service_HID, "called"); | ||
| 334 | |||
| 335 | // This function has been hardcoded since 10.0.0+ | ||
| 336 | const std::array<u32, 4> basic_xpad_id{0, 1, 2, 3}; | ||
| 337 | ctx.WriteBuffer(basic_xpad_id); | ||
| 338 | |||
| 339 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 340 | rb.Push(ResultSuccess); | ||
| 341 | rb.Push<s64>(basic_xpad_id.size()); | ||
| 342 | } | ||
| 343 | |||
| 344 | void IHidServer::ActivateJoyXpad(HLERequestContext& ctx) { | ||
| 308 | IPC::RequestParser rp{ctx}; | 345 | IPC::RequestParser rp{ctx}; |
| 309 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 346 | const auto joy_xpad_id{rp.Pop<u32>()}; |
| 310 | 347 | ||
| 311 | LOG_DEBUG(Service_HID, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id); | 348 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 312 | 349 | ||
| 313 | IPC::ResponseBuilder rb{ctx, 3}; | 350 | // This function has been stubbed since 10.0.0+ |
| 351 | |||
| 352 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 314 | rb.Push(ResultSuccess); | 353 | rb.Push(ResultSuccess); |
| 315 | rb.Push(0); | ||
| 316 | } | 354 | } |
| 317 | 355 | ||
| 318 | void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) { | 356 | void IHidServer::GetJoyXpadLifoHandle(HLERequestContext& ctx) { |
| 319 | IPC::RequestParser rp{ctx}; | 357 | IPC::RequestParser rp{ctx}; |
| 320 | struct Parameters { | 358 | const auto joy_xpad_id{rp.Pop<u32>()}; |
| 321 | u32 basic_xpad_id; | ||
| 322 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 323 | u64 applet_resource_user_id; | ||
| 324 | }; | ||
| 325 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 326 | 359 | ||
| 327 | const auto parameters{rp.PopRaw<Parameters>()}; | 360 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 361 | |||
| 362 | // This function has been stubbed since 10.0.0+ | ||
| 363 | |||
| 364 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 365 | rb.Push(ResultSuccess); | ||
| 366 | // Handle returned is null here | ||
| 367 | } | ||
| 368 | |||
| 369 | void IHidServer::GetJoyXpadIds(HLERequestContext& ctx) { | ||
| 370 | LOG_DEBUG(Service_HID, "called"); | ||
| 371 | |||
| 372 | // This function has been hardcoded since 10.0.0+ | ||
| 373 | const s64 basic_xpad_id_count{}; | ||
| 374 | |||
| 375 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 376 | rb.Push(ResultSuccess); | ||
| 377 | rb.Push(basic_xpad_id_count); | ||
| 378 | } | ||
| 328 | 379 | ||
| 329 | // This function does nothing on 10.0.0+ | 380 | void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) { |
| 381 | IPC::RequestParser rp{ctx}; | ||
| 382 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 383 | |||
| 384 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | ||
| 330 | 385 | ||
| 331 | LOG_WARNING(Service_HID, "(STUBBED) called, basic_xpad_id={}, applet_resource_user_id={}", | 386 | // This function has been stubbed since 10.0.0+ |
| 332 | parameters.basic_xpad_id, parameters.applet_resource_user_id); | ||
| 333 | 387 | ||
| 334 | IPC::ResponseBuilder rb{ctx, 2}; | 388 | IPC::ResponseBuilder rb{ctx, 2}; |
| 335 | rb.Push(ResultSuccess); | 389 | rb.Push(ResultSuccess); |
| @@ -337,24 +391,65 @@ void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) { | |||
| 337 | 391 | ||
| 338 | void IHidServer::DeactivateSixAxisSensor(HLERequestContext& ctx) { | 392 | void IHidServer::DeactivateSixAxisSensor(HLERequestContext& ctx) { |
| 339 | IPC::RequestParser rp{ctx}; | 393 | IPC::RequestParser rp{ctx}; |
| 340 | struct Parameters { | 394 | const auto joy_xpad_id{rp.Pop<u32>()}; |
| 341 | u32 basic_xpad_id; | ||
| 342 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 343 | u64 applet_resource_user_id; | ||
| 344 | }; | ||
| 345 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 346 | 395 | ||
| 347 | const auto parameters{rp.PopRaw<Parameters>()}; | 396 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 397 | |||
| 398 | // This function has been stubbed since 10.0.0+ | ||
| 399 | |||
| 400 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 401 | rb.Push(ResultSuccess); | ||
| 402 | } | ||
| 348 | 403 | ||
| 349 | // This function does nothing on 10.0.0+ | 404 | void IHidServer::GetSixAxisSensorLifoHandle(HLERequestContext& ctx) { |
| 405 | IPC::RequestParser rp{ctx}; | ||
| 406 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 407 | |||
| 408 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | ||
| 350 | 409 | ||
| 351 | LOG_WARNING(Service_HID, "(STUBBED) called, basic_xpad_id={}, applet_resource_user_id={}", | 410 | // This function has been stubbed since 10.0.0+ |
| 352 | parameters.basic_xpad_id, parameters.applet_resource_user_id); | ||
| 353 | 411 | ||
| 354 | IPC::ResponseBuilder rb{ctx, 2}; | 412 | IPC::ResponseBuilder rb{ctx, 2}; |
| 355 | rb.Push(ResultSuccess); | 413 | rb.Push(ResultSuccess); |
| 356 | } | 414 | } |
| 357 | 415 | ||
| 416 | void IHidServer::ActivateJoySixAxisSensor(HLERequestContext& ctx) { | ||
| 417 | IPC::RequestParser rp{ctx}; | ||
| 418 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 419 | |||
| 420 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | ||
| 421 | |||
| 422 | // This function has been stubbed since 10.0.0+ | ||
| 423 | |||
| 424 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 425 | rb.Push(ResultSuccess); | ||
| 426 | } | ||
| 427 | |||
| 428 | void IHidServer::DeactivateJoySixAxisSensor(HLERequestContext& ctx) { | ||
| 429 | IPC::RequestParser rp{ctx}; | ||
| 430 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 431 | |||
| 432 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | ||
| 433 | |||
| 434 | // This function has been stubbed since 10.0.0+ | ||
| 435 | |||
| 436 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 437 | rb.Push(ResultSuccess); | ||
| 438 | } | ||
| 439 | |||
| 440 | void IHidServer::GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx) { | ||
| 441 | IPC::RequestParser rp{ctx}; | ||
| 442 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 443 | |||
| 444 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | ||
| 445 | |||
| 446 | // This function has been stubbed since 10.0.0+ | ||
| 447 | |||
| 448 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 449 | rb.Push(ResultSuccess); | ||
| 450 | // Handle returned is null here | ||
| 451 | } | ||
| 452 | |||
| 358 | void IHidServer::StartSixAxisSensor(HLERequestContext& ctx) { | 453 | void IHidServer::StartSixAxisSensor(HLERequestContext& ctx) { |
| 359 | IPC::RequestParser rp{ctx}; | 454 | IPC::RequestParser rp{ctx}; |
| 360 | struct Parameters { | 455 | struct Parameters { |
diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index 3d25ea1bc..98353b0db 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h | |||
| @@ -26,11 +26,19 @@ private: | |||
| 26 | void ActivateMouse(HLERequestContext& ctx); | 26 | void ActivateMouse(HLERequestContext& ctx); |
| 27 | void ActivateKeyboard(HLERequestContext& ctx); | 27 | void ActivateKeyboard(HLERequestContext& ctx); |
| 28 | void SendKeyboardLockKeyEvent(HLERequestContext& ctx); | 28 | void SendKeyboardLockKeyEvent(HLERequestContext& ctx); |
| 29 | void AcquireXpadIdEventHandle(HLERequestContext& ctx); | ||
| 30 | void ReleaseXpadIdEventHandle(HLERequestContext& ctx); | ||
| 29 | void ActivateXpad(HLERequestContext& ctx); | 31 | void ActivateXpad(HLERequestContext& ctx); |
| 30 | void GetXpadIds(HLERequestContext& ctx); | 32 | void GetXpadIds(HLERequestContext& ctx); |
| 33 | void ActivateJoyXpad(HLERequestContext& ctx); | ||
| 34 | void GetJoyXpadLifoHandle(HLERequestContext& ctx); | ||
| 31 | void GetJoyXpadIds(HLERequestContext& ctx); | 35 | void GetJoyXpadIds(HLERequestContext& ctx); |
| 32 | void ActivateSixAxisSensor(HLERequestContext& ctx); | 36 | void ActivateSixAxisSensor(HLERequestContext& ctx); |
| 33 | void DeactivateSixAxisSensor(HLERequestContext& ctx); | 37 | void DeactivateSixAxisSensor(HLERequestContext& ctx); |
| 38 | void GetSixAxisSensorLifoHandle(HLERequestContext& ctx); | ||
| 39 | void ActivateJoySixAxisSensor(HLERequestContext& ctx); | ||
| 40 | void DeactivateJoySixAxisSensor(HLERequestContext& ctx); | ||
| 41 | void GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx); | ||
| 34 | void StartSixAxisSensor(HLERequestContext& ctx); | 42 | void StartSixAxisSensor(HLERequestContext& ctx); |
| 35 | void StopSixAxisSensor(HLERequestContext& ctx); | 43 | void StopSixAxisSensor(HLERequestContext& ctx); |
| 36 | void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx); | 44 | void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx); |