From 34cb1cce4ac95e2986e47603742bb134565c199f Mon Sep 17 00:00:00 2001 From: nevrdid Date: Sat, 16 Aug 2025 20:04:26 +0200 Subject: [PATCH 1/3] [Fix & Improve] Starttab - Fix starttab state.json which crashed MainUI after restart trying to access homepage added in fw 1.1.0 - Rework start tab systool to avoid setting a tab which is disabled - Rename values as it is easier to know which tab whe set as default --- Apps/SystemTools/GoTo_SystemTools_List.json | 102 +++++++++++------- .../USER INTERFACE##START TAB (value)/Apps.sh | 4 + .../Bests.sh | 4 + .../Favorite.sh | 4 + .../Netplay.sh | 4 + .../Ports.sh | 4 + .../RecentPlayed.sh | 5 + .../RetroGame.sh | 4 + .../Tab 1.sh | 43 -------- .../Tab 2.sh | 43 -------- .../Tab 3.sh | 20 ---- .../Tab 4.sh | 43 -------- .../Tab 5.sh | 43 -------- .../Tab 6.sh | 43 -------- .../Tab 7.sh | 43 -------- System/etc/crossmix.json | 2 +- System/resources/default_state.json | 37 +++++++ System/starts/start_tab.sh | 10 -- "System/starts/\302\260customization.sh" | 2 +- "System/starts/\302\260post_starts.sh" | 3 + .../usr/trimui/scripts/starttab_switcher.sh | 46 ++++++++ 21 files changed, 179 insertions(+), 330 deletions(-) create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Apps.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Bests.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Favorite.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Netplay.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Ports.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RecentPlayed.sh create mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RetroGame.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 1.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 2.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 3.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 4.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 5.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 6.sh delete mode 100644 Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 7.sh create mode 100644 System/resources/default_state.json delete mode 100644 System/starts/start_tab.sh create mode 100644 System/usr/trimui/scripts/starttab_switcher.sh diff --git a/Apps/SystemTools/GoTo_SystemTools_List.json b/Apps/SystemTools/GoTo_SystemTools_List.json index 46ffbc528..aa7532a5c 100644 --- a/Apps/SystemTools/GoTo_SystemTools_List.json +++ b/Apps/SystemTools/GoTo_SystemTools_List.json @@ -1,41 +1,63 @@ { - "list": [{ - "title": 198, - "type": 0, - "tabidx": 4, - "tabstartidx": 2, - "tabstate": [{ - }, { - "currpos": 0, - "pagestart": 0, - "pageend": 7 - }, { - "currpos": 0, - "pagestart": 0, - "pageend": 7 - }, { - "currpos": 0, - "pagestart": 0, - "pageend": 7 - }, { - "currpos": 0, - "pagestart": 0, - "pageend": 7 - }, { - "currpos": 0, - "pagestart": 0, - "pageend": 7 - }, { - "currpos": 7, - "pagestart": 0, - "pageend": 7 - }] - }, { - "title": -1, - "type": 23, - "currpos": 0, - "pagestart": 0, - "pageend": 7, - "emulaunch": "/mnt/SDCARD/Emus/_SystemTools/launch.sh" - }] -} \ No newline at end of file + "list": [ + { + "title": 206, + "type": 48, + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "title": 206, + "type": 0, + "tabidx": 4, + "tabstartidx": 3, + "tabstate": [ + {}, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, + { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + } + ] + }, + { + "title": -1, + "type": 23, + "currpos": 7, + "pagestart": 0, + "pageend": 7, + "emulaunch": "/mnt/SDCARD/Emus/_SystemTools/launch.sh" + } + ] +} diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Apps.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Apps.sh new file mode 100644 index 000000000..7768a5039 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Apps.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh Apps && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" Apps diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Bests.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Bests.sh new file mode 100644 index 000000000..03e64d236 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Bests.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh Bests && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" Bests diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Favorite.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Favorite.sh new file mode 100644 index 000000000..c81b85500 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Favorite.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh Favorite && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" Favorite diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Netplay.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Netplay.sh new file mode 100644 index 000000000..8f5f918c4 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Netplay.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh Netplay && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" Netplay diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Ports.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Ports.sh new file mode 100644 index 000000000..b9f217444 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Ports.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh Ports && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" Ports diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RecentPlayed.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RecentPlayed.sh new file mode 100644 index 000000000..a5ee867cc --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RecentPlayed.sh @@ -0,0 +1,5 @@ +#!/bin/sh + + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh RecentPlayed && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" RecentPlayed diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RetroGame.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RetroGame.sh new file mode 100644 index 000000000..88f22a6e3 --- /dev/null +++ b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/RetroGame.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh RetroGame && +/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" RetroGame diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 1.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 1.sh deleted file mode 100644 index 835340c73..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 1.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 0, - "tabstartidx": 0 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 2.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 2.sh deleted file mode 100644 index de2aaf2e1..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 2.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 1, - "tabstartidx": 0 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 3.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 3.sh deleted file mode 100644 index e070f1403..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 3.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -rm /mnt/SDCARD/System/starts/start_tab.sh - -/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 4.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 4.sh deleted file mode 100644 index fc1e43e13..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 4.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 3, - "tabstartidx": 2 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 5.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 5.sh deleted file mode 100644 index 2df9e5035..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 5.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 4, - "tabstartidx": 3 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 6.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 6.sh deleted file mode 100644 index 0ffdbd554..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 6.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 5, - "tabstartidx": 4 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 7.sh b/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 7.sh deleted file mode 100644 index 5355eff8a..000000000 --- a/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab 7.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -PATH="/mnt/SDCARD/System/bin:$PATH" -LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" - -silent=false -for arg in "$@"; do - if [ "$arg" = "-s" ]; then - silent=true - break - fi -done - -if [ "$silent" = false ]; then - /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "$(basename "$0" .sh) by default." -fi - -cat >/mnt/SDCARD/System/starts/start_tab.sh <<-EOM -cat > /tmp/state.json <<- EOM2 -{ - "list": [{ - "title": 0, - "type": 0, - "tabidx": 6, - "tabstartidx": 4 - }] -} -EOM2 -EOM - -chmod a+x /mnt/SDCARD/System/starts/start_tab.sh - -# Menu modification to reflect the change immediately - -# update crossmix.json configuration file -script_name=$(basename "$0" .sh) -json_file="/mnt/SDCARD/System/etc/crossmix.json" -if [ ! -f "$json_file" ]; then - echo "{}" >"$json_file" -fi -jq --arg script_name "$script_name" '. += {"START TAB": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" - -# update database of "System Tools" database -/mnt/SDCARD/System/usr/trimui/scripts/mainui_state_update.sh "START TAB" "$script_name" \ No newline at end of file diff --git a/System/etc/crossmix.json b/System/etc/crossmix.json index 8a6f1cd4e..e240aca67 100644 --- a/System/etc/crossmix.json +++ b/System/etc/crossmix.json @@ -5,7 +5,7 @@ "BACKGROUNDS": "Default", "EMULATOR ICONS": "Default", "APP ICONS": "Default", - "START TAB": "Tab 4", + "START TAB": "RetroGame", "LEDS": "Default", "SSH": 1, "TELNET": 0, diff --git a/System/resources/default_state.json b/System/resources/default_state.json new file mode 100644 index 000000000..ef3e87194 --- /dev/null +++ b/System/resources/default_state.json @@ -0,0 +1,37 @@ +{ + "list": [{ + "title": 206, + "type": 48, + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, { + "title": 206, + "type": 0, + "tabidx": 3, + "tabstartidx": 2, + "tabstate": [{ + }, { + "currpos": 0, + "pagestart": 0, + "pageend": 0 + }, { + "currpos": 0, + "pagestart": 0, + "pageend": 2 + }, { + "currpos": 0, + "pagestart": 0, + "pageend": 1 + }, { + "currpos": 0, + "pagestart": 0, + "pageend": 7 + }, { + "currpos": 0, + "pagestart": 0, + "pageend": 7 + }] + } + ] +} diff --git a/System/starts/start_tab.sh b/System/starts/start_tab.sh deleted file mode 100644 index 53c19cb9d..000000000 --- a/System/starts/start_tab.sh +++ /dev/null @@ -1,10 +0,0 @@ -cat > /tmp/state.json <<- EOM2 -{ -"list": [{ -"title": 0, -"type": 0, -"tabidx": 3, -"tabstartidx": 2 -}] -} -EOM2 diff --git "a/System/starts/\302\260customization.sh" "b/System/starts/\302\260customization.sh" index 25417d8f5..74cabfb5c 100644 --- "a/System/starts/\302\260customization.sh" +++ "b/System/starts/\302\260customization.sh" @@ -155,7 +155,7 @@ if [ "$version" != "$FW_patched_version" ]; then # Game tab by default if [ "$CrossMix_Update" = "0" ]; then - "/mnt/SDCARD/Apps/SystemTools/Menu/USER INTERFACE##START TAB (value)/Tab Game.sh" -s + /mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh RetroGame fi # Displaying only Emulators with roms diff --git "a/System/starts/\302\260post_starts.sh" "b/System/starts/\302\260post_starts.sh" index 454a0f9d6..df8bd1aad 100644 --- "a/System/starts/\302\260post_starts.sh" +++ "b/System/starts/\302\260post_starts.sh" @@ -22,6 +22,9 @@ if [ -f /tmp/device_changed ]; then /mnt/SDCARD/System/usr/trimui/scripts/inputd_switcher.sh fi +# Apply default state.json (starttab application) +cp /mnt/SDCARD/System/resources/default_state.json /tmp/state.json + # Swap A B SWAP_AB_enabled=$(/mnt/SDCARD/System/bin/jq -r '.["SWAP A B"]' "/mnt/SDCARD/System/etc/crossmix.json") if [ "$SWAP_AB_enabled" -eq 1 ]; then diff --git a/System/usr/trimui/scripts/starttab_switcher.sh b/System/usr/trimui/scripts/starttab_switcher.sh new file mode 100644 index 000000000..1f0b435a1 --- /dev/null +++ b/System/usr/trimui/scripts/starttab_switcher.sh @@ -0,0 +1,46 @@ +#!/bin/sh +PATH="/mnt/SDCARD/System/bin:$PATH" +LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" + +tabName="$1" +if [ $# -eq 0 ]; then + tabName=$(jq -r '.["START TAB"]' /mnt/SDCARD/System/etc/crossmix.json) +else + /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Setting $tabName as start tab." +fi + +# Get the tab id or check if disabled/unknown +tabN=$(awk -v tabName="$tabName" ' +BEGIN {tabName=tolower(tabName)} +$0 ~ /tab/ && !($0 ~ /focuson/) { + count++; + if ( $0 ~ tabName) { + if ($2 ~ 0 ) { + print 0 + } else { + print count + } + exit + } +} +' /mnt/UDISK/system.json) +if [ -z "$tabN" ] || [ "$tabN" -lt 1 ]; then + /mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Start tab is disabled." + exit 1 +fi + +tabN=$((tabN - 1)) +tab0=0 + +[ "$tabN" -gt 2 ] && tab0=$((tabN - 2)) + +jq ".[].[1].tabidx = $tabN | .[].[1].tabstartidx = $tab0" /mnt/SDCARD/System/resources/default_state.json >/tmp/tmp.json +mv /tmp/tmp.json /mnt/SDCARD/System/resources/default_state.json + +# update crossmix.json configuration file +json_file="/mnt/SDCARD/System/etc/crossmix.json" +if [ ! -f "$json_file" ]; then + echo "{}" >"$json_file" +fi + +jq --arg tabName "$tabName" '. += {"START TAB": $tabName}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" From 77e7ed8fe135b888b6da77ab4d0454ca6b2dbb8e Mon Sep 17 00:00:00 2001 From: nevrdid Date: Sat, 16 Aug 2025 22:17:31 +0200 Subject: [PATCH 2/3] Fix starting on wrong tab when bests/ports tabs are missing --- "System/starts/\302\260post_starts.sh" | 2 +- System/usr/trimui/scripts/starttab_switcher.sh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git "a/System/starts/\302\260post_starts.sh" "b/System/starts/\302\260post_starts.sh" index df8bd1aad..021e23d3a 100644 --- "a/System/starts/\302\260post_starts.sh" +++ "b/System/starts/\302\260post_starts.sh" @@ -23,7 +23,7 @@ if [ -f /tmp/device_changed ]; then fi # Apply default state.json (starttab application) -cp /mnt/SDCARD/System/resources/default_state.json /tmp/state.json +/mnt/SDCARD/System/usr/trimui/scripts/starttab_switcher.sh # Swap A B SWAP_AB_enabled=$(/mnt/SDCARD/System/bin/jq -r '.["SWAP A B"]' "/mnt/SDCARD/System/etc/crossmix.json") diff --git a/System/usr/trimui/scripts/starttab_switcher.sh b/System/usr/trimui/scripts/starttab_switcher.sh index 1f0b435a1..16841b2fc 100644 --- a/System/usr/trimui/scripts/starttab_switcher.sh +++ b/System/usr/trimui/scripts/starttab_switcher.sh @@ -10,10 +10,17 @@ else fi # Get the tab id or check if disabled/unknown -tabN=$(awk -v tabName="$tabName" ' + +bests="$(find /mnt/SDCARD/Best -maxdepth 2 -type f -name launch.sh | wc -l )"; +ports="$(find /mnt/SDCARD/Ports -maxdepth 2 -type f -name launch.sh | wc -l )"; + +tabN=$(awk -v tabName="$tabName" -v ignore_bests=$((!bests)) -v ignore_ports=$((!ports)) ' BEGIN {tabName=tolower(tabName)} $0 ~ /tab/ && !($0 ~ /focuson/) { - count++; + if ((ignore_ports && $0 ~ /portstab/) || (ignore_bests && $0 ~ /beststab/)){ + next + } + count++ if ( $0 ~ tabName) { if ($2 ~ 0 ) { print 0 @@ -35,7 +42,10 @@ tab0=0 [ "$tabN" -gt 2 ] && tab0=$((tabN - 2)) jq ".[].[1].tabidx = $tabN | .[].[1].tabstartidx = $tab0" /mnt/SDCARD/System/resources/default_state.json >/tmp/tmp.json -mv /tmp/tmp.json /mnt/SDCARD/System/resources/default_state.json +mv /tmp/tmp.json /mnt/SDCARD/System/resources/start_state.json +if [ $# -eq 0 ]; then + cp /mnt/SDCARD/System/resources/start_state.json /tmp/state.json +fi # update crossmix.json configuration file json_file="/mnt/SDCARD/System/etc/crossmix.json" From f0c7f7ca38913939094eafa51a1419bdf285700e Mon Sep 17 00:00:00 2001 From: nevrdid Date: Sat, 16 Aug 2025 22:33:24 +0200 Subject: [PATCH 3/3] Fix disabled tabs are no more present in state.json so we must skip them --- .../usr/trimui/scripts/starttab_switcher.sh | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/System/usr/trimui/scripts/starttab_switcher.sh b/System/usr/trimui/scripts/starttab_switcher.sh index 16841b2fc..4d7b6494f 100644 --- a/System/usr/trimui/scripts/starttab_switcher.sh +++ b/System/usr/trimui/scripts/starttab_switcher.sh @@ -11,8 +11,8 @@ fi # Get the tab id or check if disabled/unknown -bests="$(find /mnt/SDCARD/Best -maxdepth 2 -type f -name launch.sh | wc -l )"; -ports="$(find /mnt/SDCARD/Ports -maxdepth 2 -type f -name launch.sh | wc -l )"; +bests="$(find /mnt/SDCARD/Best -maxdepth 2 -type f -name launch.sh | wc -l)" +ports="$(find /mnt/SDCARD/Ports -maxdepth 2 -type f -name launch.sh | wc -l)" tabN=$(awk -v tabName="$tabName" -v ignore_bests=$((!bests)) -v ignore_ports=$((!ports)) ' BEGIN {tabName=tolower(tabName)} @@ -20,14 +20,18 @@ $0 ~ /tab/ && !($0 ~ /focuson/) { if ((ignore_ports && $0 ~ /portstab/) || (ignore_bests && $0 ~ /beststab/)){ next } - count++ - if ( $0 ~ tabName) { - if ($2 ~ 0 ) { - print 0 - } else { + if ( $2 ~ 1) { + count++ + if ($0 ~ tabName) { print count + exit + } + } + else { + if ($0 ~ tabName) { + print 0 + exit } - exit } } ' /mnt/UDISK/system.json)