Skip to content

Commit e3d50b4

Browse files
committed
make wasm compiler forceable
1 parent d9a9605 commit e3d50b4

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

build.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ const mappers = [1, 3, 4, 5];
1313
const args = process.argv.slice(2);
1414

1515
if (args.includes('-h')) {
16-
console.log(`usage: node [-h] [-v] [-m<${mappers.join('|')}>] [-a] [-s] [-k]
16+
console.log(`usage: node [-h] [-v] [-m<${mappers.join('|')}>] [-a] [-s] [-k] [-w]
1717
1818
-m mapper
1919
-a faster aeppoz + press select to end game
2020
-s disable highscores/SRAM
2121
-k Famicom Keyboard support
22+
-w force WASM compiler
2223
-h you are here
2324
`);
2425
process.exit(0);
@@ -28,9 +29,13 @@ const compileFlags = [];
2829

2930
// compiler options
3031

31-
const nativeCC65 = process.env.PATH.split(path.delimiter).some((dir) =>
32-
fs.statSync(path.join(dir, 'cc65'), { throwIfNoEntry: false })?.isFile(),
33-
);
32+
const nativeCC65 = args.includes('-w')
33+
? false
34+
: process.env.PATH.split(path.delimiter).some((dir) =>
35+
fs
36+
.statSync(path.join(dir, 'cc65'), { throwIfNoEntry: false })
37+
?.isFile(),
38+
);
3439

3540
console.log(`using ${nativeCC65 ? 'system' : 'wasm'} ca65/ld65`);
3641

@@ -106,7 +111,7 @@ function handleSpawn(exe, ...args) {
106111
}
107112
}
108113

109-
const ca65bin = nativeCC65 ? ['ca65'] : ['node', './tools/assemble/ca65.js'];
114+
const ca65bin = nativeCC65 ? ['ca65'] : ['node', './tools/assemble/ca65'];
110115

111116
console.time('assemble');
112117

@@ -126,7 +131,7 @@ console.timeEnd('assemble');
126131

127132
// link object files
128133

129-
const ld65bin = nativeCC65 ? ['ld65'] : ['node', './tools/assemble/ld65.js'];
134+
const ld65bin = nativeCC65 ? ['ld65'] : ['node', './tools/assemble/ld65'];
130135

131136
console.time('link');
132137

@@ -157,7 +162,7 @@ console.log();
157162
if (fs.existsSync('tetris.map')) {
158163
const memMap = fs.readFileSync('tetris.map', 'utf8');
159164

160-
console.log((memMap.match(/PRG_chunk\d+\s+0.+$/gm) ?? []).join('\n'));
165+
console.log((memMap.match(/PRG_chunk\d+\s+0.+$/gm) || []).join('\n'));
161166
}
162167

163168
function hashFile(filename) {

src/nametables/rocket_legal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const {
22
writeRLE,
33
drawTiles,
44
flatLookup,
5-
drawRect,
65
drawAttrs,
76
} = require('./nametables');
87

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)