I know BATOCERA gots this feature but the downside is, that if you finish the emulator a savestate like [%ROMNAME%].save.auto
is created. It’s better if you load a savestate that YOU created per demand.
So the prerequeiste is,
- Disable auto load/save state inside ES
- set a key
global.retroarch.savestate_auto_load=true
to batocera.conf
- Copy the script down to userscripts and
- make it executable
#!/bin/bash
# add 'global.retroarch.savestate_auto_load=true'
# to your batocera.conf
# by cyperghost aka lala for BATOCERA
#
# download this script to '/userdata/system/scripts' and set executable bit
#
rom_no_ext="$(basename "${5%.*}")"
sav_path="/userdata/saves/$2"
[[ "$(batocera-settings get global.autosave)" -eq 1 ]] && exit
[[ "$(batocera-settings get global.retroarch.savestate_auto_load)" == "true" ]] || exit
if [[ $1 == "gameStart" ]]; then
file="$(/bin/ls "$sav_path/$rom_no_ext."* -turR1A | tail -1)"
[[ -n "$file" ]] || exit
[[ "${file##*.}" == "png" ]] && file="${file%.*}"
[[ -f "$file" ]] || exit
cp -f "$file" "$sav_path/$rom_no_ext.state.auto"
fi
if [[ $1 == "gameStop" ]]; then
rm -f "$sav_path/$rom_no_ext.state.auto"
fi