mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-05-03 20:17:29 -05:00
75 lines
2.9 KiB
Plaintext
75 lines
2.9 KiB
Plaintext
# Very basic GodMode9 script to create, back up, and switch between save slots
|
|
# for the Friends and account (NNID) system modules
|
|
# Reference: https://3dbrew.org/wiki/System_SaveData
|
|
|
|
set friends_save_data "1:/data/$[SYSID0]/sysdata/00010032/00000000"
|
|
set account_save_data "1:/data/$[SYSID0]/sysdata/00010038/00000000"
|
|
set save_slots_dir "$[GM9OUT]/friends_accounts/saves"
|
|
set current_save_dir "$[GM9OUT]/friends_accounts/current_save"
|
|
|
|
labelsel -o -s "What do you want to do?" "menu_*"
|
|
goto end
|
|
|
|
# Save the current Friends and account system modules save data to a new slot
|
|
@menu_Create_new_save_slot
|
|
|
|
echo "This script will save your current Friends and\naccount system modules save data to a new save slot\non your SD card in\n$[save_slots_dir]"
|
|
input "What do you want to name your new save slot?" new_save_slot_name
|
|
|
|
# Copy the current Friends and account saves to the new save slot
|
|
set output_save_dir "$[save_slots_dir]/$[new_save_slot_name]"
|
|
cp "$[friends_save_data]" "$[output_save_dir]/friends.bin"
|
|
cp "$[account_save_data]" "$[output_save_dir]/account.bin"
|
|
|
|
# Save the name of the current save slot
|
|
rm -o -s "$[current_save_dir]"
|
|
mkdir "$[current_save_dir]"
|
|
fdummy "$[current_save_dir]/$[new_save_slot_name]" 0
|
|
echo "Successfully saved your current save data to\n$[output_save_dir]"
|
|
|
|
goto end
|
|
|
|
|
|
# Load a previously-saved Friends and account system modules save slot
|
|
@menu_Load_a_save_slot
|
|
|
|
if find "$[save_slots_dir]/*" NULL
|
|
allow "$[friends_save_data]"
|
|
allow "$[account_save_data]"
|
|
|
|
# Save the old save data to the current save slot
|
|
if not find "$[current_save_dir]/*" current_save
|
|
# Manually choose a save slot
|
|
echo "Last-used save slot is not set."
|
|
dirsel "Which save slot do you want to save your current\nFriends and account system modules save data to\nbefore loading another save slot?" "$[save_slots_dir]" current_save
|
|
end
|
|
strsplit current_save "$[current_save]" "/"
|
|
|
|
echo "This script will load your Friends and account\nsystem modules save data from another save slot.\n\nFirst, your current save data will be saved to the\nlast-used slot: $[current_save]."
|
|
set save_slot_save "$[save_slots_dir]/$[current_save]"
|
|
ask "Overwrite this save slot?\n$[save_slot_save]"
|
|
|
|
cp -w "$[friends_save_data]" "$[save_slot_save]/friends.bin"
|
|
cp -w "$[account_save_data]" "$[save_slot_save]/account.bin"
|
|
|
|
# Load a new save slot
|
|
dirsel "Which save slot do you want to load?" "$[save_slots_dir]" save_slot_load
|
|
cp -w -n "$[save_slot_load]/friends.bin" "$[friends_save_data]"
|
|
cp -w -n "$[save_slot_load]/account.bin" "$[account_save_data]"
|
|
|
|
# Save the name of the loaded save slot
|
|
strsplit loaded_save_slot_name "$[save_slot_load]" "/"
|
|
rm -o -s "$[current_save_dir]"
|
|
mkdir "$[current_save_dir]"
|
|
fdummy "$[current_save_dir]/$[loaded_save_slot_name]" 0
|
|
echo "Successfully loaded the saves from\n$[save_slot_load]"
|
|
else
|
|
echo "No save slots found. Create one first."
|
|
end
|
|
|
|
goto end
|
|
|
|
|
|
@end
|
|
# Exit the script
|