Check for updated values, log options.

This commit is contained in:
Themaister 2013-04-04 14:13:42 +02:00
parent 418a830665
commit e6f7b709c4
2 changed files with 28 additions and 10 deletions

View File

@ -110,6 +110,15 @@ static bool parse_variable(core_option_manager_t *opt, size_t index, const struc
}
free(value);
RARCH_LOG("Core option:\n");
RARCH_LOG("\tDescription: %s\n", option->desc);
RARCH_LOG("\tKey: %s\n", option->key);
RARCH_LOG("\tCurrent value: %s\n", core_option_get_val(opt, index));
RARCH_LOG("\tPossible values:\n");
for (size_t i = 0; i < option->vals->size; i++)
RARCH_LOG("\t\t%s\n", option->vals->elems[i].data);
return true;
}

View File

@ -206,11 +206,29 @@ static void render_audio(void)
phase %= 100;
}
static void check_variables(void)
{
struct retro_variable var = {0};
var.key = "test_opt0";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
var.key = "test_opt1";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
var.key = "test_opt2";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
}
void retro_run(void)
{
update_input();
render_checkered();
render_audio();
bool updated = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
check_variables();
}
static void keyboard_cb(bool down, unsigned keycode,
@ -242,16 +260,7 @@ bool retro_load_game(const struct retro_game_info *info)
struct retro_keyboard_callback cb = { keyboard_cb };
environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
struct retro_variable var = {0};
var.key = "test_opt0";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
var.key = "test_opt1";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
var.key = "test_opt2";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
fprintf(stderr, "Key -> Val: %s -> %s.\n", var.key, var.value);
check_variables();
(void)info;
return true;