Skip to content
275 changes: 275 additions & 0 deletions Dumping_script.gm9
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
# author: zeta , jisagi & Glazed_Belmont

@start
set PREVIEW_MODE "PKMN Randomizer script"

labelsel -o -s "Is your game a cartridge or digital install?" TYPE_*
goto start

###CARTRIDGE###
@TYPE_Cartridge

set PREVIEW_MODE "PKMN Randomizer script\nTYPE_CARTRIDGE"
ask "Script will begin dumping."
if not find -o -s C:/*.trim.3ds CARTRIDGE
echo "No 3DS cart was detected"
goto end
end

imgmount $[CARTRIDGE]
mkdir 0:/gm9/out/romfs
mkdir 0:/gm9/out/exefs

if not cp -o -s G:/content0.game/romfs/ 0:/gm9/out/romfs
echo "Dumping romfs failed"
goto end
end

if not cp -o -s G:/content0.game/exefs/ 0:/gm9/out/exefs
echo "Dumping exefs failed"
goto end
end

if not -o -s labelsel -o -s "What game are you dumping?" CARTRIDGE_*
goto start
end

#-------------------------------------------------------------------------------#


###DIGITAL###
@TYPE_Digital

set PREVIEW_MODE "PKMN Randomizer script\nTYPE_DIGITAL"

if not -o -s labelsel -o -s "What game are you dumping?" DIGITAL_*
goto start
end

###PKMN X###
@CARTRIDGE_X

set GAMEID 00055D00
goto Update_Dump

@DIGITAL_X

set X "A:/title/00040000/00055D00"
if not isdir -o -s $[X]
echo "The game wasn't found.\nMake sure you have Pokemon X installed."
goto start
end

set GAMEID 00055D00
goto Confirm


###PKMN Y###
@CARTRIDGE_Y

set GAMEID 00055E00
goto Update_Dump

@DIGITAL_Y

set Y "A:/title/00040000/00055E00"
if not isdir -o -s $[Y]
echo "The game wasn't found.\nMake sure you have Pokemon Y installed."
goto start
end

set GAMEID 00055E00
goto Confirm


###PKMN OMEGA RUBY###
@CARTRIDGE_Omega_Ruby

set GAMEID 0011C400
goto Update_Dump

@DIGITAL_Omega_Ruby

set OR "A:/title/00040000/0011C400"
if not isdir -o -s $[OR]
echo "The game wasn't found.\nMake sure you have Pokemon Omega Ruby installed."
goto start
end

set GAMEID 0011C400
goto Confirm


###PKMN ALPHA SAPPHIRE###
@CARTRIDGE_Alpha_Sapphire

set GAMEID 0011C500
goto Update_Dump

@DIGITAL_Alpha_Sapphire

set AS "A:/title/00040000/0011C500"
if not isdir -o -s $[AS]
echo "The game wasn't found.\nMake sure you have Pokemon Alpha Sapphire installed."
goto start
end

set GAMEID 0011C500
goto Confirm


###PKMN SUN###
@CARTRIDGE_Sun

set GAMEID 00164800
goto Update_Dump

@DIGITAL_Sun

set S "A:/title/00040000/00164800"
if not isdir -o -s $[S]
echo "The game wasn't found.\nMake sure you have Pokemon Sun installed."
goto start
end

set GAMEID 00164800
goto Confirm


###PKMN MOON###
@CARTRIDGE_Moon

set GAMEID 00175E00
goto Update_Dump

@DIGITAL_Moon

set M "A:/title/00040000/00175E00"
if not isdir -o -s $[M]
echo "The game wasn't found.\nMake sure you have Pokemon Moon installed."
goto start
end

set GAMEID 00175E00
goto Confirm


###PKMN ULTRA SUN###
@CARTRIDGE_Ultra_Sun

set GAMEID 001B5000
goto Update_Dump

@DIGITAL_Ultra_Sun

set US "A:/title/00040000/001B5000"
if not isdir -o -s $[US]
echo "The game wasn't found.\nMake sure you have Pokemon Ultra Sun installed."
goto start
end

set GAMEID 001B5000
goto Confirm


###PKMN ULTRA MOON###
@CARTRIDGE_Ultra_Moon

set GAMEID 001B5100
goto Update_Dump

@DIGITAL_Ultra_Moon

set UM "A:/title/00040000/001B5100"
if not isdir -o -s $[UM]
echo "The game wasn't found.\nMake sure you have Pokemon Ultra Moon installed."
goto start
end

set GAMEID 001B5100
goto Confirm

#---------------------------------------------------------------------------------------------#


###Digital_Dump###
@Digital_Dump

if not -o -s filesel "Please select the bigger .app file" A:/title/00040000/$[GAMEID]/content/*.app GAME
goto start
end

imgmount $[GAME]
mkdir 0:/gm9/out/romfs
mkdir 0:/gm9/out/exefs

set ERRORMSG "Dumping failed.\nCopying romfs/exefs failed."
if not cp -o -s G:/romfs/ 0:/gm9/out/romfs
echo "Dumping romfs failed"
goto end
end

if not cp -o -s G:/exefs/ 0:/gm9/out/exefs
echo "Dumping exefs failed"
goto end
end
goto Update_Dump


###Update_Dump###
@Update_Dump

echo "RomFS and ExeFS dumping done\nDumping the update now."
if not find -o -s A:/title/0004000e/$[GAMEID]/content/0000000?.app UPDATE
echo "No updates were found.\nMake sure you have them installed."
goto end
end

if not ask "The update was found, Continue?"
goto start
end

imgmount $[UPDATE]

if not cp -o -s G:/romfs/ 0:/gm9/out/romfs
echo "Dumping romfs failed"
goto end
end

if not cp -o -s G:/exefs/ 0:/gm9/out/exefs
echo "Dumping exefs failed"
goto end
end

echo "Dumping finished properly"
goto end


##Confirm##
@Confirm

if not ask -o -s "The game was found, Continue?"
goto start
end

goto Digital_Dump


##EXITING##
@TYPE_Exit

goto end

##GOING BACK##
@DIGITAL_Back
@CARTRIDGE_Back
goto start


##Credits##
@TYPE_Credits

echo "This script was made possible by:\nZeta\nJisagi\nGlazed_Belmont"
goto start

@end