Menu) Implement more settings

This commit is contained in:
twinaphex 2014-07-17 01:12:01 +02:00
parent 2ef607df92
commit eba59280db
2 changed files with 68 additions and 29 deletions

View File

@ -229,10 +229,16 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
#if defined(HAVE_THREADS) && !defined(GEKKO)
file_list_push(menu->selection_buf, "Threaded Video", MENU_SETTINGS_VIDEO_THREADED, 0);
#endif
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
file_list_push(menu->selection_buf, "Windowed Scale (X)", MENU_SETTINGS_VIDEO_WINDOW_SCALE_X, 0);
file_list_push(menu->selection_buf, "Windowed Scale (Y)", MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y, 0);
#endif
if ((current_setting = setting_data_find_setting(setting_data, "video_xscale")))
{
*current_setting->value.fraction = g_settings.video.xscale;
file_list_push(menu->selection_buf, current_setting->short_description, MENU_SETTINGS_VIDEO_WINDOW_SCALE_X, 0);
}
if ((current_setting = setting_data_find_setting(setting_data, "video_yscale")))
{
*current_setting->value.fraction = g_settings.video.yscale;
file_list_push(menu->selection_buf, current_setting->short_description, MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y, 0);
}
file_list_push(menu->selection_buf, "Crop Overscan (reload)", MENU_SETTINGS_VIDEO_CROP_OVERSCAN, 0);
file_list_push(menu->selection_buf, "Monitor Index", MENU_SETTINGS_VIDEO_MONITOR_INDEX, 0);
file_list_push(menu->selection_buf, "Estimated Monitor FPS", MENU_SETTINGS_VIDEO_REFRESH_RATE_AUTO, 0);
@ -4630,38 +4636,69 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
break;
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_X:
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y:
{
float *scale = setting == MENU_SETTINGS_VIDEO_WINDOW_SCALE_X ? &g_settings.video.xscale : &g_settings.video.yscale;
float old_scale = *scale;
switch (action)
if ((current_setting = setting_data_find_setting(setting_data, "video_xscale")))
{
case MENU_ACTION_START:
*scale = 3.0f;
break;
float *scale = (float*)&g_settings.video.xscale;
float old_scale = *scale;
case MENU_ACTION_LEFT:
*scale -= 1.0f;
break;
switch (action)
{
case MENU_ACTION_START:
*scale = 3.0f;
break;
case MENU_ACTION_RIGHT:
*scale += 1.0f;
break;
case MENU_ACTION_LEFT:
*scale -= 1.0f;
break;
default:
break;
case MENU_ACTION_RIGHT:
*scale += 1.0f;
break;
default:
break;
}
*scale = roundf(*scale);
*scale = max(*scale, 1.0f);
*current_setting->value.fraction = *scale;
if (old_scale != *scale && current_setting->change_handler)
current_setting->change_handler(current_setting);
}
*scale = roundf(*scale);
*scale = max(*scale, 1.0f);
if (old_scale != *scale && !g_settings.video.fullscreen)
rarch_reinit_drivers();
break;
}
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y:
if ((current_setting = setting_data_find_setting(setting_data, "video_yscale")))
{
float *scale = (float*)&g_settings.video.yscale;
float old_scale = *scale;
switch (action)
{
case MENU_ACTION_START:
*scale = 3.0f;
break;
case MENU_ACTION_LEFT:
*scale -= 1.0f;
break;
case MENU_ACTION_RIGHT:
*scale += 1.0f;
break;
default:
break;
}
*scale = roundf(*scale);
*scale = max(*scale, 1.0f);
*current_setting->value.fraction = *scale;
if (old_scale != *scale && current_setting->change_handler)
current_setting->change_handler(current_setting);
}
break;
#ifdef HAVE_THREADS
case MENU_SETTINGS_VIDEO_THREADED:
{

View File

@ -847,8 +847,10 @@ rarch_setting_t* setting_data_get_list(void)
END_SUB_GROUP()
START_SUB_GROUP("Scaling")
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
CONFIG_FLOAT(g_settings.video.xscale, "video_xscale", "Windowed Scale (X)", xscale, GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_FLOAT(g_settings.video.yscale, "video_yscale", "Windowed Scale (Y)", yscale, GROUP_NAME, SUBGROUP_NAME, general_change_handler)
#endif
CONFIG_BOOL(g_settings.video.scale_integer, "video_scale_integer", "Integer Scale", scale_integer, GROUP_NAME, SUBGROUP_NAME, general_change_handler)
CONFIG_INT(g_extern.console.screen.viewports.custom_vp.x, "custom_viewport_x", "Custom Viewport X", 0, GROUP_NAME, SUBGROUP_NAME, NULL)