Skip to content

Instantly share code, notes, and snippets.

@ItsCrocoSwine
Last active April 12, 2025 00:27
Show Gist options
  • Save ItsCrocoSwine/561d2cb86a7126e75f6cc8d93303757f to your computer and use it in GitHub Desktop.
Save ItsCrocoSwine/561d2cb86a7126e75f6cc8d93303757f to your computer and use it in GitHub Desktop.
A gm9 script to dump the romfs and exefs of 3DS mainline Pokémon games. Original script by ZetaDesigns and GlazedBelmont https://github.com/GlazedBelmont/Pokemon-Randomizing-GM9-Scripts
#ItsCrocoSwine
#version 1.0
#last updated: 2025-01-28
set PREVIEW_MODE "Dumping script for PK3DS\n\nmade possible by:\nZeta\nJisagi\nGlazed_Belmont\nItsCrocoSwine"
if isdir 0:/gm9/out/romfs
if ask -o -s "Previous dump detected.\nWould you like to remove the files?"
rm 0:/gm9/out/romfs
rm -o -s 0:/gm9/out/exefs
else
echo "Script cancelled"
goto GAME_Exit
end
end
if isdir 0:/gm9/out/exefs
if ask -o -s "Previous dump detected.\nWould you like to remove the files?"
rm 0:/gm9/out/exefs
else
echo "Script cancelled"
goto GAME_Exit
end
end
@start
labelsel -o -s "What title would you like to dump?" GAME_*
goto start
@GAME_X
set TIDLOW 00055D00
goto FORMAT
@GAME_Y
set TIDLOW 00055E00
goto FORMAT
@GAME_Omega_Ruby
set TIDLOW 0011C400
goto FORMAT
@GAME_Alpha_Saphire
set TIDLOW 0011C500
goto FORMAT
@GAME_Sun
set TIDLOW 00164800
goto FORMAT
@GAME_Moon
set TIDLOW 00175E00
goto FORMAT
@GAME_Ultra_Sun
set TIDLOW 001B5000
goto FORMAT
@GAME_Ultra_Moon
set TIDLOW 001B5100
goto FORMAT
@FORMAT
labelsel -o -s "Is this a cartridge or installed title?" DUMP_*
goto FORMAT
@DUMP_Cartridge
if not find -o -s C:/*.trim.3ds CARTRIDGE
echo "Cartridge not found"
goto GAME_Exit
end
imgmount $[CARTRIDGE]
set PREVIEW_MODE "Dumping cartridge\nthis will take a while"
if not cp -o -s -w G:/content0.game/romfs 0:/gm9/out/romfs
echo "Dumping cartridge romfs failed"
goto GAME_Exit
end
if not cp -o -s -w G:/content0.game/exefs 0:/gm9/out/exefs
echo "Dumping cartridge exefs failed"
goto GAME_Exit
end
imgumount
goto UPDATE
@DUMP_Installed_title
if not isdir A:/title/00040000/$[TIDLOW]
echo "Installed title not found"
goto GAME_Exit
end
if not filesel -x "Please select the bigger .app file" A:/title/00040000/$[TIDLOW]/content/*.app GAME
goto start
end
imgmount $[GAME]
set PREVIEW_MODE "Dumping installed title\nthis will take a while"
if not cp -o -s -w G:/romfs 0:/gm9/out/romfs
echo "Dumping digital romfs failed"
goto GAME_Exit
end
if not cp -o -s -w G:/exefs 0:/gm9/out/exefs
echo "Dumping digital exefs failed"
goto GAME_Exit
end
imgumount
goto UPDATE
@UPDATE
set PREVIEW_MODE "?"
if not find -o -s A:/title/0004000e/$[TIDLOW]/content/0000000?.app UPDATE
echo "No update found, update will not be dumped"
goto GAME_Exit
end
if ask -o -s "would you like to dump the game update?\n(This is recommended)"
imgmount $[UPDATE]
set PREVIEW_MODE "Dumping game update\nthis will take a smaller while"
if not cp -o -s -w G:/romfs 0:/gm9/out/romfs
echo "Dumping update romfs failed"
goto GAME_Exit
end
if not cp -o -s -w G:/exefs 0:/gm9/out/exefs
echo "Dumping update exefs failed"
goto GAME_Exit
end
imgumount
end
set PREVIEW_MODE ":P"
echo "romfs and exefs successfully dumped to gm9/out"
@GAME_Exit
@DUMP_Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment