Initial commit

This commit is contained in:
StarlitSkies
2024-09-28 16:57:39 -07:00
parent dc7ec6eb29
commit 0728239f7b
6 changed files with 1039 additions and 0 deletions
+176
View File
@@ -0,0 +1,176 @@
# Movable Moveover script, now with less manual
# Powered by FixupMovable TM technology https://github.com/fox8091/FixupMovable
# For use in https://wiki.hacks.guide/wiki/3DS:Movable_Moveover
# Last edited: 2024-9-24
# Version: 1.3
# Script by: ItsCrocoSwine
if keychk SELECT #Hold Select to keep preview mode on, with fun colors!
set PREVIEW_COLOR_COMMENT 32CD32 #Lime green
set PREVIEW_COLOR_ACTIVE 5D3FD3 #Iris
set PREVIEW_COLOR_CODE E37383 #Watermelon pink
else
set PREVIEW_MODE "Movable Moveover\nVersion: 1.3"
end
ask "This script will do the following:\n- Create an essential files backup\n- Fixup a provided movable.sed\n- Copy fixed movable to CTRNAND\n \nIf you are ok with this\npress (A) to continue."
set MMMPATH 0:/gm9/out/MMM #Working path
set OUTPATH 0:/gm9/out/MMM_Backup #Path for backuping up files
rm -o -s $[MMMPATH]
mkdir -o -s $[MMMPATH]
mkdir -o -s $[OUTPATH]
#Find source movable
#Select a file
@FILE_SELECT
filesel -x "Select your movable.sed or essential.exefs:" 0:/* SOURCE_FILE
strsplit SOURCE_FILENAME $[SOURCE_FILE] /
#Check if its at least a .sed .exefs or .bin
if not strsplit SOURCE_FILE_EXT $[SOURCE_FILE] .
if chk $[SOURCE_FILENAME] movable #reject no file extension, unless its exactly "movable"
cp -w $[SOURCE_FILE] $[MMMPATH]/sourcemovable.sed
else
ask "Error: '$[SOURCE_FILENAME]' is\nnot a valid input file.\n \nPlease select a movable.sed, essential.exefs,\nor sysnand.bin from the source console."
goto FILE_SELECT
end
elif chk $[SOURCE_FILE_EXT] sed
cp -w $[SOURCE_FILE] $[MMMPATH]/sourcemovable.sed
elif chk $[SOURCE_FILE_EXT] exefs
fdummy -o -s $[MMMPATH]/sourcemovable.sed 140
inject $[SOURCE_FILE]@600:140 $[MMMPATH]/sourcemovable.sed
elif chk $[SOURCE_FILE_EXT] bin
fdummy -o -s $[MMMPATH]/sourcemovable.sed 140
inject $[SOURCE_FILE]@800:140 $[MMMPATH]/sourcemovable.sed
else
ask "Error: '$[SOURCE_FILENAME]' is\nnot a valid input file.\n \nPlease select a movable.sed, essential.exefs,\nor sysnand.bin from the source console."
goto FILE_SELECT
end
#verify file integrity
fget $[MMMPATH]/sourcemovable.sed@0:4 SM_SEED
fget $[MMMPATH]/sourcemovable.sed@8:10 SM_BFMCHECK
if not shaget $[MMMPATH]/sourcemovable.sed@8:118 SM_SHA
echo "Source movable.sed is invalid:\nmovable is unreadable"
poweroff
elif chk -u $[SM_SEED] "53454544"
echo "Source movable.sed is invalid:\nSEED is missing or corrupt\n \n(Is this even a movable?)"
poweroff
elif chk $[SM_BFMCHECK] "00000000000000000000000000000000"
echo "Source movable.sed is invalid:\nmovable is from seedminer"
poweroff
end
if find 1:/private/movable.sed NULL
fget 1:/private/movable.sed@0:4 PM_SEED
fget 1:/private/movable.sed@5:1 PM_CMAC
fget 1:/private/movable.sed@8:10 PM_BFMCHECK
if not shaget 1:/private/movable.sed@8:118 PM_SHA
echo "1:/private/movable.sed is unreadable\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
elif chk -u $[PM_SEED] "53454544"
echo "1:/private/movable.sed is invalid:\nSEED is missing or corrupt\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
elif chk $[PM_BFMCHECK] "00000000000000000000000000000000"
echo "1:/private/movable.sed is invalid:\nmovable is from seedminer\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
else
echo "1:/private/movable.sed is missing\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
if find S:/essential.exefs NULL
if not shaget S:/essential.exefs@0:100 NULL
echo "S:/essential.exefs is unreadable\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
else
echo "S:/essential.exefs is missing\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
#Compare source and private movable. If both are the same determine if FixupMovable is required.
if chk $[SM_SHA] $[PM_SHA]
if chk $[PM_CMAC] 00
echo "Error: Source movable is the same as in NAND\nFixupMovable is not required.\n \nIf you are trying to do a\nMovable Moveover then you chose\nthe wrong essential.exefs or movable.sed"
poweroff
else
if not ask "Information: Source movable is the same as in NAND\nWould you like to run FixupMovable?\n \nNote: This is NOT a normal Movable Moveover\nand will NOT change your encryption key.\nIf you are not trying to fixup\na previous moveover, press (B) to cancel.\n \n Otherwise press (A) to continue."
echo "Script canceled\n \nPress (A) to power off."
rm -o -s $[MMMPATH]
poweroff
end
end
end
#Calculate and check for existence of ID0 for source movable
#Write sha file for KeyY
shaget $[MMMPATH]/sourcemovable.sed@110:10 $[MMMPATH]/KeyY.sha
#Get ID0 parts, reorder bytes, and combine
fget -e $[MMMPATH]/KeyY.sha@0:4 ID0part1
fget -e $[MMMPATH]/KeyY.sha@4:4 ID0part2
fget -e $[MMMPATH]/KeyY.sha@8:4 ID0part3
fget -e $[MMMPATH]/KeyY.sha@C:4 ID0part4
set SM_ID0 $[ID0part1]$[ID0part2]$[ID0part3]$[ID0part4]
#Check for ID0 directory
if not isdir "0:/Nintendo 3DS/$[SM_ID0]"
echo "Error: ID0 of source movable.sed does not\nmatch any ID0 on the SD card.\n \nSource file: $[SOURCE_FILENAME]\nDetected ID0: $[SM_ID0]\n \nPlease make sure the Nintendo 3DS folder you\nare trying to transfer is on the SD card\nand you are choosing the correct movable."
rm -o -s $[MMMPATH]
poweroff
end
#Backup movable/essential files
findnot $[OUTPATH]/$[DATESTAMP]_$[SERIAL]_movable_??.sed MOVABLEOUT
if not cp 1:/private/movable.sed $[MOVABLEOUT]
echo "Failed backing up movable.sed\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
findnot $[OUTPATH]/$[DATESTAMP]_$[SERIAL]_essential_??.exefs ESSENTIALOUT
if not cp S:/essential.exefs $[ESSENTIALOUT]
echo "Failed backing up essential.exefs\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
end
#FixupMovable
fdummy -o -s $[MMMPATH]/fixupmovable.sed 120
inject $[MMMPATH]/sourcemovable.sed@0:120 $[MMMPATH]/fixupmovable.sed@0
fill $[MMMPATH]/fixupmovable.sed@4:4 00
#Verify fixed up movable
#The FixupMovable section would have had to fail without throwing an exception for anything here to actually fail, but might as well be sure.
fget $[MMMPATH]/fixupmovable.sed@0:4 FM_SEED
fget $[MMMPATH]/fixupmovable.sed@4:4 FM_CMAC
if not shaget $[MMMPATH]/fixupmovable.sed@8:118 FM_SHA
echo "FixupMovable error:\nmovable is unreadable\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
elif chk -u $[SM_SEED] "53454544"
echo "FixupMovable error:\nSEED is missing or corrupt\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
elif chk -u $[FM_CMAC] "00000000"
echo "FixupMovable error:\nCMAC flag has not been set properly\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
poweroff
elif chk -u $[SM_SHA] $[FM_SHA]
echo "FixupMovable error:\nLFCS or KeyY has been changed\n(How did this happen?)\n \nAsk for help on Discord:\nhttps://discord.gg/MWxPgEp"
end
#Copy movable
if ask "Ready to perform the Moveover.\nSource file: $[SOURCE_FILENAME]\nDetected ID0: $[SM_ID0]\n \nUnlock permissions to continue."
allow 1:/private/movable.sed
cp -w $[MMMPATH]/fixupmovable.sed 1:/private/movable.sed
fixcmac 1:/dbs
fixcmac 1:/data
else
echo "Script canceled\n \nPress (A) to power off."
rm -o -s $[MMMPATH]
poweroff
end
#Cleanup
rm -o -s $[MMMPATH]
rm -o -s $[CURRDIR]/MovableMoveover.gm9
echo "Movable Moveover complete!\nYour new ID0 is: $[SM_ID0]\n \nYour backup essential files can be\nfound at: $[OUTPATH]\n \nPress (A) to reboot."
reboot
+26
View File
@@ -0,0 +1,26 @@
# 3DS Scripts
Various scripts used for recovery and system maintenance by [Nintendo Homebrew on Discord](https://discord.gg/C29hYvh).
# Usage
For instructions on how to use these scripts, open the links to their info pages on the [Hacks Guide Wiki](https://wiki.hacks.guide/wiki/Main_Page).
## ctrcheck
[ctrcheck.gm9](https://wiki.hacks.guide/wiki/3DS:Ctrcheck) is a general system maintenance and recovery tool, meant to be used in initial troubleshooting.
## Manual Transfer
[manual_transfer.gm9](https://wiki.hacks.guide/wiki/3DS:CTRTransfer/Manual) is the script used as part of a manual CTRTransfer.
## Movable Moveover
[MovableMoveover.gm9](https://wiki.hacks.guide/wiki/3DS:Movable_Moveover) is the script used as part of a Movable Moveover, which is effectively a manual System Transfer.
# Credits
* [FrozenChen](https://github.com/FrozenChen): Original creator of ctrcheck.
* [fox8091](https://github.com/fox8091) and AnalogMan: Original creators of manual_transfer.
* [ItsCrocoSwine](https://github.com/ItsCrocoSwine): Creator of MovableMoveover.
* [StarlitSkies](https://github.com/StarlitSkies): Current maintainer of ctrcheck and manual_transfer.
+618
View File
File diff suppressed because it is too large Load Diff
+187
View File
@@ -0,0 +1,187 @@
# Manual CTRTransfer Script
# A heavily-tweaked chimera of the original manual transfer script and the Lazarus3DS script.
# Attempts to revive a damaged NAND with a donor CTRNAND.
# last changed: 2024-09-08
# author: AnalogMan, fox8091, StarlitSkies
# Tell user what script does and ask for confirmation
set ERRORMSG "Script aborted by user."
ask "This script overwrites the entire CTRNAND\nwith a known working copy of that data.\nIt will try to keep all unique files intact\n but everything already missing will stay missing.\n \nOnly use this script on consoles that will not boot.\n \nContinue?"
# Check that essentials.exefs exists as backup, mount it, and extract uniques
# If it doesn't, check for backup essentials.exefs in 0:/gm9/out, mount it, and extract uniques
# If that doesn't exist either, check for already-extracted uniques in 0:/gm9/in instead
# If any console uniques are missing, immediately end script - this isn't Lazarus, nor should it be
if not find S:/essential.exefs ESSENTIAL
echo "Note: essential.exefs not found.\nUsing backup essential.exefs in 0:/gm9/out instead.\n\nPress A to continue."
if not find $[GM9OUT]/essential.exefs ESSENTIAL
echo "Note: Backup essential.exefs not found.\nUsing extracted files from 0:/gm9/in instead.\n\nPress A to continue."
end
end
set ERRORMSG "Console unique(s) not found.\nThis script will not run unless all console uniques exist."
if chk -u $[ESSENTIAL] ""
# this is if either essentials.exefs exists
imgmount $[ESSENTIAL]
set BACKUP $[GM9OUT]/backup
mkdir $[BACKUP]
cp -n -w G:/frndseed $[BACKUP]/LocalFriendCodeSeed_B
cp -n -w G:/hwcal0 $[BACKUP]/HWCAL0.dat
cp -n -w G:/hwcal1 $[BACKUP]/HWCAL1.dat
cp -n -w G:/movable $[BACKUP]/movable.sed
cp -n -w G:/secinfo $[BACKUP]/SecureInfo_A
imgumount
cp -n -w $[ESSENTIAL] $[BACKUP]/essential.exefs
find $[BACKUP]/LocalFriendCodeSeed_B SEED
find $[BACKUP]/HWCAL0.dat HWCAL0
find $[BACKUP]/HWCAL1.dat HWCAL1
find $[BACKUP]/movable.sed MOVABLE
find $[BACKUP]/SecureInfo_A SECINFO
else
# this is if neither essentials.exefs exists. note it is gm9/in, not gm9/out
find 0:/gm9/in/LocalFriendCodeSeed_B SEED
find 0:/gm9/in/HWCAL0.dat HWCAL0
find 0:/gm9/in/HWCAL1.dat HWCAL1
find 0:/gm9/in/movable.sed MOVABLE
find 0:/gm9/in/SecureInfo_A SECINFO
end
set ERRORMSG "No valid CTRNAND images found in 0:/gm9/out."
if chk $[ONTYPE] "N3DS"
find $[GM9OUT]/*_ctrtransfer_n3ds.bin NULL
else
find $[GM9OUT]/*_ctrtransfer_o3ds.bin NULL
end
set ERRORMSG "No CTRNAND image was selected."
if chk $[ONTYPE] "N3DS"
filesel "Select the CTRNAND image to use." $[GM9OUT]/*_ctrtransfer_n3ds.bin IMAGE
else
filesel "Select the CTRNAND image to use." $[GM9OUT]/*_ctrtransfer_o3ds.bin IMAGE
end
# Prompt for permission
set ERRORMSG "Script denied permissions by user."
allow -a S:
set ERRORMSG ""
if ask "Also restore non-critical data?\nThis includes things like the friends list and activity log,\nwhich would normally be reset.\n\nThis is usually safe, but may carry\na risk of preserving file corruption."
set OPTRESTORE 1
else
set OPTRESTORE 0
echo "Backups of this data will be preserved.\n\nIf you wish to restore them manually later on,\nthe files will be inside 0:/pit.\n\nPress A to continue."
end
# Preserve all other important console-unique data, to be restored after transfer
# Attempt to copy sysdata files to SD for restoring later
cp -w -o -s -n 1:/data/$[SYSID0]/sysdata/00010017/00000000 0:/pit/configsave.bin
cp -w -o -s -n 1:/data/$[SYSID0]/sysdata/00010032/00000000 0:/pit/friendsave.bin
cp -w -o -s -n 1:/data/$[SYSID0]/sysdata/0001000f/00000000 0:/pit/seedsave.bin
cp -w -o -s -n 1:/data/$[SYSID0]/sysdata/00010022/00000000 0:/pit/activitylog.bin
# Attempt to copy system app sysdata
find -o -s 1:/data/$[SYSID0]/sysdata/000202?8 MIIPLAZA
set MIIPLAZA $[MIIPLAZA]/00000000
cp -w -o -s -n $[MIIPLAZA] 0:/pit/miiplaza.bin
find -o -s 1:/data/$[SYSID0]/sysdata/000202?d FACERAIDERS
set FACERAIDERS $[FACERAIDERS]/00000000
cp -w -o -s -n $[FACERAIDERS] 0:/pit/faceraiders.bin
find -o -s 1:/data/$[SYSID0]/sysdata/000202?e ARGAMES
set ARGAMES $[ARGAMES]/00000000
cp -w -o -s -n $[ARGAMES] 0:/pit/argames.bin
# Attempt to copy extdata files to SD for restoring later
cp -w -o -s -n 1:/data/$[SYSID0]/extdata/00048000/f0000001 0:/pit/01 # Photos
cp -w -o -s -n 1:/data/$[SYSID0]/extdata/00048000/f0000002 0:/pit/02 # Sounds
cp -w -o -s -n 1:/data/$[SYSID0]/extdata/00048000/f000000b 0:/pit/0b # MiiMaker, Game Coins, etc.
# Overwrite CTRNAND with CTRTransfer image and then restore system uniques
set ERRORMSG "Failed to overwrite CTRNAND with image."
cp -n -w $[IMAGE] S:/ctrnand_full.bin
set ERRORMSG "Restoring LocalFriendCodeSeed_B failed."
cp -n -w $[SEED] 1:/rw/sys/LocalFriendCodeSeed_B
set ERRORMSG "Restoring SecureInfo_A failed."
cp -n -w $[SECINFO] 1:/rw/sys/SecureInfo_A
set ERRORMSG "Restoring HWCAL0.dat failed."
cp -n -w $[HWCAL0] 1:/ro/sys/HWCAL0.dat
set ERRORMSG "Restoring HWCAL1.dat failed."
cp -n -w $[HWCAL1] 1:/ro/sys/HWCAL1.dat
set ERRORMSG "Restoring movable.sed failed."
cp -n -w $[MOVABLE] 1:/private/movable.sed
# Create SecureInfo_C if there's a region difference between SecureInfo_A and CVer
set ERRORMSG ""
if find 1:/title/000400db/00017202 NULL
set CVREG 00
elif find 1:/title/000400db/00017302 NULL
set CVREG 01
elif find 1:/title/000400db/00017102 NULL
set CVREG 02
elif find 1:/title/000400db/00017402 NULL
set CVREG 04
elif find 1:/title/000400db/00017502 NULL
set CVREG 05
elif find 1:/title/000400db/00017602 NULL
set CVREG 06
else
echo "The CVer title does not exist.\nYour CTRTransfer image is probably corrupted.\n\nPress A to shut down, then please obtain\n a new CTRTransfer file."
poweroff
end
fget 1:/rw/sys/SecureInfo_A@100:1 SIREG
if chk -u $[CVREG] $[SIREG]
cp -w -o -s -n 1:/rw/sys/SecureInfo_A 1:/rw/sys/SecureInfo_C
fset 1:/rw/sys/SecureInfo_C@100:1 $[CVREG]
end
# Restore backed-up system data if agreed to earlier
if chk $[OPTRESTORE] 1
cp -w -o -s -n 0:/pit/seedsave.bin 1:/data/$[SYSID0]/sysdata/0001000f/00000000
cp -w -o -s -n 0:/pit/configsave.bin 1:/data/$[SYSID0]/sysdata/00010017/00000000
cp -w -o -s -n 0:/pit/friendsave.bin 1:/data/$[SYSID0]/sysdata/00010032/00000000
cp -w -o -s -n 0:/pit/activitylog.bin 1:/data/$[SYSID0]/sysdata/00010022/00000000
# Restore system app sysdata
if chk $[CVREG] 00
set CHR 0
elif chk $[CVREG] 01
set CHR 1
elif chk $[CVREG] 02
set CHR 2
elif chk $[CVREG] 04
set CHR 6
elif chk $[CVREG] 05
set CHR 7
elif chk $[CVREG] 06
set CHR 8
end
cp -w -o -s -n 0:/pit/miiplaza.bin 1:/data/$[SYSID0]/sysdata/000202$[CHR]8/00000000
cp -w -o -s -n 0:/pit/faceraiders.bin 1:/data/$[SYSID0]/sysdata/000202$[CHR]d/00000000
cp -w -o -s -n 0:/pit/argames.bin 1:/data/$[SYSID0]/sysdata/000202$[CHR]e/00000000
# Restore shared extdata
cp -w -o -s -n 0:/pit/01 1:/data/$[SYSID0]/extdata/00048000/f0000001 # Photos
cp -w -o -s -n 0:/pit/02 1:/data/$[SYSID0]/extdata/00048000/f0000002 # Sounds
cp -w -o -s -n 0:/pit/0b 1:/data/$[SYSID0]/extdata/00048000/f000000b # MiiMaker, Game Coins, etc.
end
# Fix SYSNAND CTRNAND CMACs
set ERRORMSG "Failed to fix 1:/dbs CMACs."
fixcmac 1:/dbs
set ERRORMSG "Failed to fix 1:/data CMACs."
fixcmac 1:/data
set ERRORMSG "Failed to fix 1:/private CMACs."
fixcmac 1:/private
# Wrap up
set ERRORMSG "Reboot canceled."
ask "Manual CTRTransfer complete.\n \nRemove backup files and reboot now?"
if chk $[OPTRESTORE] 1
rm -o -s 0:/pit
end
rm -o -s 0:/gm9/scripts/manual_transfer.gm9
reboot
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Nintendo Homebrew Staff
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+11
View File
@@ -0,0 +1,11 @@
# Nintendo Homebrew Scripts
A combined space for all scripts made, used, and maintained by [Nintendo Homebrew on Discord](https://discord.gg/C29hYvh).
# Usage
All scripts in this repo are separated by the console they are made for. Open the README in their respective folders for specific instructions on usage.
At current, this repo has scripts for the following consoles:
* [Nintendo 3DS](3DS/README.md)