mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-06 16:19:25 +02:00
Added hidMergeSingleJoyAsDualJoy().
This commit is contained in:
parent
3d0cab8061
commit
df203f0697
@ -596,12 +596,16 @@ bool hidGetHandheldMode(void);
|
||||
/// When used, both joy-cons in a pair should be used with this (CONTROLLER_PLAYER_1 and CONTROLLER_PLAYER_2 for example).
|
||||
/// id must be CONTROLLER_PLAYER_*.
|
||||
Result hidSetNpadJoyAssignmentModeSingleByDefault(HidControllerID id);
|
||||
|
||||
/// Use this if you want to use a pair of joy-cons as a single CONTROLLER_PLAYER_*. Only necessary if you want to use this mode in your application after \ref hidSetNpadJoyAssignmentModeSingleByDefault was used with this pair of joy-cons.
|
||||
/// Used automatically during app startup/exit for all controllers.
|
||||
/// When used, both joy-cons in a pair should be used with this (CONTROLLER_PLAYER_1 and CONTROLLER_PLAYER_2 for example).
|
||||
/// id must be CONTROLLER_PLAYER_*.
|
||||
Result hidSetNpadJoyAssignmentModeDual(HidControllerID id);
|
||||
|
||||
/// Merge two single joy-cons into a dual-mode controller. Use this after \ref hidSetNpadJoyAssignmentModeDual, when \ref hidSetNpadJoyAssignmentModeSingleByDefault was previously used (this includes using this manually at application exit).
|
||||
Result hidMergeSingleJoyAsDualJoy(HidControllerID id0, HidControllerID id1);
|
||||
|
||||
Result hidInitializeVibrationDevices(u32 *VibrationDeviceHandles, size_t total_handles, HidControllerID id, HidControllerType type);
|
||||
|
||||
/// Gets HidVibrationDeviceInfo for the specified VibrationDeviceHandle.
|
||||
|
@ -563,6 +563,51 @@ Result hidSetNpadJoyAssignmentModeDual(HidControllerID id) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hidMergeSingleJoyAsDualJoy(HidControllerID id0, HidControllerID id1) {
|
||||
Result rc;
|
||||
u64 AppletResourceUserId;
|
||||
|
||||
rc = appletGetAppletResourceUserId(&AppletResourceUserId);
|
||||
if (R_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u32 id0, id1;
|
||||
u64 AppletResourceUserId;
|
||||
} *raw;
|
||||
|
||||
ipcSendPid(&c);
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 125;
|
||||
raw->id0 = id0;
|
||||
raw->id1 = id1;
|
||||
raw->AppletResourceUserId = AppletResourceUserId;
|
||||
|
||||
rc = serviceIpcDispatch(&g_hidSrv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
ipcParse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidCreateActiveVibrationDeviceList(Service* srv_out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
Loading…
Reference in New Issue
Block a user