From b43fe8e26bd3c9d1faea5423fa65b722dabee75c Mon Sep 17 00:00:00 2001 From: AndresSM Date: Tue, 22 Apr 2014 23:37:06 -0500 Subject: [PATCH 1/2] Fixed some core options: - psx.input.port1.multitap was renamed for some reason to psx.input.pport1.multitap - psx.input.port2.multitap was renamed for some reason to psx.input.pport2.multitap Dualshock analogs were "broken", mednafen has psx.input.analog_mode_ct, if true then you toggle analogs by pressing start+select+l1+l2+r1+r2 for roughly two seconds. In the libretro port it was set to 1 always. I've made this a core option: setting_psx_analog_toggle, this enables/disables the MODE button, defaults to disabled. I think a sane default is for it to be disabled and analogs to work out of the box so I have added that too. If setting_psx_analog_toggle is enabled then it replicates mednafen's and the psx's behavior, MODE button works and by default it's off, so analogs are off. --- libretro.cpp | 20 ++++++++++++++++---- mednafen/psx-09333/input/dualshock.cpp | 12 +++++++++++- mednafen/settings.cpp | 7 ++++--- mednafen/settings.h | 1 + 4 files changed, 32 insertions(+), 8 deletions(-) mode change 100644 => 100755 libretro.cpp mode change 100644 => 100755 mednafen/psx-09333/input/dualshock.cpp mode change 100644 => 100755 mednafen/settings.cpp mode change 100644 => 100755 mednafen/settings.h diff --git a/libretro.cpp b/libretro.cpp old mode 100644 new mode 100755 index d78cdd2..8e7e384 --- a/libretro.cpp +++ b/libretro.cpp @@ -584,9 +584,18 @@ static void check_variables(void) hookup_ports(true); } - - var.key = "psx_enable_multitap_port1"; + var.key = "psx_enable_analog_toggle"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) + { + if (strcmp(var.value, "enabled") == 0) + setting_psx_analog_toggle = 1; + else if (strcmp(var.value, "disabled") == 0) + setting_psx_analog_toggle = 0; + } + + var.key = "psx_enable_multitap_port1"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) { if (strcmp(var.value, "enabled") == 0) @@ -753,7 +762,8 @@ static void hookup_ports(bool force) case RETRO_DEVICE_ANALOG: { log_cb(RETRO_LOG_INFO, "[%s]: Selected analog controller type %s.\n", mednafen_core_str, psx_analog_type); - currgame->SetInput(j, psx_analog_type, &buf.u8[j]); + currgame->SetInput(j, psx_analog_type, &buf.u8[j]); + break; } default: @@ -1467,9 +1477,11 @@ void retro_set_environment(retro_environment_t cb) #elif defined(WANT_PSX_EMU) static const struct retro_variable vars[] = { { "psx_dithering", "Dithering; enabled|disabled" }, - { "psx_enable_dual_analog_type", "Analog controller mode; disabled|dualshock|dualanalog|flightstick" }, + { "psx_enable_dual_analog_type", "Analog controller mode; disabled|dualshock|dualanalog|flightstick" }, + { "psx_enable_analog_toggle", "Dualshock analog button; disabled|enabled" }, { "psx_enable_multitap_port1", "Port 1: Multitap enable; disabled|enabled" }, { "psx_enable_multitap_port2", "Port 2: Multitap enable; disabled|enabled" }, + { NULL, NULL }, }; diff --git a/mednafen/psx-09333/input/dualshock.cpp b/mednafen/psx-09333/input/dualshock.cpp old mode 100644 new mode 100755 index 2c27e3e..3f6fef2 --- a/mednafen/psx-09333/input/dualshock.cpp +++ b/mednafen/psx-09333/input/dualshock.cpp @@ -151,6 +151,16 @@ void InputDevice_DualShock::ResetTS(void) void InputDevice_DualShock::SetAMCT(bool enabled) { amct_enabled = enabled; + if(amct_enabled) + { + analog_mode = false; + fprintf(stderr, "Analog button enabled, analog mode false\n"); + } + else + { + analog_mode = true; + fprintf(stderr, "Analog button disabled, analog mode true\n"); + } } // @@ -224,7 +234,6 @@ void InputDevice_DualShock::Power(void) transmit_pos = 0; transmit_count = 0; - analog_mode = false; analog_mode_locked = false; mad_munchkins = false; @@ -285,6 +294,7 @@ void InputDevice_DualShock::UpdateInput(const void *data) // CheckManualAnaModeChange(); + //MDFN_DispMessage(_("%s: Analog mode is %s(%s)."), gp_name.c_str(), analog_mode ? _("on") : _("off"), analog_mode_locked ? _("locked") : _("unlocked")); if(am_prev_info != analog_mode || aml_prev_info != analog_mode_locked) { MDFN_DispMessage(_("%s: Analog mode is %s(%s)."), gp_name.c_str(), analog_mode ? _("on") : _("off"), analog_mode_locked ? _("locked") : _("unlocked")); diff --git a/mednafen/settings.cpp b/mednafen/settings.cpp old mode 100644 new mode 100755 index f09d564..c74e2b8 --- a/mednafen/settings.cpp +++ b/mednafen/settings.cpp @@ -31,6 +31,7 @@ uint32_t setting_pce_keepaspect = 1; #elif defined(WANT_PSX_EMU) uint32_t setting_psx_multitap_port_1 = 0; uint32_t setting_psx_multitap_port_2 = 0; +uint32_t setting_psx_analog_toggle = 0; uint32_t setting_psx_fastboot = 1; #elif defined(WANT_NGP_EMU) uint32_t setting_ngp_language = 0; @@ -225,14 +226,14 @@ bool MDFN_GetSettingB(const char *name) return 1; if (!strcmp("psx.input.port8.memcard", name)) return 1; - if (!strcmp("psx.input.port1.multitap", name)) /* make configurable */ + if (!strcmp("psx.input.pport1.multitap", name)) /* make configurable */ return setting_psx_multitap_port_1; - if (!strcmp("psx.input.port2.multitap", name)) /* make configurable */ + if (!strcmp("psx.input.pport2.multitap", name)) /* make configurable */ return setting_psx_multitap_port_2; if (!strcmp("psx.region_autodetect", name)) /* make configurable */ return 1; if (!strcmp("psx.input.analog_mode_ct", name)) /* make configurable */ - return 1; + return setting_psx_analog_toggle; if (!strcmp("psx.fastboot", name)) return setting_psx_fastboot; #elif defined(WANT_NGP_EMU) diff --git a/mednafen/settings.h b/mednafen/settings.h old mode 100644 new mode 100755 index bd4a520..6598a3a --- a/mednafen/settings.h +++ b/mednafen/settings.h @@ -13,6 +13,7 @@ extern uint32_t setting_pce_keepaspect; #elif defined(WANT_PSX_EMU) extern uint32_t setting_psx_multitap_port_1; extern uint32_t setting_psx_multitap_port_2; +extern uint32_t setting_psx_analog_toggle; extern uint32_t setting_psx_fastboot; #elif defined(WANT_NGP_EMU) extern uint32_t setting_ngp_language; From 4ec836d8917a628dd833dc1a686ef99b9547be84 Mon Sep 17 00:00:00 2001 From: AndresSM Date: Tue, 22 Apr 2014 23:48:15 -0500 Subject: [PATCH 2/2] Fix some messages --- mednafen/psx-09333/input/dualshock.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/mednafen/psx-09333/input/dualshock.cpp b/mednafen/psx-09333/input/dualshock.cpp index 3f6fef2..d6f74a5 100755 --- a/mednafen/psx-09333/input/dualshock.cpp +++ b/mednafen/psx-09333/input/dualshock.cpp @@ -152,15 +152,11 @@ void InputDevice_DualShock::SetAMCT(bool enabled) { amct_enabled = enabled; if(amct_enabled) - { - analog_mode = false; - fprintf(stderr, "Analog button enabled, analog mode false\n"); - } + analog_mode = false; else - { - analog_mode = true; - fprintf(stderr, "Analog button disabled, analog mode true\n"); - } + analog_mode = true; + + MDFN_DispMessage(_("%s: Mode button is %s, analogs are now %s"), gp_name.c_str(), amct_enabled ? _("enabled") : _("disabled"), analog_mode?_("on") : _("off")); } // @@ -294,7 +290,6 @@ void InputDevice_DualShock::UpdateInput(const void *data) // CheckManualAnaModeChange(); - //MDFN_DispMessage(_("%s: Analog mode is %s(%s)."), gp_name.c_str(), analog_mode ? _("on") : _("off"), analog_mode_locked ? _("locked") : _("unlocked")); if(am_prev_info != analog_mode || aml_prev_info != analog_mode_locked) { MDFN_DispMessage(_("%s: Analog mode is %s(%s)."), gp_name.c_str(), analog_mode ? _("on") : _("off"), analog_mode_locked ? _("locked") : _("unlocked"));