Added Lakka Switch menu entries

This commit is contained in:
natinusala 2018-10-06 14:52:44 +02:00
parent 75a1ea749b
commit 8250007b8e
31 changed files with 541 additions and 1 deletions

View File

@ -721,6 +721,10 @@ ifeq ($(HAVE_LAKKA), 1)
DEFINES += -DHAVE_LAKKA
endif
ifeq ($(HAVE_LAKKA_SWITCH), 1)
DEFINES += -DHAVE_LAKKA_SWITCH
endif
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/menu_driver.o \
menu/menu_content.o \

View File

@ -288,7 +288,11 @@ static bool menu_show_configurations = true;
static bool menu_show_help = true;
static bool menu_show_quit_retroarch = true;
static bool menu_show_reboot = true;
#ifdef HAVE_LAKKA_SWITCH
static bool menu_show_shutdown = false;
#else
static bool menu_show_shutdown = true;
#endif
#if defined(HAVE_LAKKA) || defined(VITA) || defined(_3DS)
static bool menu_show_core_updater = false;
#else

View File

@ -1308,8 +1308,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Start Content")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot into RCM")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Recording Config")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1209,8 +1209,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"启动游戏内容")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB 评分")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"重启 (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"重启")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"录像配置目录")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1209,8 +1209,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"啟動遊戲內容")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB 評分")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"重啟 (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"重啟")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"錄影設定目錄")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1232,8 +1232,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Starte Inhalt")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB-Bewertung")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Neustart (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Neustart")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Aufnahme-Konfigurationen")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1113,8 +1113,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Start Content")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot into RCM")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Recording Config")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -2133,10 +2133,17 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating"
)
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reiniciar (RCM)"
)
#else
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reiniciar"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Carpeta de configuración de grabación"

View File

@ -1220,8 +1220,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Démarrer le contenu")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Classification TGDB")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Redémarrer en RCM")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Redémarrer")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Configurations d'enregistrement vidéo")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1234,8 +1234,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Avvia il contenuto")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Valutazione TGDB ")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Riavvia (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Riavvia")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Configurazione per la registrazione")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1374,8 +1374,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"コンテンツをスタート")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB評価")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"再起動 (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"再起動")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"録画設定")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1206,8 +1206,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"컨텐츠 시작")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB 등급")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"재시작 (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"재시작")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"녹화 설정")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1,3 +1,11 @@
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
"switch_gpu_profile")
MSG_HASH(MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
"switch_backlight_control")
MSG_HASH(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE,
"switch_cpu_profile")
#endif
MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_CHEEVOS_USERNAME,
"accounts_cheevos_username")
MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_LIST,

View File

@ -1111,8 +1111,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Content Opstarten")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Herstart (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Herstart")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Opname Config Map")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1314,8 +1314,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Rozpocznij zawartość")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Ocena TGDB")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Restart (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Restart")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Konfig. Nagrywania")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -2133,10 +2133,17 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Classificação TGDB"
)
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reiniciar (RCM)"
)
#else
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reiniciar"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Configuração de Gravação"

View File

@ -1200,8 +1200,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Iniciar conteúdo")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Classificação TGDB")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reinicializar (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Reinicializar")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Pasta de armazenamento das configuração de gravação")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1229,8 +1229,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Запустить игру")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"Рейтинг TGDB")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Перезагрузка (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Перезагрузка")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Конфигурация записи")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

View File

@ -1,3 +1,29 @@
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU Overclock"
)
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_SWITCH_CPU_PROFILE,
"CPU Overclock"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE,
"Overclock the Switch CPU"
)
#endif
MSG_HASH(
MSG_COMPILER,
"Compiler"
@ -2133,10 +2159,17 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating"
)
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot into RCM"
)
#else
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT,
"Reboot"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Recording Config"

View File

@ -1222,8 +1222,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT,
"Start Content")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING,
"TGDB Rating")
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Khởi động lại (RCM)")
#else
MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT,
"Khởi động lại")
#endif
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY,
"Recording Config")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY,

63
lakka.h
View File

@ -24,4 +24,67 @@
#define LAKKA_UPDATE_DIR "/storage/.update/"
#define LAKKA_CONNMAN_DIR "/storage/.cache/connman/"
#ifdef HAVE_LAKKA_SWITCH
static char* SWITCH_GPU_PROFILES[] = {
"docked-overclock-3",
"docked-overclock-2",
"docked-overclock-1",
"docked",
"non-docked-overclock-5",
"non-docked-overclock-4",
"non-docked-overclock-3",
"non-docked-overclock-2",
"non-docked-overclock-1",
"non-docked",
"non-docked-underclock-1",
"non-docked-underclock-2",
"non-docked-underclock-3",
};
static char* SWITCH_GPU_SPEEDS[] = {
"998 Mhz",
"921 Mhz",
"844 Mhz",
"768 Mhz",
"691 Mhz",
"614 Mhz",
"537 Mhz",
"460 Mhz",
"384 Mhz",
"307 Mhz",
"230 Mhz",
"153 Mhz",
"76 Mhz"
};
static int SWITCH_BRIGHTNESS[] = {
10,
20,
30,
40,
50,
60,
70,
80,
90,
100
};
static char* SWITCH_CPU_PROFILES[] = {
"overclock-4",
"overclock-3",
"overclock-2",
"overclock-1",
"default",
};
static char* SWITCH_CPU_SPEEDS[] = {
"1912 MHz",
"1734 MHz",
"1530 MHz",
"1224 MHz",
"1020 MHz"
};
#endif
#endif

View File

@ -187,6 +187,12 @@ generic_deferred_push(deferred_push_core_content_dirs_subdir_list, DISPLAYLIST_
generic_deferred_push(deferred_push_lakka_list, DISPLAYLIST_LAKKA)
#endif
#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)
generic_deferred_push(deferred_push_switch_cpu_profile, DISPLAYLIST_SWITCH_CPU_PROFILE)
#endif
static int deferred_push_cursor_manager_list_deferred(
menu_displaylist_info_t *info)
{
@ -875,6 +881,23 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_information);
}
#ifdef HAVE_LAKKA_SWITCH
else if (strstr(label,
msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_GPU_PROFILE)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_gpu_profile);
}
else if (strstr(label,
msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_backlight_control);
}
else if (strstr(label,
msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_cpu_profile);
}
#endif
else if (strstr(label,
msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION)))
{

View File

@ -2503,6 +2503,64 @@ static int action_ok_deferred_list_stub(const char *path,
return 0;
}
#ifdef HAVE_LAKKA_SWITCH
static int action_ok_set_switch_cpu_profile(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char* profile_name = SWITCH_CPU_PROFILES[entry_idx];
char command[PATH_MAX_LENGTH] = {0};
snprintf(command, sizeof(command), "cpu-profile set %s", profile_name);
system(command);
snprintf(command, sizeof(command), "Current profile set to %s", profile_name);
runloop_msg_queue_push(command, 1, 90, true);
return menu_cbs_exit();
}
static int action_ok_set_switch_gpu_profile(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char* profile_name = SWITCH_GPU_PROFILES[entry_idx];
char command[PATH_MAX_LENGTH] = {0};
snprintf(command, sizeof(command), "gpu-profile set %s", profile_name);
system(command);
snprintf(command, sizeof(command), "Current profile set to %s", profile_name);
runloop_msg_queue_push(command, 1, 90, true);
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)
{
int brightness = SWITCH_BRIGHTNESS[entry_idx];
char command[PATH_MAX_LENGTH] = {0};
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);
return 0;
}
#endif
static int action_ok_load_core_deferred(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -4961,6 +5019,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_HELP_LIST:
case MENU_ENUM_LABEL_INFORMATION_LIST:
case MENU_ENUM_LABEL_CONTENT_SETTINGS:
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL:
case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE:
#endif
BIND_ACTION_OK(cbs, action_ok_push_default);
break;
case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL:
@ -5384,6 +5447,17 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
BIND_ACTION_OK(cbs, action_ok_playlist_entry);
}
break;
#ifdef HAVE_LAKKA_SWITCH
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;
case MENU_SET_SWITCH_CPU_PROFILE:
BIND_ACTION_OK(cbs, action_ok_set_switch_cpu_profile);
break;
#endif
case FILE_TYPE_RPL_ENTRY:
BIND_ACTION_OK(cbs, action_ok_rpl_entry);
break;

View File

@ -478,6 +478,12 @@ default_sublabel_macro(action_bind_sublabel_show_wimp,
#endif
default_sublabel_macro(action_bind_sublabel_discord_allow, MENU_ENUM_SUBLABEL_DISCORD_ALLOW)
#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_cpu_profile, MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE)
default_sublabel_macro(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL)
#endif
static int action_bind_sublabel_cheevos_entry(
file_list_t *list,
unsigned type, unsigned i,
@ -1993,6 +1999,17 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SHOW_WIMP:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_show_wimp);
break;
#endif
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_cpu_profile);
break;
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_CHEAT_APPLY_AFTER_LOAD:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheat_apply_after_load);

View File

@ -210,6 +210,12 @@ default_title_copy_macro(action_get_title_cheevos_list, MENU_ENUM_LABE
default_title_copy_macro(action_get_title_video_shader_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS)
default_title_copy_macro(action_get_title_video_shader_preset_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS)
#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_cpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE)
default_title_macro(action_get_title_switch_backlight_control, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL)
#endif
static int action_get_title_generic(char *s, size_t len, const char *path,
const char *text)
{
@ -873,6 +879,17 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH:
BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory);
break;
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile);
break;
case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile);
break;
case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control);
break;
#endif
default:
return -1;
}
@ -1159,6 +1176,17 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
case MENU_LABEL_LIBRETRO_INFO_PATH:
BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory);
break;
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile);
break;
case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile);
break;
case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL:
BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control);
break;
#endif
default:
return -1;
}

View File

@ -2391,6 +2391,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_SHOW_WIMP:
case MENU_ENUM_LABEL_USER_INTERFACE_SETTINGS:
return xmb->textures.list[XMB_TEXTURE_UI];
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE:
#endif
case MENU_ENUM_LABEL_POWER_MANAGEMENT_SETTINGS:
return xmb->textures.list[XMB_TEXTURE_POWER];
case MENU_ENUM_LABEL_RETRO_ACHIEVEMENTS_SETTINGS:
@ -2520,6 +2524,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
return xmb->textures.list[XMB_TEXTURE_SETTING];
case MENU_SETTING_GROUP:
#ifdef HAVE_LAKKA_SWITCH
case MENU_SET_SWITCH_BRIGHTNESS:
#endif
return xmb->textures.list[XMB_TEXTURE_SETTING];
case MENU_INFO_MESSAGE:
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
@ -5327,6 +5334,17 @@ static int xmb_list_push(void *data, void *userdata,
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
#ifdef HAVE_LAKKA_SWITCH
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
#endif
#ifndef HAVE_DYNAMIC
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
@ -5343,6 +5361,7 @@ static int xmb_list_push(void *data, void *userdata,
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
}
#if !defined(IOS)
if (settings->bools.menu_show_quit_retroarch)
{

View File

@ -47,6 +47,10 @@
#include "../network/netplay/netplay_discovery.h"
#endif
#ifdef HAVE_LAKKA_SWITCH
#include "../../lakka.h"
#endif
#if defined(__linux__) || (defined(BSD) && !defined(__MACH__))
#include "../frontend/drivers/platform_unix.h"
#endif
@ -4274,6 +4278,124 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
switch (type)
{
#ifdef HAVE_LAKKA_SWITCH
case DISPLAYLIST_SWITCH_CPU_PROFILE:
{
runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true);
char current_profile[PATH_MAX_LENGTH];
FILE* profile = popen("cpu-profile get", "r");
fgets(current_profile, PATH_MAX_LENGTH, profile);
pclose(profile);
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
char text[PATH_MAX_LENGTH];
snprintf(text, sizeof(text), "Current profile : %s", current_profile);
menu_entries_append_enum(info->list,
text,
"",
0,
MENU_INFO_MESSAGE, 0, 0);
const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]);
for (int i = 0; i < profiles_count; i++)
{
char* profile = SWITCH_CPU_PROFILES[i];
char* speed = SWITCH_CPU_SPEEDS[i];
char title[PATH_MAX_LENGTH] = {0};
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
menu_entries_append_enum(info->list,
title,
"",
0, MENU_SET_SWITCH_CPU_PROFILE, 0, i);
}
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
}
case DISPLAYLIST_SWITCH_GPU_PROFILE:
{
runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true);
char current_profile[PATH_MAX_LENGTH];
FILE* profile = popen("gpu-profile get", "r");
fgets(current_profile, PATH_MAX_LENGTH, profile);
pclose(profile);
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
char text[PATH_MAX_LENGTH];
snprintf(text, sizeof(text), "Current profile : %s", current_profile);
menu_entries_append_enum(info->list,
text,
"",
0,
MENU_INFO_MESSAGE, 0, 0);
const size_t profiles_count = sizeof(SWITCH_GPU_PROFILES)/sizeof(SWITCH_GPU_PROFILES[1]);
for (int i = 0; i < profiles_count; i++)
{
char* profile = SWITCH_GPU_PROFILES[i];
char* speed = SWITCH_GPU_SPEEDS[i];
char title[PATH_MAX_LENGTH] = {0};
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
menu_entries_append_enum(info->list,
title,
"",
0, MENU_SET_SWITCH_GPU_PROFILE, 0, i);
}
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
}
case DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL:
{
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
const size_t brightness_count = sizeof(SWITCH_BRIGHTNESS)/sizeof(SWITCH_BRIGHTNESS[1]);
for (int i = 0; i < brightness_count; i++)
{
char title[PATH_MAX_LENGTH] = {0};
snprintf(title, sizeof(title), "Set to %d%%", SWITCH_BRIGHTNESS[i]);
menu_entries_append_enum(info->list,
title,
"",
0, MENU_SET_SWITCH_BRIGHTNESS, 0, i);
}
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
}
#endif
case DISPLAYLIST_MUSIC_LIST:
{
char combined_path[PATH_MAX_LENGTH];
@ -7245,6 +7367,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_QUIT_RETROARCH,
PARSE_ACTION, false);
#ifdef HAVE_LAKKA_SWITCH
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
PARSE_ACTION, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
PARSE_ACTION, false);
#endif
if (settings->bools.menu_show_reboot)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_REBOOT,

View File

@ -179,7 +179,13 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_CORE_CONTENT,
DISPLAYLIST_CORE_CONTENT_DIRS,
DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR,
DISPLAYLIST_PENDING_CLEAR
DISPLAYLIST_PENDING_CLEAR,
#ifdef HAVE_LAKKA_SWITCH
DISPLAYLIST_SWITCH_GPU_PROFILE,
DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL,
DISPLAYLIST_SWITCH_CPU_PROFILE,
#endif
};
typedef struct menu_displaylist_info

View File

@ -233,6 +233,13 @@ enum menu_settings_type
MENU_SETTINGS_SUBSYSTEM_ADD,
MENU_SETTINGS_SUBSYSTEM_LAST = MENU_SETTINGS_SUBSYSTEM_ADD + RARCH_MAX_SUBSYSTEMS,
MENU_SETTINGS_CHEAT_MATCH,
#ifdef HAVE_LAKKA_SWITCH
MENU_SET_SWITCH_GPU_PROFILE,
MENU_SET_SWITCH_BRIGHTNESS,
MENU_SET_SWITCH_CPU_PROFILE,
#endif
MENU_SETTINGS_LAST
};

View File

@ -3641,6 +3641,31 @@ static bool setting_append_list(
#endif
#if defined(HAVE_LAKKA)
#ifdef HAVE_LAKKA_SWITCH
CONFIG_ACTION(
list, list_info,
MENU_ENUM_LABEL_SWITCH_CPU_PROFILE,
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
&group_info,
&subgroup_info,
parent_group);
CONFIG_ACTION(
list, list_info,
MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
&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
CONFIG_ACTION(
list, list_info,
MENU_ENUM_LABEL_REBOOT,

View File

@ -2130,6 +2130,20 @@ enum msg_hash_enums
MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS,
MSG_CHEEVOS_HARDCORE_MODE_DISABLED,
#ifdef HAVE_LAKKA_SWITCH
MENU_ENUM_LABEL_SWITCH_GPU_PROFILE,
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL,
MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL,
MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL,
MENU_ENUM_LABEL_SWITCH_CPU_PROFILE,
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE,
#endif
MSG_LAST
};