(Settings data/Menu) Convert second setting to settings_data equivalent - also discard

'const' qualifier
This commit is contained in:
twinaphex 2014-07-16 21:29:50 +02:00
parent d60c58b2c8
commit 8aab996466
3 changed files with 34 additions and 18 deletions

View File

@ -72,9 +72,9 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
unsigned i, last;
char tmp[256];
menu_handle_t *menu = (menu_handle_t*)data;
const rarch_setting_t *setting_data, *current_setting;
rarch_setting_t *setting_data, *current_setting;
setting_data = (const rarch_setting_t *)setting_data_get_list();
setting_data = (rarch_setting_t *)setting_data_get_list();
if (!menu || !setting_data)
return;
@ -140,7 +140,12 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
file_list_push(menu->selection_buf, "Libretro Logging Level", MENU_SETTINGS_LIBRETRO_LOG_LEVEL, 0);
file_list_push(menu->selection_buf, "Logging Verbosity", MENU_SETTINGS_LOGGING_VERBOSITY, 0);
file_list_push(menu->selection_buf, "Performance Counters", MENU_SETTINGS_PERFORMANCE_COUNTERS_ENABLE, 0);
file_list_push(menu->selection_buf, "Content History Size", MENU_CONTENT_HISTORY_SIZE, 0);
current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "game_history_size");
if (current_setting)
{
*current_setting->value.unsigned_integer = g_settings.game_history_size;
file_list_push(menu->selection_buf, current_setting->short_description, MENU_CONTENT_HISTORY_SIZE, 0);
}
file_list_push(menu->selection_buf, "Configuration Save On Exit", MENU_SETTINGS_CONFIG_SAVE_ON_EXIT, 0);
file_list_push(menu->selection_buf, "Configuration Per-Core", MENU_SETTINGS_PER_CORE_CONFIG, 0);
#ifdef HAVE_SCREENSHOTS
@ -149,7 +154,10 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
file_list_push(menu->selection_buf, "Load Dummy On Core Shutdown", MENU_SETTINGS_LOAD_DUMMY_ON_CORE_SHUTDOWN, 0);
current_setting = setting_data_find_setting(setting_data, "fps_show");
if (current_setting)
{
*current_setting->value.boolean = g_settings.fps_show;
file_list_push(menu->selection_buf, current_setting->short_description, MENU_SETTINGS_DEBUG_TEXT, 0);
}
file_list_push(menu->selection_buf, "Maximum Run Speed", MENU_SETTINGS_FASTFORWARD_RATIO, 0);
file_list_push(menu->selection_buf, "Slow-Motion Ratio", MENU_SETTINGS_SLOWMOTION_RATIO, 0);
file_list_push(menu->selection_buf, "Rewind", MENU_SETTINGS_REWIND_ENABLE, 0);
@ -3369,11 +3377,11 @@ static int menu_common_setting_set_perf(unsigned setting, unsigned action,
static int menu_common_setting_set(unsigned setting, unsigned action)
{
const rarch_setting_t *setting_data, *current_setting;
rarch_setting_t *setting_data, *current_setting;
struct retro_perf_counter **counters;
unsigned port = driver.menu->current_pad;
setting_data = (const rarch_setting_t *)setting_data_get_list();
setting_data = (rarch_setting_t *)setting_data_get_list();
if (setting >= MENU_SETTINGS_PERF_COUNTERS_BEGIN && setting <= MENU_SETTINGS_PERF_COUNTERS_END)
{
@ -3716,7 +3724,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
}
break;
case MENU_SETTINGS_DEBUG_TEXT:
current_setting = setting_data_find_setting(setting_data, "fps_show");
current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "fps_show");
if (current_setting)
{
@ -3783,15 +3791,23 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
menu_save_new_config();
break;
case MENU_CONTENT_HISTORY_SIZE:
if (action == MENU_ACTION_RIGHT)
g_settings.game_history_size++;
else if (action == MENU_ACTION_LEFT)
current_setting = setting_data_find_setting(setting_data, "game_history_size");
if (current_setting)
{
if (g_settings.game_history_size > 0)
g_settings.game_history_size--;
if (action == MENU_ACTION_RIGHT)
*current_setting->value.unsigned_integer = *current_setting->value.unsigned_integer + 1;
else if (action == MENU_ACTION_LEFT)
{
if (*current_setting->value.unsigned_integer > 0)
*current_setting->value.unsigned_integer = *current_setting->value.unsigned_integer - 1;
}
else if (action == MENU_ACTION_START)
*current_setting->value.unsigned_integer = game_history_size;
if (current_setting->change_handler)
current_setting->change_handler(current_setting);
}
else if (action == MENU_ACTION_START)
g_settings.game_history_size = game_history_size;
break;
#ifdef HAVE_OVERLAY
case MENU_SETTINGS_OVERLAY_ENABLE:

View File

@ -274,9 +274,9 @@ bool setting_data_save_config(const rarch_setting_t* settings, config_file_t* co
return true;
}
const rarch_setting_t* setting_data_find_setting(const rarch_setting_t* settings, const char* name)
rarch_setting_t* setting_data_find_setting(rarch_setting_t* settings, const char* name)
{
const rarch_setting_t *setting;
rarch_setting_t *setting;
if (!name)
return NULL;
@ -740,7 +740,7 @@ WITH_FLAGS(SD_FLAG_HAS_RANGE)
#define WITH_VALUES(VALUES) (list[index -1]).values = VALUES;
const rarch_setting_t* setting_data_get_list(void)
rarch_setting_t* setting_data_get_list(void)
{
int i, player, index;
static rarch_setting_t list[SETTINGS_DATA_LIST_SIZE];

View File

@ -102,7 +102,7 @@ bool setting_data_load_config(const rarch_setting_t* settings, config_file_t* co
bool setting_data_save_config_path(const rarch_setting_t* settings, const char* path);
bool setting_data_save_config(const rarch_setting_t* settings, config_file_t* config);
const rarch_setting_t* setting_data_find_setting(const rarch_setting_t* settings, const char* name);
rarch_setting_t* setting_data_find_setting(rarch_setting_t* settings, const char* name);
void setting_data_set_with_string_representation(const rarch_setting_t* setting, const char* value);
const char* setting_data_get_string_representation(const rarch_setting_t* setting, char* buffer, size_t length);
@ -119,7 +119,7 @@ rarch_setting_t setting_data_bind_setting(const char* name, const char* descript
// These functions operate only on RetroArch's main settings list
void setting_data_load_current(void);
const rarch_setting_t* setting_data_get_list(void);
rarch_setting_t* setting_data_get_list(void);
#ifdef APPLE
#include "input/apple_keycode.h"