From b2de2c8a3130a165d6f235cbdf562eed57292e1d Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 25 Dec 2024 13:10:19 -0700 Subject: [PATCH] ZeldaWindWaker: Support case-sensitive FS & use Dolphin extract layout (#738) --- src/ZeldaWindWaker/tools/zww_extractor.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ZeldaWindWaker/tools/zww_extractor.ts b/src/ZeldaWindWaker/tools/zww_extractor.ts index 3935e91cb..daa2f9a13 100644 --- a/src/ZeldaWindWaker/tools/zww_extractor.ts +++ b/src/ZeldaWindWaker/tools/zww_extractor.ts @@ -357,27 +357,33 @@ async function loadBinaries(): Promise { const binaries: Binary[] = []; // Parse DOL. - binaries.push(new DOL(`${pathBaseIn}/main.dol`, `${pathBaseIn}/maps/framework.map`)); + binaries.push(new DOL(`${pathBaseIn}/sys/main.dol`, `${pathBaseIn}/files/maps/framework.map`)); // Parse RELs. - const rels = readdirSync(`${pathBaseIn}/rels`); + const rels = readdirSync(`${pathBaseIn}/files/rels`); for (let i = 0; i < rels.length; i++) { const relName = rels[i]; - const relFilename = `${pathBaseIn}/rels/${relName}`; + const relFilename = `${pathBaseIn}/files/rels/${relName}`; const relData = fetchDataSync(relFilename); - const mapFilename = `${pathBaseIn}/maps/${relName.replace('.rel', '.map')}`; + const mapFilename = `${pathBaseIn}/files/maps/${relName.replace('.rel', '.map')}`; binaries.push(new REL(relName, relData, mapFilename)); } - const relsARC = JKRArchive.parse(fetchDataSync(`${pathBaseIn}/RELS.arc`)); + const relsARC = JKRArchive.parse(fetchDataSync(`${pathBaseIn}/files/RELS.arc`)); + const maps = readdirSync(`${pathBaseIn}/files/maps`); for (let i = 0; i < relsARC.files.length; i++) { const file = relsARC.files[i]; if (!file.name.endsWith('.rel')) continue; - const relName = file.name; + const mapFilename = maps.find((m) => m.toLowerCase() === file.name.replace('.rel', '.map')); + if (!mapFilename) { + console.error(`Could not find map for ${file.name}`); + process.exit(1); + } + const relName = mapFilename.replace('.map', '.rel'); const relData = file.buffer; - const mapFilename = `${pathBaseIn}/maps/${relName.replace('.rel', '.map')}`; - binaries.push(new REL(relName, relData, mapFilename)); + const mapPath = `${pathBaseIn}/files/maps/${mapFilename}`; + binaries.push(new REL(relName, relData, mapPath)); } return binaries;