Update libretro.cpp

Try to map mednafen input devices as core options
This commit is contained in:
Andrés Suárez 2014-01-20 02:09:13 -05:00
parent f6e10f866a
commit 8aaa3d3930

View File

@ -537,6 +537,44 @@ static void check_variables(void)
setting_psx_fastboot = 0;
}
var.key = "psx_enable_dual_analog_port1";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
switch(psx_enable_dual_analog_port1)
{
case "disabled"
currgame->SetInput(j, "gamepad", &buf.u8[j]);;
break;
case "dualanalog"
currgame->SetInput(j, "dualanalog", &buf.u8[j]);;
break;
case "dualshock"
currgame->SetInput(j, "dualshock", &buf.u8[j]);;
break;
}
}
var.key = "psx_enable_dual_analog_port2";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
switch(psx_enable_dual_analog_port2)
{
case "disabled"
currgame->SetInput(j, "gamepad", &buf.u8[j]);;
break;
case "dualanalog"
currgame->SetInput(j, "dualanalog", &buf.u8[j]);;
break;
case "dualshock"
currgame->SetInput(j, "dualshock", &buf.u8[j]);;
break;
}
}
var.key = "psx_enable_multitap_port1";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
@ -545,7 +583,7 @@ static void check_variables(void)
setting_psx_multitap_port_1 = true;
else if (strcmp(var.value, "disabled") == 0)
setting_psx_multitap_port_1 = false;
}
}
var.key = "psx_enable_multitap_port2";
@ -654,9 +692,6 @@ static void hookup_ports(bool force)
{
switch (retro_devices[j])
{
case RETRO_DEVICE_ANALOG:
currgame->SetInput(j, "dualshock", &buf.u8[j]);
break;
default:
currgame->SetInput(j, "gamepad", &buf.u8[j]);
break;
@ -1373,8 +1408,11 @@ void retro_set_environment(retro_environment_t cb)
static const struct retro_variable vars[] = {
{ "psx_fastboot", "Skip BIOS sequence; disabled|enabled" },
{ "psx_dithering", "Dithering; enabled|disabled" },
{ "psx_enable_dual_analog_port1", "Port 1: Analog mode; disabled|dualshock|dualanalog" },
{ "psx_enable_dual_analog_port2", "Port 2: Analog mode; disabled|dualshock|dualanalog" },
{ "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);