SaveStateCheck script
-
Just forget one picture says more than 1000 words
Example picture of starting screen with Kid Icarus for GameBoy
So you see. The game gets one SRM savefile and my forst Gameslot is not 0 it's the 1 ;)
So you see it's always good to know where are your savestats and which slot they use ;)Dialog Screen paresed by
window
parameterText list via
light
parameter parsed -
I wish this could be shown in ES as a metadata field
-
@lilbud Well this is also possible but needs to add some flags to the each
gamelists.xml
and then it needs to be featured in ES and in each theme. So it isn't a task that can be done alone and in a 4 hours coding-straight.Maybe it can be added in
runcommand.sh
itself if buzz decides to do so. The advantage is it would look much sleeker.Maybe @hiulit can do a rework - instead of a fun-fact screen it could be a savestat-fact screen ;) Who knows?
-
@cyperghost Or maybe instead of tying into the splashscreen or runcommand, maybe a OSD message can pop up while Retroarch starts that says how many save are available for said game.
Something like:
There are 3 save states for this game
-
@lilbud I see it more complex as ES is standalone and RetroArch is standalone. The creation of the
save.state*
-files is a task of RetroArch. I think it won't be a good idea to integrate ES much deeper into RetroArch.You loose flexibility and independence if you rely on settings that are made by programm X to work with programm Y.
See... in my script I tried to make the determination of the pathes 100% save in case if it's the default state. It doesn't matter if the default is written
deFault, DEFAULT, dEfAuLt... default
as I set it to uppercase and compare the string withDEFAULT
so it's always a match.But this was an easy task .... in this case!
All in all it's very difficult to make every case water-proof ;) -
Updated the script:
- now removes (...) and [...] in gamenames (a bit bare!)
- removed some typos
- if parameter for sleeptimer is missing, default timer will be set to 3 seconds
- rearanged the text itself a bit
Have fun!
Thanks for any feedback -
Old version for archive - Awful piece of script!
Very complicated in a try to avoid function calls!# SaveStateCheck (for status and SRM files data) # by cyperghost # # rom=$3, is first parameter # system=$1, is second parameter # Last parameter is sleeptimer in seconds # So for exp. ./savestate.sh $1 $3 5 or ./savestate.sh $1 all 3 # Precheck if parameters are setted, if not we exit with error [ -z "$2" ] && echo "SaveState Check: Please parse system parameter! Error!" >&2 && exit 1 [ -z "$1" ] && echo "SaveState Check: Please parse rompath! Error!" >&2 && exit 1 rom="$1" system="$2" rom_name="$(basename "$rom")" rom_path="$(dirname "$rom")" rom_no_ext="${rom_name%.*}" config_dir="/opt/retropie/configs/$system" config_file="$config_dir/retroarch.cfg" # This sniplet is part of hiulits Boilerplate script thank you! # This will determine path of SRM and STATUS directory func_get_config() { config="$(grep -Po "(?<=^$1 = ).*" "$config_file")" config="${config%\"}" config="${config#\"}" } # GET SRM file location func_get_config "savefile_directory" if [ "${config^^}" = "DEFAULT" ]; then srm_path="$rom_path" else srm_path="$config" fi # GET STATE file location func_get_config "savestate_directory" if [ "${config^^}" = "DEFAULT" ]; then status_path="$rom_path" else status_path="$config" fi # Determinine number of Statussavegames! # Build Array - last file could be state.auto status_array=("$status_path/$rom_no_ext.state"*) #Build Array idx=${#status_array[@]} #Get Array size # Check for presence of SRM file if [ -f "$srm_path/$rom_no_ext.srm" ]; then status_array[$idx]="\nSRM found! Use ingame saves!" srm=1 fi # Check for presence of state.auto by using latest index number if [ "${status_array[$idx-1]#*.state.}" = "auto" ]; then status_array[$idx-1]="\nGame Slot Autosave" idx=$(( $idx - 1 )) fi # Check if Array is valid [ "${status_array[$idx-1]#*.state}" = "*" ] && idx=-1 \ && [ $srm ] && status_array[0]="" # Is there something to display? # Means Array is not valid and there is no SRM then exit [ $idx -lt 0 ] && [ -z $srm ] && exit # Build messages # Remeber the idx number, if array is invalid there is nothing to convert # As -1 is less than 0 z=0 while [ $z -lt $idx ] do status_array[$z]=${status_array[$z]#*.state} number=$(printf "%03d" ${status_array[$z]}) #convert 1 >> 001 status_array[$z]="\nGame Slot $number found" z=$(( $z + 1 )) done # Better looking ROMnames rom_name="${rom_name%%[*}" rom_name="${rom_name%%(*}" # Building Dialog dialog --title "SaveStateCheck" --infobox \ "Loaded ROM:\n$rom_name\n\nConsits of $idx SaveStates\n${status_array[*]}" 0 0 sleep $3 [ -z "$3" ] && sleep 3
-
You should open a GitHub account and create repositories for your scripts there :D
-
@hiulit I have a github account ;)
Thanks for feedback
As I'm not a professional programmer I do coding just for fun. But my hope is that maybe you can improve this script.I saw your coding style...
And I think you do coding professional or have a strong attitude to this ;) -
@cyperghost Well, what are you waiting for then! Create repositories for all your scripts! :D
Actually I am a programmer, but I'm also a noob at shell scripting, so we are all noobs ;) -
@hiulit Here you are ;)
https://github.com/crcerror/
My best repo is the binary archive for old ES versions ;)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.