-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.key | ||
*.bin | ||
*.cia | ||
*.cxi | ||
*.cfa | ||
cia-config.mk | ||
rom/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
vc_red_name := pokered pokeblue | ||
vc_yellow_name := pokeyellow | ||
vc_gold_name := pokegold pokesilver | ||
vc_crystal_name := pokecrystal11 | ||
|
||
# Modfiy the following line to match the Pret Repo you are building with | ||
vc_name := $(vc_gold_name) | ||
|
||
vc_cia := $(addprefix $(vc_dir)/, $(addsuffix .cia, $(vc_name))) | ||
vc_rom_dir := $(addprefix $(vc_dir)/, $(vc_name)) | ||
vc_orig_cia := $(addprefix $(vc_dir)/, $(addsuffix .orig.cia, $(vc_name))) | ||
vc_game_cxi := $(addprefix $(vc_dir)/, $(addsuffix .game.cxi, $(vc_name))) | ||
vc_manual_cfa := $(addprefix $(vc_dir)/, $(addsuffix .manual.cfa, $(vc_name))) | ||
vc_patch := $(addsuffix .patch, $(vc_name)) | ||
vc_gbc := $(addsuffix .gbc, $(vc_name)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,62 @@ | ||
### Virtual Console repacking stuff | ||
|
||
# Include Configuration Settings | ||
vc_dir := poke-cia | ||
vc_name := pokecrystalvc | ||
|
||
vc_titleid := 0004000000172800 | ||
vc_rom := $(vc_dir)/rom | ||
vc_game := $(addprefix $(vc_rom)/, exheader.bin logo.lz plain.bin exefs/banner.bin exefs/code.bin exefs/icon.bin romfs/) | ||
vc_manual := $(vc_rom)/manual | ||
-include $(vc_dir)/cia-config.mk | ||
|
||
.PHONY: cia | ||
cia: $(vc_dir)/$(vc_name).cia | ||
cia: $(vc_cia) | ||
|
||
.PHONY: clean | ||
clean: clean_cia | ||
|
||
.PHONY: clean_cia | ||
clean_cia: | ||
rm -f $(vc_dir)/$(vc_name).cia $(vc_dir)/game.cxi $(vc_dir)/manual.cfa | ||
rm -f $(vc_cia) $(vc_game_cxi) $(vc_manual_cfa) | ||
|
||
.PHONY: distclean_cia | ||
distclean_cia: clean_cia | ||
rm -rf $(vc_rom) $(vc_dir)/$(vc_titleid).key | ||
|
||
$(vc_dir)/$(vc_name).cia: $(vc_dir)/game.cxi $(vc_dir)/manual.cfa | ||
makerom -f cia -o $@ -content $(vc_dir)/game.cxi:0:0 -content $(vc_dir)/manual.cfa:1:1 | ||
|
||
$(vc_dir)/game.cxi: $(vc_dir)/game.rsf $(vc_game) | ||
( cd $(vc_rom); \ | ||
makerom -f cxi -o ../game.cxi -rsf ../game.rsf \ | ||
-exheader exheader.bin \ | ||
-logo logo.lz \ | ||
-plainrgn plain.bin \ | ||
-code exefs/code.bin \ | ||
-icon exefs/icon.bin \ | ||
-banner exefs/banner.bin \ | ||
) | ||
|
||
$(vc_dir)/manual.cfa: $(vc_dir)/manual.rsf $(vc_manual) | ||
( cd $(vc_rom); \ | ||
makerom -f cfa -o ../manual.cfa -rsf ../manual.rsf \ | ||
) | ||
|
||
# Populate romfs with built files | ||
$(vc_rom)/romfs/: $(vc_rom)/romfs/rom/CGBBYTE1.784 $(vc_rom)/romfs/CGBBYTE1.784.patch | ||
$(vc_rom)/romfs/rom/CGBBYTE1.784: pokecrystal11.gbc | $(vc_rom) | ||
cp $< $@ | ||
$(vc_rom)/romfs/CGBBYTE1.784.patch: pokecrystal11.patch | $(vc_rom) | ||
cp $< $@ | ||
rm -rf $(vc_rom_dir) $(vc_dir)/seeddb.bin | ||
|
||
# Update whenever the contents change | ||
$(vc_rom)/romfs/: $(shell find $(vc_rom)/romfs/ -mindepth 1 2> /dev/null) | ||
touch $@ | ||
$(vc_rom)/manual/: $(shell find $(vc_rom)/manual/ -mindepth 1 2> /dev/null) | ||
touch $@ | ||
$(vc_dir)/seeddb.bin: | ||
wget -O $@ 'https://github.com/ihaveamac/3DS-rom-tools/raw/master/seeddb/seeddb.bin' | ||
|
||
# Extract all the files | ||
$(vc_game) $(vc_manual): $(vc_rom) | ||
$(vc_rom): | $(vc_dir)/$(vc_titleid).cia $(vc_dir)/$(vc_titleid).key | ||
$(vc_rom_dir): $(vc_orig_cia) $(vc_dir)/seeddb.bin | ||
mkdir -p $@ | ||
ctrtool --contents=$@/contents $(vc_dir)/$(vc_titleid).cia | ||
ctrtool --seeddb=$(vc_dir)/$(vc_titleid).key \ | ||
ctrtool --contents=$@/contents $@.orig.cia | ||
ctrtool --seeddb=$(vc_dir)/seeddb.bin \ | ||
--exheader=$@/exheader.bin \ | ||
--exefsdir=$@/exefs \ | ||
--romfsdir=$@/romfs \ | ||
--logo=$@/logo.lz \ | ||
--plainrgn=$@/plain.bin \ | ||
$@/contents.0000.* | ||
ctrtool --seeddb=$(vc_dir)/$(vc_titleid).key \ | ||
ctrtool --seeddb=$(vc_dir)/seeddb.bin \ | ||
--romfsdir=$@/manual \ | ||
$@/contents.0001.* | ||
rm -f $@/contents.* | ||
rm -f $@/romfs/rom/* | ||
rm -f $@/romfs/CGBBYTE1.784.patch | ||
rm -f $@/romfs/*.patch | ||
|
||
$(join $(addsuffix /romfs/, $(vc_rom_dir)), $(vc_patch)): $(vc_rom_dir) ./$(vc_patch) | ||
cp ./$(notdir $@) $@ | ||
|
||
$(join $(addsuffix /romfs/rom/, $(vc_rom_dir)), $(vc_gbc)): $(vc_rom_dir) ./$(vc_gbc) | ||
cp ./$(notdir $@) $(basename $@) | ||
|
||
$(vc_game_cxi): $(vc_rom_dir) $(join $(addsuffix /romfs/, $(vc_rom_dir)), $(vc_patch)) $(join $(addsuffix /romfs/rom/, $(vc_rom_dir)), $(vc_gbc)) | ||
(cd $(basename $(basename $@))/; \ | ||
makerom -f cxi -o ../../$(basename $@).cxi -rsf ../game.rsf \ | ||
-exheader exheader.bin \ | ||
-logo logo.lz \ | ||
-plainrgn plain.bin \ | ||
-code exefs/code.bin \ | ||
-icon exefs/icon.bin \ | ||
-banner exefs/banner.bin \ | ||
) | ||
|
||
$(vc_dir)/%.key: | ||
wget -O $@ 'https://github.com/ihaveamac/3DS-rom-tools/raw/master/seeddb/seeddb.bin' | ||
$(vc_manual_cfa): $(vc_dir)/manual.rsf | ||
makerom -f cfa -o $@ -rsf $(vc_dir)/manual.rsf | ||
|
||
$(vc_dir)/%.cia: | ||
@echo "Could not find $@." | ||
@exit 1 | ||
$(vc_cia): $(vc_game_cxi) $(vc_manual_cfa) | ||
makerom -f cia -o $@ -content $(basename $@).game.cxi:0:0 -content $(basename $@).manual.cfa:1:1 |