X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Flibretro.c;h=7f331574df168c11f0c2614443af6cf75a618c40;hb=e5241564f4444496f51f4de9bf533b1d910449ec;hp=c47d260b0c510a35e3c442b38e58b553e1954bb8;hpb=5338a93079458c4437138830ef711f61c2feabe6;p=pcsx_rearmed.git diff --git a/frontend/libretro.c b/frontend/libretro.c index c47d260b..7f331574 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -145,7 +145,9 @@ int in_mouse[8][2]; 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 @@ -2011,6 +2013,14 @@ static void update_variables(bool in_flight) 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"; @@ -2863,10 +2873,14 @@ static void update_input_mouse(int port, int ret) 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; @@ -2903,7 +2917,23 @@ static void update_input(void) 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];