Skip to content

Commit

Permalink
Fix arg handling compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aquacluck committed Jul 9, 2023
1 parent 8c4d576 commit 31e3018
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ A server for querying placement objects in *The Legend of Zelda: Tears of the Ki

Run build.ts to generate a map database before starting the server for the first time.

ts-node build.ts -d ../totk/Banc

This assumes the `totk/Banc` directory contains the YAML data object map files

ts-node build.ts -r ../totk -e tools

This assumes the `totk` directory contains the unaltered romfs contents.
Expand Down
15 changes: 10 additions & 5 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ import { Beco } from './beco';

let parseArgs = require('minimist');
let argv = parseArgs(process.argv);
if (!argv.e || !argv.r) {
console.log("Error: Must specify paths to directories with ");
const validRomfsArgs = (argv.e && argv.r);
const validFolderArgs = (argv.e && argv.b && argv.d);
if (!validRomfsArgs && !validFolderArgs) {
console.log("Error: Must specify paths to directories with -e and either -r or (-b and -d)");
console.log(" -d Banc extracted YAML files");
console.log(" -b field map area beco files");
console.log(" -e Ecosystem json files");
console.log(" -r Bare game romfs");
console.log(" e.g. % ts-node build.ts -r path/to/romfs -e tools")
console.log(" e.g. % ts-node build.ts -d path/to/Banc -b path/to/beco -e path/to/Ecosystem")
console.log(" or: % ts-node build.ts -r path/to/romfs -e path/to/Ecosystem")
process.exit(1);
}
const ecoPath = argv.e;
const romfsPath = argv.r;
const totkData = path.join(romfsPath, 'Banc');
const becoPath = path.join(romfsPath, 'Ecosystem', 'FieldMapArea');
const totkData = argv.d || path.join(romfsPath, 'Banc');
const becoPath = argv.b || path.join(romfsPath, 'Ecosystem', 'FieldMapArea');

fs.rmSync('map.db.tmp', { force: true });
const db = sqlite3('map.db.tmp');
Expand Down

0 comments on commit 31e3018

Please sign in to comment.