Skip to content

Commit

Permalink
Save-states compression
Browse files Browse the repository at this point in the history
  • Loading branch information
ClusterM committed Mar 29, 2017
1 parent 9f9f6f6 commit eb04f1e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions retroarch.hmod/bin/retroarch-clover
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ done

# saves if any
rm -f /var/cache/*.state /var/cache/*.auto /var/cache/*.srm /var/cache/*.sav
[ ! -z "$load" ] && [ -f "$load" ] && [ -z "$nosaves" ] && cp -f "$load" "$autosave" && echo cp -f "$load" "$autosave"
if [ ! -z "$load" ] && [ -f "$load" ] && [ -z "$nosaves" ]; then
if [ $(hexdump -n 2 -e '1/1 "%02X"' "$load") == "1F8B" ]; then
cp -f "$load" "$autosave.gz"
gunzip -f "$autosave.gz"
else
cp -f "$load" "$autosave"
fi
fi
# Nestopia names FDS saves as $id.sav, so here's a quick fix
if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
[ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsav" && echo cp -f "$sram" "$rsav"
[ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsav"
else
[ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsram" && echo cp -f "$sram" "$rsram"
[ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsram"
fi


Expand Down Expand Up @@ -88,7 +95,7 @@ pkill -KILL clover-mcp
[ -z "$screenshot" ] || [ -z "$nosaves" ] && fbgrab -z 0 "$screenshot"

# Saves!
[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && mv -f "$autosave" "$save"
[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save"
if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
[ ! -z "$sram" ] && [ -f "$rsav" ] && mv -f "$rsav" "$sram"
else
Expand Down

0 comments on commit eb04f1e

Please sign in to comment.