mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
Merge pull request #11625 from davidgfnet/brightness
Streamlining brightness control in Retroarch (for Lakka)
This commit is contained in:
commit
68c6092e07
@ -134,6 +134,8 @@
|
||||
* thumbnails of different sizes */
|
||||
#define DEFAULT_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE true
|
||||
|
||||
#define DEFAULT_SCREEN_BRIGHTNESS 100
|
||||
|
||||
#define DEFAULT_CRT_SWITCH_RESOLUTION CRT_SWITCH_NONE
|
||||
|
||||
#define DEFAULT_CRT_SWITCH_RESOLUTION_SUPER 2560
|
||||
|
@ -1851,6 +1851,7 @@ static struct config_uint_setting *populate_settings_uint(
|
||||
#ifdef HAVE_NETWORKING
|
||||
SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false);
|
||||
#endif
|
||||
SETTING_UINT("screen_brightness", &settings->uints.screen_brightness, true, DEFAULT_SCREEN_BRIGHTNESS, false);
|
||||
SETTING_UINT("crt_switch_resolution", &settings->uints.crt_switch_resolution, true, DEFAULT_CRT_SWITCH_RESOLUTION, false);
|
||||
SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false);
|
||||
SETTING_UINT("input_bind_hold", &settings->uints.input_bind_hold, true, input_bind_hold, false);
|
||||
|
@ -177,6 +177,7 @@ typedef struct settings
|
||||
unsigned video_window_opacity;
|
||||
unsigned crt_switch_resolution;
|
||||
unsigned crt_switch_resolution_super;
|
||||
unsigned screen_brightness;
|
||||
unsigned video_monitor_index;
|
||||
unsigned video_fullscreen_x;
|
||||
unsigned video_fullscreen_y;
|
||||
|
@ -671,6 +671,7 @@ frontend_ctx_driver_t frontend_ctx_ctr =
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -202,6 +202,7 @@ frontend_ctx_driver_t frontend_ctx_dos = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -194,6 +194,7 @@ frontend_ctx_driver_t frontend_ctx_emscripten = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -564,6 +564,7 @@ frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -365,6 +365,7 @@ frontend_ctx_driver_t frontend_ctx_orbis = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -383,6 +383,7 @@ frontend_ctx_driver_t frontend_ctx_ps2 = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -707,6 +707,7 @@ frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -641,6 +641,7 @@ frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -201,6 +201,7 @@ frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -928,6 +928,7 @@ frontend_ctx_driver_t frontend_ctx_switch =
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -1325,6 +1325,23 @@ static void frontend_unix_get_lakka_version(char *s,
|
||||
|
||||
pclose(command_file);
|
||||
}
|
||||
|
||||
static void frontend_unix_set_screen_brightness(int value)
|
||||
{
|
||||
char svalue[16] = {0};
|
||||
#if defined(HAVE_LAKKA_SWITCH)
|
||||
/* Values from 0 to 100 */
|
||||
int brightness = value;
|
||||
#elif defined(HAVE_ODROIDGO2)
|
||||
/* GOA screen PWM value does not linearly relate to perceived brightness */
|
||||
int brightness = (pow(1.0369f, value) - 1) * 7;
|
||||
#endif
|
||||
|
||||
snprintf(svalue, sizeof(svalue), "%d\n", brightness);
|
||||
filestream_write_file("/sys/class/backlight/backlight/brightness",
|
||||
svalue, strlen(svalue));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void frontend_unix_get_env(int *argc,
|
||||
@ -1905,6 +1922,7 @@ static void android_app_destroy(struct android_app *android_app)
|
||||
|
||||
static void frontend_unix_deinit(void *data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef ANDROID
|
||||
struct android_app *android_app = (struct android_app*)data;
|
||||
|
||||
@ -1913,6 +1931,12 @@ static void frontend_unix_deinit(void *data)
|
||||
|
||||
android_app_destroy(android_app);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LAKKA
|
||||
/* Reset brightness to maximum */
|
||||
if (settings->uints.screen_brightness != DEFAULT_SCREEN_BRIGHTNESS)
|
||||
frontend_unix_set_screen_brightness(DEFAULT_SCREEN_BRIGHTNESS);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_unix_init(void *data)
|
||||
@ -2734,6 +2758,11 @@ frontend_ctx_driver_t frontend_ctx_unix = {
|
||||
frontend_unix_get_lakka_version, /* get_lakka_version */
|
||||
#else
|
||||
NULL, /* get_lakka_version */
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || (defined(HAVE_LAKKA) && defined(HAVE_ODROIDGO2))
|
||||
frontend_unix_set_screen_brightness, /* set_screen_brightness */
|
||||
#else
|
||||
NULL, /* set_screen_brightness */
|
||||
#endif
|
||||
frontend_unix_watch_path_for_changes,
|
||||
frontend_unix_check_for_path_changes,
|
||||
|
@ -471,6 +471,7 @@ frontend_ctx_driver_t frontend_ctx_uwp = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -326,6 +326,7 @@ frontend_ctx_driver_t frontend_ctx_wiiu =
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -1146,6 +1146,7 @@ frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
frontend_win32_attach_console, /* attach_console */
|
||||
frontend_win32_detach_console, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -437,6 +437,7 @@ frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -93,6 +93,7 @@ frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -63,6 +63,7 @@ static frontend_ctx_driver_t frontend_ctx_null = {
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
NULL, /* get_lakka_version */
|
||||
NULL, /* set_screen_brightness */
|
||||
NULL, /* watch_path_for_changes */
|
||||
NULL, /* check_for_path_changes */
|
||||
NULL, /* set_sustained_performance_mode */
|
||||
|
@ -103,6 +103,8 @@ typedef struct frontend_ctx_driver
|
||||
void (*attach_console)(void);
|
||||
void (*detach_console)(void);
|
||||
void (*get_lakka_version)(char *, size_t);
|
||||
/* TODO/FIXME: Need to implement some sort of startup brightness setting. */
|
||||
void (*set_screen_brightness)(int);
|
||||
void (*watch_path_for_changes)(struct string_list *list, int flags, path_change_data_t **change_data);
|
||||
bool (*check_for_path_changes)(path_change_data_t *change_data);
|
||||
void (*set_sustained_performance_mode)(bool on);
|
||||
@ -210,6 +212,10 @@ void frontend_driver_attach_console(void);
|
||||
|
||||
void frontend_driver_detach_console(void);
|
||||
|
||||
void frontend_driver_set_screen_brightness(int value);
|
||||
|
||||
bool frontend_driver_can_set_screen_brightness();
|
||||
|
||||
bool frontend_driver_can_watch_for_changes(void);
|
||||
|
||||
void frontend_driver_watch_path_for_changes(struct string_list *list, int flags, path_change_data_t **change_data);
|
||||
|
@ -3,10 +3,6 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
|
||||
"switch_gpu_profile"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
|
||||
"switch_backlight_control"
|
||||
)
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
MSG_HASH(
|
||||
@ -2976,6 +2972,10 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_USE_THIS_DIRECTORY,
|
||||
"use_this_directory"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_BRIGHTNESS_CONTROL,
|
||||
"screen_brightness"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE,
|
||||
"video_allow_rotate"
|
||||
|
@ -11808,6 +11808,14 @@ MSG_HASH(
|
||||
MSG_READ_ONLY,
|
||||
"Read-Only"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_BRIGHTNESS_CONTROL,
|
||||
"Screen Brightness"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
|
||||
"Increase or decrease the screen brightness."
|
||||
)
|
||||
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
MSG_HASH(
|
||||
@ -11818,14 +11826,6 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
|
||||
"Overclock or underclock the Switch GPU."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL,
|
||||
"Screen brightness"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL,
|
||||
"Increase or decrease the Switch screen brightness."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_REBOOT_RCM,
|
||||
"Reboot into RCM"
|
||||
|
@ -252,7 +252,6 @@ GENERIC_DEFERRED_PUSH(deferred_push_switch_cpu_profile, DISPLAYLIST_
|
||||
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
GENERIC_DEFERRED_PUSH(deferred_push_switch_gpu_profile, DISPLAYLIST_SWITCH_GPU_PROFILE)
|
||||
GENERIC_DEFERRED_PUSH(deferred_push_switch_backlight_control, DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL)
|
||||
#endif
|
||||
|
||||
GENERIC_DEFERRED_PUSH(deferred_push_manual_content_scan_list, DISPLAYLIST_MANUAL_CONTENT_SCAN_LIST)
|
||||
@ -759,7 +758,6 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
{MENU_ENUM_LABEL_DEFERRED_LATENCY_SETTINGS_LIST, deferred_push_latency_settings_list},
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
{MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, deferred_push_switch_gpu_profile},
|
||||
{MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, deferred_push_switch_backlight_control},
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
{MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, deferred_push_switch_cpu_profile},
|
||||
|
@ -3430,27 +3430,6 @@ static int action_ok_set_switch_gpu_profile(const char *path,
|
||||
return menu_cbs_exit();
|
||||
}
|
||||
|
||||
static int action_ok_set_switch_backlight(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char command[PATH_MAX_LENGTH] = {0};
|
||||
int brightness = SWITCH_BRIGHTNESS[entry_idx];
|
||||
|
||||
snprintf(command, sizeof(command),
|
||||
"echo %d > /sys/class/backlight/backlight/brightness",
|
||||
brightness);
|
||||
|
||||
system(command);
|
||||
|
||||
snprintf(command, sizeof(command),
|
||||
"Brightness set to %d%%", brightness);
|
||||
|
||||
runloop_msg_queue_push(command, 1, 90, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int action_ok_load_core_deferred(const char *path,
|
||||
@ -7265,7 +7244,6 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
#endif
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
{MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, action_ok_push_default},
|
||||
{MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, action_ok_push_default},
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
{MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, action_ok_push_default},
|
||||
@ -7715,9 +7693,6 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_SET_SWITCH_GPU_PROFILE:
|
||||
BIND_ACTION_OK(cbs, action_ok_set_switch_gpu_profile);
|
||||
break;
|
||||
case MENU_SET_SWITCH_BRIGHTNESS:
|
||||
BIND_ACTION_OK(cbs, action_ok_set_switch_backlight);
|
||||
break;
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
case MENU_SET_SWITCH_CPU_PROFILE:
|
||||
|
@ -854,9 +854,10 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_cpu_profile, MENU
|
||||
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_gpu_profile, MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL)
|
||||
#endif
|
||||
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_brightness_control, MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL)
|
||||
|
||||
#if defined(_3DS)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_lcd_bottom, MENU_ENUM_SUBLABEL_VIDEO_3DS_LCD_BOTTOM)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_display_mode, MENU_ENUM_SUBLABEL_VIDEO_3DS_DISPLAY_MODE)
|
||||
@ -3874,10 +3875,10 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_gpu_profile);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_backlight_control);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_BRIGHTNESS_CONTROL:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_brightness_control);
|
||||
break;
|
||||
#if defined(_3DS)
|
||||
case MENU_ENUM_LABEL_VIDEO_3DS_LCD_BOTTOM:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_3ds_lcd_bottom);
|
||||
|
@ -674,7 +674,6 @@ DEFAULT_TITLE_MACRO(action_get_title_switch_cpu_profile, MENU_ENUM_LABE
|
||||
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
DEFAULT_TITLE_MACRO(action_get_title_switch_gpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE)
|
||||
DEFAULT_TITLE_MACRO(action_get_title_switch_backlight_control, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL)
|
||||
#endif
|
||||
|
||||
DEFAULT_TITLE_SEARCH_FILTER_MACRO(action_get_title_deferred_history_list, MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY)
|
||||
@ -1121,8 +1120,6 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
{MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
|
||||
action_get_title_switch_gpu_profile},
|
||||
{MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
|
||||
action_get_title_switch_backlight_control},
|
||||
#endif
|
||||
{MENU_ENUM_LABEL_DEFERRED_MANUAL_CONTENT_SCAN_LIST,
|
||||
action_get_title_manual_content_scan_list},
|
||||
@ -1509,9 +1506,6 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control);
|
||||
break;
|
||||
#endif
|
||||
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_manual_content_scan_list);
|
||||
|
@ -1588,9 +1588,6 @@ static int ozone_list_push(void *data, void *userdata,
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE;
|
||||
menu_displaylist_setting(&entry);
|
||||
|
||||
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL;
|
||||
menu_displaylist_setting(&entry);
|
||||
#endif
|
||||
|
||||
if (settings->bools.menu_show_configurations && !settings->bools.kiosk_mode_enable)
|
||||
|
@ -424,10 +424,8 @@ uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_PAUSE];
|
||||
case MENU_SETTING_GROUP:
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING];
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
case MENU_SET_SWITCH_BRIGHTNESS:
|
||||
case MENU_SET_SCREEN_BRIGHTNESS:
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_BRIGHTNESS];
|
||||
#endif
|
||||
case MENU_INFO_MESSAGE:
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO];
|
||||
case MENU_BLUETOOTH:
|
||||
|
@ -2862,10 +2862,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
||||
return xmb->textures.list[XMB_TEXTURE_RELOAD];
|
||||
case MENU_SETTING_ACTION_PAUSE_ACHIEVEMENTS:
|
||||
return xmb->textures.list[XMB_TEXTURE_PAUSE];
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
case MENU_SET_SWITCH_BRIGHTNESS:
|
||||
case MENU_SET_SCREEN_BRIGHTNESS:
|
||||
return xmb->textures.list[XMB_TEXTURE_BRIGHTNESS];
|
||||
#endif
|
||||
case MENU_SETTING_GROUP:
|
||||
return xmb->textures.list[XMB_TEXTURE_SETTING];
|
||||
case MENU_INFO_MESSAGE:
|
||||
@ -6845,9 +6843,6 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE;
|
||||
menu_displaylist_setting(&entry);
|
||||
|
||||
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL;
|
||||
menu_displaylist_setting(&entry);
|
||||
#endif
|
||||
|
||||
if (menu_show_configurations && !kiosk_mode_enable)
|
||||
|
@ -5702,6 +5702,10 @@ unsigned menu_displaylist_build_list(
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_BRIGHTNESS_CONTROL,
|
||||
PARSE_ONLY_UINT, false) == 0)
|
||||
count++;
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_VIDEO_THREADED,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
@ -9713,29 +9717,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
info->need_refresh = true;
|
||||
info->need_clear = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL:
|
||||
{
|
||||
unsigned i;
|
||||
const size_t brightness_count = sizeof(SWITCH_BRIGHTNESS)/sizeof(SWITCH_BRIGHTNESS[1]);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
for (i = 0; i < brightness_count; i++)
|
||||
{
|
||||
char title[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
snprintf(title, sizeof(title), "Set to %d%%", SWITCH_BRIGHTNESS[i]);
|
||||
|
||||
if (menu_entries_append_enum(info->list, title, "", 0, MENU_SET_SWITCH_BRIGHTNESS, 0, i))
|
||||
count++;
|
||||
}
|
||||
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
info->need_clear = true;
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /* HAVE_LAKKA_SWITCH */
|
||||
@ -11686,11 +11667,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
PARSE_ACTION, false) == 0)
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
|
||||
MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
|
||||
PARSE_ACTION, false) == 0)
|
||||
count++;
|
||||
|
||||
if (settings->bools.menu_show_reboot)
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
|
||||
MENU_ENUM_LABEL_REBOOT,
|
||||
|
@ -234,7 +234,6 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR,
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
DISPLAYLIST_SWITCH_GPU_PROFILE,
|
||||
DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL,
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
DISPLAYLIST_SWITCH_CPU_PROFILE,
|
||||
|
@ -194,9 +194,10 @@ enum menu_settings_type
|
||||
MENU_SETTINGS_SUBSYSTEM_LAST = MENU_SETTINGS_SUBSYSTEM_ADD + RARCH_MAX_SUBSYSTEMS,
|
||||
MENU_SETTINGS_CHEAT_MATCH,
|
||||
|
||||
MENU_SET_SCREEN_BRIGHTNESS,
|
||||
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
MENU_SET_SWITCH_GPU_PROFILE,
|
||||
MENU_SET_SWITCH_BRIGHTNESS,
|
||||
#endif
|
||||
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
|
||||
MENU_SET_SWITCH_CPU_PROFILE,
|
||||
|
@ -2947,6 +2947,15 @@ static void setting_get_string_representation_state_slot(rarch_setting_t *settin
|
||||
strlcat(s, " (Auto)", len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_percentage(rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
{
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
snprintf(s, len, "%d%%", *setting->value.target.integer);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_float_video_msg_color(rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
{
|
||||
@ -7477,6 +7486,12 @@ static void general_write_handler(rarch_setting_t *setting)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_BRIGHTNESS_CONTROL:
|
||||
{
|
||||
frontend_driver_set_screen_brightness(
|
||||
*setting->value.target.unsigned_integer);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -8402,14 +8417,6 @@ static bool setting_append_list(
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
|
||||
MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
#endif
|
||||
#ifdef HAVE_LAKKA_SWITCH
|
||||
CONFIG_ACTION(
|
||||
@ -10911,6 +10918,26 @@ static bool setting_append_list(
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
|
||||
if (frontend_driver_can_set_screen_brightness())
|
||||
{
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.screen_brightness,
|
||||
MENU_ENUM_LABEL_BRIGHTNESS_CONTROL,
|
||||
MENU_ENUM_LABEL_VALUE_BRIGHTNESS_CONTROL,
|
||||
DEFAULT_SCREEN_BRIGHTNESS,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_percentage;
|
||||
menu_settings_list_current_add_range(list, list_info, 5, 100, 5, true, true);
|
||||
}
|
||||
|
||||
#if defined(HAVE_THREADS)
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
|
@ -965,6 +965,7 @@ enum msg_hash_enums
|
||||
#endif
|
||||
|
||||
/* Video */
|
||||
MENU_LABEL(BRIGHTNESS_CONTROL),
|
||||
MENU_LABEL(CRT_SWITCH_RESOLUTION),
|
||||
MENU_LABEL(CRT_SWITCH_RESOLUTION_SUPER),
|
||||
MENU_LABEL(CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID),
|
||||
@ -2950,7 +2951,6 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_TIMEDATE_HM_AMPM,
|
||||
|
||||
MENU_LABEL(SWITCH_GPU_PROFILE),
|
||||
MENU_LABEL(SWITCH_BACKLIGHT_CONTROL),
|
||||
MENU_LABEL(SWITCH_CPU_PROFILE),
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_HOLD_START,
|
||||
|
15
retroarch.c
15
retroarch.c
@ -38644,6 +38644,21 @@ void frontend_driver_attach_console(void)
|
||||
frontend->attach_console();
|
||||
}
|
||||
|
||||
void frontend_driver_set_screen_brightness(int value)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
|
||||
if (frontend && frontend->set_screen_brightness)
|
||||
frontend->set_screen_brightness(value);
|
||||
}
|
||||
|
||||
bool frontend_driver_can_set_screen_brightness()
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
|
||||
return (frontend && frontend->set_screen_brightness);
|
||||
}
|
||||
|
||||
void frontend_driver_detach_console(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
|
@ -48,18 +48,6 @@ static char *SWITCH_GPU_SPEEDS[] = {
|
||||
"153 Mhz",
|
||||
"76 Mhz"
|
||||
};
|
||||
|
||||
static int SWITCH_BRIGHTNESS[] = {
|
||||
10,
|
||||
20,
|
||||
30,
|
||||
40,
|
||||
50,
|
||||
60,
|
||||
70,
|
||||
80,
|
||||
90,
|
||||
100};
|
||||
#endif
|
||||
|
||||
static char *SWITCH_CPU_PROFILES[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user