Skip to content

Commit

Permalink
Wind Waker: Copy over res/ directories needed in the extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Dec 25, 2024
1 parent b2de2c8 commit c94345e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ZeldaWindWaker/tools/zww_extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
3 changes: 3 additions & 0 deletions src/rustlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c94345e

Please sign in to comment.