Skip to content

Commit 2f826a2

Browse files
feat: replace gnumake with just + update scripts
1 parent 4ff8124 commit 2f826a2

File tree

13 files changed

+121
-92
lines changed

13 files changed

+121
-92
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"editor.defaultFormatter": "esbenp.prettier-vscode",
55
"[svelte]": {
66
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[json]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
710
}
811
}

scripts/.gitignore

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
*
2-
!shell.nix
3-
!Makefile
4-
!.gitignore
5-
!extract_translations.py
6-
!extract_item_names.py
7-
!extract_twitch_rewards.py
8-
!extract_season_rewards.py
9-
!extract_platform_rewards.py
1+
out/
2+
PCBANKS
3+
nms-archive/

scripts/Justfile

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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."

scripts/Makefile

Lines changed: 0 additions & 61 deletions
This file was deleted.

scripts/shell.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
pkgs.mkShell {
1111
buildInputs = [
1212
pkgs.dotnet-runtime_6
13-
pkgs.gnumake
14-
pkgs.nodejs_24
13+
pkgs.just
14+
pkgs.gum
1515
pkgs.jq
16-
pkgs.git
16+
pkgs.curl
1717
pkgs.python313
18-
pkgs.python313Packages.zstandard
1918
pkgs.xmlstarlet
2019
];
2120

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import json
33

44
xml_paths = [
5-
"./nms_reality_gcproducttable.MXML",
6-
"./nms_basepartproducts.MXML"
5+
"./out/nms_reality_gcproducttable.MXML",
6+
"./out/nms_basepartproducts.MXML"
77
]
8-
translations_path = "./translations.json"
9-
output_json = "item_to_name_mappings.json"
8+
translations_path = "./out/translations.json"
9+
output_json = "./out/item_to_name_mappings.json"
1010

1111
# Load translation strings
1212
with open(translations_path, "r", encoding="utf-8") as f:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import xml.etree.ElementTree as ET
22
import json
33

4-
platform_rewards_xml = "./unlockableplatformrewards.MXML"
5-
product_mapping_json = "./item_to_name_mappings.json"
6-
output_json = "./platform_rewards.json"
4+
platform_rewards_xml = "./out/unlockableplatformrewards.MXML"
5+
product_mapping_json = "./out/item_to_name_mappings.json"
6+
output_json = "./out/platform_rewards.json"
77

88
# Load ID --> translated product name mapping
99
with open(product_mapping_json, "r", encoding="utf-8") as f:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import json
33
import re
44

5-
xml_path = "./unlockableseasonrewards.MXML"
6-
mapping_path = "./item_to_name_mappings.json"
7-
output_path = "./season_rewards.json"
5+
xml_path = "./out/unlockableseasonrewards.MXML"
6+
mapping_path = "./out/item_to_name_mappings.json"
7+
output_path = "./out/season_rewards.json"
88

99
# Load product name mapping
1010
with open(mapping_path, "r", encoding="utf-8") as f:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import json
33
import xml.etree.ElementTree as ET
44

5-
LANGDIR = "./EXTRACTED/language"
5+
LANGDIR = "./out/EXTRACTED/language"
66
PREFIX = "english"
7-
OUTPUT = "translations.json"
7+
OUTPUT = "./out/translations.json"
88

99
translations = {}
1010

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import xml.etree.ElementTree as ET
22
import json
33

4-
xml_path = "./unlockabletwitchrewards.MXML"
5-
mapping_path = "./item_to_name_mappings.json"
6-
output_path = "twitch_rewards.json"
4+
xml_path = "./out/unlockabletwitchrewards.MXML"
5+
mapping_path = "./out/item_to_name_mappings.json"
6+
output_path = "./out/twitch_rewards.json"
77

88
# Load product id --> localized name mapping
99
with open(mapping_path, "r", encoding="utf-8") as f:

0 commit comments

Comments
 (0)