@echo off
cls
echo Cassini Emulator save game process.
echo.

ProcHalt -s Cassini.exe
if exist bins\*.bin del bins\*.bin

if exist  %windir%\Profiles\Saturn\*.bin goto GETBINS
echo  Their does not appear to be anything to save :(
pause
goto EXIT

:GETBINS
copy %windir%\Profiles\Saturn\*.bin bins
input NAME
wait 5
call input.bat
cls

REM Looks a bit messy, but keeps highest compatability.

if exist savedata\*.zip del savedata\*.zip

echo zip "savedata\%NAME%.zip" bins\*.bin > doit.bat
echo rename savedata\*.zip "_%NAME%_%date%_%time%.sav" >> doit.bat
gsar.exe -i -o "-s::" "-r_" doit.bat
gsar.exe -i -o "-s/" "-r-" doit.bat
gsar.exe -i -o "-s " "-r_" doit.bat
gsar.exe -i -o "-szip_" "-rzip " doit.bat
gsar.exe -i -o "-srename_" "-rrename " doit.bat
gsar.exe -i -o "-sbin_" "-rbin" doit.bat
gsar.exe -i -o "-s:x22_" "-r:x22" doit.bat
gsar.exe -i -o "-s.zip:x22" "-r.zip:x22 " doit.bat

gsar.exe -i -o "-s:x21" "-r_" doit.bat
gsar.exe -i -o "-s:x23" "-r_" doit.bat
gsar.exe -i -o "-s:x24" "-r_" doit.bat
gsar.exe -i -o "-s:x25" "-r_" doit.bat
gsar.exe -i -o "-s:x26" "-r_" doit.bat
gsar.exe -i -o "-s:x3a" "-r_" doit.bat
gsar.exe -i -o "-s:x3b" "-r_" doit.bat
gsar.exe -i -o "-s:x5e" "-r_" doit.bat

call doit.bat > null.log
if exist null.log del null.log
if exist doit.bat del doit.bat

ProcHalt -r Cassini.exe

:EXIT
pause

