diff --git a/functions/run_game.sh b/functions/run_game.sh index 4f3afcbd..8f084a05 100755 --- a/functions/run_game.sh +++ b/functions/run_game.sh @@ -20,7 +20,7 @@ run_game() { 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 ;; esac @@ -30,11 +30,18 @@ run_game() { # Check for game argument if [[ -z "$1" ]]; then 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 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 @@ -46,7 +53,6 @@ run_game() { exit 1 fi fi - log d "System recognized: $system" # Step 2: Emulator Definition if [[ -n "$emulator" ]]; then @@ -80,10 +86,8 @@ run_game() { # Fallback to first available emulator in es_systems.xml if no found 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" - emulator_command=$(xmllint --recover --xpath "string(//system[name='$system']/command[1])" "$es_systems" 2>/dev/null) - emulator=$(find_emulator_name_from_label "$emulator_command") + emulator=$(xmllint --recover --xpath "string(//system[name='$system']/command[1])" "$es_systems") fi if [[ -z "$emulator" ]]; then @@ -93,7 +97,12 @@ run_game() { fi # 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 final_command=$(substitute_placeholders "$emulator") diff --git a/retrodeck.sh b/retrodeck.sh index 50851874..3c0f52dc 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -28,11 +28,15 @@ Arguments: --info-msg \t Print paths and config informations --configurator \t Starts the RetroDECK Configurator --compress-one \t Compresses target file to a compatible format - --compress-all \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 \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 \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 [-s ] [-e ] \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] \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