Fix feedback state position 0x1b when DualSense is connected.

The previous value of `0` caused the PS5 to expect a set of 'trigger status'
values in the 0x19 and 0x1a position, which would have required reading
raw values from the DualSense HID device, since these values are not
reported by the SDL DualSense driver (code that does so can be checked
out from the `trigger-feedback` branch on https://git.sr.ht/~jbaiter/chiaki).

Fortunately this is not neccessary, simply setting the value to `1`
seems to make the PS5 to rely on fallback logic (presumably based on the
L2/R2 value) and games that would otherwise have relied on the trigger
status (Astro's Playroom climbing levels) now work without any problems.
This commit is contained in:
Johannes Baiter 2022-11-21 20:21:43 +01:00 committed by Florian Märkl
parent 4c8209762c
commit 7a490b5aae
3 changed files with 8 additions and 4 deletions

View file

@ -38,7 +38,7 @@ CHIAKI_EXPORT void chiaki_feedback_state_format_v9(uint8_t *buf, ChiakiFeedbackS
/**
* @param buf buffer of at least CHIAKI_FEEDBACK_STATE_BUF_SIZE_V12
*/
CHIAKI_EXPORT void chiaki_feedback_state_format_v12(uint8_t *buf, ChiakiFeedbackState *state, bool enable_dualsense);
CHIAKI_EXPORT void chiaki_feedback_state_format_v12(uint8_t *buf, ChiakiFeedbackState *state);
#define CHIAKI_HISTORY_EVENT_SIZE_MAX 0x5

View file

@ -76,12 +76,16 @@ CHIAKI_EXPORT void chiaki_feedback_state_format_v9(uint8_t *buf, ChiakiFeedbackS
*((chiaki_unaligned_uint16_t *)(buf + 0x17)) = htons((uint16_t)state->right_y);
}
CHIAKI_EXPORT void chiaki_feedback_state_format_v12(uint8_t *buf, ChiakiFeedbackState *state, bool enable_dualsense)
CHIAKI_EXPORT void chiaki_feedback_state_format_v12(uint8_t *buf, ChiakiFeedbackState *state)
{
chiaki_feedback_state_format_v9(buf, state);
buf[0x19] = 0x0;
buf[0x1a] = 0x0;
buf[0x1b] = enable_dualsense ? 0x0 : 0x1;
// 1 is classic DualShock, 0 is DualSense, but using 0 requires setting [0x19] and [0x1a] to
// values taken from raw HID, which is generally not available. But setting 1 for both seems
// to always work fine.
buf[0x1b] = 0x1;
}
CHIAKI_EXPORT ChiakiErrorCode chiaki_feedback_history_event_set_button(ChiakiFeedbackHistoryEvent *event, uint64_t button, uint8_t state)

View file

@ -558,7 +558,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_send_feedback_state(ChiakiTakion *ta
else
{
buf_sz = 0xc + CHIAKI_FEEDBACK_STATE_BUF_SIZE_V12;
chiaki_feedback_state_format_v12(buf + 0xc, feedback_state, takion->enable_dualsense);
chiaki_feedback_state_format_v12(buf + 0xc, feedback_state);
}
return takion_send_feedback_packet(takion, buf, buf_sz);
}