Skip to content

Commit b59a560

Browse files
committed
Merge branch 'Development' into AnythingButThat
2 parents 6279a46 + 4eb9f01 commit b59a560

File tree

180 files changed

+628
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+628
-370
lines changed

.github/workflows/create-release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
required: true
99
default: 'Development'
1010
type: string
11+
publish:
12+
description: 'Update OTA files immediately'
13+
required: true
14+
default: 'false'
15+
type: boolean
1116

1217
jobs:
1318
create-release:
@@ -123,7 +128,8 @@ jobs:
123128
prerelease: true
124129

125130
- name: Update OTA files
126-
if: success()
131+
# Only run this step if the release is published immediately
132+
if: success() && github.event.inputs.publish == 'true'
127133
env:
128134
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
129135
run: |
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Update OTA on Release Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Release version to update OTA for (without v prefix)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
update-ota:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Set version
20+
run: |
21+
if [ -n "${{ github.event.inputs.version }}" ]; then
22+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
23+
else
24+
VERSION=${GITHUB_REF#refs/tags/v}
25+
echo "VERSION=$VERSION" >> $GITHUB_ENV
26+
fi
27+
28+
- name: Download release asset
29+
env:
30+
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
31+
run: |
32+
gh release download "v${VERSION}" -p "*.7z"
33+
34+
- name: Update OTA files
35+
env:
36+
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
37+
run: |
38+
# Clone both repositories
39+
git clone https://github.com/spruceUI/spruceui.github.io.git ota_repo
40+
git clone https://github.com/spruceUI/spruceSource.git mirror_repo
41+
42+
# Get version from tag
43+
VERSION=${GITHUB_REF#refs/tags/v}
44+
45+
# Calculate file info
46+
CHECKSUM=$(md5sum "spruceV${VERSION}.7z" | cut -d' ' -f1)
47+
SIZE_MB=$(ls -l --block-size=1M "spruceV${VERSION}.7z" | awk '{print $5}')
48+
49+
# Function to update OTA file
50+
update_ota_file() {
51+
local file="$1"
52+
local content
53+
content=$(cat "$file")
54+
55+
echo "$content" | grep -v "^RELEASE_" > "$file"
56+
echo "RELEASE_VERSION=${VERSION}" >> "$file"
57+
echo "RELEASE_CHECKSUM=$CHECKSUM" >> "$file"
58+
echo "RELEASE_SIZE_IN_MB=$SIZE_MB" >> "$file"
59+
echo "RELEASE_LINK=https://github.com/spruceUI/spruceOS/releases/download/v${VERSION}/spruceV${VERSION}.7z" >> "$file"
60+
echo "RELEASE_INFO=https://github.com/spruceUI/spruceOS/releases/tag/v${VERSION}" >> "$file"
61+
}
62+
63+
# Update main OTA file
64+
update_ota_file "ota_repo/OTA/spruce"
65+
66+
# Update mirror OTA file
67+
update_ota_file "mirror_repo/OTA/spruce"
68+
69+
# Push changes to main repo
70+
cd ota_repo
71+
git config user.name "GitHub Actions Bot"
72+
git config user.email "[email protected]"
73+
git add OTA/spruce
74+
git commit -m "Update release to ${VERSION}"
75+
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/spruceUI/spruceui.github.io.git main
76+
77+
# Push changes to mirror repo
78+
cd ../mirror_repo
79+
git config user.name "GitHub Actions Bot"
80+
git config user.email "[email protected]"
81+
git add OTA/spruce
82+
git commit -m "Update release to ${VERSION}"
83+
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/spruceUI/spruceSource.git main

App/spruceRestore/UpgradeScripts/3.3.0.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ update_file "/mnt/SDCARD/.config/ppsspp/PSP/SYSTEM/controls.ini" \
8383
"Hold = 10-4"
8484

8585
if setting_get "runGSAtBoot"; then
86-
update_file "/mnt/SDCARD/spruce/settings/spruce.cfg" "boot_to=Game Switcher"
86+
setting_update "boot_to" "Switcher"
8787
fi
8888

8989
# -------------------- ADDITIONAL UPGRADE STEPS --------------------
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/sh
2+
3+
# -------------------- UPGRADE SCRIPT TEMPLATE --------------------
4+
# Instructions:
5+
# 1. Set the TARGET_VERSION to the version you're upgrading to.
6+
# 2. Add your file updates in the designated section using the update_file function.
7+
# 3. Ensure all paths are correct for your specific upgrade scenario.
8+
# 4. Add any additional upgrade steps as needed.
9+
10+
# Define the target version for this upgrade script
11+
TARGET_VERSION="3.3.1" # Replace X.Y.Z with your target version number
12+
13+
/mnt/SDCARD/spruce/scripts/helperFunctions.sh
14+
15+
# Source the helper functions
16+
HELPER_FUNCTIONS="/mnt/SDCARD/spruce/scripts/helperFunctions.sh"
17+
if [ -f "$HELPER_FUNCTIONS" ]; then
18+
. "$HELPER_FUNCTIONS"
19+
else
20+
echo "Error: helperFunctions.sh not found, cannot proceed with the upgrade"
21+
exit 1
22+
fi
23+
24+
# Function to update specific settings in a file
25+
# Usage: update_file "file_path" "setting1=value1" "setting2=value2" ...
26+
update_file() {
27+
file="$1"
28+
shift
29+
30+
for setting in "$@"; do
31+
if grep -q "${setting%%=*}" "$file"; then
32+
sed -i "s|^${setting%%=*}.*|$setting|" "$file"
33+
else
34+
echo "$setting" >> "$file"
35+
fi
36+
done
37+
38+
log_message "Updated $file"
39+
}
40+
41+
# Function to update launch paths in JSON files
42+
update_launch_paths() {
43+
input_file="$1"
44+
if [ -f "$input_file" ]; then
45+
# Create a temporary file
46+
TEMP_FILE="${input_file}.tmp"
47+
48+
# Process the file line by line
49+
while IFS= read -r line; do
50+
# Check if line contains old launch path pattern
51+
if echo "$line" | grep -q '"/mnt/SDCARD/Emu/.*/launch.sh"'; then
52+
# Replace the launch path pattern
53+
echo "$line" | sed 's|/launch.sh"|/../.emu_setup/standard_launch.sh"|' >> "$TEMP_FILE"
54+
else
55+
echo "$line" >> "$TEMP_FILE"
56+
fi
57+
done < "$input_file"
58+
59+
# Replace original file with updated content
60+
mv "$TEMP_FILE" "$input_file"
61+
log_message "Updated launch paths in $(basename "$input_file")"
62+
fi
63+
}
64+
65+
# Main execution
66+
log_message "Starting upgrade to version $TARGET_VERSION"
67+
68+
# -------------------- FILE UPDATES --------------------
69+
# Remove boot_to=Game Switcher if it exists, this is to fix a bad migration for a few early adopters
70+
CONFIG_FILE="/mnt/SDCARD/spruce/settings/spruce.cfg"
71+
if [ -f "$CONFIG_FILE" ]; then
72+
sed -i '/^boot_to=Game Switcher$/d' "$CONFIG_FILE"
73+
log_message "Removed boot_to=Game Switcher from spruce.cfg if it existed"
74+
fi
75+
76+
77+
FAVOURITE_FILE="/mnt/SDCARD/Roms/favourite.json"
78+
RECENT_FILE="/mnt/SDCARD/Roms/recentlist.json"
79+
80+
# Update launch paths in favourite.json and recentlist.json if they exist
81+
update_launch_paths "$FAVOURITE_FILE"
82+
update_launch_paths "$RECENT_FILE"
83+
84+
85+
# update launch paths in Game Switcher list if necessary
86+
GS_LIST="/mnt/SDCARD/spruce/settings/gs_list"
87+
sed -i "s|/launch.sh|/../.emu_setup/standard_launch.sh|g" "$GS_LIST"
88+
89+
# -------------------- ADDITIONAL UPGRADE STEPS --------------------
90+
91+
92+
# -------------------- UPGRADE COMPLETION --------------------
93+
# Check if the update was successful
94+
if [ $? -eq 0 ]; then
95+
log_message "Upgrade to version $TARGET_VERSION completed successfully"
96+
exit 0
97+
else
98+
log_message "Error: Upgrade to version $TARGET_VERSION failed"
99+
exit 1
100+
fi

Emu/-CUSTOM-SYSTEM-/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"extlist": "file|ext|ens|ions|sep|arat|ed|by|pipes|with|no|dots",
1313
"launchlist": [
1414
{
15-
"name": "Add to Favorites",
16-
"launch": "/mnt/SDCARD/Emu/.emu_setup/add_favourite.sh"
15+
"name": "Add/Remove Favorite",
16+
"launch": "/mnt/SDCARD/Emu/.emu_setup/toggle_favourite.sh"
1717
},
1818
{
1919
"name": "Jump to random Custom System game",

Emu/-CUSTOM-SYSTEM-/config.json.simple

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"extlist": "file|ext|ens|ions|sep|arat|ed|by|pipes|with|no|dots",
1313
"launchlist": [
1414
{
15-
"name": "Add to Favorites",
16-
"launch": "/mnt/SDCARD/Emu/.emu_setup/add_favourite.sh"
15+
"name": "Add/Remove Favorite",
16+
"launch": "/mnt/SDCARD/Emu/.emu_setup/toggle_favourite.sh"
1717
},
1818
{
1919
"name": "Jump to random Custom System game",

Emu/.emu_setup/add_favourite.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

Emu/.emu_setup/toggle_favourite.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh
2+
3+
. /mnt/SDCARD/spruce/scripts/helperFunctions.sh
4+
5+
##### DEFINE BASE VARIABLES #####
6+
7+
FAVOURITE_FILE="/mnt/SDCARD/Roms/favourite.json"
8+
EMU_NAME="$(echo "$1" | cut -d'/' -f5)"
9+
ROMFILENAME="$(basename "$1")"
10+
GAMELIST_FILE="/mnt/SDCARD/Roms/$EMU_NAME/miyoogamelist.xml"
11+
ROM_PATH="$1"
12+
BG="/mnt/SDCARD/spruce/imgs/bg_tree.png"
13+
14+
# Get game name first - we'll need it either way
15+
if [ -f "$GAMELIST_FILE" ]; then
16+
# Extract filename without path and extension for matching
17+
ROM_PATH_MATCH="./$(basename "$ROMFILENAME")"
18+
# Use grep to find the game entry and extract the name, and trim whitespace
19+
GAMENAME=$(grep -A 2 "<path>$ROM_PATH_MATCH</path>" "$GAMELIST_FILE" | grep "<name>" | sed 's/<name>\(.*\)<\/name>/\1/' | sed 's/^[ \t]*//;s/[ \t]*$//')
20+
# If no name found in gamelist, fall back to filename
21+
if [ -z "$GAMENAME" ]; then
22+
GAMENAME="$(echo "$ROMFILENAME" | cut -d'.' -f1)"
23+
fi
24+
else
25+
GAMENAME="$(echo "$ROMFILENAME" | cut -d'.' -f1)"
26+
fi
27+
28+
# Check if ROM is already in favourites
29+
if grep -q "\"rompath\":\"$ROM_PATH\"" "$FAVOURITE_FILE"; then
30+
# Create a temporary file without the matching entry
31+
grep -v "\"rompath\":\"$ROM_PATH\"" "$FAVOURITE_FILE" > "$FAVOURITE_FILE.tmp"
32+
# Replace the original file
33+
mv "$FAVOURITE_FILE.tmp" "$FAVOURITE_FILE"
34+
log_message "Removed $GAMENAME from favourite.json via X menu"
35+
display -i "$BG" -t "$GAMENAME removed from favorites" -d 2
36+
else
37+
log_message "Added $GAMENAME ($EMU_NAME) to favourite.json via X menu"
38+
39+
# Construct the new JSON entry
40+
NEW_ENTRY=$(jq -n \
41+
--arg label "$GAMENAME ($EMU_NAME)" \
42+
--arg launch "/mnt/SDCARD/Emu/$EMU_NAME/../.emu_setup/standard_launch.sh" \
43+
--arg rompath "$ROM_PATH" \
44+
--argjson type "5" \
45+
'{label: $label, launch: $launch, rompath: $rompath, type: $type}')
46+
47+
# Append new json formatted entry to favourite file
48+
echo "$NEW_ENTRY" >> "$FAVOURITE_FILE"
49+
display -i "$BG" -t "$GAMENAME added to favorites" -d 2
50+
fi
51+

Emu/AMIGA/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"extlist": "zip|7z|adf|adz|dms|fdi|ipf|hdf|hdz|lha|slave|info|cue|ccd|nrg|mds|iso|chd|uae|m3u|rp9",
1717
"launchlist": [
1818
{
19-
"name": "Add to Favorites",
20-
"launch": "/mnt/SDCARD/Emu/.emu_setup/add_favourite.sh"
19+
"name": "Add/Remove Favorite",
20+
"launch": "/mnt/SDCARD/Emu/.emu_setup/toggle_favourite.sh"
2121
},
2222
{
2323
"name": "Jump to random Amiga game",

Emu/AMIGA/config.json.simple

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"extlist": "zip|7z|adf|adz|dms|fdi|ipf|hdf|hdz|lha|slave|info|cue|ccd|nrg|mds|iso|chd|uae|m3u|rp9",
1717
"launchlist": [
1818
{
19-
"name": "Add to Favorites",
20-
"launch": "/mnt/SDCARD/Emu/.emu_setup/add_favourite.sh"
19+
"name": "Add/Remove Favorite",
20+
"launch": "/mnt/SDCARD/Emu/.emu_setup/toggle_favourite.sh"
2121
},
2222
{
2323
"name": "Jump to random Amiga game",

0 commit comments

Comments
 (0)