aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfinput
diff options
context:
space:
mode:
authornotaz2012-03-01 23:34:16 +0200
committernotaz2012-03-01 23:34:16 +0200
commit3a40ff141abca7d9c5a1e3f47e41c26d9bc3b3ff (patch)
treec6fcccf114319e52684848ff59f243b3a22a22dc /plugins/dfinput
parent76720f7ff171a7d13d010d7f0af1ae546f781c9c (diff)
downloadpcsx_rearmed-3a40ff141abca7d9c5a1e3f47e41c26d9bc3b3ff.tar.gz
pcsx_rearmed-3a40ff141abca7d9c5a1e3f47e41c26d9bc3b3ff.tar.bz2
pcsx_rearmed-3a40ff141abca7d9c5a1e3f47e41c26d9bc3b3ff.zip
improve vibration support for Caanoo
..maybe, not tested much.
Diffstat (limited to 'plugins/dfinput')
-rw-r--r--plugins/dfinput/main.h2
-rw-r--r--plugins/dfinput/pad.c24
2 files changed, 20 insertions, 6 deletions
diff --git a/plugins/dfinput/main.h b/plugins/dfinput/main.h
index 3492170..8e2d5ae 100644
--- a/plugins/dfinput/main.h
+++ b/plugins/dfinput/main.h
@@ -27,4 +27,4 @@ extern void pl_update_gun(int *xn, int *xres, int *y, int *in);
/* vibration trigger to frontend */
extern int in_enable_vibration;
-extern void plat_trigger_vibrate(void);
+extern void plat_trigger_vibrate(int is_strong);
diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c
index ab55db0..a8019b9 100644
--- a/plugins/dfinput/pad.c
+++ b/plugins/dfinput/pad.c
@@ -206,11 +206,21 @@ static void do_cmd2(unsigned char value)
case CMD_READ_DATA_AND_VIBRATE:
if (value == 1 && CurPad == 0 && in_enable_vibration)
- plat_trigger_vibrate();
+ plat_trigger_vibrate(0);
break;
}
}
+static void do_cmd3(unsigned char value)
+{
+ if (in_enable_vibration && CurCmd == CMD_READ_DATA_AND_VIBRATE && CurPad == 0) {
+ if (value >= 0xf0)
+ plat_trigger_vibrate(1);
+ else if (value > 0x40)
+ plat_trigger_vibrate(0);
+ }
+}
+
#if 0
#include <stdio.h>
unsigned char PADpoll_(unsigned char value);
@@ -224,7 +234,8 @@ unsigned char PADpoll(unsigned char value) {
unsigned char PADpoll_pad(unsigned char value) {
- if (CurByte == 0) {
+ switch (CurByte) {
+ case 0:
CurCmd = value;
CurByte++;
@@ -233,10 +244,13 @@ unsigned char PADpoll_pad(unsigned char value) {
CurCmd = CMD_READ_DATA_AND_VIBRATE;
return do_cmd();
- }
-
- if (CurByte == 2)
+ case 2:
do_cmd2(value);
+ break;
+ case 3:
+ do_cmd3(value);
+ break;
+ }
if (CurByte >= CmdLen)
return 0xff; // verified