Merge branch 'cooker' into feat/okonomiyaki

This commit is contained in:
XargonWan 2024-09-12 14:52:34 +09:00
commit dbb957bcdb
2 changed files with 22 additions and 9 deletions

View file

@ -20,7 +20,7 @@ run_game() {
log i "Run game: manual mode enabled" log i "Run game: manual mode enabled"
;; ;;
\?) \?)
echo "Usage: $0 --run [-e emulator] [-s system] [-m manual] game" echo "Usage: $0 start [-e emulator] [-s system] [-m] game"
exit 1 exit 1
;; ;;
esac esac
@ -30,11 +30,18 @@ run_game() {
# Check for game argument # Check for game argument
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
log e "Game path is required." log e "Game path is required."
log i "Usage: $0 start [-e emulator] [-s system] [-m manual] game" log i "Usage: $0 start [-e emulator] [-s system] [-m] game"
exit 1 exit 1
fi fi
game=$1 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")" game_basename="./$(basename "$game")"
# Step 1: System Recognition # Step 1: System Recognition
@ -46,7 +53,6 @@ run_game() {
exit 1 exit 1
fi fi
fi fi
log d "System recognized: $system"
# Step 2: Emulator Definition # Step 2: Emulator Definition
if [[ -n "$emulator" ]]; then if [[ -n "$emulator" ]]; then
@ -80,10 +86,8 @@ run_game() {
# Fallback to first available emulator in es_systems.xml if no <altemulator> found # Fallback to first available emulator in es_systems.xml if no <altemulator> found
if [[ -z "$emulator" ]]; then if [[ -z "$emulator" ]]; then
# TODO: the non-alt emulator is broken
log d "No alternate emulator found, using first available emulator in es_systems.xml" log d "No alternate emulator found, using first available emulator in es_systems.xml"
emulator_command=$(xmllint --recover --xpath "string(//system[name='$system']/command[1])" "$es_systems" 2>/dev/null) emulator=$(xmllint --recover --xpath "string(//system[name='$system']/command[1])" "$es_systems")
emulator=$(find_emulator_name_from_label "$emulator_command")
fi fi
if [[ -z "$emulator" ]]; then if [[ -z "$emulator" ]]; then
@ -93,7 +97,12 @@ run_game() {
fi fi
# Step 3: Construct and Run the Command # Step 3: Construct and Run the Command
log d "Preparing to launch with emulator: $emulator" 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 # Now pass the final constructed command to substitute_placeholders function
final_command=$(substitute_placeholders "$emulator") final_command=$(substitute_placeholders "$emulator")

View file

@ -28,11 +28,15 @@ Arguments:
--info-msg \t Print paths and config informations --info-msg \t Print paths and config informations
--configurator \t Starts the RetroDECK Configurator --configurator \t Starts the RetroDECK Configurator
--compress-one <file> \t Compresses target file to a compatible format --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\". --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-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!) --reset-retrodeck \t Starts the initial RetroDECK installer (backup your data first!)
start [-s <path>] [-e <path>] <path>\t Start a game from cli, if no system is defined it will deducted from the path.\n\t\t\t\t\t\t For example flatpak run net.retrodeck.retrodeck start ~/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. 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 For flatpak run specific options please run: flatpak run -h