diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 6 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index dbb0dd72d..9aa8d6f92 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -287,15 +287,31 @@ Controller_NPad::NPadType Controller_NPad::GetSupportedStyleSet() const { | |||
| 287 | 287 | ||
| 288 | void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) { | 288 | void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) { |
| 289 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); | 289 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); |
| 290 | supported_npad_id_types.clear(); | ||
| 290 | supported_npad_id_types.resize(length / sizeof(u32)); | 291 | supported_npad_id_types.resize(length / sizeof(u32)); |
| 291 | std::memcpy(supported_npad_id_types.data(), data, length); | 292 | std::memcpy(supported_npad_id_types.data(), data, length); |
| 292 | CheckForHandheldVariant(); | 293 | CheckForHandheldVariant(); |
| 293 | } | 294 | } |
| 294 | 295 | #pragma optimize("", off) | |
| 295 | void Controller_NPad::CheckForHandheldVariant() { | 296 | void Controller_NPad::CheckForHandheldVariant() { |
| 296 | // As some games expect us to use the variant of handheld mode and some games don't. It's | 297 | // As some games expect us to use the variant of handheld mode and some games don't. It's |
| 297 | // consistent that games set the npad ids in order of priority. We can just swap the controller | 298 | // consistent that games set the npad ids in order of priority. We can just swap the controller |
| 298 | // ids on the fly then if we're in handheld mode | 299 | // ids on the fly then if we're in handheld mode |
| 300 | if (std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(), 32) != | ||
| 301 | supported_npad_id_types.end()) { | ||
| 302 | const auto& first_controller = connected_controllers.front(); | ||
| 303 | if (first_controller.is_connected && | ||
| 304 | first_controller.type == NPadControllerType::Handheld) { | ||
| 305 | DisconnectNPad(0); | ||
| 306 | AddNewController(NPadControllerType::Handheld, true); | ||
| 307 | } | ||
| 308 | } else { | ||
| 309 | if (connected_controllers[8].is_connected) { | ||
| 310 | DisconnectNPad(8); | ||
| 311 | AddNewController(NPadControllerType::Handheld); | ||
| 312 | } | ||
| 313 | } | ||
| 314 | /* | ||
| 299 | if (supported_npad_id_types.size() > 0) { | 315 | if (supported_npad_id_types.size() > 0) { |
| 300 | const auto& first_controller = supported_npad_id_types.front(); | 316 | const auto& first_controller = supported_npad_id_types.front(); |
| 301 | if (first_controller == 32 && !connected_controllers[8].is_connected) { | 317 | if (first_controller == 32 && !connected_controllers[8].is_connected) { |
| @@ -311,7 +327,7 @@ void Controller_NPad::CheckForHandheldVariant() { | |||
| 311 | AddNewController(NPadControllerType::Handheld); | 327 | AddNewController(NPadControllerType::Handheld); |
| 312 | } | 328 | } |
| 313 | } | 329 | } |
| 314 | } | 330 | }*/ |
| 315 | } | 331 | } |
| 316 | 332 | ||
| 317 | const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { | 333 | const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index e5cbd2ef6..db1537b40 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -284,7 +284,7 @@ public: | |||
| 284 | 284 | ||
| 285 | private: | 285 | private: |
| 286 | std::shared_ptr<IAppletResource> applet_resource; | 286 | std::shared_ptr<IAppletResource> applet_resource; |
| 287 | 287 | #pragma optimize("", off) | |
| 288 | void CreateAppletResource(Kernel::HLERequestContext& ctx) { | 288 | void CreateAppletResource(Kernel::HLERequestContext& ctx) { |
| 289 | if (applet_resource == nullptr) { | 289 | if (applet_resource == nullptr) { |
| 290 | applet_resource = std::make_shared<IAppletResource>(); | 290 | applet_resource = std::make_shared<IAppletResource>(); |
| @@ -405,6 +405,8 @@ private: | |||
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { | 407 | void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { |
| 408 | IPC::RequestParser rp{ctx}; | ||
| 409 | auto npad_id = rp.PopRaw<u32>(); | ||
| 408 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 410 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 409 | rb.Push(RESULT_SUCCESS); | 411 | rb.Push(RESULT_SUCCESS); |
| 410 | rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad) | 412 | rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad) |
| @@ -454,6 +456,8 @@ private: | |||
| 454 | } | 456 | } |
| 455 | 457 | ||
| 456 | void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) { | 458 | void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) { |
| 459 | IPC::RequestParser rp{ctx}; | ||
| 460 | auto npad_id = rp.PopRaw<u32>(); | ||
| 457 | IPC::ResponseBuilder rb{ctx, 2}; | 461 | IPC::ResponseBuilder rb{ctx, 2}; |
| 458 | rb.Push(RESULT_SUCCESS); | 462 | rb.Push(RESULT_SUCCESS); |
| 459 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 463 | LOG_WARNING(Service_HID, "(STUBBED) called"); |