+static enum input_device input_name_to_val(const char *name)
+{
+ if (strcmp(name, "3 button pad") == 0)
+ return PICO_INPUT_PAD_3BTN;
+ if (strcmp(name, "6 button pad") == 0)
+ return PICO_INPUT_PAD_6BTN;
+ if (strcmp(name, "None") == 0)
+ return PICO_INPUT_NOTHING;
+
+ lprintf("invalid picodrive_input: '%s'\n", name);
+ return PICO_INPUT_PAD_3BTN;
+}
+
+static void update_variables(void)
+{
+ struct retro_variable var;
+
+ var.value = NULL;
+ var.key = "picodrive_input1";
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ PicoSetInputDevice(0, input_name_to_val(var.value));
+
+ var.value = NULL;
+ var.key = "picodrive_input2";
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ PicoSetInputDevice(1, input_name_to_val(var.value));
+
+ var.value = NULL;
+ var.key = "picodrive_sprlim";
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
+ if (strcmp(var.value, "enabled") == 0)
+ PicoOpt |= POPT_DIS_SPRITE_LIM;
+ else
+ PicoOpt &= ~POPT_DIS_SPRITE_LIM;
+ }
+
+ var.value = NULL;
+ var.key = "picodrive_ramcart";
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
+ if (strcmp(var.value, "enabled") == 0)
+ PicoOpt |= POPT_EN_MCD_RAMCART;
+ else
+ PicoOpt &= ~POPT_EN_MCD_RAMCART;
+ }
+
+#ifdef DRC_SH2
+ var.value = NULL;
+ var.key = "picodrive_drc";
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
+ if (strcmp(var.value, "enabled") == 0)
+ PicoOpt |= POPT_EN_DRC;
+ else
+ PicoOpt &= ~POPT_EN_DRC;
+ }
+#endif
+}
+