mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 13:17:33 +01:00
hid: Implement MergeSingleJoyasDualJoy
- Used in multiple games such as Super Mario Odyssey.
This commit is contained in:
parent
045f50bc7f
commit
0e33b19ae0
@ -574,6 +574,22 @@ Controller_NPad::GyroscopeZeroDriftMode Controller_NPad::GetGyroscopeZeroDriftMo
|
|||||||
return gyroscope_zero_drift_mode;
|
return gyroscope_zero_drift_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) {
|
||||||
|
const auto npad_index_1 = NPadIdToIndex(npad_id_1);
|
||||||
|
const auto npad_index_2 = NPadIdToIndex(npad_id_2);
|
||||||
|
|
||||||
|
// If the controllers at both npad indices form a pair of left and right joycons, merge them.
|
||||||
|
// Otherwise, do nothing.
|
||||||
|
if ((connected_controllers[npad_index_1].type == NPadControllerType::JoyLeft &&
|
||||||
|
connected_controllers[npad_index_2].type == NPadControllerType::JoyRight) ||
|
||||||
|
(connected_controllers[npad_index_2].type == NPadControllerType::JoyLeft &&
|
||||||
|
connected_controllers[npad_index_1].type == NPadControllerType::JoyRight)) {
|
||||||
|
// Disconnect the joycon at the second id and connect the dual joycon at the first index.
|
||||||
|
DisconnectNPad(npad_id_2);
|
||||||
|
AddNewControllerAt(NPadControllerType::JoyDual, npad_index_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Controller_NPad::StartLRAssignmentMode() {
|
void Controller_NPad::StartLRAssignmentMode() {
|
||||||
// Nothing internally is used for lr assignment mode. Since we have the ability to set the
|
// Nothing internally is used for lr assignment mode. Since we have the ability to set the
|
||||||
// controller types from boot, it doesn't really matter about showing a selection screen
|
// controller types from boot, it doesn't really matter about showing a selection screen
|
||||||
|
@ -134,6 +134,7 @@ public:
|
|||||||
void ConnectAllDisconnectedControllers();
|
void ConnectAllDisconnectedControllers();
|
||||||
void ClearAllControllers();
|
void ClearAllControllers();
|
||||||
|
|
||||||
|
void MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2);
|
||||||
void StartLRAssignmentMode();
|
void StartLRAssignmentMode();
|
||||||
void StopLRAssignmentMode();
|
void StopLRAssignmentMode();
|
||||||
bool SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2);
|
bool SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2);
|
||||||
|
@ -671,13 +671,15 @@ void Hid::SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) {
|
void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto unknown_1{rp.Pop<u32>()};
|
const auto npad_id_1{rp.Pop<u32>()};
|
||||||
const auto unknown_2{rp.Pop<u32>()};
|
const auto npad_id_2{rp.Pop<u32>()};
|
||||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
LOG_WARNING(Service_HID,
|
LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}",
|
||||||
"(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}",
|
npad_id_1, npad_id_2, applet_resource_user_id);
|
||||||
unknown_1, unknown_2, applet_resource_user_id);
|
|
||||||
|
auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
|
||||||
|
controller.MergeSingleJoyAsDualJoy(npad_id_1, npad_id_2);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
Loading…
Reference in New Issue
Block a user