aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2014-12-20 20:26:22 +0200
committernotaz2014-12-20 21:27:23 +0200
commitd71c709541218f67ab32229b03307b045a8ed6cb (patch)
tree8fc070bbe8339e1b669766cac5eba01299b679dc
parent4e47706596441172d1cc3f203b8baa398cea3023 (diff)
downloadpcsx_rearmed-d71c709541218f67ab32229b03307b045a8ed6cb.tar.gz
pcsx_rearmed-d71c709541218f67ab32229b03307b045a8ed6cb.tar.bz2
pcsx_rearmed-d71c709541218f67ab32229b03307b045a8ed6cb.zip
fix up other platforms after rumble change
-rw-r--r--frontend/libretro.c2
-rw-r--r--frontend/plat_dummy.c2
-rw-r--r--frontend/plat_pandora.c2
-rw-r--r--frontend/plat_pollux.c7
-rw-r--r--frontend/plat_sdl.c2
-rw-r--r--include/psemu_plugin_defs.h7
-rw-r--r--maemo/hildon.c5
-rw-r--r--plugins/dfinput/externals.h2
-rw-r--r--plugins/dfinput/pad.c30
9 files changed, 34 insertions, 25 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 47f07a6..74b5dbf 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -197,7 +197,7 @@ void pl_timing_prepare(int is_pal)
is_pal_mode = is_pal;
}
-void plat_trigger_vibrate(int pad, uint32_t low, uint32_t high)
+void plat_trigger_vibrate(int pad, int low, int high)
{
rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8);
rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0);
diff --git a/frontend/plat_dummy.c b/frontend/plat_dummy.c
index baed0d5..b490cff 100644
--- a/frontend/plat_dummy.c
+++ b/frontend/plat_dummy.c
@@ -54,7 +54,7 @@ void *plat_prepare_screenshot(int *w, int *h, int *bpp)
return 0;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c
index 3202c1d..41dc2fe 100644
--- a/frontend/plat_pandora.c
+++ b/frontend/plat_pandora.c
@@ -106,6 +106,6 @@ void plat_gvideo_open(int is_pal)
plat_omap_gvideo_open();
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index cb7afef..33e9417 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -704,10 +704,15 @@ static int haptic_init(void)
return 0;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
+ int is_strong;
int ret;
+ if (low == 0 && high == 0)
+ return;
+ is_strong = (high >= 0xf0);
+
if (hapticdev == -2)
return; // it's broken
if (hapticdev < 0) {
diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c
index 4e77dc3..5e11cf8 100644
--- a/frontend/plat_sdl.c
+++ b/frontend/plat_sdl.c
@@ -336,7 +336,7 @@ void *plat_prepare_screenshot(int *w, int *h, int *bpp)
return 0;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
diff --git a/include/psemu_plugin_defs.h b/include/psemu_plugin_defs.h
index 0805f4a..9986654 100644
--- a/include/psemu_plugin_defs.h
+++ b/include/psemu_plugin_defs.h
@@ -205,11 +205,10 @@ typedef struct
// values are in range -128 - 127
unsigned char moveX, moveY;
- uint8_t Vib[2];
+ unsigned char Vib[2];
+ unsigned char VibF[2];
- volatile uint8_t VibF[2];
-
- unsigned char reserved[87];
+ unsigned char reserved[87];
} PadDataS;
diff --git a/maemo/hildon.c b/maemo/hildon.c
index bd895c9..7e9cd9f 100644
--- a/maemo/hildon.c
+++ b/maemo/hildon.c
@@ -805,7 +805,7 @@ void plat_step_volume(int is_up)
{
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
const int vDuration = 10;
@@ -817,7 +817,8 @@ void plat_trigger_vibrate(int is_strong)
"req_start_manual_vibration");
if (msg) {
dbus_message_iter_init_append(msg, &args);
- int speed = is_strong ? 200 : 150;
+ // FIXME: somebody with hardware should tune this
+ int speed = high; // is_strong ? 200 : 150;
int duration = vDuration;
if (dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &speed)) {
if (dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &duration)) {
diff --git a/plugins/dfinput/externals.h b/plugins/dfinput/externals.h
index 042d9dc..a446956 100644
--- a/plugins/dfinput/externals.h
+++ b/plugins/dfinput/externals.h
@@ -11,4 +11,4 @@ extern void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in);
/* vibration trigger to frontend */
extern int in_enable_vibration;
-extern void plat_trigger_vibrate(int pad, uint32_t low, uint32_t high);
+extern void plat_trigger_vibrate(int pad, int low, int high);
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++];
}