int multitap1 = 0;
int multitap2 = 0;
int in_enable_vibration = 1;
-int in_enable_crosshair[2] = { 0, 0 };
+static int in_enable_crosshair[2] = { 0, 0 };
+static bool in_dualshock_toggle_enable = 0;
+static bool in_dualshock_toggling = 0;
// NegCon adjustment parameters
// > The NegCon 'twist' action is somewhat awkward when mapped
in_enable_vibration = 1;
}
+ var.value = NULL;
+ var.key = "pcsx_rearmed_analog_toggle";
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ {
+ in_dualshock_toggle_enable = (strcmp(var.value, "enabled") == 0);
+ }
+
var.value = NULL;
var.key = "pcsx_rearmed_dithering";
static void update_input(void)
{
- // reset all keystate, query libretro for keystate
+ int16_t analog_combo =
+ (1 << RETRO_DEVICE_ID_JOYPAD_L) |
+ (1 << RETRO_DEVICE_ID_JOYPAD_R) |
+ (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
int i;
int j;
+ // reset all keystate, query libretro for keystate
for (i = 0; i < PORTS_NUMBER; i++)
{
int16_t ret = 0;
update_input_mouse(i, ret);
break;
default:
- // Query digital inputs
+ // dualshock ANALOG toggle?
+ if (type == PSE_PAD_TYPE_ANALOGPAD && in_dualshock_toggle_enable
+ && (ret & analog_combo) == analog_combo)
+ {
+ if (!in_dualshock_toggling)
+ {
+ int state = padToggleAnalog(i);
+ char msg[32];
+ snprintf(msg, sizeof(msg), "ANALOG %s", state ? "ON" : "OFF");
+ show_notification(msg, 800, 1);
+ in_dualshock_toggling = true;
+ }
+ return;
+ }
+ in_dualshock_toggling = false;
+
+ // Set digital inputs
for (j = 0; j < RETRO_PSX_MAP_LEN; j++)
if (ret & (1 << j))
in_keystate[i] |= retro_psx_map[j];
},
"enabled",
},
+ {
+ "pcsx_rearmed_analog_toggle",
+ "DualShock Analog Mode Toggle",
+ NULL,
+ "When the input device type is DualShock, this option allows the emulated DualShock to be toggled between DIGITAL and ANALOG mode like original hardware. The button combination is L1 + R1 + Select.",
+ NULL,
+ "input",
+ {
+ { "disabled", NULL },
+ { "enabled", NULL },
+ { NULL, NULL },
+ },
+ "enabled",
+ },
{
"pcsx_rearmed_multitap",
"Multitap Mode",
unsigned char padMode; // 0 : digital 1: analog
unsigned char cmd4dConfig[6];
unsigned int lastUseFrame;
- unsigned int digitalModeFrames;
+ unsigned int unused;
unsigned char configModeUsed;
unsigned char padding[3];
} ds;
"SLPM86009",
};
+static const char * const dualshock_init_analog_hack_db[] =
+{
+ /* Formula 1 Championship Edition */
+ "SLUS00546",
+};
+
#define HACK_ENTRY(var, list) \
{ #var, &Config.hacks.var, list, ARRAY_SIZE(list) }
HACK_ENTRY(gpu_slow_list_walking, gpu_slow_llist_db),
HACK_ENTRY(gpu_busy, gpu_busy_hack_db),
HACK_ENTRY(gpu_centering, gpu_centering_hack_db),
+ HACK_ENTRY(dualshock_init_analog, dualshock_init_analog_hack_db),
};
static const struct
}
}
+ if (Config.hacks.dualshock_init_analog) {
+ // assume the default is off, see LoadPAD1plugin()
+ for (i = 0; i < 8; i++)
+ padToggleAnalog(i);
+ }
+
/* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
for (i = 0; i < ARRAY_SIZE(MemorycardHack_db); i++)
{
return;
}
- // switch to analog mode automatically after the game finishes init
- if (value == 0x42 && pads[padIndex].ds.padMode == 0)
- pads[padIndex].ds.digitalModeFrames++;
- if (pads[padIndex].ds.digitalModeFrames == 60*4) {
- pads[padIndex].ds.padMode = 1;
- pads[padIndex].ds.digitalModeFrames = 0;
- }
-
- if ((u32)(frame_counter - pads[padIndex].ds.lastUseFrame) > 60u)
+ if ((u32)(frame_counter - pads[padIndex].ds.lastUseFrame) > 60u
+ && !Config.hacks.dualshock_init_analog)
pads[padIndex].ds.padMode = 0; // according to nocash
pads[padIndex].ds.lastUseFrame = frame_counter;
return 0;
}
+int padToggleAnalog(unsigned int index)
+{
+ int r = -1;
+
+ if (index < sizeof(pads) / sizeof(pads[0]))
+ r = (pads[index].ds.padMode ^= 1);
+ return r;
+}
+
void *hNETDriver = NULL;
void SetCdOpenCaseTime(s64 time);\r
\r
int padFreeze(void *f, int Mode);\r
+int padToggleAnalog(unsigned int index);\r
\r
extern void pl_gun_byte2(int port, unsigned char byte);\r
extern void plat_trigger_vibrate(int pad, int low, int high);\r
boolean gpu_slow_list_walking;
boolean gpu_busy;
boolean gpu_centering;
+ boolean dualshock_init_analog;
} hacks;
} PcsxConfig;