Skip to content

Commit e15e7bf

Browse files
committed
print name of mapper
1 parent 0ff3bff commit e15e7bf

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

build.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ const { spawnSync } = require('child_process');
66
console.log('TetrisGYM buildscript');
77
console.time('build');
88

9-
const mappers = [1, 3, 4, 5];
9+
const mappers = { // https://www.nesdev.org/wiki/Mapper
10+
1: 'MMC1',
11+
3: 'CNROM',
12+
4: 'MMC3',
13+
5: 'MMC5',
14+
};
1015

1116
// options handling
1217

1318
const args = process.argv.slice(2);
1419

1520
if (args.includes('-h')) {
16-
console.log(`usage: node build.js [-h] [-v] [-m<${mappers.join('|')}>] [-a] [-s] [-k] [-w]
21+
console.log(`usage: node build.js [-h] [-v] [-m<${Object.keys(mappers).join('|')}>] [-a] [-s] [-k] [-w]
1722
1823
-m mapper
1924
-a faster aeppoz + press select to end game
@@ -44,9 +49,9 @@ console.log(`using ${nativeCC65 ? 'system' : 'wasm'} ca65/ld65`);
4449

4550
const mapper = args.find((d) => d.startsWith('-m'))?.slice(2) ?? 1;
4651

47-
if (!mappers.includes(+mapper)) {
52+
if (!mappers[mapper]) {
4853
console.error(
49-
`Invalid INES_MAPPER - options are ${mappers
54+
`invalid INES_MAPPER - options are ${Object.keys(mappers)
5055
.map((d) => `-m${d}`)
5156
.join(', ')}`,
5257
);
@@ -57,7 +62,7 @@ if (!mappers.includes(+mapper)) {
5762

5863
compileFlags.push('-D', `INES_MAPPER=${mapper}`);
5964

60-
console.log(`using mapper ${mapper}`);
65+
console.log(`using ${mappers[mapper]}`);
6166

6267
if (args.includes('-a')) {
6368
compileFlags.push('-D', 'AUTO_WIN=1');

0 commit comments

Comments
 (0)