From f42f4115a2c5eeeed7c6d0e0b78ef752e4133116 Mon Sep 17 00:00:00 2001 From: Matthew Lopez <73856503+MatthewL246@users.noreply.github.com> Date: Thu, 28 Dec 2023 21:34:45 -0500 Subject: [PATCH] Make save switcher script more user-friendly --- README.md | 26 +++++----- console-files/FriendsSaveSwitcher.gm9 | 69 ++++++++++++++++----------- 2 files changed, 54 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 04d09c9..9834831 100644 --- a/README.md +++ b/README.md @@ -225,26 +225,24 @@ line and have a basic understanding of Docker. > released on the Pretendo Network Discord server as `manual_override.3dsx`) > **goes to Trace.** 1. Reboot into GodMode9 and open the scripts menu. - 2. Run the `FriendsSaveSwitcher` script and select "Save new slot". Name the - slot something descriptive like `pretendo_official`. + 2. Run the `FriendsSaveSwitcher` script and select "Create a new save slot". + Name the slot something descriptive like `pretendo_official`. 3. Reboot into the Home Menu and open the Homebrew Launcher. From there, run the `ResetFriendsTestAccount.3dsx` app and press A when a white line appears at the top of the screen (the Nimbus GUI was removed). 4. Open the Friend List applet. You should be "online" and have a new friend code that is different from your friend code on the official servers. 5. Reboot into GodMode9 and open the scripts menu again. - 6. Run the `FriendsSaveSwitcher` script and select "Save new slot" again. - Name the slot something descriptive like `local_server`. + 6. Run the `FriendsSaveSwitcher` script and select "Create a new save slot" + again. Name the slot something descriptive like `local_server`. 7. You now have multiple test Friends accounts saved on your SD card at `sd:/gm9/out/friends_accounts/`. You can switch between them by running - the `FriendsSaveSwitcher` script, selecting "Load save slot", and + the `FriendsSaveSwitcher` script, selecting "Create a new save slot", and following the instructions. - - Pay careful attention to the script's instructions. Make sure that you - first save your current save data to the active save slot when prompted - and then load the other save slot. For example, when switching from - `local_server` to `pretendo_official`: start the script, select - `Load save slot`, save the current save data to the `local_server` slot, - and then load the `pretendo_official` slot. + - Pay careful attention to the script's instructions. When loading a save + slot, it will first save the current Friends and account system modules + save data to the last-used save slot. Create a new slot if you don't + want to overwrite your existing save data. 8. Open System Settings using your `local_server` Friends test account and create a new PNID or sign in to one you created on your Wii U or website. @@ -280,9 +278,9 @@ line and have a basic understanding of Docker. re-downloading Nimbus from GitHub. - On 3DS, switch to your official Pretendo Friends account by running the `FriendsSaveSwitcher` script in GodMode9 and loading the - `pretendo_official` slot. - - You may now delete the `sd:/gm9/out/friends_accounts/` directory from - your SD card, as well as `sd:/3ds/ResetFriendsTestAccount.3dsx` and + `pretendo_official` slot you made. + - You may now delete the `sd:/gm9/out/friends_accounts` directory from your + SD card, as well as `sd:/3ds/ResetFriendsTestAccount.3dsx` and `sd:/gm9/scripts/FriendsSaveSwitcher.gm9` if you will no longer be using multiple Friends accounts. - Make sure your console still works when connecting to the official Pretendo diff --git a/console-files/FriendsSaveSwitcher.gm9 b/console-files/FriendsSaveSwitcher.gm9 index c35a959..24f92c2 100644 --- a/console-files/FriendsSaveSwitcher.gm9 +++ b/console-files/FriendsSaveSwitcher.gm9 @@ -4,16 +4,16 @@ 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" -set current_save_file "$[save_slots_dir]/current_save.txt" - -labelsel "What do you want to do?" "menu_*" +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_Save_new_slot +@menu_Create_new_save_slot -echo "This script will save your current Friends and\naccount save data to a new save slot on your\nSD card at $[save_slots_dir]" +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 @@ -22,36 +22,51 @@ 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 -dumptxt "$[current_save_file]" "$[output_save_dir]" +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_save_slot +@menu_Load_a_save_slot -# Save the old save data to the current save slot -# I can't figure out how to read the file using fget, so just ask the user to -# choose when saving the current slot before switching -echo "This script will load your Friends and account\nsave data from a previously saved slot.\nFirst, select a slot to save your current data." -echo "The next screen displays the last loaded slot.\nSave your current data to this slot\nbefore loading a different one." -textview "$[current_save_file]" -dirsel "Which save slot do you want to save to?" "$[save_slots_dir]" save_slot_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" +if find "$[save_slots_dir]/*" NULL + allow "$[friends_save_data]" + allow "$[account_save_data]" -# Load a new save slot -allow "$[friends_save_data]" -allow "$[account_save_data]" -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 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 modules save data to\nbefore loading another save slot?" "$[save_slots_dir]" + current_save + end + strsplit current_save "$[current_save]" "/" -# Save the name of the loaded save slot -dumptxt "$[current_save_file]" "$[save_slot_load]" -echo "Successfully loaded the save slot\n$[save_slot_load]" + echo "This script will load your Friends and account\nsave data from a previously saved slot.\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