Skip to content

Commit

Permalink
Lakka Switch Updates.... (#15754)
Browse files Browse the repository at this point in the history
* Lakka: Switch: Decouple From LibNX builds.

* Lakka: Always show Power Management Settings menu

* Lakka: Switch: Add Nintendo Switch Options Menu, and First Option

* Lakka: Switch: Add CEC Toggle

* Lakka: Switch: Add Bluetooth ERTM Toggle

* Retroarch: unix platform:  Always display battery meter even when the device reports it as unknown
This is useful for most arm devices that have unknown battery status until charger state changes

* Retroarch: Lakka: Remove Gamemode stuff from build

Lakka will never include this, as it only runs base system, and retroarch.
  • Loading branch information
GavinDarkglider authored Oct 6, 2023
1 parent 812c003 commit 4387b0a
Show file tree
Hide file tree
Showing 67 changed files with 521 additions and 632 deletions.
6 changes: 6 additions & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@

#define DEFAULT_GAMEMODE_ENABLE true

#ifdef HAVE_LAKKA_SWITCH
#define DEFAULT_SWITCH_OC false
#define DEFAULT_SWITCH_CEC true
#define DEFAULT_BLUETOOTH_ERTM false
#endif

#if (defined(_WIN32) && !defined(_XBOX)) || (defined(__linux) && !defined(ANDROID) && !defined(HAVE_LAKKA)) || (defined(__MACH__) && !defined(IOS)) || defined(EMSCRIPTEN)
#define DEFAULT_MOUSE_ENABLE true
#else
Expand Down
40 changes: 38 additions & 2 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@

#include "lakka.h"

#if defined(HAVE_LAKKA) || defined(HAVE_LIBNX)
#ifdef HAVE_LAKKA_SWITCH
#include "lakka-switch.h"
#endif

#if defined(HAVE_LIBNX)
#include "switch_performance_profiles.h"
#endif

Expand Down Expand Up @@ -1748,8 +1752,14 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("ai_service_enable", &settings->bools.ai_service_enable, true, DEFAULT_AI_SERVICE_ENABLE, false);
SETTING_BOOL("ai_service_pause", &settings->bools.ai_service_pause, true, DEFAULT_AI_SERVICE_PAUSE, false);
SETTING_BOOL("wifi_enabled", &settings->bools.wifi_enabled, true, DEFAULT_WIFI_ENABLE, false);
#ifndef HAVE_LAKKA
SETTING_BOOL("gamemode_enable", &settings->bools.gamemode_enable, true, DEFAULT_GAMEMODE_ENABLE, false);

#endif
#ifdef HAVE_LAKKA_SWITCH
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);
#endif
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, DEFAULT_AUDIO_ENABLE, false);
SETTING_BOOL("audio_sync", &settings->bools.audio_sync, true, DEFAULT_AUDIO_SYNC, false);
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, DEFAULT_RATE_CONTROL, false);
Expand Down Expand Up @@ -4068,6 +4078,32 @@ static bool config_load_file(global_t *global,
libnx_apply_overclock();
#endif

#ifdef HAVE_LAKKA_SWITCH
FILE* f = fopen(SWITCH_OC_TOGGLE_PATH, "w");
if (settings->bools.switch_oc == true) {
fprintf(f, "1\n");
} else {
fprintf(f, "0\n");
}
fclose(f);
if (settings->bools.switch_cec == true) {
FILE* f = fopen(SWITCH_CEC_TOGGLE_PATH, "w");
fprintf(f, "\n");
fclose(f);
} else {
filestream_delete(SWITCH_CEC_TOGGLE_PATH);
}
if (settings->bools.bluetooth_ertm_disable == true) {
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
fprintf(f, "1\n");
fclose(f);
} else {
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
fprintf(f, "0\n");
fclose(f);
}
#endif

frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode);
recording_driver_update_streaming_url();

Expand Down
5 changes: 5 additions & 0 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,11 @@ typedef struct settings
bool screenshots_in_content_dir;
bool systemfiles_in_content_dir;
bool ssh_enable;
#ifdef HAVE_LAKKA_SWITCH
bool switch_oc;
bool switch_cec;
bool bluetooth_ertm_disable;
#endif
bool samba_enable;
bool bluetooth_enable;
bool localap_enable;
Expand Down
17 changes: 17 additions & 0 deletions frontend/drivers/platform_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,23 @@ static void check_proc_acpi_sysfs_battery(const char *node,
}
}

fill_pathname_join_special(path, basenode, "type", sizeof(path));

if (!filestream_exists(path))
goto status;

if (filestream_read_file(path, (void**)&buf, &length) != 1)
goto status;

if (buf)
{
if (strstr((char*)buf, "Battery"))
*have_battery = true;
free(buf);
buf = NULL;
}

status:
fill_pathname_join_special(path, basenode, "status", sizeof(path));

if (!filestream_exists(path))
Expand Down
15 changes: 3 additions & 12 deletions intl/msg_hash_ar.h
Original file line number Diff line number Diff line change
Expand Up @@ -9530,18 +9530,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
"زيادة أو تقليل سطوع الشاشة."
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU فوق الساعة"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"تبديل GPU على مدار الساعة أو تحت الساعة."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"تجاوز الساعة المعالج"
Expand Down Expand Up @@ -9637,6 +9626,8 @@ MSG_HASH(
"ملف تكوين خاطئ - تعذر العثور على APNAME أو PASSWORD في %s"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
7 changes: 3 additions & 4 deletions intl/msg_hash_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -3766,10 +3766,7 @@ MSG_HASH(
MSG_READ_ONLY,
"Estáu del almacenamientu internu: namás llectura"
)

#ifdef HAVE_LAKKA_SWITCH
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
#endif
#ifdef HAVE_LAKKA
MSG_HASH(
Expand Down Expand Up @@ -3805,6 +3802,8 @@ MSG_HASH(
"El ficheru de configuración ye incorreutu - nun se pudo atopar APNAME o PASSWORD en %s"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
#endif
#ifdef UDEV_TOUCH_SUPPORT
Expand Down
15 changes: 3 additions & 12 deletions intl/msg_hash_ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -8138,18 +8138,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
"Augmenta o redueix la brillantor de la pantalla."
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"Força la GPU"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Augmenta o redueix la velocitat de rellotge de la GPU de la Switch."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"Força la CPU"
Expand Down Expand Up @@ -8233,6 +8222,8 @@ MSG_HASH(
"Fitxer de configuració erroni — no s’han trobat APNAME ni PASSWORD a %s"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
15 changes: 3 additions & 12 deletions intl/msg_hash_chs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14330,18 +14330,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
"提高或降低屏幕亮度。"
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU 超频"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"超频或降频 Switch 的 GPU。"
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"CPU 超频"
Expand Down Expand Up @@ -14433,6 +14422,8 @@ MSG_HASH(
"错误配置文件——在 %s 中找不到 APNAME 或 PASSWORD"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
13 changes: 1 addition & 12 deletions intl/msg_hash_cht.h
Original file line number Diff line number Diff line change
Expand Up @@ -14502,18 +14502,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
"調整螢幕亮度。"
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU超頻"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Switch主機圖形處理器超頻設定。"
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"CPU超頻"
Expand Down
15 changes: 3 additions & 12 deletions intl/msg_hash_cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14458,18 +14458,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL,
"Zvýšení Nebo Snížení Jasu Obrazovky."
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"Přetaktování GPU"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Přetaktování nebo podtaktování přepínače grafického procesoru."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"Přetaktování CPU"
Expand Down Expand Up @@ -14557,6 +14546,8 @@ MSG_HASH(
"Chybný konfigurační soubor - nepodařilo se najít APNAME nebo HESLO v %s"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
6 changes: 2 additions & 4 deletions intl/msg_hash_cy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1734,13 +1734,11 @@ MSG_HASH(
MSG_LOCAL,
"Lleol"
)

#ifdef HAVE_LAKKA_SWITCH
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
#endif
#ifdef HAVE_LAKKA
#endif
#ifdef HAVE_LAKKA_SWITCH
#ifdef GEKKO
#endif
#ifdef UDEV_TOUCH_SUPPORT
Expand Down
6 changes: 3 additions & 3 deletions intl/msg_hash_da.h
Original file line number Diff line number Diff line change
Expand Up @@ -1463,12 +1463,12 @@ MSG_HASH(
"Genstart RetroArch"
)

#ifdef HAVE_LAKKA_SWITCH
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
#endif
#ifdef HAVE_LAKKA
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
#endif
#ifdef UDEV_TOUCH_SUPPORT
Expand Down
14 changes: 3 additions & 11 deletions intl/msg_hash_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -14339,17 +14339,7 @@ MSG_HASH(
"Bildschirmhelligkeit erhöhen oder verringern."
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU Übertakten"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Über- oder Untertakten der Switch GPU."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"CPU Übertakten"
Expand Down Expand Up @@ -14445,6 +14435,8 @@ MSG_HASH(
"Falsche Konfigurationsdatei - APNAME oder PASSWORD in %s nicht gefunden"
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
15 changes: 3 additions & 12 deletions intl/msg_hash_el.h
Original file line number Diff line number Diff line change
Expand Up @@ -5554,18 +5554,7 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_BRIGHTNESS_CONTROL,
"Φωτεινότητα Οθόνης"
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"Υπερχρονισμός Κάρτας Γραφικών"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Υπερχρονισμός ή υποχρονισμός της Κάρτας Γραφικών του Switch."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"Υπερχρονισμός Επεξεργαστή"
Expand Down Expand Up @@ -5613,6 +5602,8 @@ MSG_HASH(
"Επιλέξτε τη ζώνη ώρας σας για να προσαρμόσετε την ημερομηνία και την ώρα στην τοποθεσία σας."
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_SCALE,
Expand Down
14 changes: 3 additions & 11 deletions intl/msg_hash_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -2207,17 +2207,7 @@ MSG_HASH(
"Enabling Linux GameMode can improve latency, fix audio crackling issues and maximise overall performance by automatically configuring your CPU and GPU for best performance.\nThe GameMode software needs to be installed for this to work. See https://github.com/FeralInteractive/gamemode for information on how to install GameMode."
)

#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,
"GPU Over-clock"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Over-clock or under-clock the Switch GPU."
)
#endif
#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX)
#ifdef HAVE_LIBNX
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE,
"CPU Over-clock"
Expand All @@ -2233,6 +2223,8 @@ MSG_HASH(
"Displays a list of available time zones. After selecting a time zone, time and date is adjusted to the selected time zone. It assumes, that system/hardware clock is set to UTC."
)
#endif
#ifdef HAVE_LAKKA_SWITCH
#endif
#ifdef GEKKO
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_MOUSE_SCALE,
Expand Down
Loading

0 comments on commit 4387b0a

Please sign in to comment.