Merge pull request #45 from fr500/master

Fix dualshock analogs, and other fixes
This commit is contained in:
Twinaphex 2014-04-23 16:13:30 +02:00
commit 25577ff7bc
4 changed files with 27 additions and 8 deletions

12
libretro.cpp Normal file → Executable file
View File

@ -584,6 +584,15 @@ static void check_variables(void)
hookup_ports(true);
}
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";
@ -754,6 +763,7 @@ static void hookup_ports(bool force)
{
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]);
break;
}
default:
@ -1468,9 +1478,11 @@ void retro_set_environment(retro_environment_t cb)
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_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 },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);

7
mednafen/psx-09333/input/dualshock.cpp Normal file → Executable file
View File

@ -151,6 +151,12 @@ void InputDevice_DualShock::ResetTS(void)
void InputDevice_DualShock::SetAMCT(bool enabled)
{
amct_enabled = enabled;
if(amct_enabled)
analog_mode = false;
else
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"));
}
//
@ -224,7 +230,6 @@ void InputDevice_DualShock::Power(void)
transmit_pos = 0;
transmit_count = 0;
analog_mode = false;
analog_mode_locked = false;
mad_munchkins = false;

7
mednafen/settings.cpp Normal file → Executable file
View File

@ -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)

1
mednafen/settings.h Normal file → Executable file
View File

@ -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;