diff --git a/src/common/system/settings.h b/src/common/system/settings.h index 135d6f57f..585dbce4f 100644 --- a/src/common/system/settings.h +++ b/src/common/system/settings.h @@ -51,6 +51,7 @@ typedef struct settings_s { int ingame_long_press; int ingame_double_press; bool disable_standby; + bool swap_abxy; char mainui_button_x[JSON_STRING_LEN]; char mainui_button_y[JSON_STRING_LEN]; @@ -96,6 +97,7 @@ static settings_s __default_settings = (settings_s){ .ingame_long_press = 2, .ingame_double_press = 3, .disable_standby = false, + .swap_abxy = false, .mainui_button_x = "", .mainui_button_y = ""}; @@ -174,7 +176,7 @@ void settings_load(void) settings.low_battery_autosave = !config_flag_get(".noLowBatteryAutoSave"); settings.mute = config_flag_get(".muteVolume"); settings.disable_standby = config_flag_get(".disableStandby"); - + settings.swap_abxy = config_flag_get(".swapABXY"); if (config_flag_get(".noBatteryWarning")) // flag is deprecated, but keep compatibility settings.low_battery_warn_at = 0; @@ -300,6 +302,7 @@ void settings_save(void) config_flag_set(".noLowBatteryAutoSave", !settings.low_battery_autosave); config_flag_set(".muteVolume", settings.mute); config_flag_set(".disableStandby", settings.disable_standby); + config_flag_set(".swapABXY", settings.swap_abxy); config_setNumber("battery/warnAt", settings.low_battery_warn_at); config_setNumber("startup/app", settings.startup_application); config_setNumber("startup/addHours", settings.time_skip); diff --git a/src/tweaks/actions.h b/src/tweaks/actions.h index 270d3fb45..568c23bef 100644 --- a/src/tweaks/actions.h +++ b/src/tweaks/actions.h @@ -84,6 +84,11 @@ void action_setDisableStandby(void *pt) settings.disable_standby = ((ListItem *)pt)->value == 1; } +void action_swapABXY(void *pt) +{ + settings.swap_abxy = ((ListItem *)pt)->value == 1; +} + void action_setMenuButtonHaptics(void *pt) { settings.menu_button_haptics = ((ListItem *)pt)->value == 1; diff --git a/src/tweaks/menus.h b/src/tweaks/menus.h index 5d9e219f3..0438cf3a7 100644 --- a/src/tweaks/menus.h +++ b/src/tweaks/menus.h @@ -270,7 +270,7 @@ void menu_buttonActionInGameMenu(void *_) void menu_buttonAction(void *_) { if (!_menu_button_action._created) { - _menu_button_action = list_create(6, LIST_SMALL); + _menu_button_action = list_create(7, LIST_SMALL); strcpy(_menu_button_action.title, "Button shortcuts"); list_addItem(&_menu_button_action, (ListItem){ @@ -306,6 +306,12 @@ void menu_buttonAction(void *_) .value_formatter = formatter_appShortcut, .action_id = 1, .action = action_setAppShortcut}); + list_addItem(&_menu_button_action, + (ListItem){ + .label = "MainUI: Swap A/B and X/Y", + .item_type = TOGGLE, + .value = (int)settings.swap_abxy, + .action = action_swapABXY}); list_addItem(&_menu_button_action, (ListItem){ .label = "Power single press", diff --git a/static/build/.tmp_update/bin/MainUI-283-clean b/static/build/.tmp_update/bin/MainUI-283-clean index f8020af9c..84f34b3bf 100644 Binary files a/static/build/.tmp_update/bin/MainUI-283-clean and b/static/build/.tmp_update/bin/MainUI-283-clean differ diff --git a/static/build/.tmp_update/bin/MainUI-283-clean-abxy b/static/build/.tmp_update/bin/MainUI-283-clean-abxy new file mode 100644 index 000000000..2a00a06c2 Binary files /dev/null and b/static/build/.tmp_update/bin/MainUI-283-clean-abxy differ diff --git a/static/build/.tmp_update/bin/MainUI-283-expert b/static/build/.tmp_update/bin/MainUI-283-expert index 58907630b..0cdc185d7 100644 Binary files a/static/build/.tmp_update/bin/MainUI-283-expert and b/static/build/.tmp_update/bin/MainUI-283-expert differ diff --git a/static/build/.tmp_update/bin/MainUI-283-expert-abxy b/static/build/.tmp_update/bin/MainUI-283-expert-abxy new file mode 100644 index 000000000..5021650cb Binary files /dev/null and b/static/build/.tmp_update/bin/MainUI-283-expert-abxy differ diff --git a/static/build/.tmp_update/bin/MainUI-354-clean-abxy b/static/build/.tmp_update/bin/MainUI-354-clean-abxy new file mode 100644 index 000000000..a53f1118f Binary files /dev/null and b/static/build/.tmp_update/bin/MainUI-354-clean-abxy differ diff --git a/static/build/.tmp_update/bin/MainUI-354-expert-abxy b/static/build/.tmp_update/bin/MainUI-354-expert-abxy new file mode 100644 index 000000000..ccbcaba07 Binary files /dev/null and b/static/build/.tmp_update/bin/MainUI-354-expert-abxy differ diff --git a/static/build/.tmp_update/runtime.sh b/static/build/.tmp_update/runtime.sh index ef7801c68..bc27c1eca 100644 --- a/static/build/.tmp_update/runtime.sh +++ b/static/build/.tmp_update/runtime.sh @@ -426,6 +426,7 @@ mainui_target=$miyoodir/app/MainUI mount_main_ui() { mainui_mode=$([ -f $sysdir/config/.showExpert ] && echo "expert" || echo "clean") + [ -f $sysdir/config/.swapABXY ] && mainui_mode="${mainui_mode}-abxy" mainui_srcname="MainUI-$DEVICE_ID-$mainui_mode" mainui_mount=$(basename "$(cat /proc/self/mountinfo | grep $mainui_target | cut -d' ' -f4)") @@ -437,7 +438,7 @@ mount_main_ui() { if [ ! -f $mainui_target ]; then touch $mainui_target fi - + mount -o bind "$sysdir/bin/$mainui_srcname" $mainui_target fi }