From 1006c662c71ad6fc1cc9d3babb1aa1b013f59e2a Mon Sep 17 00:00:00 2001 From: Brandon Johnson Date: Mon, 26 Jan 2026 10:36:02 -0500 Subject: [PATCH] tools --- tools/print_smb2_common_models.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tools/print_smb2_common_models.ts diff --git a/tools/print_smb2_common_models.ts b/tools/print_smb2_common_models.ts new file mode 100644 index 0000000..cf01a16 --- /dev/null +++ b/tools/print_smb2_common_models.ts @@ -0,0 +1,28 @@ +import fs from "node:fs"; +import path from "node:path"; + +import ArrayBufferSlice from "../src/noclip/ArrayBufferSlice.js"; +import { parseAVTpl } from "../src/noclip/SuperMonkeyBall/AVTpl.js"; +import { parseGma } from "../src/noclip/SuperMonkeyBall/Gma.js"; + +function loadFileBuffer(filePath: string): ArrayBufferSlice { + const data = fs.readFileSync(filePath); + return new ArrayBufferSlice(data.buffer, data.byteOffset, data.byteLength); +} + +const root = path.resolve(__dirname, ".."); +const commonGmaPath = path.join(root, "smb2_content", "test", "init", "common.gma"); +const commonTplPath = path.join(root, "smb2_content", "test", "init", "common.tpl"); + +const tpl = parseAVTpl(loadFileBuffer(commonTplPath), "common"); +const gma = parseGma(loadFileBuffer(commonGmaPath), tpl); + +const wanted = [0x5f, 0x60]; +for (const id of wanted) { + const model = gma.idMap.get(id); + if (!model) { + console.log(`${id.toString(16)}: `); + continue; + } + console.log(`${id.toString(16)}: ${model.name}`); +}