Start adding core options to RGUI.

Broken atm.
This commit is contained in:
Themaister 2013-04-04 21:47:37 +02:00
parent 2b1082df63
commit 435eec44f0
2 changed files with 165 additions and 137 deletions

View File

@ -365,8 +365,9 @@ static void render_text(rgui_handle_t *rgui)
if (menu_type == RGUI_SETTINGS_CORE)
strlcpy(title, "CORE SELECTION", sizeof(title));
else
if ((menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4) ||
else if (menu_type == RGUI_SETTINGS_CORE_OPTIONS)
strlcpy(title, "CORE OPTIONS", sizeof(title));
else if ((menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4) ||
(menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT || menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2) ||
menu_type == RGUI_SETTINGS)
snprintf(title, sizeof(title), "SETTINGS: %s", dir);
@ -392,6 +393,13 @@ static void render_text(rgui_handle_t *rgui)
char type_str[256];
int w = (menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4) ? 26 : 19;
unsigned port = menu_type - RGUI_SETTINGS_CONTROLLER_1;
if (type >= RGUI_SETTINGS_CORE_OPTION_START)
{
strlcpy(type_str, core_option_get_val(g_extern.system.core_options, type - RGUI_SETTINGS_CORE_OPTION_START), sizeof(type_str));
}
else
{
switch (type)
{
case RGUI_FILE_PLAIN:
@ -428,11 +436,11 @@ static void render_text(rgui_handle_t *rgui)
case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
snprintf(type_str, sizeof(type_str), (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE)) ? "ON" : "OFF");
break;
#ifdef GEKKO
#ifdef GEKKO
case RGUI_SETTINGS_VIDEO_RESOLUTION:
strlcpy(type_str, gx_get_video_mode(), sizeof(type_str));
break;
#endif
#endif
case RGUI_SETTINGS_VIDEO_GAMMA:
snprintf(type_str, sizeof(type_str), "%d", g_extern.console.screen.gamma_correction);
break;
@ -471,6 +479,7 @@ static void render_text(rgui_handle_t *rgui)
snprintf(type_str, sizeof(type_str), (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) ? "ON" : "OFF");
break;
case RGUI_SETTINGS_OPEN_FILEBROWSER:
case RGUI_SETTINGS_CORE_OPTIONS:
case RGUI_SETTINGS_CUSTOM_VIEWPORT:
case RGUI_SETTINGS_CORE:
case RGUI_SETTINGS_CONTROLLER_1:
@ -529,6 +538,7 @@ static void render_text(rgui_handle_t *rgui)
w = 0;
break;
}
}
const char *entry_title;
char tmp[256];
@ -988,6 +998,7 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
#ifdef HAVE_DYNAMIC
rgui_list_push(rgui->selection_buf, "Core", RGUI_SETTINGS_CORE, 0);
#endif
rgui_list_push(rgui->selection_buf, "Core Options", RGUI_SETTINGS_CORE_OPTIONS, 0);
rgui_list_push(rgui->selection_buf, "Rewind", RGUI_SETTINGS_REWIND_ENABLE, 0);
rgui_list_push(rgui->selection_buf, "Rewind granularity", RGUI_SETTINGS_REWIND_GRANULARITY, 0);
if (g_extern.main_is_init)
@ -1034,6 +1045,18 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
rgui_list_push(rgui->selection_buf, "Quit RetroArch", RGUI_SETTINGS_QUIT_RARCH, 0);
}
static void rgui_settings_core_options_populate_entries(rgui_handle_t *rgui)
{
rgui_list_clear(rgui->selection_buf);
if (!g_extern.system.core_options)
return;
size_t opts = core_option_size(g_extern.system.core_options);
for (size_t i = 0; i < opts; i++)
rgui_list_push(rgui->selection_buf, core_option_get_desc(g_extern.system.core_options, i), RGUI_SETTINGS_CORE_OPTION_START + i, 0);
}
static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
{
rgui_list_clear(rgui->selection_buf);
@ -1237,7 +1260,7 @@ static int rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
case RGUI_ACTION_OK:
case RGUI_ACTION_START:
if (((type >= RGUI_SETTINGS_CONTROLLER_1 && type <= RGUI_SETTINGS_CONTROLLER_4) ||
type == RGUI_SETTINGS_CORE) && action == RGUI_ACTION_OK)
type == RGUI_SETTINGS_CORE || type == RGUI_SETTINGS_CORE_OPTIONS) && action == RGUI_ACTION_OK)
{
rgui_list_push(rgui->menu_stack, label, type, rgui->selection_ptr);
rgui->selection_ptr = 0;
@ -1286,6 +1309,8 @@ static int rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui->need_refresh = false;
if ((menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4))
rgui_settings_controller_populate_entries(rgui);
else if (menu_type == RGUI_SETTINGS_CORE_OPTIONS)
rgui_settings_core_options_populate_entries(rgui);
else
rgui_settings_populate_entries(rgui);
}
@ -1396,7 +1421,7 @@ int rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui_list_get_last(rgui->menu_stack, &dir, &menu_type, &directory_ptr);
int ret = 0;
if (menu_type == RGUI_SETTINGS || (menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4))
if (menu_type == RGUI_SETTINGS || menu_type == RGUI_SETTINGS_CORE_OPTIONS || (menu_type >= RGUI_SETTINGS_CONTROLLER_1 && menu_type <= RGUI_SETTINGS_CONTROLLER_4))
return rgui_settings_iterate(rgui, action);
else if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT || menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
return rgui_viewport_iterate(rgui, action);

View File

@ -36,6 +36,7 @@ typedef enum
// settings options are done here too
RGUI_SETTINGS_OPEN_FILEBROWSER,
RGUI_SETTINGS_CORE_OPTIONS,
RGUI_SETTINGS_REWIND_ENABLE,
RGUI_SETTINGS_REWIND_GRANULARITY,
RGUI_SETTINGS_SAVESTATE_SAVE,
@ -89,6 +90,8 @@ typedef enum
RGUI_SETTINGS_BIND_R2,
RGUI_SETTINGS_BIND_L3,
RGUI_SETTINGS_BIND_R3,
RGUI_SETTINGS_CORE_OPTION_START = 0x10000
} rgui_file_type_t;
typedef enum