Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ endif

ifeq ($(HAVE_LAKKA_SWITCH), 1)
DEFINES += -DHAVE_LAKKA_SWITCH
OBJ += misc/reboot2payload/reboot2payload.o
endif

ifeq ($(HAVE_MENU_COMMON), 1)
Expand Down
1 change: 1 addition & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
#define DEFAULT_SWITCH_OC false
#define DEFAULT_SWITCH_CEC true
#define DEFAULT_BLUETOOTH_ERTM false
#define DEFAULT_REBOOT_FORCE_SELF_ON_UPDATE true
#endif

#if (defined(_WIN32) && !defined(_XBOX)) || (defined(__linux) && !defined(ANDROID) && !defined(HAVE_LAKKA)) || (defined(__MACH__) && !TARGET_OS_IPHONE) || defined(__EMSCRIPTEN__)
Expand Down
7 changes: 7 additions & 0 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,9 @@ static struct config_array_setting *populate_settings_array(
SETTING_ARRAY("cpu_main_gov", settings->arrays.cpu_main_gov, false, NULL, true);
SETTING_ARRAY("cpu_menu_gov", settings->arrays.cpu_menu_gov, false, NULL, true);
#endif
#ifdef HAVE_LAKKA_SWITCH
SETTING_ARRAY("reboot_payload_name", settings->arrays.reboot_payload_name, false, NULL, true);
#endif

*size = count;

Expand Down Expand Up @@ -2258,6 +2261,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("switch_oc", &settings->bools.switch_oc, true, DEFAULT_SWITCH_OC, false);
SETTING_BOOL("switch_cec", &settings->bools.switch_cec, true, DEFAULT_SWITCH_CEC, false);
SETTING_BOOL("bluetooth_ertm_disable", &settings->bools.bluetooth_ertm_disable, true, DEFAULT_BLUETOOTH_ERTM, false);
SETTING_BOOL("reboot_force_self_on_update", &settings->bools.reboot_force_self_on_update, true, DEFAULT_REBOOT_FORCE_SELF_ON_UPDATE, false);
#endif
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, DEFAULT_RATE_CONTROL, false);
SETTING_BOOL("audio_enable_menu_ok", &settings->bools.audio_enable_menu_ok, true, DEFAULT_AUDIO_ENABLE_MENU_OK, false);
Expand Down Expand Up @@ -4398,6 +4402,9 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("cpu_min_freq", &settings->uints.cpu_min_freq, true, 1, false);
SETTING_UINT("cpu_max_freq", &settings->uints.cpu_max_freq, true, ~0U, false);
#endif
#ifdef HAVE_LAKKA_SWITCH
SETTING_UINT("reboot_payload_kind", &settings->uints.reboot_payload_kind, true, 0, false);
#endif



Expand Down
11 changes: 11 additions & 0 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ typedef struct settings
unsigned cpu_min_freq;
unsigned cpu_max_freq;
#endif
#ifdef HAVE_LAKKA_SWITCH
/* enum r2p_payload_kind; paired with reboot_payload_name */
unsigned reboot_payload_kind;
#endif

#ifdef HAVE_MIST
unsigned steam_rich_presence_format;
Expand Down Expand Up @@ -1128,6 +1132,10 @@ typedef struct settings
bool switch_oc;
bool switch_cec;
bool bluetooth_ertm_disable;
/* When an update is staged, reboot back into the running
* Lakka entry instead of the selected payload so the
* initramfs installs it. */
bool reboot_force_self_on_update;
#endif
#ifdef HAVE_LAKKA
bool ssh_enable;
Expand Down Expand Up @@ -1247,6 +1255,9 @@ typedef struct settings
char cpu_main_gov[32];
char cpu_menu_gov[32];
#endif
#ifdef HAVE_LAKKA_SWITCH
char reboot_payload_name[64]; /* R2P_NAME_MAXLEN */
#endif
#ifdef HAVE_MICROPHONE
char microphone_driver[32];
char microphone_resampler[32];
Expand Down
8 changes: 8 additions & 0 deletions intl/msg_hash_lbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,14 @@ MSG_HASH(
MENU_ENUM_LABEL_BLUETOOTH_ERTM_DISABLE,
MENU_ENUM_LABEL_BLUETOOTH_ERTM_DISABLE_STR
)
MSG_HASH(
MENU_ENUM_LABEL_REBOOT_PAYLOAD,
MENU_ENUM_LABEL_REBOOT_PAYLOAD_STR
)
MSG_HASH(
MENU_ENUM_LABEL_REBOOT_FORCE_SELF_ON_UPDATE,
MENU_ENUM_LABEL_REBOOT_FORCE_SELF_ON_UPDATE_STR
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_SYSTEM_BGM_ENABLE,
Expand Down
20 changes: 20 additions & 0 deletions intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -33160,6 +33160,10 @@ MSG_HASH(
MSG_VALUE_REBOOTING,
"Rebooting..."
)
MSG_HASH(
MSG_VALUE_INSTALL_UPDATE,
"Install Update"
)
MSG_HASH(
MSG_VALUE_SHUTTING_DOWN,
"Shutting down..."
Expand Down Expand Up @@ -35574,6 +35578,22 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BLUETOOTH_ERTM_DISABLE,
"Disable Bluetooth ERTM to fix pairing of some devices"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT_PAYLOAD,
"Reboot Payload"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_REBOOT_PAYLOAD,
"Choose which Hekate entry 'Reboot' in the Main Menu boots into. Use Left/Right to cycle through the entries in hekate_ipl.ini and bootloader/ini/. Defaults to the entry currently running."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_REBOOT_FORCE_SELF_ON_UPDATE,
"Force Reboot to Lakka if Update Exists"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_REBOOT_FORCE_SELF_ON_UPDATE,
"When a Lakka update is staged, reboot back into Lakka instead of the selected payload so the update is installed. Disable to always honour the payload selection."
)
#endif
MSG_HASH(
MSG_LOCALAP_SWITCHING_OFF,
Expand Down
17 changes: 17 additions & 0 deletions lakka.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#ifndef __RARCH_LAKKA_H
#define __RARCH_LAKKA_H

#include <boolean.h>
#include <retro_common_api.h>

#define LAKKA_SSH_PATH "/storage/.cache/services/sshd.conf"
#define LAKKA_SAMBA_PATH "/storage/.cache/services/samba.conf"
#define LAKKA_SAMBA_DISABLED_FILE_PATH "/storage/.cache/services/samba.disabled"
Expand All @@ -33,4 +36,18 @@
#define DEFAULT_TIMEZONE "UTC"
#define TIMEZONE_LENGTH 255

RETRO_BEGIN_DECLS

/* Looks in LAKKA_UPDATE_DIR for an update image the Lakka initramfs
* check_update step installs on the next boot (*.tar, *.img.gz, *.img)
* and keeps the answer for lakka_update_pending(). Reads a directory:
* called when the menu builds the main list and before a reboot, never
* per frame. */
void lakka_update_check(void);

/* Whether the last lakka_update_check() found an update staged. */
bool lakka_update_pending(void);

RETRO_END_DECLS

#endif
66 changes: 65 additions & 1 deletion menu/cbs/menu_cbs_get_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
#include "../../playlist.h"
#include "../../manual_content_scan.h"
#include "../misc/cpufreq/cpufreq.h"
#ifdef HAVE_LAKKA
#include "../../lakka.h"
#endif
#ifdef HAVE_LAKKA_SWITCH
#include "../../misc/reboot2payload/reboot2payload.h"
#endif
#include "../../audio/audio_driver.h"

#ifdef HAVE_NETWORKING
Expand Down Expand Up @@ -691,6 +697,54 @@ static size_t menu_action_cpu_governor_label(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
return strlcpy(s, d->scaling_governor, len);
}

/* Value column of the main menu "Reboot" entry: shows
* "Install Update" while an update image is staged, so the user
* knows the next reboot will install it. On Switch with pmc_r2p it
* otherwise shows the selected reboot payload (and an update only
* wins when reboot_force_self_on_update is set). Empty otherwise. */
static size_t menu_action_setting_disp_reboot(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*s = '\0';
*w = 19;
if (path)
strlcpy(s2, path, len2);
#ifdef HAVE_LAKKA_SWITCH
if (r2p_is_supported())
{
settings_t *settings = config_get_ptr();
if ( settings->bools.reboot_force_self_on_update
&& lakka_update_pending())
return strlcpy(s, msg_hash_to_str(MSG_VALUE_INSTALL_UPDATE), len);
return strlcpy(s, r2p_get_destination_name(), len);
}
#endif
if (lakka_update_pending())
return strlcpy(s, msg_hash_to_str(MSG_VALUE_INSTALL_UPDATE), len);
return 0;
}
#endif

#ifdef HAVE_LAKKA_SWITCH
static size_t menu_action_setting_disp_reboot_payload(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*w = 19;
if (path)
strlcpy(s2, path, len2);
return strlcpy(s, r2p_get_destination_name(), len);
}
#endif

static size_t menu_action_setting_disp_set_label_core_lock(
Expand Down Expand Up @@ -2206,6 +2260,12 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_cpu_gov_mode);
break;
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_REBOOT_PAYLOAD:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_reboot_payload);
break;
#endif
case MENU_ENUM_LABEL_CPU_POLICY_CORE_GOVERNOR:
case MENU_ENUM_LABEL_CPU_POLICY_MENU_GOVERNOR:
BIND_ACTION_GET_VALUE(cbs,
Expand Down Expand Up @@ -2475,12 +2535,16 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
#ifdef HAVE_NETWORKING
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_netplay_mitm_server);
#endif
return 0;
case MENU_ENUM_LABEL_REBOOT:
#ifdef HAVE_LAKKA
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_reboot);
#endif
return 0;
case MENU_ENUM_LABEL_RESTART_RETROARCH:
case MENU_ENUM_LABEL_QUIT_RETROARCH:
case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE:
case MENU_ENUM_LABEL_REBOOT:
case MENU_ENUM_LABEL_SHUTDOWN:
case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG:
case MENU_ENUM_LABEL_SAVE_NEW_CONFIG:
Expand Down
19 changes: 19 additions & 0 deletions menu/cbs/menu_cbs_left.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
#include "../../playlist.h"
#include "../../manual_content_scan.h"
#include "../misc/cpufreq/cpufreq.h"
#ifdef HAVE_LAKKA_SWITCH
#include "../../misc/reboot2payload/reboot2payload.h"
#endif

#ifndef BIND_ACTION_LEFT
#define BIND_ACTION_LEFT(cbs, name) (cbs)->action_left = (name)
Expand Down Expand Up @@ -952,6 +955,17 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label,
}
#endif

#ifdef HAVE_LAKKA_SWITCH
static int reboot_payload_left(unsigned type, const char *label,
bool wraparound)
{
struct menu_state *menu_st = menu_state_get_ptr();
r2p_cycle_selection(config_get_ptr(), false);
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
return 0;
}
#endif

static int core_setting_left(unsigned type, const char *label,
bool wraparound)
{
Expand Down Expand Up @@ -1323,6 +1337,11 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_LEFT(cbs, cpu_policy_freq_managed_gov);
break;
#endif
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_REBOOT_PAYLOAD:
BIND_ACTION_LEFT(cbs, reboot_payload_left);
break;
#endif
default:
return -1;
}
Expand Down
8 changes: 8 additions & 0 deletions menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -7087,6 +7087,13 @@ STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_menu_bottom_list, ACTION_OK_DL_MENU_BOTT
#endif
#ifdef HAVE_LAKKA_SWITCH
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_lakka_switch_options, ACTION_OK_DL_LAKKA_SWITCH_OPTIONS_LIST)

/* Left/Right cycles the payload selection; OK does nothing. */
static int action_ok_reboot_payload(const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
return 0;
}
#endif
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_rdb_entry, ACTION_OK_DL_RDB_ENTRY)
#ifdef HAVE_AUDIOMIXER
Expand Down Expand Up @@ -9929,6 +9936,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
#endif
#ifdef HAVE_LAKKA_SWITCH
{MENU_ENUM_LABEL_LAKKA_SWITCH_OPTIONS, action_ok_lakka_switch_options},
{MENU_ENUM_LABEL_REBOOT_PAYLOAD, action_ok_reboot_payload},
#endif
{MENU_ENUM_LABEL_SCREEN_RESOLUTION, action_ok_video_resolution},
{MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE, action_ok_playlist_default_core},
Expand Down
19 changes: 19 additions & 0 deletions menu/cbs/menu_cbs_right.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
#include "../../playlist.h"
#include "../../manual_content_scan.h"
#include "../misc/cpufreq/cpufreq.h"
#ifdef HAVE_LAKKA_SWITCH
#include "../../misc/reboot2payload/reboot2payload.h"
#endif

#ifndef BIND_ACTION_RIGHT
#define BIND_ACTION_RIGHT(cbs, name) (cbs)->action_right = (name)
Expand Down Expand Up @@ -1128,6 +1131,17 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label,
}
#endif

#ifdef HAVE_LAKKA_SWITCH
static int reboot_payload_right(unsigned type, const char *label,
bool wraparound)
{
struct menu_state *menu_st = menu_state_get_ptr();
r2p_cycle_selection(config_get_ptr(), true);
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
return 0;
}
#endif

static int core_setting_right(unsigned type, const char *label,
bool wraparound)
{
Expand Down Expand Up @@ -1472,6 +1486,11 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
BIND_ACTION_RIGHT(cbs, cpu_policy_freq_managed_gov);
break;
#endif
#ifdef HAVE_LAKKA_SWITCH
case MENU_ENUM_LABEL_REBOOT_PAYLOAD:
BIND_ACTION_RIGHT(cbs, reboot_payload_right);
break;
#endif
default:
return -1;
}
Expand Down
8 changes: 8 additions & 0 deletions menu/cbs/menu_cbs_sublabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_options, MENU_
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_oc_enable, MENU_ENUM_SUBLABEL_SWITCH_OC_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_switch_cec_enable, MENU_ENUM_SUBLABEL_SWITCH_CEC_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_bluetooth_ertm_disable, MENU_ENUM_SUBLABEL_BLUETOOTH_ERTM_DISABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_reboot_payload, MENU_ENUM_SUBLABEL_REBOOT_PAYLOAD)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_reboot_force_self_on_update, MENU_ENUM_SUBLABEL_REBOOT_FORCE_SELF_ON_UPDATE)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_user_remap_settings, MENU_ENUM_SUBLABEL_INPUT_USER_REMAPS)

Expand Down Expand Up @@ -3774,6 +3776,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_BLUETOOTH_ERTM_DISABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_bluetooth_ertm_disable);
break;
case MENU_ENUM_LABEL_REBOOT_PAYLOAD:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_reboot_payload);
break;
case MENU_ENUM_LABEL_REBOOT_FORCE_SELF_ON_UPDATE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_reboot_force_self_on_update);
break;
#endif
#ifdef HAVE_VIDEO_FILTER
case MENU_ENUM_LABEL_VIDEO_FILTER_ENABLE:
Expand Down
Loading
Loading