diff options
author | Twinaphex | 2014-12-20 20:43:18 +0100 |
---|---|---|
committer | Twinaphex | 2014-12-20 20:43:18 +0100 |
commit | 247fc699be6b3bd95fd9126541e0804cc8dffdd4 (patch) | |
tree | d38e169e68e48a3ccbf8a3805f9cb87197ed894a /plugins/dfinput/pad.c | |
parent | 3e5b01fcef8ef20dacca45ea7a7b0c461e6bd666 (diff) | |
parent | 7931825ed8ef51dab3e37475d8126103ebc9fb6f (diff) | |
download | pcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.tar.gz pcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.tar.bz2 pcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.zip |
Merge pull request #11 from notaz/upstream_merge
Upstream merge
Diffstat (limited to 'plugins/dfinput/pad.c')
-rw-r--r-- | plugins/dfinput/pad.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index 348bb8f..7e00a11 100644 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -206,21 +206,24 @@ static void do_cmd2(unsigned char value) } } -static void do_cmd3(unsigned char value) +static void do_vibration(unsigned char value) { + int changed = 0; int i; + switch (CurCmd) { case CMD_READ_DATA_AND_VIBRATE: - if (!in_enable_vibration) - break; - if (padstate[CurPad].pad.controllerType != PSE_PAD_TYPE_ANALOGPAD) - break; - for (i = 0; i < 2; i++) { - if (padstate[CurPad].pad.Vib[i] == CurByte) + if (padstate[CurPad].pad.Vib[i] == CurByte + && padstate[CurPad].pad.VibF[i] != value) { padstate[CurPad].pad.VibF[i] = value; + changed = 1; + } } + if (!in_enable_vibration || !changed) + break; + plat_trigger_vibrate(CurPad, padstate[CurPad].pad.VibF[0], padstate[CurPad].pad.VibF[1]); @@ -252,7 +255,7 @@ unsigned char PADpoll(unsigned char value) { #endif unsigned char PADpoll_pad(unsigned char value) { - if (CurByte == 0) { + if (CurByte == 0) { CurCmd = value; CurByte++; @@ -261,15 +264,16 @@ unsigned char PADpoll_pad(unsigned char value) { CurCmd = CMD_READ_DATA_AND_VIBRATE; return do_cmd(); - } + } - if (CurByte >= CmdLen) - return 0xff; // verified + if (CurByte >= CmdLen) + return 0xff; // verified - if (CurByte == 2) + if (CurByte == 2) do_cmd2(value); - do_cmd3(value); + if (padstate[CurPad].pad.controllerType == PSE_PAD_TYPE_ANALOGPAD) + do_vibration(value); return buf[CurByte++]; } |