Merge Cooker

This commit is contained in:
Rekku 2024-09-09 14:32:18 +01:00
commit f545081e26
5 changed files with 171 additions and 29 deletions

View file

@ -849,7 +849,7 @@
} }
] ]
}, },
"picodrive_libetro": { "picodrive_libretro": {
"name": "PicoDrive", "name": "PicoDrive",
"description": "SEGA MS/MD/CD/32X Libretro Core", "description": "SEGA MS/MD/CD/32X Libretro Core",
"system": [ "system": [
@ -866,7 +866,7 @@
} }
] ]
}, },
"genesisplusgx_libetro": { "genesisplusgx_libretro": {
"name": "Genesis Plus GX", "name": "Genesis Plus GX",
"description": "SEGA MS/GG/MD/CD Libretro Core", "description": "SEGA MS/GG/MD/CD Libretro Core",
"system": [ "system": [
@ -883,7 +883,7 @@
} }
] ]
}, },
"genesisplusgxwide_libetro": { "genesisplusgxwide_libretro": {
"name": "Genesis Plus GX Wide", "name": "Genesis Plus GX Wide",
"description": "SEGA MS/GG/MD/CD Libretro Core for Wide Screen", "description": "SEGA MS/GG/MD/CD Libretro Core for Wide Screen",
"system": [ "system": [
@ -899,7 +899,7 @@
} }
] ]
}, },
"mupen64plus-next_libetro": { "mupen64plus-next_libretro": {
"name": "Mupen64Plus-Next", "name": "Mupen64Plus-Next",
"description": "Nintendo 64 Libretro Core", "description": "Nintendo 64 Libretro Core",
"system": "n64", "system": "n64",
@ -911,7 +911,7 @@
} }
] ]
}, },
"snes9x-current_libetro": { "snes9x-current_libretro": {
"name": "Snes9x - Current", "name": "Snes9x - Current",
"description": "Super Nintendo Libretro Core", "description": "Super Nintendo Libretro Core",
"system": "snes", "system": "snes",
@ -924,7 +924,7 @@
} }
] ]
}, },
"gambatte_libetro": { "gambatte_libretro": {
"name": "Gambatte", "name": "Gambatte",
"description": "Game Boy/Color Libretro Core", "description": "Game Boy/Color Libretro Core",
"system": [ "system": [
@ -939,7 +939,7 @@
} }
] ]
}, },
"mgba_libetro": { "mgba_libretro": {
"name": "mGBA", "name": "mGBA",
"description": "Game Boy Advance Libretro Core", "description": "Game Boy Advance Libretro Core",
"system": "gba", "system": "gba",
@ -960,7 +960,8 @@
"system": [ "system": [
"arcade" "arcade"
], ],
"launch": "mame" "launch": "mame",
"launch-args": "-inipath /var/config/mame/ini -rompath $(dirname \"$game\") $game"
}, },
"citra": { "citra": {
"description": "Citra Nintendo 3DS Emulator (via Ponzu)", "description": "Citra Nintendo 3DS Emulator (via Ponzu)",
@ -988,7 +989,7 @@
"name": "melonds", "name": "melonds",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/",
"system": "nds", "system": "nds",
"launch": "MelonDS" "launch": "melonDS"
}, },
"pcsx2": { "pcsx2": {
"name": "pcsx2", "name": "pcsx2",
@ -996,6 +997,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/",
"system": "ps2", "system": "ps2",
"launch": "pcsx2-qt", "launch": "pcsx2-qt",
"launch-args": "-batch $game",
"properties": [ "properties": [
{ {
"ask_to_exit": true, "ask_to_exit": true,
@ -1008,6 +1010,7 @@
"description": "PlayStation Emulator", "description": "PlayStation Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/duckstation/duckstation-guide/",
"launch": "duckstation-qt", "launch": "duckstation-qt",
"launch-args": "-batch $game",
"system": "psx", "system": "psx",
"properties": [ "properties": [
{ {
@ -1034,7 +1037,8 @@
"description": "Vita3K PSVita Emulator", "description": "Vita3K PSVita Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/",
"system": "psvita", "system": "psvita",
"launch": "Vita3K" "launch": "Vita3K",
"launch-args": "-r $game.psvita"
}, },
"rpcs3": { "rpcs3": {
"name": "RPCS3", "name": "RPCS3",
@ -1042,6 +1046,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/",
"system": "ps3", "system": "ps3",
"launch": "rpcs3", "launch": "rpcs3",
"launch-override": "cd $(dirname $game) && rpcs3 $game",
"properties": [ "properties": [
{ {
"ask_to_exit": true "ask_to_exit": true
@ -1061,6 +1066,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/",
"launch": "Yuzu", "launch": "Yuzu",
"system": "switch", "system": "switch",
"launch-args": "-f -g $game",
"ponzu": true, "ponzu": true,
"abxy_button": true "abxy_button": true
}, },
@ -1069,6 +1075,7 @@
"description": "Dolphin Wii and GameCube Emulator", "description": "Dolphin Wii and GameCube Emulator",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "dolphin-emu-wrapper", "launch": "dolphin-emu-wrapper",
"launch-args": "-e $game",
"system": [ "system": [
"gc", "gc",
"wii" "wii"
@ -1088,6 +1095,7 @@
"description": "A fork of Dolphiin to enhance Metroid Prime experience", "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/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/",
"launch": "primehack-wrapper", "launch": "primehack-wrapper",
"launch-args": "-e $game",
"system": [ "system": [
"wii" "wii"
], ],
@ -1104,6 +1112,7 @@
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/cemu/cemu-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/cemu/cemu-guide/",
"system": "wiiu", "system": "wiiu",
"launch": "Cemu-wrapper", "launch": "Cemu-wrapper",
"launch-args": "-g $game",
"properties": [ "properties": [
{ {
"abxy_button": true, "abxy_button": true,
@ -1116,7 +1125,8 @@
"name": "xemu", "name": "xemu",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/xemu/xemu-guide/", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/xemu/xemu-guide/",
"system": "xbox", "system": "xbox",
"launch": "xemu" "launch": "xemu",
"launch-args": "-dvd_path $game"
}, },
"es-de": { "es-de": {
"description": "ES-DE Emulation Frontend", "description": "ES-DE Emulation Frontend",

View file

@ -132,8 +132,9 @@ elif [[ "$new_version_major_rev" -eq "$current_version_major_rev" ]]; then
fi fi
fi fi
# Perform post_update commands for current version if it is a cooker # Perform post_update commands for current version if it is a cooker or PR
if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build, always perform post_update commands for current version if grep -qF "cooker" <<< "$hard_version" || grep -qF "PR" <<< "$hard_version"; then
# If newly-installed version is a "cooker" or "PR" build, always perform post_update commands for current version
if [[ "$(echo $hard_version | cut -d'-' -f2)" == "$new_version" ]]; then if [[ "$(echo $hard_version | cut -d'-' -f2)" == "$new_version" ]]; then
is_newer_version="true" is_newer_version="true"
fi fi

View file

@ -891,3 +891,125 @@ start_retrodeck() {
log i "Starting RetroDECK v$version" log i "Starting RetroDECK v$version"
es-de es-de
} }
run_game() {
# Initialize variables
emulator=""
system=""
# Parse options
while getopts ":e:s:" opt; do
case ${opt} in
e )
emulator=$OPTARG
;;
s )
system=$OPTARG
;;
\? )
echo "Usage: $0 --run [-e emulator] [-s system] game"
exit 1
;;
esac
done
shift $((OPTIND -1))
# Check for game argument
if [[ -z "$1" ]]; then
echo "Error: Game file is required."
echo "Usage: $0 --run [-e emulator] [-s system] game"
exit 1
fi
game=$1
# If no system is provided, extract it from the game path
if [[ -z "$system" ]]; then
system=$(echo "$game" | grep -oP '(?<=roms/)[^/]+')
fi
log d "Emulator: $emulator"
log d "System: $system"
log d "Game: $game"
# Query the features JSON for emulators that support the system
local emulators=$(jq -r --arg system "$system" '
.emulator | to_entries[] |
select(
(.value.system == $system) or
(.value.system[]? == $system)
) | .key' "$features")
# Check if the system is handled by RetroArch cores
local retroarch_cores=$(jq -r --arg system "$system" '
.emulator.retroarch.cores | to_entries[] |
select(
.value.system == $system or
(.value.system[]? == $system)
) | .key' "$features")
# if the emulator is given and it's a retroarch core just execute it
if [[ "$emulator" == *"_libretro" ]]; then
local core_path="/var/config/retroarch/cores/$emulator.so"
log d "Running RetroArch core: $core_path"
log d "Command: retroarch -L $core_path \"$game\""
eval "retroarch -L $core_path \"$game\""
return 1
fi
# If the system is handled by RetroArch cores, add them to the list of emulators
if [[ -n "$retroarch_cores" ]]; then
emulators=$(echo -e "$emulators\n$retroarch_cores")
fi
local pretty_system=$(jq -r --arg system "$system" '.system[$system].name' "$features")
# Check if multiple emulators are found and prompt the user to select one with zenity
if [[ $(echo "$emulators" | wc -l) -gt 1 ]]; then
emulator=$(echo "$emulators" | zenity --list --title="Select Emulator" --text="Multiple emulators found for $pretty_system. Select one to run." --column="Emulator")
else
emulator="$emulators"
fi
# If no emulator was selected, exit
if [[ -z "$emulator" ]]; then
log e "No emulator selected. Exiting."
return 1
fi
log d "Run game: selected emulator $emulator"
# Handle RetroArch core separately
if [[ "$emulator" == *"_libretro" ]]; then
local core_path="/var/config/retroarch/cores/$emulator.so"
log d "Running RetroArch core: $core_path"
log d "Command: retroarch -L $core_path \"$game\""
eval "retroarch -L $core_path \"$game\""
else
# Check if launch-override exists
local launch_override=$(jq -r ".emulator.$emulator.\"launch-override\"" "$features")
if [[ "$launch_override" != "null" ]]; then
# Use launch-override
launch_override=${launch_override//\$game/\"$game\"}
log d "Using launch-override: $launch_override"
eval "$launch_override"
else
# Use standard launch and launch-args
local launch_command=$(jq -r ".emulator.$emulator.launch" "$features")
local launch_args=$(jq -r ".emulator.$emulator.\"launch-args\"" "$features")
log d "launch args: $launch_args"
# Only add launch_args if they are not null
if [[ "$launch_args" != "null" ]]; then
# Replace $game in launch_args with the actual game path, quoting it to handle spaces
launch_args=${launch_args//\$game/\"$game\"}
log d "Command: \"$launch_command $launch_args\""
eval "$launch_command $launch_args"
else
log d "Command: \"$launch_command\""
eval "$launch_command \"$game\""
fi
fi
fi
}

View file

@ -18,19 +18,21 @@ for i in "$@"; do
case $i in case $i in
-h*|--help*) -h*|--help*)
echo "RetroDECK v""$version" echo "RetroDECK v""$version"
echo " echo -e "
Usage: Usage:
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS] flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments: Arguments:
-h, --help Print this help -h, --help \t Print this help
-v, --version Print RetroDECK version -v, --version \t Print RetroDECK version
--info-msg Print paths and config informations --info-msg \t Print paths and config informations
--configurator Starts the RetroDECK Configurator --configurator \t Starts the RetroDECK Configurator
--compress-one <file> Compresses target file to a compatible format --compress-one <file> \t 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\". --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> Reset one or more component or emulator configs to the default values --reset-component <component> \t Reset one or more component or emulator configs to the default values
--reset-retrodeck Starts the initial RetroDECK installer (backup your data first!) --reset-retrodeck \t Starts the initial RetroDECK installer (backup your data first!)
--run [-s <path>] [-e <path>] <path>\t Run a game from cli, if no system is defined it will deducted from the path.\n\t\t\t\t\t\t For example --run ~/retrodeck/roms/system/game.ext will be run with the system "system".\n\t\t\t\t\t\t Optionally -e (emulator) and -s (system) can be passed as arguments.
For flatpak run specific options please run: flatpak run -h For flatpak run specific options please run: flatpak run -h
@ -42,6 +44,11 @@ https://retrodeck.net
echo "RetroDECK v$version" echo "RetroDECK v$version"
exit exit
;; ;;
--run*)
shift # Remove --run
run_game "$@"
exit
;;
--info-msg*) --info-msg*)
echo "RetroDECK v$version" echo "RetroDECK v$version"
echo "RetroDECK config file is in: $rd_conf" echo "RetroDECK config file is in: $rd_conf"
@ -199,3 +206,4 @@ fi
# Normal Startup # Normal Startup
start_retrodeck start_retrodeck
quit_retrodeck

View file

@ -192,6 +192,7 @@ func _on_bios_button_expert_pressed():
func _on_exit_button_pressed(): func _on_exit_button_pressed():
_play_main_animations() _play_main_animations()
_exit() _exit()
_exit()
func _on_locale_selected(index): func _on_locale_selected(index):
match index: match index: