port: fix rumble

This commit is contained in:
fgsfds 2023-08-18 15:34:13 +02:00
parent a49bfd00a4
commit 554fde7a9d
2 changed files with 14 additions and 5 deletions

View File

@ -262,11 +262,14 @@ void inputRumble(s32 idx, f32 strength, f32 time)
return;
}
if (SDL_GameControllerHasRumble(pads[idx])) {
if (strength < 0.f) {
if (strength <= 0.f) {
strength = 0.f;
time = 0.f;
} else {
strength *= 65535.f;
time *= 1000.f;
}
strength *= 65535.f;
SDL_GameControllerRumble(pads[idx], (u16)strength, (u16)strength, (u32)(time * 1000.f));
SDL_GameControllerRumble(pads[idx], (u16)strength, (u16)strength, (u32)time);
}
}

View File

@ -207,7 +207,7 @@ void osContGetQuery(OSContStatus *status)
if (inputControllerConnected(i)) {
status->errnum = 0;
status->type = CONT_ABSOLUTE;
status->status = 1;
status->status = CONT_CARD_ON;
} else {
status->errnum = CONT_NO_RESPONSE_ERROR;
status->type = 0;
@ -287,13 +287,19 @@ s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern)
{
if (pattern) {
*pattern = 0;
for (s32 i = 0; i < MAXCONTROLLERS; ++i) {
if (inputRumbleSupported(i)) {
*pattern |= 1 << i;
}
}
}
return 0;
}
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, s32 channel, s32 *arg3)
{
return PFS_ERR_NOPACK;
// if rumble is supported, indicate that we have a rumble pak instead
return inputRumbleSupported(channel) ? PFS_ERR_DEVICE : PFS_ERR_NOPACK;
}
s32 osPfsChecker(OSPfs *pfs)