Guest User

NEOsave

a guest
Apr 7th, 2017
469
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ECHO OFF
  2. TITLE NEO Scavenger Savegame Backup Tool - NEOsave
  3. SETLOCAL enabledelayedexpansion
  4.  
  5. REM Find and set .bat file launch folder.
  6. SET launchdir=%~dp0
  7.  
  8. REM Set variables for savegame folder creation.
  9. SET /a saveslots=0
  10. SET /a saveslotcntr=1
  11.  
  12. cls
  13.  
  14. REM Look for NEOScavenger.exe and create NEOsave folder in .bat file folder.
  15. IF EXIST "NEOScavenger.exe" (
  16.     IF NOT EXIST "NEOsave" (
  17.         mkdir NEOsave
  18.         mkdir NEOsave\quicksave
  19.         (
  20.             ECHO [AVAILABLE SAVEGAME SLOTS]
  21.             ECHO savegameslots=0
  22.         ) > NEOsave\settings.ini
  23.         ECHO.
  24.         ECHO NEOsave folder created in: %launchdir%NEOsave
  25.         ECHO NEOsave quick save folder created in: %launchdir%NEOsave\quicksave
  26.         ECHO NEOsave settings.ini created in: %launchdir%NEOsave\settings.ini
  27.         ECHO.
  28.         PAUSE
  29.     )
  30. ) ELSE (
  31.     ECHO.
  32.     ECHO ERROR: NEOScavenger.exe not found.
  33.     ECHO.
  34.     PAUSE
  35.     GOTO exitNEOsave
  36. )
  37.  
  38.  
  39.  
  40. REM Menu and save backup management.
  41. :menu
  42. cls
  43. SET selection=
  44. REM Check number of savegame folders and update settings.ini if necessary.
  45. SET foldercount=
  46. FOR /d %%a IN ("%launchdir%NEOsave\"*) DO SET /a foldercount+=1
  47. SET /a foldercount-=1
  48. FOR /f "delims== tokens=1,2" %%i IN ('findstr "savegameslots" NEOsave\settings.ini') DO @SET savegameslots=%%j
  49. IF NOT !savegameslots!==!foldercount! (
  50.     (
  51.         ECHO [AVAILABLE SAVEGAME SLOTS]
  52.         ECHO savegameslots=!foldercount!
  53.     ) > NEOsave\settings.ini
  54. )
  55. REM Build main menu.
  56. ECHO ==================================
  57. ECHO   NEO Scavenger SAVEGAME BACKUP:
  58. ECHO ==================================
  59. ECHO.
  60. ECHO    1: START NEO Scavenger
  61. ECHO.
  62. ECHO    2: QUICK SAVE
  63. ECHO    3: QUICK RESTORE
  64. IF EXIST "NEOsave\quicksave\savesettings.ini" (
  65.     FOR /f "delims== tokens=1,2" %%i IN ('findstr "saverestoredon" NEOsave\quicksave\savesettings.ini') DO @SET savedate=%%j
  66.     ECHO      [Last save: !savedate!]
  67. ) ELSE (
  68.     ECHO      [No quick save data]
  69. )
  70. ECHO.
  71. ECHO    4: SAVE savegame
  72. ECHO    5: RESTORE savegame
  73. ECHO.
  74. ECHO    6: DELETE savegame
  75. ECHO.
  76. ECHO    0: EXIT
  77. ECHO.
  78. ECHO.
  79.  
  80. SET /p selection=SELECT:
  81. ECHO.
  82. IF "%selection%"=="1" GOTO startNEO
  83. IF "%selection%"=="2" GOTO quickSaveNEO
  84. IF "%selection%"=="3" GOTO quickLoadNEO
  85. IF "%selection%"=="4" GOTO saveNEOmenu
  86. IF "%selection%"=="5" GOTO loadNEOmenu
  87. IF "%selection%"=="6" GOTO deleteNEOmenu
  88. IF "%selection%"=="0" (
  89.     GOTO exitNEOsave
  90. ) ELSE (
  91.     cls
  92.     ECHO.
  93.     ECHO ERROR: Invalid selection.
  94.     ECHO.
  95.     PAUSE
  96.     GOTO menu
  97. )
  98.  
  99.  
  100.  
  101. :startNEO
  102. IF NOT EXIST "NEOScavenger.exe" (
  103.     ECHO  ERROR: NEOScavenger.exe not found.
  104.     PAUSE
  105.     GOTO menu
  106. ) ELSE (
  107.     NEOScavenger.exe
  108.     GOTO menu
  109. )
  110.  
  111.  
  112.  
  113. :quickSaveNEO
  114. REM Find NEOScavenger Flash Player folder and savegames.
  115. SET p=
  116. FOR /r "%userprofile%\AppData\Roaming\Macromedia\Flash Player\#SharedObjects" %%a IN (*) DO IF "%%~nxa"=="nsTest.sol" SET p=%%~dpa
  117. IF DEFINED p (
  118.     ECHO Savegame found in: %p%
  119. ) ELSE (
  120.     ECHO ERROR: No NEO Scavenger savegame found.
  121.     ECHO.
  122.     PAUSE
  123.     GOTO menu
  124. )
  125.  
  126. REM Copy savegame from NEOScavenger Flash Player folder to backup folder.
  127. XCOPY "%p%*.sol" "%launchdir%NEOsave\quicksave\" /y
  128. SET dateandtime=%DATE%, %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
  129. (
  130.     ECHO [DATE OF SAVEGAME]
  131.     ECHO saverestoredon=%dateandtime%
  132. ) > "%launchdir%NEOsave\quicksave\savesettings.ini"
  133. ECHO.
  134. ECHO Savegame copied to: %launchdir%NEOsave\quicksave\
  135. ECHO.
  136. PAUSE
  137. GOTO menu
  138.  
  139.  
  140.  
  141. :quickLoadNEO
  142. REM Look for backed up files in NEOsave.
  143. IF NOT EXIST "%launchdir%NEOsave\quicksave\nsTest.sol" (
  144.     ECHO ERROR: No NEO Scavenger savegame found in: %launchdir%NEOsave\quicksave\
  145.     ECHO.
  146.     PAUSE
  147.     GOTO menu
  148. )
  149.  
  150. REM Find NEOScavenger Flash Player folder.
  151. SET p=
  152. FOR /r "%userprofile%\AppData\Roaming\Macromedia\Flash Player\#SharedObjects" %%a IN (*) DO IF "%%~nxa"=="nsTest.sol" SET p=%%~dpa
  153. IF DEFINED p (
  154.     ECHO NEO Scavenger savegame folder found in: %p%
  155. ) ELSE (
  156.     ECHO ERROR: No NEO Scavenger savegame folder found.
  157.     ECHO SOLUTION: Please restart NEO Scavenger, exit the game and run this batch file again.
  158.     ECHO.
  159.     PAUSE
  160.     GOTO menu
  161. )
  162.  
  163. REM Copy savegame from backup folder to NEOScavenger Flash Player savegame folder.
  164. XCOPY "%launchdir%NEOsave\quicksave\*.sol" "%p%" /y
  165. ECHO.
  166. ECHO NEO Scavenger savegame restored.
  167. ECHO.
  168. PAUSE
  169. GOTO menu
  170.  
  171.  
  172.  
  173. :saveNEOmenu
  174. cls
  175. SET selectionsave=
  176. SET newsaveslotcreated=
  177. SET confirmoverwrite=
  178. REM Read settings.ini file.
  179. FOR /f "delims== tokens=1,2" %%i IN ('findstr "savegameslots" NEOsave\settings.ini') DO @SET savegameslots=%%j
  180. ECHO ==================================
  181. ECHO   NEO Scavenger SAVEGAME BACKUP:
  182. ECHO ==================================
  183. ECHO.
  184. ECHO  SAVE savegame
  185. ECHO.
  186. ECHO    0: BACK
  187. ECHO.
  188. ECHO    n: NEW SAVE
  189. ECHO.
  190. REM Build menu entries.
  191. SET /a savegameslots=savegameslots+1
  192. SET /a savemenucounter=1
  193. :buildsavemenu
  194. IF NOT "%savemenucounter%"=="%savegameslots%" (
  195.     IF EXIST "%launchdir%NEOsave\save%savemenucounter%\savesettings.ini" (
  196.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "saverestoredon" NEOsave\save%savemenucounter%\savesettings.ini') DO @SET savedate=%%j
  197.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "savename" NEOsave\save%savemenucounter%\savesettings.ini') DO @SET menusavename=%%j
  198.         ECHO    %savemenucounter%: !menusavename!_[!savedate!]
  199.     ) ELSE (
  200.         ECHO    %savemenucounter%: Save Data for save%savemenucounter% not found.
  201.     )
  202.     SET /a savemenucounter=savemenucounter+1
  203.     GOTO buildsavemenu
  204. )
  205. ECHO.
  206. SET /a savegameslots=savegameslots-1
  207. SET /p selectionsave=SELECT:
  208. ECHO.
  209. IF "%selectionsave%" LSS "1" GOTO menu
  210. IF "%selectionsave%"=="n" GOTO createnewsave
  211. IF "%selectionsave%" LEQ "%savegameslots%" (
  212.     GOTO overwritecheck
  213. ) ELSE (
  214.     ECHO ERROR: No save location available for this selection.
  215.     ECHO.
  216.     PAUSE
  217.     GOTO saveNEOmenu
  218. )
  219.  
  220.  
  221.  
  222. :loadNEOmenu
  223. cls
  224. SET selectionload=
  225. REM Read settings.ini file.
  226. FOR /f "delims== tokens=1,2" %%i IN ('findstr "savegameslots" NEOsave\settings.ini') DO @SET savegameslots=%%j
  227. ECHO ==================================
  228. ECHO   NEO Scavenger SAVEGAME BACKUP:
  229. ECHO ==================================
  230. ECHO.
  231. ECHO  RESTORE savegame
  232. ECHO.
  233. ECHO    0: BACK
  234. ECHO.
  235. REM Build menu entries.
  236. SET /a savegameslots=savegameslots+1
  237. SET /a loadmenucounter=1
  238. :buildloadmenu
  239. IF NOT "%loadmenucounter%"=="%savegameslots%" (
  240.     IF EXIST "%launchdir%NEOsave\save%loadmenucounter%\savesettings.ini" (
  241.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "saverestoredon" NEOsave\save%loadmenucounter%\savesettings.ini') DO @SET savedate=%%j
  242.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "savename" NEOsave\save%loadmenucounter%\savesettings.ini') DO @SET menusavename=%%j
  243.         ECHO    %loadmenucounter%: !menusavename!_[!savedate!]
  244.     ) ELSE (
  245.         ECHO    %loadmenucounter%: Save Data for save%loadmenucounter% not found.
  246.     )
  247.     SET /a loadmenucounter=loadmenucounter+1
  248.     GOTO buildloadmenu
  249. )
  250. ECHO.
  251. SET /a savegameslots=savegameslots-1
  252. SET /p selectionload=SELECT:
  253. ECHO.
  254. IF "%selectionload%" LSS "1" GOTO menu
  255. IF "%selectionload%" LEQ "%savegameslots%" (
  256.     GOTO loadNEO
  257. ) ELSE (
  258.     ECHO ERROR: No save location available for this selection.
  259.     ECHO.
  260.     PAUSE
  261.     GOTO loadNEOmenu
  262. )
  263.  
  264.  
  265.  
  266. :deleteNEOmenu
  267. cls
  268. SET selectiondelete=
  269. SET foldercount=
  270. REM Read settings.ini file.
  271. FOR /f "delims== tokens=1,2" %%i IN ('findstr "savegameslots" NEOsave\settings.ini') DO @SET savegameslots=%%j
  272. ECHO ==================================
  273. ECHO   NEO Scavenger SAVEGAME BACKUP:
  274. ECHO ==================================
  275. ECHO.
  276. ECHO  DELETE savegame
  277. ECHO.
  278. ECHO    0: BACK
  279. ECHO.
  280. REM Build menu entries.
  281. SET /a savegameslots=savegameslots+1
  282. SET /a deletemenucounter=1
  283. :builddeletemenu
  284. IF NOT "%deletemenucounter%"=="%savegameslots%" (
  285.     IF EXIST "%launchdir%NEOsave\save%deletemenucounter%\savesettings.ini" (
  286.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "saverestoredon" NEOsave\save%deletemenucounter%\savesettings.ini') DO @SET savedate=%%j
  287.         FOR /f "delims== tokens=1,2" %%i IN ('findstr "savename" NEOsave\save%deletemenucounter%\savesettings.ini') DO @SET menusavename=%%j
  288.         ECHO    %deletemenucounter%: !menusavename!_[!savedate!]
  289.     ) ELSE (
  290.         ECHO    %deletemenucounter%: Save Data for save%deletemenucounter% not found.
  291.     )
  292.     SET /a deletemenucounter=deletemenucounter+1
  293.     GOTO builddeletemenu
  294. )
  295. ECHO.
  296. SET /a savegameslots=savegameslots-1
  297. SET /p selectiondelete=SELECT:
  298. ECHO.
  299. IF "%selectiondelete%" LSS "1" GOTO menu
  300. IF "%selectiondelete%" LEQ "%savegameslots%" (
  301.     GOTO deleteNEO
  302. ) ELSE (
  303.     ECHO ERROR: No save location available for this selection.
  304.     ECHO.
  305.     PAUSE
  306.     GOTO deleteNEOmenu
  307. )
  308.  
  309.  
  310.  
  311. :createnewsave
  312. SET newsaveslotcreated=
  313. REM Find NEOScavenger Flash Player folder and savegames.
  314. SET p=
  315. FOR /r "%userprofile%\AppData\Roaming\Macromedia\Flash Player\#SharedObjects" %%a IN (*) DO IF "%%~nxa"=="nsTest.sol" SET p=%%~dpa
  316. IF NOT DEFINED p (
  317.     ECHO ERROR: No NEO Scavenger savegame found.
  318.     ECHO.
  319.     PAUSE
  320.     GOTO menu
  321. )
  322. REM Create savegame folder and settings.ini file.
  323. SET /a lookforsavecounter=1
  324. :lookforsaves
  325. IF EXIST "%launchdir%NEOsave\save%lookforsavecounter%" (
  326.     SET /a lookforsavecounter=lookforsavecounter+1
  327.     GOTO lookforsaves
  328. ) ELSE (
  329.     mkdir "%launchdir%NEOsave\save%lookforsavecounter%"
  330.     SET /a selectionsave=%lookforsavecounter%
  331.     SET /a foldercount=0
  332.     FOR /d %%a IN ("%launchdir%NEOsave\"*) DO SET /a foldercount+=1
  333.     SET /a foldercount=foldercount-1
  334.     (
  335.         ECHO [AVAILABLE SAVEGAME SLOTS]
  336.         ECHO savegameslots=!foldercount!
  337.     ) > NEOsave\settings.ini
  338. )
  339. SET /a newsaveslotcreated=1
  340. GOTO overwritecheck
  341.  
  342.  
  343.  
  344. :overwritecheck
  345. SET confirmoverwrite=
  346. REM Check for existing save and ask for overwrite confirmation.
  347. IF NOT "!newsaveslotcreated!"=="1" (
  348.     SET /p confirmoverwrite=Are you sure you want to OVERWRITE save!selectionsave!? y/n:
  349.     IF "!confirmoverwrite!"=="n" (
  350.         GOTO saveNEOmenu
  351.     )
  352.     IF "!confirmoverwrite!"=="y" (
  353.         GOTO saveNEO
  354.     ) ELSE (
  355.         ECHO.
  356.         ECHO ERROR: No valid selection.
  357.         ECHO.
  358.         GOTO overwritecheck
  359.     )
  360. ) ELSE (
  361.     GOTO saveNEO
  362. )
  363.  
  364.  
  365.  
  366. :saveNEO
  367. REM Find NEOScavenger Flash Player folder and savegame.
  368. SET p=
  369. FOR /r "%userprofile%\AppData\Roaming\Macromedia\Flash Player\#SharedObjects" %%a IN (*) DO IF "%%~nxa"=="nsTest.sol" SET p=%%~dpa
  370. IF DEFINED p (
  371.     ECHO.
  372.     ECHO Savegame found in: %p%
  373.     ECHO.
  374. ) ELSE (
  375.     ECHO ERROR: No NEO Scavenger savegame found.
  376.     ECHO.
  377.     PAUSE
  378.     GOTO menu
  379. )
  380. SET /p nameofsave=Enter savegame name:
  381. REM Copy savegame from NEOScavenger Flash Player folder to backup folder.
  382. XCOPY "%p%*.sol" "%launchdir%NEOsave\save!selectionsave!\" /y
  383. SET dateandtime=%DATE%, %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
  384. (
  385.     ECHO [SAVEGAME NAME]
  386.     ECHO savename=%nameofsave%
  387.     ECHO.
  388.     ECHO [DATE OF SAVEGAME]
  389.     ECHO saverestoredon=%dateandtime%
  390. ) > "%launchdir%NEOsave\save%selectionsave%\savesettings.ini"
  391. ECHO.
  392. ECHO Savegame copied to: %launchdir%NEOsave\save%selectionsave%\
  393. ECHO.
  394. PAUSE
  395. GOTO saveNEOmenu
  396.  
  397.  
  398.  
  399. :loadNEO
  400. REM Look for backed up files in NEOsave.
  401. IF NOT EXIST "%launchdir%NEOsave\save%selectionload%\nsTest.sol" (
  402.     ECHO ERROR: No NEO Scavenger savegame found in: %launchdir%NEOsave\save%selectionload%\
  403.     ECHO.
  404.     PAUSE
  405.     GOTO loadNEOmenu
  406. )
  407.  
  408. REM Find NEOScavenger Flash Player folder.
  409. SET p=
  410. FOR /r "%userprofile%\AppData\Roaming\Macromedia\Flash Player\#SharedObjects" %%a IN (*) DO IF "%%~nxa"=="nsTest.sol" SET p=%%~dpa
  411. IF DEFINED p (
  412.     ECHO NEO Scavenger savegame folder found in: %p%
  413. ) ELSE (
  414.     ECHO ERROR: No NEO Scavenger savegame folder found.
  415.     ECHO SOLUTION: Please restart NEO Scavenger, exit the game and run this batch file again.
  416.     ECHO.
  417.     PAUSE
  418.     GOTO menu
  419. )
  420.  
  421. REM Copy savegame from backup folder to NEOScavenger Flash Player savegame folder.
  422. XCOPY "%launchdir%NEOsave\save%selectionload%\*.sol" "%p%" /y
  423. ECHO.
  424. ECHO NEO Scavenger savegame restored.
  425. ECHO.
  426. PAUSE
  427. GOTO loadNEOmenu
  428.  
  429.  
  430.  
  431. :deleteNEO
  432. SET foldercount=
  433. SET confirmdelete=
  434. IF EXIST "NEOsave\save%selectiondelete%\" (
  435.     ECHO Savegame found in: %launchdir%NEOsave\save%selectiondelete%\
  436.     ECHO.
  437.     SET /p confirmdelete=Are you sure you want to DELETE save%selectiondelete%? y/n:
  438.     IF "!confirmdelete!"=="y" (
  439.         del NEOsave\save!selectiondelete! /q
  440.         rmdir NEOsave\save!selectiondelete! /q
  441. REM Rename remaining folders.
  442.         SET /a selectdelrename=selectiondelete+1
  443.         SET /a selectdelrenamedown=selectdelrename-1       
  444.         :renamesavefolders
  445.         IF EXIST "NEOsave\save!selectdelrename!" (
  446.             ren NEOsave\save!selectdelrename! save!selectdelrenamedown!
  447.             SET /a selectdelrename=selectdelrename+1
  448.             SET /a selectdelrenamedown=selectdelrenamedown+1
  449.             GOTO renamesavefolders
  450.         )
  451. REM Update settings.ini file.
  452.         FOR /d %%a IN ("%launchdir%NEOsave\"*) DO SET /a foldercount+=1
  453.         SET /a foldercount-=1
  454.         SET /a !foldercount!=!foldercount!
  455.         (
  456.             ECHO [AVAILABLE SAVEGAME SLOTS]
  457.             ECHO savegameslots=!foldercount!
  458.         ) > NEOsave\settings.ini
  459.         ECHO.
  460.         ECHO Savegame save%selectiondelete% in %launchdir%NEOsave\save%selectiondelete%\ deleted.
  461.         ECHO.
  462.         GOTO deleteNEOmenu
  463.     )
  464.     IF "!confirmdelete!"=="n" (
  465.         GOTO deleteNEOmenu
  466.     ) ELSE (
  467.         ECHO.
  468.         ECHO ERROR: No valid selection.
  469.         ECHO.
  470.         GOTO deleteNEO
  471.     )
  472. ) ELSE (
  473.     ECHO.
  474.     ECHO ERROR: No savegame found in: %launchdir%NEOsave\save%selectiondelete%\
  475.     ECHO.
  476.     PAUSE
  477.     GOTO deleteNEOmenu
  478. )
  479.  
  480.  
  481.  
  482. :exitNEOsave
  483. EXIT
RAW Paste Data