Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Oct 1, 2023
0 parents commit 52f157e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.nsp
45 changes: 45 additions & 0 deletions mkdlc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Prerequisites:
# * Place your extracted console keys in ~/.switch/prod.keys
# * Install hacpack (https://github.com/The-4n/hacPack) and add it into $PATH

# Number of the first DLC to generate
firstDlcId=1
# Title ID of the first DLC to generate
firstDlcTitleId=0100ae7012b5f001
# Generate x DLCs
maxDlcs=255

if ! command -v hacpack &> /dev/null
then
echo "'hacpak' could not be found. Make sure to the program is installed and in \$PATH."
exit 1
fi

rm -rf tmp_nca/
for ((id = $firstDlcId ; id <= maxDlcs ; id++)); do
echo -e "\033[0;36m\033[1mMaking DLC #$id (TID $firstDlcTitleId)\033[0m"

# Write DLC unlock file
mkdir -p 0/
printf "\r\n" >> 0/TPZ_DLC${id}.dat

# Pack data NCA
hacpack --type nca -o tmp_nca -k ~/.switch/prod.keys --titleid $firstDlcTitleId --ncatype publicdata --romfsdir 0/
# Pack meta NCA
hacpack --type nca -o tmp_nca -k ~/.switch/prod.keys --titleid $firstDlcTitleId --ncatype meta --titletype addon --publicdatanca $(ls tmp_nca/*.nca | head -n1)
# Pack DLC NSP
hacpack --type nsp -o . -k ~/.switch/prod.keys --titleid $firstDlcTitleId --ncadir tmp_nca

# Cleanup working directory
rm tmp_nca/*.nca
rm -rf 0/

# Next TID
firstDlcTitleId=$(printf "%016x" $((0x$firstDlcTitleId+1)))
done

# Remove temporary files
rm -rf tmp_nca
rm -rf hacpack_backup

0 comments on commit 52f157e

Please sign in to comment.