notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #322 from retro-wertz/fix_android_build
[pcsx_rearmed.git]
/
plugins
/
dfinput
/
pad.c
diff --git
a/plugins/dfinput/pad.c
b/plugins/dfinput/pad.c
index
348bb8f
..
853c8c8
100644
(file)
--- 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;
int i;
+
switch (CurCmd) {
case CMD_READ_DATA_AND_VIBRATE:
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++) {
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;
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]);
plat_trigger_vibrate(CurPad,
padstate[CurPad].pad.VibF[0],
padstate[CurPad].pad.VibF[1]);
@@
-251,8
+254,9
@@
unsigned char PADpoll(unsigned char value) {
#define PADpoll PADpoll_
#endif
#define PADpoll PADpoll_
#endif
+#ifndef HAVE_LIBRETRO
unsigned char PADpoll_pad(unsigned char value) {
unsigned char PADpoll_pad(unsigned char value) {
- if (CurByte == 0) {
+
if (CurByte == 0) {
CurCmd = value;
CurByte++;
CurCmd = value;
CurByte++;
@@
-261,15
+265,16
@@
unsigned char PADpoll_pad(unsigned char value) {
CurCmd = CMD_READ_DATA_AND_VIBRATE;
return do_cmd();
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_cmd2(value);
- do_cmd3(value);
+ if (padstate[CurPad].pad.controllerType == PSE_PAD_TYPE_ANALOGPAD)
+ do_vibration(value);
return buf[CurByte++];
}
return buf[CurByte++];
}
@@
-298,3
+303,4
@@
void pad_init(void)
padstate[i].PadMode = padstate[i].pad.controllerType == PSE_PAD_TYPE_ANALOGPAD;
}
}
padstate[i].PadMode = padstate[i].pad.controllerType == PSE_PAD_TYPE_ANALOGPAD;
}
}
+#endif