Skip to content

Instantly share code, notes, and snippets.

@danny8376
Last active May 18, 2024 15:43
Show Gist options
  • Save danny8376/1a894b7ba0e7686aba98b2260d469b44 to your computer and use it in GitHub Desktop.
Save danny8376/1a894b7ba0e7686aba98b2260d469b44 to your computer and use it in GitHub Desktop.
Simple Cartridge Save Manager GodMode9 Script
######################################################
# Simple Cartridge Save Manager GodMode9 Script #
# by DannyAAM #
######################################################
@Start
labelsel -s "Choose an Option." MainMenu_*
goto Start
#### Dump ####
@MainMenu_Dump_Save_From_Cartridge
if not find C:/*.sav CARTSAV
echo "No cartridge inserted or doesn't support save."
goto Start
end
strsplit SAVEFN $[CARTSAV] "/"
strsplit -b SAVEFN $[SAVEFN] "."
findnot $[GM9OUT]/$[SAVEFN]_??.sav OUTPATH
cp $[CARTSAV] $[OUTPATH]
echo "Dump created successfully:\n$[OUTPATH]"
goto Start
#### Restore ####
@MainMenu_Restore_Save_To_Cartridge
if not find C:/*.sav CARTSAV
echo "No cartridge inserted or doesn't support save."
goto Start
end
strsplit SAVEFN $[CARTSAV] "/"
strsplit -b SAVEFN $[SAVEFN] "."
# missing here . is specifically for also matching non suffixed sav file.
if not filesel "Select the .sav file you want to restore." $[GM9OUT]/$[SAVEFN]*sav SRCPATH
echo "Cancelled."
goto Start
end
if not allow $[CARTSAV]
echo "Permissions denied. Aborting."
goto Start
end
if cp $[SRCPATH] $[CARTSAV]
echo "Save restored successfully."
else
echo "Write failed, probably Card2 cartridge, which\nGodMode9 doesn't support writing to currently."
end
goto Start
#### Nuke ####
@MainMenu_Nuke_Cartridge_Save
if not find C:/*.sav CARTSAV
echo "No cartridge inserted or doesn't support save."
goto Start
end
if not ask "Are you really sure you want to erase the save?"
echo "Cancelled."
goto Start
end
if not allow $[CARTSAV]
echo "Permissions denied. Aborting."
goto Start
end
if fill $[CARTSAV] FF
echo "Save nuked successfully."
else
echo "Write failed, probably Card2 cartridge, which\nGodMode9 doesn't support writing to currently."
end
goto Start
@MainMenu_Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment