From be92517b1687f28f1e72fbd5178a0ca6b9b9aa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 20:30:17 +0100 Subject: [PATCH 1/8] Lakka: use different shutdown/reboot system commands To avoid any filesystem corruption during shutdown/reboot a sleep is added before shutdown/reboot is called. Also no quit is called, as the RetroArch process will be killed by systemd. Quitting RetroArch may result in unwanted restart of RetroArch by systemd. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-02-graceful-shutdown-reboot-hack.patch --- retroarch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/retroarch.c b/retroarch.c index 18ba465cf8..6773ccf923 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4727,8 +4727,12 @@ bool command_event(enum event_command cmd, void *data) runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_SHUTTING_DOWN), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); } +#ifdef HAVE_LAKKA + system("(sleep 1 && shutdown -P now) & disown"); +#else command_event(CMD_EVENT_QUIT, NULL); system("shutdown -P now"); +#endif /* HAVE_LAKKA */ #endif break; case CMD_EVENT_REBOOT: @@ -4738,8 +4742,12 @@ bool command_event(enum event_command cmd, void *data) runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_REBOOTING), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); } +#ifdef HAVE_LAKKA + system("(sleep 1 && shutdown -r now) & disown"); +#else command_event(CMD_EVENT_QUIT, NULL); system("shutdown -r now"); +#endif /* HAVE_LAKKA */ #endif break; case CMD_EVENT_RESUME: From a60df14d8197b09319d6d23a5dcba75b679d13e4 Mon Sep 17 00:00:00 2001 From: GavinDarkglider <31815002+GavinDarkglider@users.noreply.github.com> Date: Wed, 17 Nov 2021 21:03:03 +0100 Subject: [PATCH 2/8] Lakka/Nintendo Switch: disable cpu scaling for Nintendo Switch Lakka on Nintendo Switch uses own cpu governor. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-04-cpufreq-wip-disable-on-switch.patch --- driver.c | 4 ++++ menu/cbs/menu_cbs_left.c | 2 ++ menu/menu_driver.c | 4 ++++ retroarch.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/driver.c b/driver.c index 8d9dddcf54..cc498e390f 100644 --- a/driver.c +++ b/driver.c @@ -668,9 +668,11 @@ void drivers_init( if (flags & DRIVER_MIDI_MASK) midi_driver_init(settings); +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA cpu_scaling_driver_init(); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ } void driver_uninit(int flags) @@ -755,9 +757,11 @@ void driver_uninit(int flags) if (flags & DRIVER_MIDI_MASK) midi_driver_free(); +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA cpu_scaling_driver_free(); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ } void retroarch_deinit_drivers(struct retro_callbacks *cbs) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 08a92fdce1..3d9ed590da 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -678,6 +678,7 @@ static int manual_content_scan_core_name_left(unsigned type, const char *label, return 0; } +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA static int cpu_policy_mode_change(unsigned type, const char *label, bool wraparound) @@ -792,6 +793,7 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label, return 0; } #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ static int core_setting_left(unsigned type, const char *label, bool wraparound) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 87166738e6..ce94d3b8cc 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -6704,9 +6704,11 @@ void menu_driver_toggle( if (on) { +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA set_cpu_scaling_signal(CPUSCALING_EVENT_FOCUS_MENU); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ #ifdef HAVE_OVERLAY /* If an overlay was displayed before the toggle * and overlays are disabled in menu, need to @@ -6725,9 +6727,11 @@ void menu_driver_toggle( } else { +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA set_cpu_scaling_signal(CPUSCALING_EVENT_FOCUS_CORE); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ #ifdef HAVE_OVERLAY /* Inhibits pointer 'select' and 'cancel' actions * (until the next time 'select'/'cancel' are released) */ diff --git a/retroarch.c b/retroarch.c index 6773ccf923..3bd493ec05 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3626,15 +3626,19 @@ static void runloop_pause_checks(void) command_event(CMD_EVENT_DISCORD_UPDATE, &userdata); #endif +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA set_cpu_scaling_signal(CPUSCALING_EVENT_FOCUS_MENU); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ } else { +#ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA set_cpu_scaling_signal(CPUSCALING_EVENT_FOCUS_CORE); #endif +#endif /* #ifndef HAVE_LAKKA_SWITCH */ } #if defined(HAVE_TRANSLATE) && defined(HAVE_GFX_WIDGETS) From a2f92739791ed49d7d38b1d3748158d8120b93f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 21:25:06 +0100 Subject: [PATCH 3/8] Bluetooth: add option to remove pairing Pressing the START button removes the device pairing. Useful in case the device (e.g. gamepad) was paired with a different adapter/computer and needs to be paired again with current adapter/computer. To pair again, RetroArch needs to be restarted, so the device list is populated again. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-98-remove_bluetooth_pairing.patch --- bluetooth/bluetooth_driver.h | 3 +++ bluetooth/drivers/bluetoothctl.c | 40 ++++++++++++++++++++++++++++++++ bluetooth/drivers/bluez.c | 22 ++++++++++++++++++ driver.c | 1 + intl/msg_hash_us.h | 4 ++++ menu/cbs/menu_cbs_start.c | 19 +++++++++++++++ msg_hash.h | 1 + retroarch.c | 8 +++++++ 8 files changed, 98 insertions(+) diff --git a/bluetooth/bluetooth_driver.h b/bluetooth/bluetooth_driver.h index 498bd23804..5ce5268abb 100644 --- a/bluetooth/bluetooth_driver.h +++ b/bluetooth/bluetooth_driver.h @@ -43,6 +43,7 @@ typedef struct bluetooth_driver bool (*device_is_connected)(void *data, unsigned i); void (*device_get_sublabel)(void *data, char *s, unsigned i, size_t len); bool (*connect_device)(void *data, unsigned i); + bool (*remove_device)(void *data, unsigned i); const char *ident; } bluetooth_driver_t; @@ -71,6 +72,8 @@ void driver_bluetooth_device_get_sublabel(char *s, unsigned i, size_t len); bool driver_bluetooth_connect_device(unsigned i); +bool driver_bluetooth_remove_device(unsigned i); + bool bluetooth_driver_ctl(enum rarch_bluetooth_ctl_state state, void *data); extern const bluetooth_driver_t *bluetooth_drivers[]; diff --git a/bluetooth/drivers/bluetoothctl.c b/bluetooth/drivers/bluetoothctl.c index 6741931454..f3205c8ee9 100644 --- a/bluetooth/drivers/bluetoothctl.c +++ b/bluetooth/drivers/bluetoothctl.c @@ -191,6 +191,45 @@ static bool bluetoothctl_connect_device(void *data, unsigned idx) return true; } +static bool bluetoothctl_remove_device(void *data, unsigned idx) +{ + unsigned i; + bluetoothctl_t *btctl = (bluetoothctl_t*) data; + char device[18] = {0}; + const char *line = btctl->lines->elems[idx].data; + static struct string_list* list = NULL; + + /* bluetoothctl devices outputs lines of the format: + * $ bluetoothctl devices + * 'Device (mac address) (device name)' + */ + list = string_split(line, " "); + if (!list) + return false; + + if (list->size == 0) + { + string_list_free(list); + return false; + } + + strlcpy(device, list->elems[1].data, sizeof(device)); + string_list_free(list); + + snprintf(btctl->command, sizeof(btctl->command), "\ + echo -e \"disconnect %s\\nremove %s\\n\" | bluetoothctl", + device, device); + + pclose(popen(btctl->command, "r")); + + runloop_msg_queue_push(msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED), + 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, + MESSAGE_QUEUE_CATEGORY_INFO); + + btctl->bluetoothctl_counter[idx] = 0; + return true; +} + static void bluetoothctl_device_get_sublabel( void *data, char *s, unsigned i, size_t len) { @@ -211,5 +250,6 @@ bluetooth_driver_t bluetooth_bluetoothctl = { bluetoothctl_device_is_connected, bluetoothctl_device_get_sublabel, bluetoothctl_connect_device, + bluetoothctl_remove_device, "bluetoothctl", }; diff --git a/bluetooth/drivers/bluez.c b/bluetooth/drivers/bluez.c index 82239c319d..f0bfdb2973 100644 --- a/bluetooth/drivers/bluez.c +++ b/bluetooth/drivers/bluez.c @@ -604,6 +604,27 @@ static bool bluez_connect_device(void *data, unsigned i) return true; } +static bool bluez_remove_device(void *data, unsigned i) +{ + bluez_t *bluez = (bluez_t*)data; + bluez_dbus_connect(bluez); + + /* Disconnect the device */ + device_method(bluez, bluez->devices->data[i].path, "Disconnect"); + + /* Remove the device */ + if (device_method(bluez, bluez->devices->data[i].path, "RemoveDevice")) + return false; + + runloop_msg_queue_push(msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED), + 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, + MESSAGE_QUEUE_CATEGORY_INFO); + + bluez_dbus_disconnect(bluez); + bluez->bluez_cache_counter[i] = 0; + return true; +} + bluetooth_driver_t bluetooth_bluez = { bluez_init, bluez_free, @@ -612,5 +633,6 @@ bluetooth_driver_t bluetooth_bluez = { bluez_device_is_connected, bluez_device_get_sublabel, bluez_connect_device, + bluez_remove_device, "bluez", }; diff --git a/driver.c b/driver.c index cc498e390f..54d7e702ce 100644 --- a/driver.c +++ b/driver.c @@ -53,6 +53,7 @@ static bluetooth_driver_t bluetooth_null = { NULL, /* device_is_connected */ NULL, /* device_get_sublabel */ NULL, /* connect_device */ + NULL, /* remove_device */ "null", }; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 068de0158f..dedec1f092 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -11889,6 +11889,10 @@ MSG_HASH( MSG_BLUETOOTH_SCAN_COMPLETE, "Bluetooth scan complete." ) +MSG_HASH( + MSG_BLUETOOTH_PAIRING_REMOVED, + "Pairing removed. Restart RetroArch to connect/pair again." + ) MSG_HASH( MSG_WIFI_SCAN_COMPLETE, "Wi-Fi scan complete." diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index c884df9015..3569f912f0 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -48,6 +48,10 @@ #include "../../config.def.h" +#ifdef HAVE_BLUETOOTH +#include "../../bluetooth/bluetooth_driver.h" +#endif + #ifdef HAVE_NETWORKING #include "../../core_updater_list.h" #endif @@ -539,6 +543,16 @@ static int action_start_load_core( return ret; } +#ifdef HAVE_BLUETOOTH +static int action_start_bluetooth(const char *path, const char *label, + unsigned menu_type, size_t idx, size_t entry_idx) +{ + driver_bluetooth_remove_device((unsigned)idx); + + return 0; +} +#endif + #ifdef HAVE_NETWORKING static int action_start_core_updater_entry( const char *path, const char *label, @@ -711,6 +725,11 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs) case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_CORE_NAME: BIND_ACTION_START(cbs, action_start_manual_content_scan_core_name); break; +#ifdef HAVE_BLUETOOTH + case MENU_ENUM_LABEL_CONNECT_BLUETOOTH: + BIND_ACTION_START(cbs, action_start_bluetooth); + break; +#endif default: return -1; } diff --git a/msg_hash.h b/msg_hash.h index ea33750180..1e2412d669 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -386,6 +386,7 @@ enum msg_hash_enums MSG_TOGGLE_CONTENT_METADATA, MSG_NO_THUMBNAIL_AVAILABLE, MSG_PRESS_AGAIN_TO_QUIT, + MSG_BLUETOOTH_PAIRING_REMOVED, MSG_BLUETOOTH_SCAN_COMPLETE, MSG_WIFI_SCAN_COMPLETE, MSG_WIFI_CONNECTING_TO, diff --git a/retroarch.c b/retroarch.c index 3bd493ec05..8bb251ab16 100644 --- a/retroarch.c +++ b/retroarch.c @@ -9977,6 +9977,14 @@ bool driver_bluetooth_connect_device(unsigned i) return false; } +bool driver_bluetooth_remove_device(unsigned i) +{ + struct rarch_state *p_rarch = &rarch_st; + if (p_rarch->bluetooth_driver_active) + return p_rarch->bluetooth_driver->remove_device(p_rarch->bluetooth_data, i); + return false; +} + bool bluetooth_driver_ctl(enum rarch_bluetooth_ctl_state state, void *data) { struct rarch_state *p_rarch = &rarch_st; From efad7a7dcc85440516be26781db46a1a3ffd7379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 21:33:23 +0100 Subject: [PATCH 4/8] Lakka: CD-ROM eject menu item Adds new entry (where the entry for dumping CD is) to eject the disc - in case the CD drive has no physical button to eject the disc / the button does not work. Useless for most, but quality of life improvement for some. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-99-eject_disc.patch --- config.def.h | 3 +++ configuration.c | 3 +++ configuration.h | 3 +++ intl/msg_hash_lbl.h | 18 ++++++++++++++++++ intl/msg_hash_us.h | 20 ++++++++++++++++++++ menu/cbs/menu_cbs_deferred_push.c | 11 +++++++++++ menu/cbs/menu_cbs_ok.c | 30 ++++++++++++++++++++++++++++++ menu/cbs/menu_cbs_sublabel.c | 16 ++++++++++++++++ menu/cbs/menu_cbs_title.c | 6 ++++++ menu/drivers/materialui.c | 17 +++++++++++++++++ menu/drivers/ozone.c | 17 +++++++++++++++++ menu/drivers/xmb.c | 17 +++++++++++++++++ menu/menu_cbs.h | 3 +++ menu/menu_displaylist.c | 30 ++++++++++++++++++++++++++++++ menu/menu_displaylist.h | 3 +++ menu/menu_driver.h | 1 + menu/menu_setting.c | 27 +++++++++++++++++++++++++++ msg_hash.h | 9 +++++++++ 18 files changed, 234 insertions(+) diff --git a/config.def.h b/config.def.h index 0f57cec9b1..63fe9d67a8 100644 --- a/config.def.h +++ b/config.def.h @@ -646,6 +646,9 @@ static const bool menu_show_load_content = true; #ifdef HAVE_CDROM static const bool menu_show_load_disc = true; static const bool menu_show_dump_disc = true; +#ifdef HAVE_LAKKA +static const bool menu_show_eject_disc = true; +#endif /* HAVE_LAKKA */ #endif static const bool menu_show_information = true; static const bool menu_show_configurations = true; diff --git a/configuration.c b/configuration.c index e6a3841324..f5b9ac8354 100644 --- a/configuration.c +++ b/configuration.c @@ -1824,6 +1824,9 @@ static struct config_bool_setting *populate_settings_bool( #ifdef HAVE_CDROM SETTING_BOOL("menu_show_load_disc", &settings->bools.menu_show_load_disc, true, menu_show_load_disc, false); SETTING_BOOL("menu_show_dump_disc", &settings->bools.menu_show_dump_disc, true, menu_show_dump_disc, false); +#ifdef HAVE_LAKKA + SETTING_BOOL("menu_show_eject_disc", &settings->bools.menu_show_eject_disc, true, menu_show_eject_disc, false); +#endif /* HAVE_LAKKA */ #endif SETTING_BOOL("menu_show_information", &settings->bools.menu_show_information, true, menu_show_information, false); SETTING_BOOL("menu_show_configurations", &settings->bools.menu_show_configurations, true, menu_show_configurations, false); diff --git a/configuration.h b/configuration.h index 0e4afb6c7a..548731220f 100644 --- a/configuration.h +++ b/configuration.h @@ -653,6 +653,9 @@ typedef struct settings bool menu_show_load_content; bool menu_show_load_disc; bool menu_show_dump_disc; +#ifdef HAVE_LAKKA + bool menu_show_eject_disc; +#endif bool menu_show_information; bool menu_show_configurations; bool menu_show_help; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index cbc10e1298..954a2090fe 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1730,6 +1730,12 @@ MSG_HASH( MENU_ENUM_LABEL_DUMP_DISC, "dump_disc" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_EJECT_DISC, + "eject_disc" + ) +#endif MSG_HASH( MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL, "load_special" @@ -2386,6 +2392,12 @@ MSG_HASH( MENU_ENUM_LABEL_DEFERRED_LOAD_DISC_LIST, "deferred_load_disc_list" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_DEFERRED_EJECT_DISC, + "deferred_eject_disc" + ) +#endif MSG_HASH( MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_DEVELOPER, "deferred_cursor_manager_list_rdb_entry_developer" @@ -4030,6 +4042,12 @@ MSG_HASH( MENU_ENUM_LABEL_MENU_SHOW_DUMP_DISC, "menu_show_dump_disc" ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_MENU_SHOW_EJECT_DISC, + "menu_show_eject_disc" + ) +#endif MSG_HASH( MENU_ENUM_LABEL_MENU_SHOW_INFORMATION, "menu_show_information" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index dedec1f092..2421a18c88 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -91,6 +91,16 @@ MSG_HASH( /* FIXME Is a specific image format used? Is it determined automatical MENU_ENUM_SUBLABEL_DUMP_DISC, "Dump the physical media disc to internal storage. It will be saved as an image file." ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_EJECT_DISC, + "Eject Disc" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_EJECT_DISC, + "Ejects the disc from physical CD/DVD drive." + ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, "Playlists" @@ -4335,6 +4345,16 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SHOW_DUMP_DISC, "Show the 'Dump Disc' option in the Main Menu." ) +#ifdef HAVE_LAKKA +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_EJECT_DISC, + "Show 'Eject Disc'" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_EJECT_DISC, + "Show the 'Eject Disc' option in the Main Menu." + ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, "Show 'Online Updater'" diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 0201245659..b6d614d3dd 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -113,6 +113,9 @@ GENERIC_DEFERRED_PUSH(deferred_push_configurations_list, DISPLAYLIST_ GENERIC_DEFERRED_PUSH(deferred_push_load_content_special, DISPLAYLIST_LOAD_CONTENT_LIST) GENERIC_DEFERRED_PUSH(deferred_push_load_content_list, DISPLAYLIST_LOAD_CONTENT_LIST) GENERIC_DEFERRED_PUSH(deferred_push_dump_disk_list, DISPLAYLIST_DUMP_DISC) +#ifdef HAVE_LAKKA +GENERIC_DEFERRED_PUSH(deferred_push_eject_disc, DISPLAYLIST_EJECT_DISC) +#endif GENERIC_DEFERRED_PUSH(deferred_push_cdrom_info_detail_list, DISPLAYLIST_CDROM_DETAIL_INFO) GENERIC_DEFERRED_PUSH(deferred_push_load_disk_list, DISPLAYLIST_LOAD_DISC) GENERIC_DEFERRED_PUSH(deferred_push_information_list, DISPLAYLIST_INFORMATION_LIST) @@ -676,6 +679,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( const deferred_info_list_t info_list[] = { {MENU_ENUM_LABEL_DEFERRED_DUMP_DISC_LIST, deferred_push_dump_disk_list}, +#ifdef HAVE_LAKKA + {MENU_ENUM_LABEL_DEFERRED_EJECT_DISC, deferred_push_eject_disc}, +#endif {MENU_ENUM_LABEL_DEFERRED_LOAD_DISC_LIST, deferred_push_load_disk_list}, {MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, deferred_push_favorites_list}, {MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST, deferred_push_dropdown_box_list}, @@ -1276,6 +1282,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_DEFERRED_DUMP_DISC_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dump_disk_list); break; +#ifdef HAVE_LAKKA + case MENU_ENUM_LABEL_DEFERRED_EJECT_DISC: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_eject_disc); + break; +#endif case MENU_ENUM_LABEL_DEFERRED_CDROM_INFO_DETAIL_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_cdrom_info_detail_list); break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b0101901a6..47616fcfcf 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -447,6 +447,10 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_FACEBOOK_LIST; case ACTION_OK_DL_DUMP_DISC_LIST: return MENU_ENUM_LABEL_DEFERRED_DUMP_DISC_LIST; +#ifdef HAVE_LAKKA + case ACTION_OK_DL_EJECT_DISC: + return MENU_ENUM_LABEL_DEFERRED_EJECT_DISC; +#endif case ACTION_OK_DL_LOAD_DISC_LIST: return MENU_ENUM_LABEL_DEFERRED_LOAD_DISC_LIST; case ACTION_OK_DL_ACCOUNTS_YOUTUBE_LIST: @@ -1529,6 +1533,9 @@ int generic_action_ok_displaylist_push(const char *path, case ACTION_OK_DL_IMAGES_LIST: case ACTION_OK_DL_LOAD_DISC_LIST: case ACTION_OK_DL_DUMP_DISC_LIST: +#ifdef HAVE_LAKKA + case ACTION_OK_DL_EJECT_DISC: +#endif case ACTION_OK_DL_SHADER_PRESET_REMOVE: case ACTION_OK_DL_SHADER_PRESET_SAVE: case ACTION_OK_DL_CDROM_INFO_LIST: @@ -2735,6 +2742,17 @@ static int action_ok_dump_cdrom(const char *path, return 0; } +#ifdef HAVE_LAKKA +static int action_ok_eject_disc(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ +#ifdef HAVE_CDROM + system("eject & disown"); +#endif /* HAVE_CDROM */ + return 0; +} +#endif /* HAVE_LAKKA */ + static int action_ok_lookup_setting(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -5644,6 +5662,9 @@ DEFAULT_ACTION_OK_FUNC(action_ok_push_accounts_youtube_list, ACTION_OK_DL_ACCOUN DEFAULT_ACTION_OK_FUNC(action_ok_push_accounts_twitch_list, ACTION_OK_DL_ACCOUNTS_TWITCH_LIST) DEFAULT_ACTION_OK_FUNC(action_ok_push_accounts_facebook_list, ACTION_OK_DL_ACCOUNTS_FACEBOOK_LIST) DEFAULT_ACTION_OK_FUNC(action_ok_push_dump_disc_list, ACTION_OK_DL_DUMP_DISC_LIST) +#ifdef HAVE_LAKKA +DEFAULT_ACTION_OK_FUNC(action_ok_push_eject_disc, ACTION_OK_DL_EJECT_DISC) +#endif DEFAULT_ACTION_OK_FUNC(action_ok_push_load_disc_list, ACTION_OK_DL_LOAD_DISC_LIST) DEFAULT_ACTION_OK_FUNC(action_ok_open_archive, ACTION_OK_DL_OPEN_ARCHIVE) DEFAULT_ACTION_OK_FUNC(action_ok_rgui_menu_theme_preset, ACTION_OK_DL_RGUI_MENU_THEME_PRESET) @@ -7865,6 +7886,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_ACCOUNTS_TWITCH, action_ok_push_accounts_twitch_list}, {MENU_ENUM_LABEL_ACCOUNTS_FACEBOOK, action_ok_push_accounts_facebook_list}, {MENU_ENUM_LABEL_DUMP_DISC, action_ok_push_dump_disc_list}, +#ifdef HAVE_LAKKA + {MENU_ENUM_LABEL_EJECT_DISC, action_ok_push_eject_disc}, +#endif {MENU_ENUM_LABEL_LOAD_DISC, action_ok_push_load_disc_list}, {MENU_ENUM_LABEL_SHADER_OPTIONS, action_ok_push_default}, {MENU_ENUM_LABEL_CORE_OPTIONS, action_ok_push_core_options_list}, @@ -8045,6 +8069,12 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, { BIND_ACTION_OK(cbs, action_ok_dump_cdrom); } +#ifdef HAVE_LAKKA + else if (type == MENU_SET_EJECT_DISC) + { + BIND_ACTION_OK(cbs, action_ok_eject_disc); + } +#endif else if (type == MENU_SET_CDROM_INFO) { BIND_ACTION_OK(cbs, action_ok_cdrom_info_list); diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index b469d96fe7..97e0978fbb 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -411,6 +411,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_sideload_core_list, MENU_ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_manager_list, MENU_ENUM_SUBLABEL_CORE_MANAGER_LIST) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_load_disc, MENU_ENUM_SUBLABEL_LOAD_DISC) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_dump_disc, MENU_ENUM_SUBLABEL_DUMP_DISC) +#ifdef HAVE_LAKKA +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_eject_disc, MENU_ENUM_SUBLABEL_EJECT_DISC) +#endif DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_content_list, MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_content_special, MENU_ENUM_SUBLABEL_LOAD_CONTENT_SPECIAL) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_load_content_history, MENU_ENUM_SUBLABEL_LOAD_CONTENT_HISTORY) @@ -803,6 +806,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_core, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_content, MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_disc, MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_DISC) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_dump_disc, MENU_ENUM_SUBLABEL_MENU_SHOW_DUMP_DISC) +#ifdef HAVE_LAKKA +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_eject_disc, MENU_ENUM_SUBLABEL_MENU_SHOW_EJECT_DISC) +#endif DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_information, MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_configurations, MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_help, MENU_ENUM_SUBLABEL_MENU_SHOW_HELP) @@ -2451,6 +2457,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_DUMP_DISC: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_dump_disc); break; +#ifdef HAVE_LAKKA + case MENU_ENUM_LABEL_EJECT_DISC: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_eject_disc); + break; +#endif case MENU_ENUM_LABEL_MENU_SHOW_LOAD_CONTENT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_show_load_content); break; @@ -2460,6 +2471,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_SHOW_DUMP_DISC: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_show_dump_disc); break; +#ifdef HAVE_LAKKA + case MENU_ENUM_LABEL_MENU_SHOW_EJECT_DISC: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_show_eject_disc); + break; +#endif case MENU_ENUM_LABEL_MENU_SHOW_INFORMATION: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_show_information); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index d6b7eeee40..db8338707e 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -602,6 +602,9 @@ DEFAULT_TITLE_MACRO(action_get_crt_switchres_settings_list, MENU_ENUM_LABEL_ DEFAULT_TITLE_MACRO(action_get_configuration_settings_list, MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS) DEFAULT_TITLE_MACRO(action_get_load_disc_list, MENU_ENUM_LABEL_VALUE_LOAD_DISC) DEFAULT_TITLE_MACRO(action_get_dump_disc_list, MENU_ENUM_LABEL_VALUE_DUMP_DISC) +#ifdef HAVE_LAKKA +DEFAULT_TITLE_MACRO(action_get_eject_disc, MENU_ENUM_LABEL_VALUE_EJECT_DISC) +#endif DEFAULT_TITLE_MACRO(action_get_saving_settings_list, MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS) DEFAULT_TITLE_MACRO(action_get_logging_settings_list, MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS) DEFAULT_TITLE_MACRO(action_get_frame_throttle_settings_list, MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS) @@ -930,6 +933,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_DEFERRED_CORE_RESTORE_BACKUP_LIST, action_get_title_deferred_core_restore_backup_list}, {MENU_ENUM_LABEL_DEFERRED_CORE_DELETE_BACKUP_LIST, action_get_title_deferred_core_delete_backup_list}, {MENU_ENUM_LABEL_DEFERRED_DUMP_DISC_LIST, action_get_dump_disc_list}, +#ifdef HAVE_LAKKA + {MENU_ENUM_LABEL_DEFERRED_EJECT_DISC, action_get_eject_disc}, +#endif {MENU_ENUM_LABEL_DEFERRED_LOAD_DISC_LIST, action_get_load_disc_list}, {MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST, action_get_configuration_settings_list }, {MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST, action_get_saving_settings_list}, diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 9b9bb5b56b..4bbded8135 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -9302,6 +9302,17 @@ static int materialui_list_push(void *data, void *userdata, false); } +#ifdef HAVE_LAKKA + if (settings->bools.menu_show_eject_disc) + { + MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( + info->list, + MENU_ENUM_LABEL_EJECT_DISC, + PARSE_ACTION, + false); + } +#endif + #if defined(HAVE_NETWORKING) #ifdef HAVE_LAKKA MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( @@ -10082,6 +10093,9 @@ static void materialui_list_insert( { case MENU_SET_CDROM_INFO: case MENU_SET_CDROM_LIST: +#ifdef HAVE_LAKKA + case MENU_SET_EJECT_DISC: +#endif case MENU_SET_LOAD_CDROM_LIST: node->icon_texture_index = MUI_TEXTURE_DISK; node->icon_type = MUI_ICON_TYPE_INTERNAL; @@ -10362,6 +10376,9 @@ static void materialui_list_insert( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_IMAGE_APPEND)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_DISC)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DUMP_DISC)) || +#ifdef HAVE_LAKKA + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EJECT_DISC)) || +#endif string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISC_INFORMATION)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_OPTIONS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_INDEX)) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index f7909ad1d3..01f9404769 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1602,6 +1602,9 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone, { case MENU_ENUM_LABEL_LOAD_DISC: case MENU_ENUM_LABEL_DUMP_DISC: +#ifdef HAVE_LAKKA + case MENU_ENUM_LABEL_EJECT_DISC: +#endif case MENU_ENUM_LABEL_DISC_INFORMATION: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DISC]; case MENU_ENUM_LABEL_CORE_OPTIONS: @@ -1931,6 +1934,9 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone, { case MENU_SET_CDROM_INFO: case MENU_SET_CDROM_LIST: +#ifdef HAVE_LAKKA + case MENU_SET_EJECT_DISC: +#endif case MENU_SET_LOAD_CDROM_LIST: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DISC]; case FILE_TYPE_DIRECTORY: @@ -7857,6 +7863,17 @@ static int ozone_list_push(void *data, void *userdata, false); } +#ifdef HAVE_LAKKA + if (settings->bools.menu_show_eject_disc) + { + MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( + info->list, + MENU_ENUM_LABEL_EJECT_DISC, + PARSE_ACTION, + false); + } +#endif + MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( info->list, MENU_ENUM_LABEL_ADD_CONTENT_LIST, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index bdea925bae..4da4d10159 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2638,6 +2638,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_LOAD_DISC: case MENU_ENUM_LABEL_DUMP_DISC: +#ifdef HAVE_LAKKA + case MENU_ENUM_LABEL_EJECT_DISC: +#endif case MENU_ENUM_LABEL_DISC_INFORMATION: return xmb->textures.list[XMB_TEXTURE_DISC]; @@ -6882,6 +6885,9 @@ static int xmb_list_push(void *data, void *userdata, bool menu_show_configurations = settings->bools.menu_show_configurations; bool menu_show_load_disc = settings->bools.menu_show_load_disc; bool menu_show_dump_disc = settings->bools.menu_show_dump_disc; +#ifdef HAVE_LAKKA + bool menu_show_eject_disc = settings->bools.menu_show_eject_disc; +#endif bool menu_show_shutdown = settings->bools.menu_show_shutdown; bool menu_show_reboot = settings->bools.menu_show_reboot; #if !defined(IOS) @@ -7023,6 +7029,17 @@ static int xmb_list_push(void *data, void *userdata, false); } +#ifdef HAVE_LAKKA + if (menu_show_eject_disc) + { + MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( + info->list, + MENU_ENUM_LABEL_EJECT_DISC, + PARSE_ACTION, + false); + } +#endif + MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM( info->list, MENU_ENUM_LABEL_ADD_CONTENT_LIST, diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 0b4936f702..6e98ebe046 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -198,6 +198,9 @@ enum ACTION_OK_DL_MIDI_SETTINGS_LIST, ACTION_OK_DL_LOAD_DISC_LIST, ACTION_OK_DL_DUMP_DISC_LIST, +#ifdef HAVE_LAKKA + ACTION_OK_DL_EJECT_DISC, +#endif ACTION_OK_DL_BROWSE_URL_START, ACTION_OK_DL_CONTENT_SETTINGS, ACTION_OK_DL_CDROM_INFO_DETAIL_LIST, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a012a6db9b..008558ecb8 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -8211,6 +8211,9 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_MENU_SHOW_LOAD_CONTENT, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_MENU_SHOW_LOAD_DISC, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_MENU_SHOW_DUMP_DISC, PARSE_ONLY_BOOL, true }, +#ifdef HAVE_LAKKA + {MENU_ENUM_LABEL_MENU_SHOW_EJECT_DISC, PARSE_ONLY_BOOL, true }, +#endif {MENU_ENUM_LABEL_MENU_SHOW_ONLINE_UPDATER, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_MENU_SHOW_CORE_UPDATER, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_MENU_SHOW_LEGACY_THUMBNAIL_UPDATER, PARSE_ONLY_BOOL, true }, @@ -9537,6 +9540,14 @@ unsigned menu_displaylist_build_list( MENU_SET_CDROM_LIST); #endif break; +#ifdef HAVE_LAKKA + case DISPLAYLIST_EJECT_DISC: +#ifdef HAVE_CDROM + count = menu_displaylist_parse_disc_info(list, + MENU_SET_EJECT_DISC); +#endif /* HAVE_CDROM */ + break; +#endif /* HAVE_LAKKA */ default: break; } @@ -11841,6 +11852,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_BROWSE_URL_LIST: case DISPLAYLIST_DISC_INFO: case DISPLAYLIST_DUMP_DISC: +#ifdef HAVE_LAKKA + case DISPLAYLIST_EJECT_DISC: +#endif case DISPLAYLIST_LOAD_CONTENT_LIST: case DISPLAYLIST_LOAD_CONTENT_SPECIAL: case DISPLAYLIST_OPTIONS_REMAPPINGS: @@ -11884,6 +11898,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_DISC_INFO: case DISPLAYLIST_DUMP_DISC: +#ifdef HAVE_LAKKA + case DISPLAYLIST_EJECT_DISC: +#endif case DISPLAYLIST_MENU_SETTINGS_LIST: case DISPLAYLIST_ADD_CONTENT_LIST: case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION: @@ -11942,6 +11959,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { case DISPLAYLIST_DISC_INFO: case DISPLAYLIST_DUMP_DISC: +#ifdef HAVE_LAKKA + case DISPLAYLIST_EJECT_DISC: +#endif info->need_clear = true; break; default: @@ -12344,6 +12364,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, PARSE_ACTION, false) == 0) count++; } + +#ifdef HAVE_LAKKA + if (settings->bools.menu_show_eject_disc) + { + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list, + MENU_ENUM_LABEL_EJECT_DISC, + PARSE_ACTION, false) == 0) + count++; + } +#endif /* HAVE_LAKKA */ #endif #if defined(HAVE_RGUI) || defined(HAVE_MATERIALUI) diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index daff826351..844f7cacce 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -134,6 +134,9 @@ enum menu_displaylist_ctl_state DISPLAYLIST_VIDEO_FONTS, DISPLAYLIST_LOAD_DISC, DISPLAYLIST_DUMP_DISC, +#ifdef HAVE_LAKKA + DISPLAYLIST_EJECT_DISC, +#endif DISPLAYLIST_OVERLAYS, #ifdef HAVE_VIDEO_LAYOUT DISPLAYLIST_VIDEO_LAYOUT_PATH, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 896bbd0b50..9375041e6d 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -240,6 +240,7 @@ enum menu_settings_type MENU_SET_CDROM_LIST, MENU_SET_LOAD_CDROM_LIST, + MENU_SET_EJECT_DISC, MENU_SET_CDROM_INFO, MENU_SETTING_ACTION_DELETE_PLAYLIST, MENU_SETTING_ACTION_PLAYLIST_MANAGER_RESET_CORES, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 006f730856..1372abfbfa 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9044,6 +9044,16 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group); + +#ifdef HAVE_LAKKA + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_EJECT_DISC, + MENU_ENUM_LABEL_VALUE_EJECT_DISC, + &group_info, + &subgroup_info, + parent_group); +#endif } string_list_free(drive_list); @@ -16102,6 +16112,23 @@ static bool setting_append_list( general_write_handler, general_read_handler, SD_FLAG_NONE); + +#ifdef HAVE_LAKKA + CONFIG_BOOL( + list, list_info, + &settings->bools.menu_show_eject_disc, + MENU_ENUM_LABEL_MENU_SHOW_EJECT_DISC, + MENU_ENUM_LABEL_VALUE_MENU_SHOW_EJECT_DISC, + menu_show_eject_disc, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); +#endif /* HAVE_LAKKA */ #endif CONFIG_BOOL( diff --git a/msg_hash.h b/msg_hash.h index 1e2412d669..fddb649745 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1124,6 +1124,9 @@ enum msg_hash_enums MENU_LABEL(MENU_SHOW_LOAD_CONTENT), MENU_LABEL(MENU_SHOW_LOAD_DISC), MENU_LABEL(MENU_SHOW_DUMP_DISC), +#ifdef HAVE_LAKKA + MENU_LABEL(MENU_SHOW_EJECT_DISC), +#endif MENU_LABEL(MENU_SHOW_INFORMATION), MENU_LABEL(MENU_SHOW_CONFIGURATIONS), MENU_LABEL(MENU_SHOW_HELP), @@ -1467,6 +1470,9 @@ enum msg_hash_enums MENU_ENUM_LABEL_DEFERRED_CDROM_INFO_DETAIL_LIST, MENU_ENUM_LABEL_DEFERRED_LOAD_DISC_LIST, MENU_ENUM_LABEL_DEFERRED_DUMP_DISC_LIST, +#ifdef HAVE_LAKKA + MENU_ENUM_LABEL_DEFERRED_EJECT_DISC, +#endif MENU_ENUM_LABEL_DEFERRED_REMAPPINGS_PORT_LIST, MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST, MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL, @@ -2232,6 +2238,9 @@ enum msg_hash_enums MENU_LABEL(LOAD_CONTENT_HISTORY), MENU_LABEL(LOAD_DISC), MENU_LABEL(DUMP_DISC), +#ifdef HAVE_LAKKA + MENU_LABEL(EJECT_DISC), +#endif MENU_LABEL(NETWORK_INFORMATION), MENU_LABEL(SYSTEM_INFORMATION), MENU_LABEL(ACHIEVEMENT_LIST), From 6a99832a4d4a3576a6b1b8d2f98c0601a13acd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 17 Nov 2021 21:48:05 +0100 Subject: [PATCH 5/8] Lakka: Patch to fix keyboard typing Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-01-xkb-fix.patch --- input/drivers/udev_input.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index c5b70c0e4e..36c1463c9e 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -80,6 +80,13 @@ #define UDEV_XKB_HANDLING #endif +/* Force UDEV_XKB_HANDLING for Lakka */ +#ifdef HAVE_LAKKA +#ifndef UDEV_XKB_HANDLING +#define UDEV_XKB_HANDLING +#endif +#endif + #define UDEV_MAX_KEYS (KEY_MAX + 7) / 8 typedef struct udev_input udev_input_t; @@ -1391,7 +1398,12 @@ static void *udev_input_init(const char *joypad_driver) goto error; video_context_driver_get_ident(&ctx_ident); +#ifdef HAVE_LAKKA + /* Force xkb_handling on Lakka */ + udev->xkb_handling = true; +#else udev->xkb_handling = string_is_equal(ctx_ident.ident, "kms"); +#endif /* HAVE_LAKKA */ #endif #if defined(HAVE_EPOLL) From 44dcfb88b699239267bb4d8ed85f9311783b0a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 21:56:05 +0100 Subject: [PATCH 6/8] Lakka: do not add include for libdrm Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-03-libdrm-include.patch --- Makefile.common | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 1725c33ba6..ccf5cecbef 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1434,7 +1434,9 @@ endif ifeq ($(HAVE_PLAIN_DRM), 1) OBJ += gfx/drivers/drm_gfx.o - INCLUDE_DIRS += -I/usr/include/libdrm + ifneq ($(HAVE_LAKKA), 1) + INCLUDE_DIRS += -I/usr/include/libdrm + endif LIBS += -ldrm endif From 0cf437e3759262db77d9d86acafe66b7990a6eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 21:59:37 +0100 Subject: [PATCH 7/8] Lakka/Nintendo Switch: disable rumble gain Rumble gain breaks controlls on Nintendo Switch port of Lakka, probably due to issue in the driver). Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-06-switch_disable_rumble_gain.patch --- input/drivers_joypad/udev_joypad.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 833b0861ea..0743de226e 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -151,6 +151,7 @@ error: return -1; } +#ifndef HAVE_LAKKA_SWITCH static bool udev_set_rumble_gain(unsigned i, unsigned gain) { struct input_event ie; @@ -179,6 +180,7 @@ static bool udev_set_rumble_gain(unsigned i, unsigned gain) return true; } +#endif static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char *path) { @@ -299,6 +301,7 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char p, path, pad->num_effects); } +#ifndef HAVE_LAKKA_SWITCH /* Set rumble gain here, if supported */ if (test_bit(FF_RUMBLE, ffbit)) { @@ -307,6 +310,7 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char : DEFAULT_RUMBLE_GAIN; udev_set_rumble_gain(p, rumble_gain); } +#endif return ret; } @@ -790,7 +794,11 @@ input_device_driver_t udev_joypad = { udev_joypad_axis, udev_joypad_poll, udev_set_rumble, +#ifndef HAVE_LAKKA_SWITCH udev_set_rumble_gain, +#else + NULL, +#endif udev_joypad_name, "udev", }; From fd5c718b481ef57254e70ab644af0dc8b8d5076c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen=20=28vudiq=29?= Date: Wed, 17 Nov 2021 22:04:38 +0100 Subject: [PATCH 8/8] buildfix: undefined srm.x_scale, srm.y_scale srm.x_scale and srm.y_scale are undefined in this context/scope. Upstream of patch used by Lakka at build time https://github.com/libretro/Lakka-LibreELEC/blob/1943ad296eaf7c01040f02aa8f5dff3d2f37309f/packages/libretro/retroarch/patches/retroarch-07-gpicase_buildfix.patch --- gfx/video_crt_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 4e1caab591..25793945f5 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -131,7 +131,7 @@ static void set_aspect(videocrt_switch_t *p_switch, unsigned int width, RARCH_LOG("[CRT]: Resolution is stretched. Fractal scaling @ X:%f Y:%f \n", srm_xscale, srm_yscale); } else - RARCH_LOG("[CRT]: SR integer scaled X:%d Y:%d \n",srm.x_scale, srm.y_scale); + RARCH_LOG("[CRT]: SR integer scaled X:%d Y:%d \n",(int)srm_xscale, (int)srm_yscale); scaled_width = roundf(patched_width*srm_xscale); scaled_height = roundf(patched_height*srm_yscale);