Skip to content

Commit

Permalink
Rumble not working for non-XInput gamepads #601
Browse files Browse the repository at this point in the history
  • Loading branch information
matlo committed Jan 6, 2019
1 parent f2c8563 commit 036be63
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 94 deletions.
19 changes: 18 additions & 1 deletion core/haptic/sink/haptic_sink_os.c
Expand Up @@ -15,6 +15,10 @@ struct haptic_sink_state {
static void dump_event(const GE_Event * event) {

switch (event->type) {
case GE_JOYRUMBLE:
dprintf("< RUMBLE, weak=%hu, strong=%hu\n", event->jrumble.weak, event->jrumble.strong);
fflush(stdout);
break;
case GE_JOYCONSTANTFORCE:
dprintf("< CONSTANT, level: %d\n", event->jconstant.level);
fflush(stdout);
Expand Down Expand Up @@ -43,7 +47,7 @@ static struct haptic_sink_state * haptic_sink_os_init(int joystick) {

if (joystick >= 0) {
int haptic = ginput_joystick_get_haptic(joystick);
if (haptic & (GE_HAPTIC_CONSTANT | GE_HAPTIC_SPRING | GE_HAPTIC_DAMPER)) {
if (haptic & (GE_HAPTIC_RUMBLE | GE_HAPTIC_CONSTANT | GE_HAPTIC_SPRING | GE_HAPTIC_DAMPER)) {
void * ptr = calloc(1, sizeof(struct haptic_sink_state));
if (ptr != NULL) {
struct haptic_sink_state * state = (struct haptic_sink_state *) ptr;
Expand Down Expand Up @@ -112,6 +116,19 @@ static void haptic_sink_os_process(struct haptic_sink_state * state, const s_hap
if(gimx_params.debug.haptic) {
dump_event(&event);
}
} else if (data->type == E_DATA_TYPE_RUMBLE) {
GE_Event event = {
.jrumble = {
.type = GE_JOYRUMBLE,
.which = state->joystick,
.weak = data->rumble.weak,
.strong = data->rumble.strong
}
};
ginput_queue_push(&event);
if(gimx_params.debug.haptic) {
dump_event(&event);
}
}
}

Expand Down
93 changes: 0 additions & 93 deletions core/haptic/sink/haptic_sink_rumble.c

This file was deleted.

0 comments on commit 036be63

Please sign in to comment.