diff --git a/src/ZeldaWindWaker/tools/zww_extractor.ts b/src/ZeldaWindWaker/tools/zww_extractor.ts index daa2f9a13..7dbb2e0b0 100644 --- a/src/ZeldaWindWaker/tools/zww_extractor.ts +++ b/src/ZeldaWindWaker/tools/zww_extractor.ts @@ -3,7 +3,7 @@ import ArrayBufferSlice from "../../ArrayBufferSlice.js"; import * as BYML from "../../byml.js"; import * as Yaz0 from '../../Common/Compression/Yaz0.js'; import * as JKRArchive from "../../Common/JSYSTEM/JKRArchive.js"; -import { openSync, readSync, closeSync, readFileSync, writeFileSync, readdirSync, mkdirSync } from "fs"; +import { openSync, readSync, closeSync, readFileSync, writeFileSync, readdirSync, mkdirSync, cpSync } from "fs"; import { assertExists, hexzero, assert, readString } from "../../util.js"; import { Endianness } from "../../endian.js"; import { loadRustLib } from "../../rustlib.js"; @@ -420,12 +420,22 @@ function extractProfiles(binaries: Binary[]) { writeFileSync(`${pathBaseOut}/f_pc_profiles.crg1_arc`, Buffer.from(data)); } +function copyDir(dirName: string, dstPath: string): void { + cpSync(`${pathBaseIn}/files/${dirName}`, `${pathBaseOut}/${dstPath}`, { recursive: true }); +} + async function main() { await loadRustLib(); const binaries = await loadBinaries(); extractExtra(binaries); extractProfiles(binaries); + + copyDir(`res/Msg`, `Msg`); + copyDir(`res/Object`, `Object`); + copyDir(`res/Particle`, `Particle`); + copyDir(`res/placename`, `placename`); + copyDir(`res/Stage`, `Stage`); } main(); diff --git a/src/rustlib.ts b/src/rustlib.ts index 3e0a35347..ae994bea2 100644 --- a/src/rustlib.ts +++ b/src/rustlib.ts @@ -14,8 +14,11 @@ export async function loadRustLib() { /* if (typeof process !== 'undefined') { + // @ts-ignore const fs = await import('fs'); + // @ts-ignore const path = await import('path'); + // @ts-ignore const url = await import('url'); const wasmPath = path.join(path.dirname(url.fileURLToPath(import.meta.url)), '../rust/pkg/noclip_support_bg.wasm'); const wasm = fs.readFileSync(wasmPath);