diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/controller_base.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 202 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_device.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 14 |
7 files changed, 165 insertions, 90 deletions
diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index 8bc69c372..f47a9e61c 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h | |||
| @@ -31,6 +31,10 @@ public: | |||
| 31 | virtual void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, | 31 | virtual void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 32 | std::size_t size) = 0; | 32 | std::size_t size) = 0; |
| 33 | 33 | ||
| 34 | // When the controller is requesting a motion update for the shared memory | ||
| 35 | virtual void OnMotionUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, | ||
| 36 | std::size_t size) {} | ||
| 37 | |||
| 34 | // Called when input devices should be loaded | 38 | // Called when input devices should be loaded |
| 35 | virtual void OnLoadInputDevices() = 0; | 39 | virtual void OnLoadInputDevices() = 0; |
| 36 | 40 | ||
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 620386cd1..e34ee519e 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -365,6 +365,135 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 365 | } | 365 | } |
| 366 | const u32 npad_index = static_cast<u32>(i); | 366 | const u32 npad_index = static_cast<u32>(i); |
| 367 | 367 | ||
| 368 | RequestPadStateUpdate(npad_index); | ||
| 369 | auto& pad_state = npad_pad_states[npad_index]; | ||
| 370 | |||
| 371 | auto& main_controller = | ||
| 372 | npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index]; | ||
| 373 | auto& handheld_entry = | ||
| 374 | npad.handheld_states.npad[npad.handheld_states.common.last_entry_index]; | ||
| 375 | auto& dual_entry = npad.dual_states.npad[npad.dual_states.common.last_entry_index]; | ||
| 376 | auto& left_entry = npad.left_joy_states.npad[npad.left_joy_states.common.last_entry_index]; | ||
| 377 | auto& right_entry = | ||
| 378 | npad.right_joy_states.npad[npad.right_joy_states.common.last_entry_index]; | ||
| 379 | auto& pokeball_entry = | ||
| 380 | npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index]; | ||
| 381 | auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; | ||
| 382 | |||
| 383 | libnx_entry.connection_status.raw = 0; | ||
| 384 | libnx_entry.connection_status.IsConnected.Assign(1); | ||
| 385 | auto& full_sixaxis_entry = | ||
| 386 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; | ||
| 387 | auto& handheld_sixaxis_entry = | ||
| 388 | npad.sixaxis_handheld.sixaxis[npad.sixaxis_handheld.common.last_entry_index]; | ||
| 389 | auto& dual_left_sixaxis_entry = | ||
| 390 | npad.sixaxis_dual_left.sixaxis[npad.sixaxis_dual_left.common.last_entry_index]; | ||
| 391 | auto& dual_right_sixaxis_entry = | ||
| 392 | npad.sixaxis_dual_right.sixaxis[npad.sixaxis_dual_right.common.last_entry_index]; | ||
| 393 | auto& left_sixaxis_entry = | ||
| 394 | npad.sixaxis_left.sixaxis[npad.sixaxis_left.common.last_entry_index]; | ||
| 395 | auto& right_sixaxis_entry = | ||
| 396 | npad.sixaxis_right.sixaxis[npad.sixaxis_right.common.last_entry_index]; | ||
| 397 | |||
| 398 | switch (controller_type) { | ||
| 399 | case NPadControllerType::None: | ||
| 400 | UNREACHABLE(); | ||
| 401 | break; | ||
| 402 | case NPadControllerType::ProController: | ||
| 403 | main_controller.connection_status.raw = 0; | ||
| 404 | main_controller.connection_status.IsConnected.Assign(1); | ||
| 405 | main_controller.connection_status.IsWired.Assign(1); | ||
| 406 | main_controller.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 407 | main_controller.pad.l_stick = pad_state.l_stick; | ||
| 408 | main_controller.pad.r_stick = pad_state.r_stick; | ||
| 409 | |||
| 410 | libnx_entry.connection_status.IsWired.Assign(1); | ||
| 411 | break; | ||
| 412 | case NPadControllerType::Handheld: | ||
| 413 | handheld_entry.connection_status.raw = 0; | ||
| 414 | handheld_entry.connection_status.IsConnected.Assign(1); | ||
| 415 | handheld_entry.connection_status.IsWired.Assign(1); | ||
| 416 | handheld_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 417 | handheld_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 418 | handheld_entry.connection_status.IsLeftJoyWired.Assign(1); | ||
| 419 | handheld_entry.connection_status.IsRightJoyWired.Assign(1); | ||
| 420 | handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 421 | handheld_entry.pad.l_stick = pad_state.l_stick; | ||
| 422 | handheld_entry.pad.r_stick = pad_state.r_stick; | ||
| 423 | |||
| 424 | libnx_entry.connection_status.IsWired.Assign(1); | ||
| 425 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 426 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 427 | libnx_entry.connection_status.IsLeftJoyWired.Assign(1); | ||
| 428 | libnx_entry.connection_status.IsRightJoyWired.Assign(1); | ||
| 429 | break; | ||
| 430 | case NPadControllerType::JoyDual: | ||
| 431 | dual_entry.connection_status.raw = 0; | ||
| 432 | dual_entry.connection_status.IsConnected.Assign(1); | ||
| 433 | dual_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 434 | dual_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 435 | dual_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 436 | dual_entry.pad.l_stick = pad_state.l_stick; | ||
| 437 | dual_entry.pad.r_stick = pad_state.r_stick; | ||
| 438 | |||
| 439 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 440 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 441 | break; | ||
| 442 | case NPadControllerType::JoyLeft: | ||
| 443 | left_entry.connection_status.raw = 0; | ||
| 444 | left_entry.connection_status.IsConnected.Assign(1); | ||
| 445 | left_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 446 | left_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 447 | left_entry.pad.l_stick = pad_state.l_stick; | ||
| 448 | left_entry.pad.r_stick = pad_state.r_stick; | ||
| 449 | |||
| 450 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 451 | break; | ||
| 452 | case NPadControllerType::JoyRight: | ||
| 453 | right_entry.connection_status.raw = 0; | ||
| 454 | right_entry.connection_status.IsConnected.Assign(1); | ||
| 455 | right_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 456 | right_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 457 | right_entry.pad.l_stick = pad_state.l_stick; | ||
| 458 | right_entry.pad.r_stick = pad_state.r_stick; | ||
| 459 | |||
| 460 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 461 | break; | ||
| 462 | case NPadControllerType::Pokeball: | ||
| 463 | pokeball_entry.connection_status.raw = 0; | ||
| 464 | pokeball_entry.connection_status.IsConnected.Assign(1); | ||
| 465 | pokeball_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 466 | pokeball_entry.pad.l_stick = pad_state.l_stick; | ||
| 467 | pokeball_entry.pad.r_stick = pad_state.r_stick; | ||
| 468 | break; | ||
| 469 | } | ||
| 470 | |||
| 471 | // LibNX exclusively uses this section, so we always update it since LibNX doesn't activate | ||
| 472 | // any controllers. | ||
| 473 | libnx_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 474 | libnx_entry.pad.l_stick = pad_state.l_stick; | ||
| 475 | libnx_entry.pad.r_stick = pad_state.r_stick; | ||
| 476 | |||
| 477 | press_state |= static_cast<u32>(pad_state.pad_states.raw); | ||
| 478 | } | ||
| 479 | std::memcpy(data + NPAD_OFFSET, shared_memory_entries.data(), | ||
| 480 | shared_memory_entries.size() * sizeof(NPadEntry)); | ||
| 481 | } | ||
| 482 | |||
| 483 | void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, | ||
| 484 | std::size_t data_len) { | ||
| 485 | if (!IsControllerActivated()) { | ||
| 486 | return; | ||
| 487 | } | ||
| 488 | for (std::size_t i = 0; i < shared_memory_entries.size(); i++) { | ||
| 489 | auto& npad = shared_memory_entries[i]; | ||
| 490 | |||
| 491 | const auto& controller_type = connected_controllers[i].type; | ||
| 492 | |||
| 493 | if (controller_type == NPadControllerType::None || !connected_controllers[i].is_connected) { | ||
| 494 | continue; | ||
| 495 | } | ||
| 496 | |||
| 368 | const std::array<SixAxisGeneric*, 6> controller_sixaxes{ | 497 | const std::array<SixAxisGeneric*, 6> controller_sixaxes{ |
| 369 | &npad.sixaxis_full, &npad.sixaxis_handheld, &npad.sixaxis_dual_left, | 498 | &npad.sixaxis_full, &npad.sixaxis_handheld, &npad.sixaxis_dual_left, |
| 370 | &npad.sixaxis_dual_right, &npad.sixaxis_left, &npad.sixaxis_right, | 499 | &npad.sixaxis_dual_right, &npad.sixaxis_left, &npad.sixaxis_right, |
| @@ -403,9 +532,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 403 | } | 532 | } |
| 404 | } | 533 | } |
| 405 | 534 | ||
| 406 | RequestPadStateUpdate(npad_index); | ||
| 407 | auto& pad_state = npad_pad_states[npad_index]; | ||
| 408 | |||
| 409 | auto& main_controller = | 535 | auto& main_controller = |
| 410 | npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index]; | 536 | npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index]; |
| 411 | auto& handheld_entry = | 537 | auto& handheld_entry = |
| @@ -418,8 +544,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 418 | npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index]; | 544 | npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index]; |
| 419 | auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; | 545 | auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; |
| 420 | 546 | ||
| 421 | libnx_entry.connection_status.raw = 0; | ||
| 422 | libnx_entry.connection_status.IsConnected.Assign(1); | ||
| 423 | auto& full_sixaxis_entry = | 547 | auto& full_sixaxis_entry = |
| 424 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; | 548 | npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; |
| 425 | auto& handheld_sixaxis_entry = | 549 | auto& handheld_sixaxis_entry = |
| @@ -438,15 +562,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 438 | UNREACHABLE(); | 562 | UNREACHABLE(); |
| 439 | break; | 563 | break; |
| 440 | case NPadControllerType::ProController: | 564 | case NPadControllerType::ProController: |
| 441 | main_controller.connection_status.raw = 0; | ||
| 442 | main_controller.connection_status.IsConnected.Assign(1); | ||
| 443 | main_controller.connection_status.IsWired.Assign(1); | ||
| 444 | main_controller.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 445 | main_controller.pad.l_stick = pad_state.l_stick; | ||
| 446 | main_controller.pad.r_stick = pad_state.r_stick; | ||
| 447 | |||
| 448 | libnx_entry.connection_status.IsWired.Assign(1); | ||
| 449 | |||
| 450 | if (sixaxis_sensors_enabled && motions[i][0]) { | 565 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 451 | full_sixaxis_entry.accel = motion_devices[0].accel; | 566 | full_sixaxis_entry.accel = motion_devices[0].accel; |
| 452 | full_sixaxis_entry.gyro = motion_devices[0].gyro; | 567 | full_sixaxis_entry.gyro = motion_devices[0].gyro; |
| @@ -455,23 +570,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 455 | } | 570 | } |
| 456 | break; | 571 | break; |
| 457 | case NPadControllerType::Handheld: | 572 | case NPadControllerType::Handheld: |
| 458 | handheld_entry.connection_status.raw = 0; | ||
| 459 | handheld_entry.connection_status.IsConnected.Assign(1); | ||
| 460 | handheld_entry.connection_status.IsWired.Assign(1); | ||
| 461 | handheld_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 462 | handheld_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 463 | handheld_entry.connection_status.IsLeftJoyWired.Assign(1); | ||
| 464 | handheld_entry.connection_status.IsRightJoyWired.Assign(1); | ||
| 465 | handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 466 | handheld_entry.pad.l_stick = pad_state.l_stick; | ||
| 467 | handheld_entry.pad.r_stick = pad_state.r_stick; | ||
| 468 | |||
| 469 | libnx_entry.connection_status.IsWired.Assign(1); | ||
| 470 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 471 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 472 | libnx_entry.connection_status.IsLeftJoyWired.Assign(1); | ||
| 473 | libnx_entry.connection_status.IsRightJoyWired.Assign(1); | ||
| 474 | |||
| 475 | if (sixaxis_sensors_enabled && motions[i][0]) { | 573 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 476 | handheld_sixaxis_entry.accel = motion_devices[0].accel; | 574 | handheld_sixaxis_entry.accel = motion_devices[0].accel; |
| 477 | handheld_sixaxis_entry.gyro = motion_devices[0].gyro; | 575 | handheld_sixaxis_entry.gyro = motion_devices[0].gyro; |
| @@ -480,17 +578,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 480 | } | 578 | } |
| 481 | break; | 579 | break; |
| 482 | case NPadControllerType::JoyDual: | 580 | case NPadControllerType::JoyDual: |
| 483 | dual_entry.connection_status.raw = 0; | ||
| 484 | dual_entry.connection_status.IsConnected.Assign(1); | ||
| 485 | dual_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 486 | dual_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 487 | dual_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 488 | dual_entry.pad.l_stick = pad_state.l_stick; | ||
| 489 | dual_entry.pad.r_stick = pad_state.r_stick; | ||
| 490 | |||
| 491 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 492 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 493 | |||
| 494 | if (sixaxis_sensors_enabled && motions[i][0]) { | 581 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 495 | // Set motion for the left joycon | 582 | // Set motion for the left joycon |
| 496 | dual_left_sixaxis_entry.accel = motion_devices[0].accel; | 583 | dual_left_sixaxis_entry.accel = motion_devices[0].accel; |
| @@ -507,15 +594,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 507 | } | 594 | } |
| 508 | break; | 595 | break; |
| 509 | case NPadControllerType::JoyLeft: | 596 | case NPadControllerType::JoyLeft: |
| 510 | left_entry.connection_status.raw = 0; | ||
| 511 | left_entry.connection_status.IsConnected.Assign(1); | ||
| 512 | left_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 513 | left_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 514 | left_entry.pad.l_stick = pad_state.l_stick; | ||
| 515 | left_entry.pad.r_stick = pad_state.r_stick; | ||
| 516 | |||
| 517 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | ||
| 518 | |||
| 519 | if (sixaxis_sensors_enabled && motions[i][0]) { | 597 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 520 | left_sixaxis_entry.accel = motion_devices[0].accel; | 598 | left_sixaxis_entry.accel = motion_devices[0].accel; |
| 521 | left_sixaxis_entry.gyro = motion_devices[0].gyro; | 599 | left_sixaxis_entry.gyro = motion_devices[0].gyro; |
| @@ -524,15 +602,6 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 524 | } | 602 | } |
| 525 | break; | 603 | break; |
| 526 | case NPadControllerType::JoyRight: | 604 | case NPadControllerType::JoyRight: |
| 527 | right_entry.connection_status.raw = 0; | ||
| 528 | right_entry.connection_status.IsConnected.Assign(1); | ||
| 529 | right_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 530 | right_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 531 | right_entry.pad.l_stick = pad_state.l_stick; | ||
| 532 | right_entry.pad.r_stick = pad_state.r_stick; | ||
| 533 | |||
| 534 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | ||
| 535 | |||
| 536 | if (sixaxis_sensors_enabled && motions[i][1]) { | 605 | if (sixaxis_sensors_enabled && motions[i][1]) { |
| 537 | right_sixaxis_entry.accel = motion_devices[1].accel; | 606 | right_sixaxis_entry.accel = motion_devices[1].accel; |
| 538 | right_sixaxis_entry.gyro = motion_devices[1].gyro; | 607 | right_sixaxis_entry.gyro = motion_devices[1].gyro; |
| @@ -541,21 +610,8 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 541 | } | 610 | } |
| 542 | break; | 611 | break; |
| 543 | case NPadControllerType::Pokeball: | 612 | case NPadControllerType::Pokeball: |
| 544 | pokeball_entry.connection_status.raw = 0; | ||
| 545 | pokeball_entry.connection_status.IsConnected.Assign(1); | ||
| 546 | pokeball_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 547 | pokeball_entry.pad.l_stick = pad_state.l_stick; | ||
| 548 | pokeball_entry.pad.r_stick = pad_state.r_stick; | ||
| 549 | break; | 613 | break; |
| 550 | } | 614 | } |
| 551 | |||
| 552 | // LibNX exclusively uses this section, so we always update it since LibNX doesn't activate | ||
| 553 | // any controllers. | ||
| 554 | libnx_entry.pad.pad_states.raw = pad_state.pad_states.raw; | ||
| 555 | libnx_entry.pad.l_stick = pad_state.l_stick; | ||
| 556 | libnx_entry.pad.r_stick = pad_state.r_stick; | ||
| 557 | |||
| 558 | press_state |= static_cast<u32>(pad_state.pad_states.raw); | ||
| 559 | } | 615 | } |
| 560 | std::memcpy(data + NPAD_OFFSET, shared_memory_entries.data(), | 616 | std::memcpy(data + NPAD_OFFSET, shared_memory_entries.data(), |
| 561 | shared_memory_entries.size() * sizeof(NPadEntry)); | 617 | shared_memory_entries.size() * sizeof(NPadEntry)); |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 654d97c3f..0fa7455ba 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -32,6 +32,10 @@ public: | |||
| 32 | // When the controller is requesting an update for the shared memory | 32 | // When the controller is requesting an update for the shared memory |
| 33 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; | 33 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 34 | 34 | ||
| 35 | // When the controller is requesting a motion update for the shared memory | ||
| 36 | void OnMotionUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, | ||
| 37 | std::size_t size) override; | ||
| 38 | |||
| 35 | // Called when input devices should be loaded | 39 | // Called when input devices should be loaded |
| 36 | void OnLoadInputDevices() override; | 40 | void OnLoadInputDevices() override; |
| 37 | 41 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 395e83b3f..9a7e5e265 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -40,7 +40,8 @@ namespace Service::HID { | |||
| 40 | // Updating period for each HID device. | 40 | // Updating period for each HID device. |
| 41 | // HID is polled every 15ms, this value was derived from | 41 | // HID is polled every 15ms, this value was derived from |
| 42 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering#joy-con-status-data-packet | 42 | // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering#joy-con-status-data-packet |
| 43 | constexpr auto pad_update_ns = std::chrono::nanoseconds{1000 * 1000}; // (1ms, 1000Hz) | 43 | constexpr auto pad_update_ns = std::chrono::nanoseconds{1000 * 1000}; // (1ms, 1000Hz) |
| 44 | constexpr auto motion_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; // (15ms, 66.666Hz) | ||
| 44 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; | 45 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; |
| 45 | 46 | ||
| 46 | IAppletResource::IAppletResource(Core::System& system) | 47 | IAppletResource::IAppletResource(Core::System& system) |
| @@ -79,10 +80,14 @@ IAppletResource::IAppletResource(Core::System& system) | |||
| 79 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | 80 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 80 | UpdateControllers(user_data, ns_late); | 81 | UpdateControllers(user_data, ns_late); |
| 81 | }); | 82 | }); |
| 82 | 83 | motion_update_event = Core::Timing::CreateEvent( | |
| 83 | // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?) | 84 | "HID::MotionPadCallback", |
| 85 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | ||
| 86 | UpdateMotion(user_data, ns_late); | ||
| 87 | }); | ||
| 84 | 88 | ||
| 85 | system.CoreTiming().ScheduleEvent(pad_update_ns, pad_update_event); | 89 | system.CoreTiming().ScheduleEvent(pad_update_ns, pad_update_event); |
| 90 | system.CoreTiming().ScheduleEvent(motion_update_ns, motion_update_event); | ||
| 86 | 91 | ||
| 87 | ReloadInputDevices(); | 92 | ReloadInputDevices(); |
| 88 | } | 93 | } |
| @@ -122,6 +127,16 @@ void IAppletResource::UpdateControllers(std::uintptr_t user_data, | |||
| 122 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); | 127 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); |
| 123 | } | 128 | } |
| 124 | 129 | ||
| 130 | void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | ||
| 131 | auto& core_timing = system.CoreTiming(); | ||
| 132 | |||
| 133 | for (const auto& controller : controllers) { | ||
| 134 | controller->OnMotionUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); | ||
| 135 | } | ||
| 136 | |||
| 137 | core_timing.ScheduleEvent(motion_update_ns - ns_late, motion_update_event); | ||
| 138 | } | ||
| 139 | |||
| 125 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { | 140 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { |
| 126 | public: | 141 | public: |
| 127 | IActiveVibrationDeviceList() : ServiceFramework("IActiveVibrationDeviceList") { | 142 | IActiveVibrationDeviceList() : ServiceFramework("IActiveVibrationDeviceList") { |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index e04aaf1e9..3cfd72a51 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -65,10 +65,12 @@ private: | |||
| 65 | 65 | ||
| 66 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); | 66 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); |
| 67 | void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); | 67 | void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 68 | void UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); | ||
| 68 | 69 | ||
| 69 | std::shared_ptr<Kernel::SharedMemory> shared_mem; | 70 | std::shared_ptr<Kernel::SharedMemory> shared_mem; |
| 70 | 71 | ||
| 71 | std::shared_ptr<Core::Timing::EventType> pad_update_event; | 72 | std::shared_ptr<Core::Timing::EventType> pad_update_event; |
| 73 | std::shared_ptr<Core::Timing::EventType> motion_update_event; | ||
| 72 | Core::System& system; | 74 | Core::System& system; |
| 73 | 75 | ||
| 74 | std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)> | 76 | std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)> |
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index 05e31f1de..3d8d3213d 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp | |||
| @@ -388,14 +388,6 @@ bool VKDevice::Create() { | |||
| 388 | 388 | ||
| 389 | CollectTelemetryParameters(); | 389 | CollectTelemetryParameters(); |
| 390 | 390 | ||
| 391 | if (ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_AMD_PROPRIETARY_KHR) { | ||
| 392 | // AMD's proprietary driver supports VK_EXT_extended_dynamic_state but the <stride> field | ||
| 393 | // seems to be bugged. Blacklisting it for now. | ||
| 394 | LOG_WARNING(Render_Vulkan, | ||
| 395 | "Blacklisting AMD proprietary from VK_EXT_extended_dynamic_state"); | ||
| 396 | ext_extended_dynamic_state = false; | ||
| 397 | } | ||
| 398 | |||
| 399 | graphics_queue = logical.GetQueue(graphics_family); | 391 | graphics_queue = logical.GetQueue(graphics_family); |
| 400 | present_queue = logical.GetQueue(present_family); | 392 | present_queue = logical.GetQueue(present_family); |
| 401 | 393 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 6a2a88dd8..e3de0f0e1 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -288,8 +288,8 @@ GMainWindow::~GMainWindow() { | |||
| 288 | void GMainWindow::ControllerSelectorReconfigureControllers( | 288 | void GMainWindow::ControllerSelectorReconfigureControllers( |
| 289 | const Core::Frontend::ControllerParameters& parameters) { | 289 | const Core::Frontend::ControllerParameters& parameters) { |
| 290 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get()); | 290 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get()); |
| 291 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 291 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 292 | Qt::WindowSystemMenuHint); | 292 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); |
| 293 | dialog.setWindowModality(Qt::WindowModal); | 293 | dialog.setWindowModality(Qt::WindowModal); |
| 294 | dialog.exec(); | 294 | dialog.exec(); |
| 295 | 295 | ||
| @@ -307,8 +307,9 @@ void GMainWindow::ProfileSelectorSelectProfile() { | |||
| 307 | int index = 0; | 307 | int index = 0; |
| 308 | if (manager.GetUserCount() != 1) { | 308 | if (manager.GetUserCount() != 1) { |
| 309 | QtProfileSelectionDialog dialog(this); | 309 | QtProfileSelectionDialog dialog(this); |
| 310 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 310 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 311 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 311 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | |
| 312 | Qt::WindowCloseButtonHint); | ||
| 312 | dialog.setWindowModality(Qt::WindowModal); | 313 | dialog.setWindowModality(Qt::WindowModal); |
| 313 | 314 | ||
| 314 | if (dialog.exec() == QDialog::Rejected) { | 315 | if (dialog.exec() == QDialog::Rejected) { |
| @@ -331,8 +332,9 @@ void GMainWindow::ProfileSelectorSelectProfile() { | |||
| 331 | void GMainWindow::SoftwareKeyboardGetText( | 332 | void GMainWindow::SoftwareKeyboardGetText( |
| 332 | const Core::Frontend::SoftwareKeyboardParameters& parameters) { | 333 | const Core::Frontend::SoftwareKeyboardParameters& parameters) { |
| 333 | QtSoftwareKeyboardDialog dialog(this, parameters); | 334 | QtSoftwareKeyboardDialog dialog(this, parameters); |
| 334 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 335 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 335 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 336 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | |
| 337 | Qt::WindowCloseButtonHint); | ||
| 336 | dialog.setWindowModality(Qt::WindowModal); | 338 | dialog.setWindowModality(Qt::WindowModal); |
| 337 | 339 | ||
| 338 | if (dialog.exec() == QDialog::Rejected) { | 340 | if (dialog.exec() == QDialog::Rejected) { |