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);
return 0;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
plat_omap_gvideo_open();
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
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) {
return 0;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
}
// 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;
{
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
const int vDuration = 10;
"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)) {
/* 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);
}
}
-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]);
#endif
unsigned char PADpoll_pad(unsigned char value) {
- if (CurByte == 0) {
+ if (CurByte == 0) {
CurCmd = value;
CurByte++;
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++];
}