|
| 1 | +set shell := ["bash", "-eu", "-o", "pipefail", "-c"] |
| 2 | + |
| 3 | +MBIN_COMPILER_VERSION := "v6.13.0-pre1" |
| 4 | +HGPAK_TOOL_VERSION := "1.0.0" |
| 5 | + |
| 6 | +default: clean setup extract-mappings extract-rewards |
| 7 | + |
| 8 | +# --------------------------------------------------------------------------- |
| 9 | +# 🧹 CLEANUP |
| 10 | +# --------------------------------------------------------------------------- |
| 11 | +clean: |
| 12 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "🧹 CLEANUP" |
| 13 | + rm -rf ./out/* |
| 14 | +# --------------------------------------------------------------------------- |
| 15 | +# ⚙️ SETUP & TOOL DOWNLOADS |
| 16 | +# --------------------------------------------------------------------------- |
| 17 | +setup: download-tools |
| 18 | + |
| 19 | +download-tools: |
| 20 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "⚙️ TOOL DOWNLOADS" |
| 21 | + |
| 22 | + @gum spin --spinner dot --title "Downloading MBINCompiler ({{MBIN_COMPILER_VERSION}})..." -- curl -sSL https://github.com/monkeyman192/MBINCompiler/releases/download/{{MBIN_COMPILER_VERSION}}/MBINCompiler-linux-dotnet6 -o ./out/mbincompiler |
| 23 | + @gum style --foreground 10 "✅ Downloaded MBINCompiler ({{MBIN_COMPILER_VERSION}})." |
| 24 | + @chmod +x ./out/mbincompiler |
| 25 | + |
| 26 | + @gum spin --spinner dot --title "Downloading HGPAKtool ({{HGPAK_TOOL_VERSION}})..." -- curl -sSL https://github.com/monkeyman192/HGPAKtool/releases/download/{{HGPAK_TOOL_VERSION}}/hgpaktool-x86_64-unknown-linux.gz -o ./out/hgpaktool.gz |
| 27 | + @gum style --foreground 10 "✅ Downloaded HGPAKtool ({{HGPAK_TOOL_VERSION}})." |
| 28 | + @gunzip -c ./out/hgpaktool.gz > ./out/hgpaktool |
| 29 | + @rm ./out/hgpaktool.gz |
| 30 | + @chmod +x ./out/hgpaktool |
| 31 | + |
| 32 | +# --------------------------------------------------------------------------- |
| 33 | +# 🗺️ DATA EXTRACTION |
| 34 | +# --------------------------------------------------------------------------- |
| 35 | +extract-mappings: |
| 36 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "📜 mapping.json" |
| 37 | + @gum spin --spinner dot --title "Downloading mapping.json..." -- curl -sSL "https://github.com/monkeyman192/MBINCompiler/releases/download/{{MBIN_COMPILER_VERSION}}/mapping.json" -o ./out/mapping.json |
| 38 | + @jq '.Mapping | map({(.Key): .Value}) | add' ./out/mapping.json > ../src/data/mapping.json |
| 39 | + @npx prettier --write ../src/data/mapping.json --config ../.prettierrc > /dev/null |
| 40 | + @gum style --foreground 10 "✅ mapping.json created." |
| 41 | + |
| 42 | +extract-metadata-hgpak: |
| 43 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "📦 HGPAK MetadataEtc EXTRACTION" |
| 44 | + @gum spin --spinner dot --title "Extracting..." -- ./out/hgpaktool ./PCBANKS/NMSARC.MetadataEtc.pak -O ./out/EXTRACTED |
| 45 | + @gum style --foreground 10 "✅ NMSARC.MetadataEtc.pak extracted." |
| 46 | + |
| 47 | +extract-precache-hgpak: |
| 48 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "📦 HGPAK Precache EXTRACTION" |
| 49 | + @gum spin --spinner dot --title "Extracting..." -- ./out/hgpaktool ./PCBANKS/NMSARC.Precache.pak -O ./out/EXTRACTED |
| 50 | + @gum style --foreground 10 "✅ NMSARC.Precache.pak extracted." |
| 51 | + |
| 52 | +extract-locale: extract-metadata-hgpak |
| 53 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "📜 translations.json" |
| 54 | + @for f in ./out/EXTRACTED/language/*_usenglish.mbin; do \ |
| 55 | + gum spin --spinner dot --title "Decoding $f" -- ./out/mbincompiler -y -d ./out/EXTRACTED/language/ "$f" > /dev/null; \ |
| 56 | + done |
| 57 | + @gum spin --spinner dot --title "Extracting translations" -- python ./src/extract_translations.py |
| 58 | + @gum style --foreground 10 "✅ translations.json ready." |
| 59 | + |
| 60 | +extract-items: extract-precache-hgpak extract-locale |
| 61 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "📜 item_to_name_mappings.json" |
| 62 | + @gum spin --spinner dot --title "Decoding nms_reality_gcproducttable.mbin" -- ./out/mbincompiler -y -d ./out/ "./out/EXTRACTED/metadata/reality/tables/nms_reality_gcproducttable.mbin" > /dev/null; |
| 63 | + @gum spin --spinner dot --title "Decoding nms_basepartproducts.mbin" -- ./out/mbincompiler -y -d ./out/ "./out/EXTRACTED/metadata/reality/tables/nms_basepartproducts.mbin" > /dev/null; |
| 64 | + @python ./src/extract_item_names.py |
| 65 | + @gum style --foreground 10 "✅ item_to_name_mappings.json created." |
| 66 | + |
| 67 | +# --------------------------------------------------------------------------- |
| 68 | +# 🎁 REWARDS |
| 69 | +# --------------------------------------------------------------------------- |
| 70 | +extract-rewards: extract-season-rewards extract-twitch-rewards extract-platform-rewards |
| 71 | + |
| 72 | +extract-season-rewards: extract-items |
| 73 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "🎁 rewards/season.json" |
| 74 | + @gum spin --spinner dot --title "Decoding unlockableseasonrewards.mbin" -- ./out/mbincompiler -y -d ./out/ "./out/EXTRACTED/metadata/reality/tables/unlockableseasonrewards.mbin" > /dev/null |
| 75 | + @gum spin --spinner dot --title "Extracting rewards" -- python ./src/extract_season_rewards.py |
| 76 | + @cp ./out/season_rewards.json ../src/data/rewards/season.json |
| 77 | + @npx prettier --write ../src/data/rewards/season.json --config ../.prettierrc > /dev/null |
| 78 | + @gum style --foreground 10 "✅ rewards/season.json created." |
| 79 | + |
| 80 | +extract-twitch-rewards: extract-items |
| 81 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "🎁 rewards/twitch.json" |
| 82 | + @gum spin --spinner dot --title "Decoding unlockabletwitchrewards.mbin" -- ./out/mbincompiler -y -d ./out/ "./out/EXTRACTED/metadata/reality/tables/unlockabletwitchrewards.mbin" > /dev/null |
| 83 | + @gum spin --spinner dot --title "Extracting rewards" -- python ./src/extract_twitch_rewards.py |
| 84 | + @cp ./out/twitch_rewards.json ../src/data/rewards/twitch.json |
| 85 | + @npx prettier --write ../src/data/rewards/twitch.json --config ../.prettierrc > /dev/null |
| 86 | + @gum style --foreground 10 "✅ rewards/twitch.json created." |
| 87 | + |
| 88 | +extract-platform-rewards: extract-items |
| 89 | + @gum style --border rounded --border-foreground 45 --margin "1 0 0 0" --padding "0 3" --width 80 --align left "🎁 rewards/platform.json" |
| 90 | + @gum spin --spinner dot --title "Decoding unlockableplatformrewards.mbin" -- ./out/mbincompiler -y -d ./out/ "./out/EXTRACTED/metadata/reality/tables/unlockableplatformrewards.mbin" > /dev/null |
| 91 | + @gum spin --spinner dot --title "Extracting rewards" -- python ./src/extract_platform_rewards.py |
| 92 | + @cp ./out/platform_rewards.json ../src/data/rewards/platform.json |
| 93 | + @npx prettier --write ../src/data/rewards/platform.json --config ../.prettierrc > /dev/null |
| 94 | + @gum style --foreground 10 "✅ rewards/platform.json created." |
0 commit comments