@wasm-gaming/fbneo-wasm 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -69
- package/dist/fbneo/app/app.css +112 -0
- package/dist/fbneo/app/app.js +646 -0
- package/dist/fbneo/engine-specs.js +646 -0
- package/dist/fbneo/fbneo.js +2 -0
- package/dist/fbneo/fbneo.options.d.ts +72 -19
- package/dist/fbneo/fbneo.options.d.ts.map +1 -1
- package/dist/fbneo/fbneo.options.js +49 -48
- package/dist/fbneo/fbneo.options.js.map +1 -1
- package/dist/fbneo/fbneo.sdk.d.ts +157 -8
- package/dist/fbneo/fbneo.sdk.d.ts.map +1 -1
- package/dist/fbneo/fbneo.sdk.js +641 -181
- package/dist/fbneo/fbneo.sdk.js.map +1 -1
- package/dist/fbneo/fbneo.wasm +4 -0
- package/dist/fbneo/romset.d.ts +0 -0
- package/dist/fbneo/romset.d.ts.map +1 -1
- package/dist/fbneo/romset.js.map +1 -1
- package/{data → dist/fbneo}/romsets/atari.json +5036 -118
- package/{data → dist/fbneo}/romsets/capcom.json +3392 -848
- package/{data → dist/fbneo}/romsets/cave.json +460 -115
- package/{data → dist/fbneo}/romsets/channelf.json +200 -50
- package/{data → dist/fbneo}/romsets/coleco.json +2650 -658
- package/{data → dist/fbneo}/romsets/cps3.json +240 -60
- package/{data → dist/fbneo}/romsets/dataeast.json +1352 -338
- package/{data → dist/fbneo}/romsets/galaxian.json +1192 -298
- package/dist/fbneo/romsets/gba.json +197 -0
- package/{data → dist/fbneo}/romsets/index.json +16 -12
- package/{data → dist/fbneo}/romsets/irem.json +796 -199
- package/{data → dist/fbneo}/romsets/konami.json +1644 -411
- package/{data → dist/fbneo}/romsets/megadrive.json +11899 -2926
- package/{data → dist/fbneo}/romsets/midway.json +560 -140
- package/{data → dist/fbneo}/romsets/msx.json +7204 -1798
- package/{data → dist/fbneo}/romsets/neogeo.json +2704 -614
- package/{data → dist/fbneo}/romsets/nes.json +12815 -3155
- package/{data → dist/fbneo}/romsets/pce.json +1952 -488
- package/{data → dist/fbneo}/romsets/pgm.json +796 -199
- package/{data → dist/fbneo}/romsets/pgm2.json +32 -8
- package/{data → dist/fbneo}/romsets/pre90s.json +10002 -2084
- package/{data → dist/fbneo}/romsets/psikyo.json +160 -40
- package/{data → dist/fbneo}/romsets/pst90s.json +6400 -1597
- package/{data → dist/fbneo}/romsets/sega.json +2756 -658
- package/{data → dist/fbneo}/romsets/sg1000.json +1032 -255
- package/{data → dist/fbneo}/romsets/sms.json +6012 -1503
- package/{data → dist/fbneo}/romsets/snes.json +10991 -2816
- package/{data → dist/fbneo}/romsets/spectrum.json +13579 -3361
- package/{data → dist/fbneo}/romsets/taito.json +2496 -624
- package/{data → dist/fbneo}/romsets/toaplan.json +576 -144
- package/package.json +10 -15
- package/src/app/app.css +112 -0
- package/src/app/app.js +646 -0
- package/src/fbneo.options.ts +119 -63
- package/src/fbneo.sdk.ts +712 -211
- package/src/romset.ts +0 -0
- package/dist/fbneo/fbneo.manifest.d.ts +0 -4
- package/dist/fbneo/fbneo.manifest.d.ts.map +0 -1
- package/dist/fbneo/fbneo.manifest.js +0 -33
- package/dist/fbneo/fbneo.manifest.js.map +0 -1
- package/dist/manifest.json +0 -91
- package/src/fbneo.manifest.ts +0 -38
package/src/fbneo.options.ts
CHANGED
|
@@ -1,83 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* What FBNeo accepts, as types and as data.
|
|
3
|
+
*
|
|
4
|
+
* The four payloads of the wasm-gaming engine contract, closed for this engine, and
|
|
5
|
+
* {@link FBNEO_SPEC} — the same thing as data the contract's base class reads: every
|
|
6
|
+
* default lives there and nowhere else.
|
|
7
|
+
*/
|
|
8
|
+
import type { EnginePayloads, EngineSpec } from '@wasm-gaming/engine-specs';
|
|
2
9
|
|
|
10
|
+
/** Bytes, or a thunk that produces them only when the engine actually needs them. */
|
|
11
|
+
export type FbneoAsset =
|
|
12
|
+
| Uint8Array
|
|
13
|
+
| ArrayBuffer
|
|
14
|
+
| null
|
|
15
|
+
| (() => Uint8Array | ArrayBuffer | null | Promise<Uint8Array | ArrayBuffer | null>);
|
|
16
|
+
|
|
17
|
+
/** The engine: fixed for the life of the wasm instance (`renderFilter` aside). */
|
|
18
|
+
export interface FbneoConfig {
|
|
19
|
+
/** How the picture is scaled to the mount: crisp pixels or linear filtering. */
|
|
20
|
+
renderFilter?: 'pixelated' | 'smooth';
|
|
21
|
+
/** Emscripten glue URL. Defaults to `./fbneo.js` next to the SDK. */
|
|
22
|
+
jsUrl?: string;
|
|
23
|
+
/** WASM URL. Defaults to `./fbneo.wasm` next to the SDK. */
|
|
24
|
+
wasmUrl?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The session: which game the ROM set is. */
|
|
3
28
|
export interface FbneoOptions {
|
|
4
29
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
30
|
+
* The FBNeo driver (ROM-set short name, e.g. `mslug`). When empty it is taken from
|
|
31
|
+
* {@link FbneoOptions.romFileName}; the `romset` helper can recover it from a zip's
|
|
32
|
+
* contents when the file name is unreliable.
|
|
8
33
|
*/
|
|
34
|
+
driver?: string;
|
|
35
|
+
/** The ROM zip's file name (`mslug.zip`), used for the driver when `driver` is empty. */
|
|
9
36
|
romFileName?: string;
|
|
10
37
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
38
|
+
* How a Neo Geo set boots: `mvs`, the arcade board (coins, credits — FBNeo's default),
|
|
39
|
+
* or `aes`, the home console: the AES BIOS from the `bios` zip (or Universe BIOS 4.0 in
|
|
40
|
+
* AES mode) and a memory card per game. Other systems ignore it.
|
|
13
41
|
*/
|
|
14
|
-
|
|
15
|
-
/** Canvas scaling filter: `pixelated` for crisp pixels, `smooth` for linear filtering. */
|
|
16
|
-
renderFilter?: 'pixelated' | 'smooth';
|
|
17
|
-
/** Target audio sample rate in Hz. FBNeo defaults to 44100. */
|
|
18
|
-
audioSampleRate?: number;
|
|
19
|
-
/** Enable vertical sync. Defaults to true. */
|
|
20
|
-
vsync?: boolean;
|
|
21
|
-
/** Use integer scaling (no fractional stretching). Defaults to false. */
|
|
22
|
-
integerScale?: boolean;
|
|
23
|
-
/** Window scale multiplier for the internal render resolution. Defaults to 2. */
|
|
24
|
-
windowScale?: number;
|
|
42
|
+
neogeo?: 'mvs' | 'aes';
|
|
25
43
|
}
|
|
26
44
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
integerScale: false,
|
|
34
|
-
windowScale: 2,
|
|
35
|
-
};
|
|
45
|
+
export interface FbneoAssets {
|
|
46
|
+
/** The game's ROM set: a `.zip` (or `.7z`) named after its driver. Required to start. */
|
|
47
|
+
rom?: FbneoAsset;
|
|
48
|
+
/** A system BIOS set some games need (`neogeo.zip` for Neo Geo). */
|
|
49
|
+
bios?: FbneoAsset;
|
|
50
|
+
}
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
/** Where this engine's files live, and whether they outlive the page. */
|
|
53
|
+
export interface FbneoStorage {
|
|
54
|
+
/**
|
|
55
|
+
* Per-game folder for NVRAM/EEPROM, hiscores and save states.
|
|
56
|
+
*
|
|
57
|
+
* Relative to the engine's own folder: the SDK always prefixes `fbneo/`, so the files
|
|
58
|
+
* land in OPFS `fbneo/<namespace>/` and no namespace can reach another engine's
|
|
59
|
+
* files. Segments are cleaned (`.`/`..` dropped, odd characters → `_`); anything
|
|
60
|
+
* unusable becomes `"default"`. `play.storagePath` gives the result.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `"default"`
|
|
63
|
+
*/
|
|
64
|
+
namespace?: string;
|
|
65
|
+
/** `null` keeps nothing; leaving it out (or `'opfs'`) mirrors the save folder to OPFS. */
|
|
66
|
+
persist?: 'opfs' | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Engine events beyond the contract's core set. */
|
|
70
|
+
export interface FbneoEvents {
|
|
71
|
+
/** Save files were just written to `fbneo/<namespace>/` (names relative to it). */
|
|
72
|
+
saves: { files: string[] };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FbneoPayloads extends EnginePayloads {
|
|
76
|
+
config: FbneoConfig;
|
|
77
|
+
options: FbneoOptions;
|
|
78
|
+
assets: FbneoAssets;
|
|
79
|
+
storage: FbneoStorage;
|
|
80
|
+
events: FbneoEvents;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The canvas's backing size; FBNeo scales each game's picture into it. */
|
|
84
|
+
export const FBNEO_VIDEO = { width: 640, height: 480, aspect: '4:3' } as const;
|
|
85
|
+
|
|
86
|
+
export const FBNEO_SPEC: EngineSpec<FbneoPayloads> = {
|
|
87
|
+
config: {
|
|
88
|
+
renderFilter: {
|
|
89
|
+
default: 'pixelated',
|
|
90
|
+
enum: ['pixelated', 'smooth'],
|
|
91
|
+
live: true,
|
|
92
|
+
description: 'Scaling: crisp pixels or linear filtering.',
|
|
45
93
|
},
|
|
94
|
+
jsUrl: { live: false, description: 'Emscripten glue URL. Defaults to ./fbneo.js.' },
|
|
95
|
+
wasmUrl: { live: false, description: 'WASM URL. Defaults to ./fbneo.wasm.' },
|
|
96
|
+
},
|
|
97
|
+
options: {
|
|
46
98
|
driver: {
|
|
47
|
-
type: 'string',
|
|
48
99
|
default: '',
|
|
49
|
-
|
|
50
|
-
|
|
100
|
+
live: false,
|
|
101
|
+
description: 'FBNeo driver (ROM-set short name, e.g. "mslug"). Empty: taken from romFileName.',
|
|
51
102
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
description: 'Canvas scaling filter: pixelated for crisp pixels, smooth for linear filtering.',
|
|
103
|
+
romFileName: {
|
|
104
|
+
default: '',
|
|
105
|
+
live: false,
|
|
106
|
+
description: 'The ROM zip file name; its stem is the driver when driver is empty.',
|
|
57
107
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
description: 'Target audio sample rate in Hz.',
|
|
108
|
+
neogeo: {
|
|
109
|
+
default: 'mvs',
|
|
110
|
+
enum: ['mvs', 'aes'],
|
|
111
|
+
live: false,
|
|
112
|
+
description: 'Neo Geo sets: mvs (arcade, FBNeo default) or aes (home console: AES BIOS, memory card).',
|
|
64
113
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
114
|
+
},
|
|
115
|
+
assets: {
|
|
116
|
+
rom: {
|
|
117
|
+
allowedTypes: ['.zip', '.7z'],
|
|
118
|
+
live: false,
|
|
119
|
+
description: 'The arcade ROM set, named after its driver. Required to start.',
|
|
120
|
+
},
|
|
121
|
+
bios: {
|
|
122
|
+
allowedTypes: ['.zip'],
|
|
123
|
+
live: false,
|
|
124
|
+
description: 'Optional system BIOS set (neogeo.zip for Neo Geo).',
|
|
69
125
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
126
|
+
},
|
|
127
|
+
storage: {
|
|
128
|
+
namespace: {
|
|
129
|
+
default: 'default',
|
|
130
|
+
live: false,
|
|
131
|
+
description: "Folder for this game's saves, inside the engine's own fbneo/ folder (OPFS fbneo/<namespace>/).",
|
|
74
132
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
maximum: 8,
|
|
80
|
-
description: 'Window scale multiplier for the internal render resolution.',
|
|
133
|
+
persist: {
|
|
134
|
+
enum: ['opfs', null],
|
|
135
|
+
live: false,
|
|
136
|
+
description: 'null keeps nothing; otherwise saves are mirrored to OPFS.',
|
|
81
137
|
},
|
|
82
138
|
},
|
|
83
|
-
};
|
|
139
|
+
};
|