Advertisement
Guest User

Pico-8 customRunCommand.sh in Retropie

a guest
Mar 1st, 2021
1,995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. argument=$1
  4.  
  5. if [[ $argument == *.sh ]]
  6. then
  7. #Is a script file, execute script
  8. cmd=$argument
  9. elif [[ $argument == *.p8 || $argument == *.png ]]
  10. then
  11. #Is a game image, start the game. But need to escape string first
  12. #List of charaters to be escaped
  13. characters=("\'" "\ " "\(" "\)")
  14.  
  15.  
  16. #Start escaping string
  17. for item in "${characters[@]}"
  18. do
  19. argument=${argument//$item/"$item"}
  20. done
  21.  
  22. cmd="/home/pi/pico-8/pico8_dyn -run $argument"
  23. else
  24. #unsupported file format
  25. exit
  26. fi
  27.  
  28. /opt/retropie/supplementary/runcommand/runcommand.sh 0 "$cmd"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement