Libretro: Clean up config item style

This commit is contained in:
Jeffrey Pfau 2016-01-08 22:04:32 -08:00
parent 78b761cf01
commit 1ac5726d8a
1 changed files with 15 additions and 21 deletions

View File

@ -18,12 +18,6 @@
#define SAMPLES 1024 #define SAMPLES 1024
#define RUMBLE_PWM 35 #define RUMBLE_PWM 35
#define SOLAR_SENSOR_LEVEL "mgba_solar_sensor_level"
#define ALLOW_OPPOSING_DIRECTIONS "mgba_allow_opposing_directions"
#define USE_BIOS "mgba_use_bios"
#define SKIP_BIOS "mgba_skip_bios"
#define IDLE_OPTIMIZATION "mgba_idle_optimization"
static retro_environment_t environCallback; static retro_environment_t environCallback;
static retro_video_refresh_t videoCallback; static retro_video_refresh_t videoCallback;
static retro_audio_sample_batch_t audioCallback; static retro_audio_sample_batch_t audioCallback;
@ -61,26 +55,26 @@ static void _reloadSettings(void) {
struct retro_variable var; struct retro_variable var;
var.key = USE_BIOS; var.key = "mgba_use_bios";
var.value = 0; var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
opts.useBios = strcmp(var.value, "yes") == 0; opts.useBios = strcmp(var.value, "ON") == 0;
} }
var.key = SKIP_BIOS; var.key = "mgba_skip_bios";
var.value = 0; var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
opts.skipBios = strcmp(var.value, "yes") == 0; opts.skipBios = strcmp(var.value, "ON") == 0;
} }
var.key = IDLE_OPTIMIZATION; var.key = "mgba_idle_optimization";
var.value = 0; var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "don't remove") == 0) { if (strcmp(var.value, "Don't Remove") == 0) {
opts.idleOptimization = IDLE_LOOP_IGNORE; opts.idleOptimization = IDLE_LOOP_IGNORE;
} else if (strcmp(var.value, "remove known") == 0) { } else if (strcmp(var.value, "Remove Known") == 0) {
opts.idleOptimization = IDLE_LOOP_REMOVE; opts.idleOptimization = IDLE_LOOP_REMOVE;
} else if (strcmp(var.value, "detect and remove") == 0) { } else if (strcmp(var.value, "Detect and Remove") == 0) {
opts.idleOptimization = IDLE_LOOP_DETECT; opts.idleOptimization = IDLE_LOOP_DETECT;
} }
} }
@ -96,11 +90,11 @@ void retro_set_environment(retro_environment_t env) {
environCallback = env; environCallback = env;
struct retro_variable vars[] = { struct retro_variable vars[] = {
{ SOLAR_SENSOR_LEVEL, "Solar sensor level; 0|1|2|3|4|5|6|7|8|9|10" }, { "mgba_solar_sensor_level", "Solar sensor level; 0|1|2|3|4|5|6|7|8|9|10" },
{ ALLOW_OPPOSING_DIRECTIONS, "Allow opposing directional input; no|yes" }, { "mgba_allow_opposing_directions", "Allow opposing directional input; OFF|ON" },
{ USE_BIOS, "Use BIOS file if found; yes|no" }, { "mgba_use_bios", "Use BIOS file if found; ON|OFF" },
{ SKIP_BIOS, "Skip BIOS intro; no|yes" }, { "mgba_skip_bios", "Skip BIOS intro; OFF|ON" },
{ IDLE_OPTIMIZATION, "Idle loop removal; remove known|detect and remove|don't remove" }, { "mgba_idle_optimization", "Idle loop removal; Remove Known|Detect and Remove|Don't Remove" },
{ 0, 0 } { 0, 0 }
}; };
@ -252,7 +246,7 @@ void retro_run(void) {
inputPollCallback(); inputPollCallback();
struct retro_variable var = { struct retro_variable var = {
.key = ALLOW_OPPOSING_DIRECTIONS, .key = "mgba_allow_opposing_directions",
.value = 0 .value = 0
}; };
@ -507,7 +501,7 @@ static void _setRumble(struct GBARumble* rumble, int enable) {
static void _updateLux(struct GBALuminanceSource* lux) { static void _updateLux(struct GBALuminanceSource* lux) {
UNUSED(lux); UNUSED(lux);
struct retro_variable var = { struct retro_variable var = {
.key = SOLAR_SENSOR_LEVEL, .key = "mgba_solar_sensor_level",
.value = 0 .value = 0
}; };