-static int controller_port_variable(unsigned port, struct retro_variable *var)
-{
- if (port >= PORTS_NUMBER)
- return 0;
-
- if (!environ_cb)
- return 0;
-
- var->value = NULL;
- switch (port)
- {
- case 0:
- var->key = "pcsx_rearmed_pad1type";
- break;
- case 1:
- var->key = "pcsx_rearmed_pad2type";
- break;
- case 2:
- var->key = "pcsx_rearmed_pad3type";
- break;
- case 3:
- var->key = "pcsx_rearmed_pad4type";
- break;
- case 4:
- var->key = "pcsx_rearmed_pad5type";
- break;
- case 5:
- var->key = "pcsx_rearmed_pad6type";
- break;
- case 6:
- var->key = "pcsx_rearmed_pad7type";
- break;
- case 7:
- var->key = "pcsx_rearmed_pad8type";
- break;
- }
-
- return environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, var) && var->value;
-}
-
-static void update_controller_port_variable(unsigned port)
-{
- if (port >= PORTS_NUMBER)
- return;
-
- struct retro_variable var;
-
- if (controller_port_variable(port, &var))
- {
- if (strcmp(var.value, "standard") == 0)
- in_type[port] = PSE_PAD_TYPE_STANDARD;
- else if (strcmp(var.value, "analog") == 0)
- in_type[port] = PSE_PAD_TYPE_ANALOGJOY;
- else if (strcmp(var.value, "dualshock") == 0)
- in_type[port] = PSE_PAD_TYPE_ANALOGPAD;
- else if (strcmp(var.value, "negcon") == 0)
- in_type[port] = PSE_PAD_TYPE_NEGCON;
- else if (strcmp(var.value, "guncon") == 0)
- in_type[port] = PSE_PAD_TYPE_GUNCON;
- else if (strcmp(var.value, "none") == 0)
- in_type[port] = PSE_PAD_TYPE_NONE;
- // else 'default' case, do nothing
- }
-}
-
-static void update_controller_port_device(unsigned port, unsigned device)
-{
- if (port >= PORTS_NUMBER)
- return;
-
- struct retro_variable var;
-
- if (!controller_port_variable(port, &var))
- return;
-
- if (strcmp(var.value, "default") != 0)
- return;
-
- switch (device)
- {
- case RETRO_DEVICE_JOYPAD:
- in_type[port] = PSE_PAD_TYPE_STANDARD;
- break;
- case RETRO_DEVICE_ANALOG:
- in_type[port] = PSE_PAD_TYPE_ANALOGPAD;
- break;
- case RETRO_DEVICE_MOUSE:
- in_type[port] = PSE_PAD_TYPE_MOUSE;
- break;
- case RETRO_DEVICE_LIGHTGUN:
- in_type[port] = PSE_PAD_TYPE_GUN;
- break;
- case RETRO_DEVICE_NONE:
- default:
- in_type[port] = PSE_PAD_TYPE_NONE;
- }
-}
-
-static void update_multitap()