Create menu_setting_apply_deferred

This commit is contained in:
twinaphex 2015-05-15 00:22:26 +02:00
parent 3fea013c96
commit 29a10e5cb3
6 changed files with 64 additions and 63 deletions

View File

@ -256,65 +256,6 @@ void menu_free(menu_handle_t *menu)
free(menu);
}
void menu_apply_deferred_settings(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
rarch_setting_t *setting = menu ? menu->list_settings : NULL;
if (!menu || !setting)
return;
for (; setting->type != ST_NONE; setting++)
{
if (setting->type >= ST_GROUP)
continue;
if (!(setting->flags & SD_FLAG_IS_DEFERRED))
continue;
switch (setting->type)
{
case ST_BOOL:
if (*setting->value.boolean != setting->original_value.boolean)
{
setting->original_value.boolean = *setting->value.boolean;
setting->deferred_handler(setting);
}
break;
case ST_INT:
if (*setting->value.integer != setting->original_value.integer)
{
setting->original_value.integer = *setting->value.integer;
setting->deferred_handler(setting);
}
break;
case ST_UINT:
if (*setting->value.unsigned_integer != setting->original_value.unsigned_integer)
{
setting->original_value.unsigned_integer = *setting->value.unsigned_integer;
setting->deferred_handler(setting);
}
break;
case ST_FLOAT:
if (*setting->value.fraction != setting->original_value.fraction)
{
setting->original_value.fraction = *setting->value.fraction;
setting->deferred_handler(setting);
}
break;
case ST_PATH:
case ST_DIR:
case ST_STRING:
case ST_BIND:
/* Always run the deferred write handler */
setting->deferred_handler(setting);
break;
default:
break;
}
}
}
/**
* menu_iterate:
* @input : input sample for this frame

View File

@ -196,8 +196,6 @@ bool menu_load_content(void);
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
void menu_apply_deferred_settings(void);
#ifdef __cplusplus
}
#endif

View File

@ -85,7 +85,7 @@ int menu_entries_select_back(void)
if (!menu_list)
return -1;
menu_apply_deferred_settings();
menu_setting_apply_deferred();
menu_list_pop_stack(menu_list);
return 0;

View File

@ -199,3 +199,62 @@ int menu_setting_set(unsigned type, const char *label,
return 0;
return ret;
}
void menu_setting_apply_deferred(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
rarch_setting_t *setting = menu ? menu->list_settings : NULL;
if (!menu || !setting)
return;
for (; setting->type != ST_NONE; setting++)
{
if (setting->type >= ST_GROUP)
continue;
if (!(setting->flags & SD_FLAG_IS_DEFERRED))
continue;
switch (setting->type)
{
case ST_BOOL:
if (*setting->value.boolean != setting->original_value.boolean)
{
setting->original_value.boolean = *setting->value.boolean;
setting->deferred_handler(setting);
}
break;
case ST_INT:
if (*setting->value.integer != setting->original_value.integer)
{
setting->original_value.integer = *setting->value.integer;
setting->deferred_handler(setting);
}
break;
case ST_UINT:
if (*setting->value.unsigned_integer != setting->original_value.unsigned_integer)
{
setting->original_value.unsigned_integer = *setting->value.unsigned_integer;
setting->deferred_handler(setting);
}
break;
case ST_FLOAT:
if (*setting->value.fraction != setting->original_value.fraction)
{
setting->original_value.fraction = *setting->value.fraction;
setting->deferred_handler(setting);
}
break;
case ST_PATH:
case ST_DIR:
case ST_STRING:
case ST_BIND:
/* Always run the deferred write handler */
setting->deferred_handler(setting);
break;
default:
break;
}
}
}

View File

@ -24,6 +24,8 @@
extern "C" {
#endif
void menu_setting_apply_deferred(void);
int menu_setting_set_flags(rarch_setting_t *setting);
int menu_setting_generic(rarch_setting_t *setting);

View File

@ -39,6 +39,7 @@
#ifdef HAVE_MENU
#include "menu/menu.h"
#include "menu/menu_setting.h"
#include "menu/menu_shader.h"
#include "menu/menu_input.h"
#endif
@ -1288,7 +1289,7 @@ void rarch_main_set_state(unsigned cmd)
break;
case RARCH_ACTION_STATE_MENU_RUNNING_FINISHED:
#ifdef HAVE_MENU
menu_apply_deferred_settings();
menu_setting_apply_deferred();
menu_driver_toggle(false);