Merge branch 'cooker' into feat/shadps4

This commit is contained in:
XargonWan 2024-09-23 21:46:33 +09:00
commit 8f2c6e7241
14 changed files with 17263 additions and 54 deletions

View file

@ -28,3 +28,4 @@ hash^RETRODECKSHADPS4LATESTSTABLE^https://github.com/shadps4-emu/shadPS4/release
#This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash.
#latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt
hash^PORTMASTERLATESTSHA^https://github.com/PortsMaster/PortMaster-GUI/releases/latest/download/retrodeck.portmaster.zip

View file

@ -620,6 +620,9 @@
"pokemini": {
"name": "Nintendo Pokémon Mini"
},
"portmaster": {
"name": "PortMaster"
},
"ports": {
"name": "Ports"
},
@ -963,8 +966,7 @@
"system": [
"arcade"
],
"launch": "mame",
"launch-args": "-inipath /var/config/mame/ini -rompath $(dirname \"$game\") $game"
"launch": "mame"
},
"citra": {
"description": "Citra Nintendo 3DS Emulator (via Ponzu)",
@ -1000,7 +1002,6 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/",
"system": "ps2",
"launch": "pcsx2-qt",
"launch-args": "-batch $game",
"properties": [
{
"ask_to_exit": true,
@ -1013,7 +1014,6 @@
"description": "PlayStation Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/",
"launch": "duckstation-qt",
"launch-args": "-batch $game",
"system": "psx",
"properties": [
{
@ -1040,8 +1040,7 @@
"description": "Vita3K PSVita Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/",
"system": "psvita",
"launch": "Vita3K",
"launch-args": "-r $game.psvita"
"launch": "Vita3K"
},
"rpcs3": {
"name": "RPCS3",
@ -1069,7 +1068,6 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
"launch": "Yuzu",
"system": "switch",
"launch-args": "-f -g $game",
"ponzu": true,
"abxy_button": true
},
@ -1084,7 +1082,6 @@
"description": "Dolphin Wii and GameCube Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "dolphin-emu-wrapper",
"launch-args": "-e $game",
"system": [
"gc",
"wii"
@ -1104,7 +1101,6 @@
"description": "A fork of Dolphiin to enhance Metroid Prime experience",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "primehack-wrapper",
"launch-args": "-e $game",
"system": [
"wii"
],
@ -1121,7 +1117,6 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/cemu/cemu-guide/",
"system": "wiiu",
"launch": "Cemu-wrapper",
"launch-args": "-g $game",
"properties": [
{
"abxy_button": true,
@ -1134,14 +1129,19 @@
"name": "xemu",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/xemu/xemu-guide/",
"system": "xbox",
"launch": "xemu",
"launch-args": "-dvd_path $game"
"launch": "xemu"
},
"es-de": {
"description": "ES-DE Emulation Frontend",
"name": "ES-DE",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_es_de/esde-guide/.",
"launch": "es-de"
},
"portmaster": {
"description": "PortMaster",
"name": "PortMaster",
"system": "portmaster",
"launch": "PortMaster"
}
}
}

View file

@ -0,0 +1,36 @@
#!/bin/bash
# List of branches to pull and merge
branches=(
"cooker"
"feat/shadps4"
"feat/PortMaster"
"feat/steam-rom-manager"
)
# Get the current branch name
current_branch=$(git branch --show-current)
# Check if the current branch contains 'feat/' and 'okonomiyaki'
if [[ $current_branch == feat/* && $current_branch == *okonomiyaki* ]]; then
echo "Current branch is $current_branch, proceeding with fetch, pull, and merge."
# Iterate through the list of branches
for branch in "${branches[@]}"; do
echo "Fetching $branch..."
git fetch origin $branch
echo "Pulling $branch..."
git pull origin $branch
echo "Merging $branch into $current_branch..."
if ! git merge origin/$branch; then
echo "Merge conflict detected while merging $branch!"
echo "Please resolve the conflict, then run 'git merge --continue' to finish the merge."
exit 1 # Exit the script due to conflict
fi
done
else
echo "Current branch is not an okonomiyaki branch, quitting."
exit 1
fi

View file

@ -0,0 +1,25 @@
#!/bin/bash
# A pre-commit hook to lint features.json if it is edited
# Check if any path contains 'features.json'
if git diff --cached --name-only | grep -q 'config/retrodeck/reference_lists/features.json'; then
# Run the linting script
echo "Linting config/retrodeck/reference_lists/features.json..."
if ! bash developer_toolbox/lint_features.json.sh; then
echo "Linting failed. Please fix the issues and try again."
exit 1 # Exit with a non-zero status to block the commit
fi
fi
# Lint Manifest
# if git diff --cached --name-only | grep -q 'net.retrodeck.retrodeck.yml'; then
# # Run the linting script
# echo "Linting net.retrodeck.retrodeck.yml..."
# if ! bash developer_toolbox/lint_manifest.sh; then
# echo "Linting failed. Please fix the issues and try again."
# exit 1 # Exit with a non-zero status to block the commit
# fi
# fi
# Continue with the commit if all checks passed
exit 0

View file

@ -0,0 +1,4 @@
#!/bin/bash
mkdir -p .git/hooks
cp -f developer_toolbox/hooks/* .git/hooks

View file

@ -0,0 +1,3 @@
#!/bin/bash
yamllint net.retrodeck.retrodeck.yml

View file

@ -18,6 +18,7 @@ source /app/libexec/post_update.sh
source /app/libexec/prepare_component.sh
source /app/libexec/presets.sh
source /app/libexec/configurator_functions.sh
source /app/libexec/run_game.sh
# Static variables
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
@ -36,7 +37,7 @@ default_splash_file="/var/config/ES-DE/resources/graphics/splash-orig.svg"
multi_user_emulator_config_dirs="$config/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg" # A list of emulator config folders that can be safely linked/unlinked entirely in multi-user mode
rd_es_themes="/app/share/es-de/themes" # The directory where themes packaged with RetroDECK are stored
lockfile="/var/config/retrodeck/.lock" # Where the lockfile is located
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path # A static location for RetroDECK logs to be written
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
rd_repo="https://github.com/RetroDECK/RetroDECK" # The URL of the main RetroDECK GitHub repo
es_themes_list="https://gitlab.com/es-de/themes/themes-list/-/raw/master/themes.json" # The URL of the ES-DE 2.0 themes list
@ -45,13 +46,15 @@ remote_network_target_2="$rd_repo"
remote_network_target_3="https://one.one.one.one" # The URL of a common internet target for testing network access
helper_files_folder="$config/retrodeck/helper_files" # The parent folder of RetroDECK documentation files for deployment
rd_appdata="/app/share/appdata/net.retrodeck.retrodeck.appdata.xml" # The shipped appdata XML file for this version
rpcs3_firmware="http://dus01.ps3.update.playstation.net/update/ps3/image/us/2024_0227_3694eb3fb8d9915c112e6ab41a60c69f/PS3UPDAT.PUP"
rpcs3_firmware="http://dus01.ps3.update.playstation.net/update/ps3/image/us/2024_0227_3694eb3fb8d9915c112e6ab41a60c69f/PS3UPDAT.PUP" # RPCS3 Firmware download location
RA_API_URL="https://retroachievements.org/dorequest.php" # API URL for RetroAchievements.org
presets_dir="$config/retrodeck/presets" # Repository for all system preset config files
git_organization_name="RetroDECK" # The name of the organization in our git repository such as GitHub
cooker_repository_name="Cooker" # The name of the cooker repository under RetroDECK organization
main_repository_name="RetroDECK" # The name of the main repository under RetroDECK organization
features="$config/retrodeck/reference_lists/features.json" # A file where all the RetroDECK and component capabilities are kept for querying
es_systems="/app/share/es-de/resources/systems/linux/es_systems.xml" # ES-DE supported system list
es_find_rules="/app/share/es-de/resources/systems/linux/es_find_rules.xml" # ES-DE emulator find rules
# Godot data transfer temp files
@ -81,6 +84,7 @@ es_source_logs="/var/config/ES-DE/logs"
raconf="/var/config/retroarch/retroarch.cfg"
ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg"
ra_scummvm_conf="/var/config/retroarch/system/scummvm.ini"
ra_cores_path="/var/config/retroarch/cores"
# CEMU config files

View file

@ -775,6 +775,15 @@ ponzu_remove() {
}
release_selector() {
# Show a progress bar
(
while true; do
echo "# Fetching all available releases from GitHub repositories... Please wait. This may take some time." ; sleep 1
done
) | zenity --progress --title="Fetching Releases" --text="Fetching releases..." --pulsate --no-cancel --auto-close --width=500 --height=150 &
progress_pid=$! # save process PID to kill it later
log d "Fetching releases from GitHub API for repository $cooker_repository_name"
# Fetch the main release from the RetroDECK repository
@ -783,6 +792,7 @@ release_selector() {
if [[ -z "$main_release" ]]; then
log e "Failed to fetch the main release"
kill $progress_pid # kill the progress bar
configurator_generic_dialog "Error" "Unable to fetch the main release. Please check your network connection or try again later."
return 1
fi
@ -796,11 +806,12 @@ release_selector() {
# Add the main release as the first entry in the release array
local release_array=("Main Release" "$main_tag_name" "$main_human_readable_date")
# Fetch all releases from the Cooker repository
local releases=$(curl -s https://api.github.com/repos/$git_organization_name/$cooker_repository_name/releases)
# Fetch all releases (including draft and pre-release) from the Cooker repository
local releases=$(curl -s https://api.github.com/repos/$git_organization_name/$cooker_repository_name/releases?per_page=100)
if [[ -z "$releases" ]]; then
log e "Failed to fetch releases or no releases available"
kill $progress_pid # kill the progress bar
configurator_generic_dialog "Error" "Unable to fetch releases. Please check your network connection or try again later."
return 1
fi
@ -809,15 +820,37 @@ release_selector() {
while IFS= read -r release; do
tag_name=$(echo "$release" | jq -r '.tag_name')
published_at=$(echo "$release" | jq -r '.published_at')
draft=$(echo "$release" | jq -r '.draft')
prerelease=$(echo "$release" | jq -r '.prerelease')
# Convert published_at to human-readable format
# Classifying releases
if echo "$tag_name" | grep -q "PR"; then
status="Pull Request"
elif [[ "$draft" == "true" ]]; then
status="Draft"
elif [[ "$prerelease" == "true" ]]; then
status="Pre-release"
elif [[ "$cooker_repository_name" == *"Cooker"* ]]; then
status="Cooker"
else
status="Main"
fi
# Convert published_at to human-readable format, if available
if [[ "$published_at" != "null" ]]; then
human_readable_date=$(date -d "$published_at" +"%d %B %Y %H:%M")
else
human_readable_date="Not published"
fi
# Ensure fields are properly aligned for Zenity
release_array+=("Cooker Channel" "$tag_name" "$human_readable_date")
release_array+=("$status" "$tag_name" "$human_readable_date")
done < <(echo "$releases" | jq -c '.[]' | sort -t: -k3,3r)
# kill the progress bar before opening the release list window
kill $progress_pid
if [[ ${#release_array[@]} -eq 0 ]]; then
configurator_generic_dialog "RetroDECK Updater" "No available releases found, exiting."
log d "No available releases found"

View file

@ -433,7 +433,9 @@ post_update() {
# Placeholder for version 0.9.0b
set_setting_value "$raconf" "libretro_info_path" "/var/config/retroarch/cores" "retroarch"
prepare_component "reset" "shadps4"
# TODO: Configurator dialog: Hey, we need to reset ES-DE! (because again ES-DE folders, new theme and such)
prepare_component "reset" "es-de"
prepare_component "reset" "portmaster"
prepare_component "reset" "ruffle"
prepare_component "reset" "shadps4"
update_rd_conf

View file

@ -857,7 +857,7 @@ prepare_component() {
sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON
fi
if [[ "$component" =~ ^(gzdoom|all)$ ]]; then
if [[ "$component" =~ ^(shadps4|all)$ ]]; then
component_found="true"
# This is just a placeholder script to test the emulator's flow
log i "----------------------"
@ -867,6 +867,21 @@ prepare_component() {
# TODO: plceholder
fi
if [[ "$component" =~ ^(portmaster|all)$ ]]; then
component_found="true"
# TODO: MultiUser
log i "----------------------"
log i "Prepearing PortMaster"
log i "----------------------"
rm -rf "/var/data/PortMaster"
unzip "/app/retrodeck/PortMaster.zip" -d "/var/data/"
cp -f "/var/data/PortMaster/retrodeck/PortMaster.txt" "/var/data/PortMaster/PortMaster.sh"
chmod +x "/var/data/PortMaster/PortMaster.sh"
rm -f "$roms_folder/portmaster/PortMaster.sh"
install -Dm755 "/var/data/PortMaster/PortMaster.sh" "$roms_folder/portmaster/PortMaster.sh"
fi
if [[ "$component" =~ ^(ruffle|all)$ ]]; then
component_found="true"
log i "----------------------"

354
functions/run_game.sh Executable file
View file

@ -0,0 +1,354 @@
#!/bin/bash
run_game() {
# Initialize variables
emulator=""
system=""
manual_mode=false
# Parse options for system, emulator, and manual mode
while getopts ":e:s:m" opt; do
case ${opt} in
e)
emulator=$OPTARG # Emulator provided via -e
;;
s)
system=$OPTARG # System provided via -s
;;
m)
manual_mode=true # Manual mode enabled via -m
log i "Run game: manual mode enabled"
;;
\?)
echo "Usage: $0 start [-e emulator] [-s system] [-m] game"
exit 1
;;
esac
done
shift $((OPTIND - 1))
# Check for game argument
if [[ -z "$1" ]]; then
log e "Game path is required."
log i "Usage: $0 start [-e emulator] [-s system] [-m] game"
exit 1
fi
game=$1
if [[ -d "$game" ]]; then
log d "$(basename "$game") is a directory, parsing it like a \"directory as a file\""
game="$game/$(basename "$game")"
log d "Actual file is in \"$game\""
fi
game_basename="./$(basename "$game")"
# Step 1: System Recognition
if [[ -z "$system" ]]; then
# Automatically detect system from game path
system=$(echo "$game" | grep -oP '(?<=roms/)[^/]+')
if [[ -z "$system" ]]; then
log e "Failed to detect system from game path."
exit 1
fi
fi
# Step 2: Emulator Definition
if [[ -n "$emulator" ]]; then
log d "Emulator provided via command-line: $emulator"
elif [[ "$manual_mode" = true ]]; then
log d "Manual mode: showing Zenity emulator selection"
emulator=$(show_zenity_emulator_list "$system")
if [[ -z "$emulator" ]]; then
log e "No emulator selected in manual mode."
exit 1
fi
else
log d "Automatically searching for an emulator for system: $system"
# Check for <altemulator> in the game block in gamelist.xml
altemulator=$(xmllint --recover --xpath "string(//game[path='$game_basename']/altemulator)" "$rdhome/ES-DE/gamelists/$system/gamelist.xml" 2>/dev/null)
if [[ -n "$altemulator" ]]; then
log d "Found <altemulator> for game: $altemulator"
emulator=$(xmllint --recover --xpath "string(//command[@label=\"$altemulator\"])" "$es_systems" 2>/dev/null)
else # if no altemulator is found we search if a global one is set
log d "No altemulator found in the game entry, searching for alternativeEmulator to check if a global emulator is set for the system $system"
alternative_emulator=$(xmllint --recover --xpath 'string(//alternativeEmulator/label)' "$rdhome/ES-DE/gamelists/$system/gamelist.xml" 2>/dev/null)
log d "Alternate emulator found in <alternativeEmulator> header: $alternative_emulator"
emulator=$(xmllint --recover --xpath "string(//system[platform='$system']/command[@label=\"$alternative_emulator\"])" "$es_systems" 2>/dev/null)
fi
# Fallback to first available emulator in es_systems.xml if no <altemulator> found
if [[ -z "$emulator" ]]; then
log d "No alternate emulator found, using first available emulator in es_systems.xml"
emulator=$(xmllint --recover --xpath "string(//system[name='$system']/command[1])" "$es_systems")
fi
if [[ -z "$emulator" ]]; then
log e "No valid emulator found for system: $system"
exit 1
fi
fi
# Step 3: Construct and Run the Command
log i "-------------------------------------------"
log i " RetroDECK is now booting the game"
log i " Game path: \"$game\""
log i " Recognized system: $system"
log i " Given emulator: $emulator"
log i "-------------------------------------------"
# Now pass the final constructed command to substitute_placeholders function
final_command=$(substitute_placeholders "$emulator")
# Log and execute the command
log i "Launching game with command: $final_command"
eval "$final_command"
}
# Assume this function handles showing the Zenity list of emulators for manual mode
show_zenity_emulator_list() {
local system="$1"
# Example logic to retrieve and show Zenity list of emulators for the system
# This would extract available emulators for the system from es_systems.xml and show a Zenity dialog
emulators=$(xmllint --xpath "//system[name='$system']/command/@label" "$es_systems" | sed 's/ label=/\n/g' | sed 's/\"//g' | grep -o '[^ ]*')
zenity --list --title="Select Emulator" --column="Emulators" $emulators
}
# Function to extract commands from es_systems.xml and present them in Zenity
find_system_commands() {
local system_name=$system
# Use xmllint to extract the system commands from the XML
system_section=$(xmllint --xpath "//system[name='$system_name']" "$es_systems" 2>/dev/null)
if [ -z "$system_section" ]; then
log e "System not found: $system_name"
exit 1
fi
# Extract commands and labels
commands=$(echo "$system_section" | xmllint --xpath "//command" - 2>/dev/null)
# Prepare Zenity command list
command_list=()
while IFS= read -r line; do
label=$(echo "$line" | sed -n 's/.*label="\([^"]*\)".*/\1/p')
command=$(echo "$line" | sed -n 's/.*<command[^>]*>\(.*\)<\/command>.*/\1/p')
# Substitute placeholders in the command
command=$(substitute_placeholders "$command")
# Add label and command to Zenity list (label first, command second)
command_list+=("$label" "$command")
done <<< "$commands"
# Check if there's only one command
if [ ${#command_list[@]} -eq 2 ]; then
log d "Only one command found for $system_name, running it directly: ${command_list[1]}"
selected_command="${command_list[1]}"
else
# Show the list with Zenity and return the **command** (second column) selected
selected_command=$(zenity --list \
--title="Select an emulator for $system_name" \
--column="Emulator" --column="Hidden Command" "${command_list[@]}" \
--width=800 --height=400 --print-column=2 --hide-column=2)
fi
echo "$selected_command"
}
# Function to substitute placeholders in the command
substitute_placeholders() {
local cmd="$1"
log d "Substitute placeholder: working on $cmd"
game=$(echo "$game" | sed "s/'/'\\\\''/g") # escaping internal '
local rom_path="$game"
local rom_dir=$(dirname "$rom_path")
# Strip all file extensions from the base name
local base_name=$(basename "$rom_path")
base_name="${base_name%%.*}"
local file_name=$(basename "$rom_path")
local rom_raw="$rom_path"
local rom_dir_raw="$rom_dir"
local es_path=""
local emulator_path=""
# Manually replace %EMULATOR_*% placeholders
while [[ "$cmd" =~ (%EMULATOR_[A-Z0-9_]+%) ]]; do
placeholder="${BASH_REMATCH[1]}"
emulator_path=$(replace_emulator_placeholder "$placeholder")
cmd="${cmd//$placeholder/$emulator_path}"
done
# Substitute %BASENAME% and other placeholders
cmd="${cmd//"%BASENAME%"/"'$base_name'"}"
cmd="${cmd//"%FILENAME%"/"'$file_name'"}"
cmd="${cmd//"%ROMRAW%"/"'$rom_raw'"}"
cmd="${cmd//"%ROMPATH%"/"'$rom_dir'"}"
cmd="${cmd//"%ENABLESHORTCUTS%"/""}"
cmd="${cmd//"%EMULATOR_OS-SHELL%"/"/bin/sh"}"
# Ensure paths are quoted correctly
cmd="${cmd//"%ROM%"/"'$rom_path'"}"
cmd="${cmd//"%GAMEDIR%"/"'$rom_dir'"}"
cmd="${cmd//"%GAMEDIRRAW%"/"'$rom_dir_raw'"}"
cmd="${cmd//"%CORE_RETROARCH%"/"$ra_cores_path"}"
log d "Command after placeholders substitutions: $cmd"
# Now handle %INJECT% after %BASENAME% has been substituted
cmd=$(handle_inject_placeholder "$cmd")
echo "$cmd"
}
# Function to replace %EMULATOR_SOMETHING% with the actual path of the emulator
replace_emulator_placeholder() {
local placeholder=$1
# Extract emulator name from placeholder without changing case
local emulator_name="${placeholder//"%EMULATOR_"/}" # Extract emulator name after %EMULATOR_
emulator_name="${emulator_name//"%"/}" # Remove the trailing %
# Use the find_emulator function to get the emulator path using the correct casing
local emulator_exec=$(find_emulator "$emulator_name")
if [[ -z "$emulator_exec" ]]; then
log e "Emulator '$emulator_name' not found."
exit 1
fi
echo "$emulator_exec"
}
# Function to handle the %INJECT% placeholder
handle_inject_placeholder() {
local cmd="$1"
local rom_dir=$(dirname "$game") # Get the ROM directory based on the game path
# Find and process all occurrences of %INJECT%='something'.extension
while [[ "$cmd" =~ (%INJECT%=\'([^\']+)\')(.[^ ]+)? ]]; do
inject_file="${BASH_REMATCH[2]}" # Extract the quoted file name
extension="${BASH_REMATCH[3]}" # Extract the extension (if any)
inject_file_full_path="$rom_dir/$inject_file$extension" # Form the full path
log d "Found inject part: %INJECT%='$inject_file'$extension"
# Check if the file exists
if [[ -f "$inject_file_full_path" ]]; then
# Read the content of the file and replace newlines with spaces
inject_content=$(cat "$inject_file_full_path" | tr '\n' ' ')
log i "File \"$inject_file_full_path\" found. Replacing %INJECT% with content."
# Escape special characters in the inject part for the replacement
escaped_inject_part=$(printf '%s' "%INJECT%='$inject_file'$extension" | sed 's/[]\/$*.^[]/\\&/g')
# Replace the entire %INJECT%=...'something'.extension part with the file content
cmd=$(echo "$cmd" | sed "s|$escaped_inject_part|$inject_content|g")
log d "Replaced cmd: $cmd"
else
log e "File \"$inject_file_full_path\" not found. Removing %INJECT% placeholder."
# Use sed to remove the entire %INJECT%=...'something'.extension
escaped_inject_part=$(printf '%s' "%INJECT%='$inject_file'$extension" | sed 's/[]\/$*.^[]/\\&/g')
cmd=$(echo "$cmd" | sed "s|$escaped_inject_part||g")
log d "sedded cmd: $cmd"
fi
done
log d "Returning the command with injected content: $cmd"
echo "$cmd"
}
# Function to get the first available emulator in the list
get_first_emulator() {
local system_name=$system
system_section=$(xmllint --xpath "//system[name='$system_name']" "$es_systems" 2>/dev/null)
if [ -z "$system_section" ]; then
log e "System not found: $system_name"
exit 1
fi
# Extract the first command and use it as the selected emulator
first_command=$(echo "$system_section" | xmllint --xpath "string(//command[1])" - 2>/dev/null)
if [[ -n "$first_command" ]]; then
# Substitute placeholders in the command
first_command=$(substitute_placeholders "$first_command")
log d "Automatically selected the first emulator: $first_command"
echo "$first_command"
else
log e "No command found for the system: $system_name"
return 1
fi
}
find_emulator() {
local emulator_name="$1"
found_path=""
# Search the es_find_rules.xml file for the emulator
emulator_section=$(xmllint --xpath "//emulator[@name='$emulator_name']" "$es_find_rules" 2>/dev/null)
if [ -z "$emulator_section" ]; then
log e "Find emulator: emulator not found: $emulator_name"
return 1
fi
# Search systempath entries
while IFS= read -r line; do
command_path=$(echo "$line" | sed -n 's/.*<entry>\(.*\)<\/entry>.*/\1/p')
if [ -x "$(command -v $command_path)" ]; then
found_path=$command_path
break
fi
done <<< "$(echo "$emulator_section" | xmllint --xpath "//rule[@type='systempath']/entry" - 2>/dev/null)"
# If not found, search staticpath entries
if [ -z "$found_path" ]; then
while IFS= read -r line; do
command_path=$(eval echo "$line" | sed -n 's/.*<entry>\(.*\)<\/entry>.*/\1/p')
if [ -x "$command_path" ]; then
found_path=$command_path
break
fi
done <<< "$(echo "$emulator_section" | xmllint --xpath "//rule[@type='staticpath']/entry" - 2>/dev/null)"
fi
if [ -z "$found_path" ]; then
log e "Find emulator: no valid path found for emulator: $emulator_name"
return 1
else
log d "Find emulator: found emulator \"$found_path\""
echo "$found_path"
return 0
fi
}
# Function to find the emulator name from the label in es_systems.xml
find_emulator_name_from_label() {
local label="$1"
# Search for the emulator matching the label in the es_systems.xml file
extracted_emulator_name=$(xmllint --recover --xpath "string(//system[name='$system']/command[@label='$label']/text())" "$es_systems" 2>/dev/null | sed 's/%//g' | sed 's/EMULATOR_//g' | cut -d' ' -f1)
log d "Found emulator from label: $extracted_emulator_name"
emulator_command=$(find_emulator "$extracted_emulator_name")
if [[ -n "$emulator_command" ]]; then
echo "$emulator_command"
else
log e "Found emulator from label: emulator name not found for label: $label"
return 1
fi
}

View file

@ -197,6 +197,24 @@ modules:
sha256: RASHAPLACEHOLDER
# Not part of the offical RetroArch AppImage
# TODO: outsource me
- name: libbz2
no-autogen: true
make-args:
- --f=Makefile-libbz2_so
- PREFIX=${FLATPAK_DEST}
no-make-install: true
post-install:
- mv libbz2.so.1.0.8 ${FLATPAK_DEST}/lib/
- ln -s ${FLATPAK_DEST}/lib/libbz2.so.1.0.8 ${FLATPAK_DEST}/lib/libbz2.so.1.0
sources:
- type: archive
url: https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
sha256: ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269
# TODO: If more are mising are here: https://github.com/flathub/org.libretro.RetroArch/tree/8c388bb84df63b3a2efb40dc3d8f78df7717059e/modules
# retroarch-cores-nightly must be earlier than retroarch-cores as it will overwrite this cores with the stable ones
- name: retroarch-cores-nightly
buildsystem: simple
@ -538,6 +556,32 @@ modules:
- type: archive
url: https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt.zip
sha256: RETRODECKSHADPS4LATESTSTABLE
# PortMaster
- name: PortMaster
buildsystem: simple
build-commands:
- mkdir -p "${FLATPAK_DEST}/retrodeck/PortMaster/"
- install -Dm755 "PortMaster" "${FLATPAK_DEST}/bin/PortMaster"
- install -Dm755 "harbourmaster" "${FLATPAK_DEST}/bin/harbourmaster"
- cp PortMaster.zip "${FLATPAK_DEST}/retrodeck/PortMaster.zip"
sources:
- type: file
url: https://github.com/PortsMaster/PortMaster-GUI/releases/latest/download/retrodeck.portmaster.zip
sha256: PORTMASTERLATESTSHA
dest-filename: PortMaster.zip
- type: script
commands:
- |
#!/bin/bash
"/var/data/PortMaster/PortMaster.sh" "$@"
dest-filename: PortMaster
- type: script
commands:
- |
#!/bin/bash
"/var/data/PortMaster/harbourmaster" "$@"
dest-filename: harbourmaster
# ES-DE
@ -550,6 +594,7 @@ modules:
- cp -r files/* "${FLATPAK_DEST}"
- chmod +x "${FLATPAK_DEST}/bin/"*
sources:
# Testing the new feat/update-3.1.0
- type: archive
url: https://github.com/RetroDECK/ES-DE/releases/download/feat%2Fshadps4-150924.23/RetroDECK-ES-DE-Artifact.tar.gz
sha256: 21b937034be0381dab81b00ec0a9a95210b0610c1a3b66c5ab3b3b0aceae8654

File diff suppressed because it is too large Load diff

View file

@ -23,14 +23,20 @@ for i in "$@"; do
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments:
-h, --help Print this help
-v, --version Print RetroDECK version
--info-msg Print paths and config informations
--configurator Starts the RetroDECK Configurator
--compress-one <file> Compresses target file to a compatible format
--compress-all <format> Compresses all supported games into a compatible format. Available formats are \"chd\", \"zip\", \"rvz\" and \"all\".
--reset-component <component> Reset one or more component or emulator configs to the default values
--reset-retrodeck Starts the initial RetroDECK installer (backup your data first!)
-h, --help \t Print this help
-v, --version \t Print RetroDECK version
--info-msg \t Print paths and config informations
--configurator \t Starts the RetroDECK Configurator
--compress-one <file> \t Compresses target file to a compatible format
--compress-all <format> \t Compresses all supported games into a compatible format.\n\t\t\t\t\t\t Available formats are \"chd\", \"zip\", \"rvz\" and \"all\"
--reset-component <component> \t Reset one or more component or emulator configs to the default values
--reset-retrodeck \t Starts the initial RetroDECK installer (backup your data first!)
start [-e emulator] [-s system] [-m] <game_path>\t Start a game from cli using the default emulator or\n\t\t\t\t\t\t\t the one defined in ES-DE for game or system
\t start arguments:
\t \t-e (emulator)\t Run the game with the defined emulator (optional)
\t \t-s (system)\t Force the game running with the defined system, for example running a gb game on gba (optional)
\t \t-m (manual)\t Manual mode: show the list of available emulator to chose from (optional)
For flatpak run specific options please run: flatpak run -h
@ -42,6 +48,11 @@ https://retrodeck.net
echo "RetroDECK v$version"
exit
;;
start*)
shift # Remove "start"
run_game "$@"
exit
;;
--info-msg*)
echo "RetroDECK v$version"
echo "RetroDECK config file is in: $rd_conf"