@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.
Files changed (59) hide show
  1. package/README.md +112 -69
  2. package/dist/fbneo/app/app.css +112 -0
  3. package/dist/fbneo/app/app.js +646 -0
  4. package/dist/fbneo/engine-specs.js +646 -0
  5. package/dist/fbneo/fbneo.js +2 -0
  6. package/dist/fbneo/fbneo.options.d.ts +72 -19
  7. package/dist/fbneo/fbneo.options.d.ts.map +1 -1
  8. package/dist/fbneo/fbneo.options.js +49 -48
  9. package/dist/fbneo/fbneo.options.js.map +1 -1
  10. package/dist/fbneo/fbneo.sdk.d.ts +157 -8
  11. package/dist/fbneo/fbneo.sdk.d.ts.map +1 -1
  12. package/dist/fbneo/fbneo.sdk.js +641 -181
  13. package/dist/fbneo/fbneo.sdk.js.map +1 -1
  14. package/dist/fbneo/fbneo.wasm +4 -0
  15. package/dist/fbneo/romset.d.ts +0 -0
  16. package/dist/fbneo/romset.d.ts.map +1 -1
  17. package/dist/fbneo/romset.js.map +1 -1
  18. package/{data → dist/fbneo}/romsets/atari.json +5036 -118
  19. package/{data → dist/fbneo}/romsets/capcom.json +3392 -848
  20. package/{data → dist/fbneo}/romsets/cave.json +460 -115
  21. package/{data → dist/fbneo}/romsets/channelf.json +200 -50
  22. package/{data → dist/fbneo}/romsets/coleco.json +2650 -658
  23. package/{data → dist/fbneo}/romsets/cps3.json +240 -60
  24. package/{data → dist/fbneo}/romsets/dataeast.json +1352 -338
  25. package/{data → dist/fbneo}/romsets/galaxian.json +1192 -298
  26. package/dist/fbneo/romsets/gba.json +197 -0
  27. package/{data → dist/fbneo}/romsets/index.json +16 -12
  28. package/{data → dist/fbneo}/romsets/irem.json +796 -199
  29. package/{data → dist/fbneo}/romsets/konami.json +1644 -411
  30. package/{data → dist/fbneo}/romsets/megadrive.json +11899 -2926
  31. package/{data → dist/fbneo}/romsets/midway.json +560 -140
  32. package/{data → dist/fbneo}/romsets/msx.json +7204 -1798
  33. package/{data → dist/fbneo}/romsets/neogeo.json +2704 -614
  34. package/{data → dist/fbneo}/romsets/nes.json +12815 -3155
  35. package/{data → dist/fbneo}/romsets/pce.json +1952 -488
  36. package/{data → dist/fbneo}/romsets/pgm.json +796 -199
  37. package/{data → dist/fbneo}/romsets/pgm2.json +32 -8
  38. package/{data → dist/fbneo}/romsets/pre90s.json +10002 -2084
  39. package/{data → dist/fbneo}/romsets/psikyo.json +160 -40
  40. package/{data → dist/fbneo}/romsets/pst90s.json +6400 -1597
  41. package/{data → dist/fbneo}/romsets/sega.json +2756 -658
  42. package/{data → dist/fbneo}/romsets/sg1000.json +1032 -255
  43. package/{data → dist/fbneo}/romsets/sms.json +6012 -1503
  44. package/{data → dist/fbneo}/romsets/snes.json +10991 -2816
  45. package/{data → dist/fbneo}/romsets/spectrum.json +13579 -3361
  46. package/{data → dist/fbneo}/romsets/taito.json +2496 -624
  47. package/{data → dist/fbneo}/romsets/toaplan.json +576 -144
  48. package/package.json +10 -15
  49. package/src/app/app.css +112 -0
  50. package/src/app/app.js +646 -0
  51. package/src/fbneo.options.ts +119 -63
  52. package/src/fbneo.sdk.ts +712 -211
  53. package/src/romset.ts +0 -0
  54. package/dist/fbneo/fbneo.manifest.d.ts +0 -4
  55. package/dist/fbneo/fbneo.manifest.d.ts.map +0 -1
  56. package/dist/fbneo/fbneo.manifest.js +0 -33
  57. package/dist/fbneo/fbneo.manifest.js.map +0 -1
  58. package/dist/manifest.json +0 -91
  59. package/src/fbneo.manifest.ts +0 -38
@@ -1,27 +1,80 @@
1
- import type { JSONSchema } from '@wasm-gaming/engine-specs';
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';
9
+ /** Bytes, or a thunk that produces them only when the engine actually needs them. */
10
+ export type FbneoAsset = Uint8Array | ArrayBuffer | null | (() => Uint8Array | ArrayBuffer | null | Promise<Uint8Array | ArrayBuffer | null>);
11
+ /** The engine: fixed for the life of the wasm instance (`renderFilter` aside). */
12
+ export interface FbneoConfig {
13
+ /** How the picture is scaled to the mount: crisp pixels or linear filtering. */
14
+ renderFilter?: 'pixelated' | 'smooth';
15
+ /** Emscripten glue URL. Defaults to `./fbneo.js` next to the SDK. */
16
+ jsUrl?: string;
17
+ /** WASM URL. Defaults to `./fbneo.wasm` next to the SDK. */
18
+ wasmUrl?: string;
19
+ }
20
+ /** The session: which game the ROM set is. */
2
21
  export interface FbneoOptions {
3
22
  /**
4
- * Filename used when writing the ROM zip bytes to Emscripten MEMFS.
5
- * FBNeo identifies a game by the zip filename (without extension), so this
6
- * should match the driver's expected ROM set name (e.g. "mslug" for Metal Slug).
23
+ * The FBNeo driver (ROM-set short name, e.g. `mslug`). When empty it is taken from
24
+ * {@link FbneoOptions.romFileName}; the `romset` helper can recover it from a zip's
25
+ * contents when the file name is unreliable.
7
26
  */
27
+ driver?: string;
28
+ /** The ROM zip's file name (`mslug.zip`), used for the driver when `driver` is empty. */
8
29
  romFileName?: string;
9
30
  /**
10
- * The FBNeo driver/game name to load (e.g. "mslug", "sf2", "kof98").
11
- * If omitted, the driver is inferred from `romFileName` (without extension).
31
+ * How a Neo Geo set boots: `mvs`, the arcade board (coins, credits — FBNeo's default),
32
+ * or `aes`, the home console: the AES BIOS from the `bios` zip (or Universe BIOS 4.0 in
33
+ * AES mode) and a memory card per game. Other systems ignore it.
12
34
  */
13
- driver?: string;
14
- /** Canvas scaling filter: `pixelated` for crisp pixels, `smooth` for linear filtering. */
15
- renderFilter?: 'pixelated' | 'smooth';
16
- /** Target audio sample rate in Hz. FBNeo defaults to 44100. */
17
- audioSampleRate?: number;
18
- /** Enable vertical sync. Defaults to true. */
19
- vsync?: boolean;
20
- /** Use integer scaling (no fractional stretching). Defaults to false. */
21
- integerScale?: boolean;
22
- /** Window scale multiplier for the internal render resolution. Defaults to 2. */
23
- windowScale?: number;
35
+ neogeo?: 'mvs' | 'aes';
36
+ }
37
+ export interface FbneoAssets {
38
+ /** The game's ROM set: a `.zip` (or `.7z`) named after its driver. Required to start. */
39
+ rom?: FbneoAsset;
40
+ /** A system BIOS set some games need (`neogeo.zip` for Neo Geo). */
41
+ bios?: FbneoAsset;
42
+ }
43
+ /** Where this engine's files live, and whether they outlive the page. */
44
+ export interface FbneoStorage {
45
+ /**
46
+ * Per-game folder for NVRAM/EEPROM, hiscores and save states.
47
+ *
48
+ * Relative to the engine's own folder: the SDK always prefixes `fbneo/`, so the files
49
+ * land in OPFS `fbneo/<namespace>/` and no namespace can reach another engine's
50
+ * files. Segments are cleaned (`.`/`..` dropped, odd characters → `_`); anything
51
+ * unusable becomes `"default"`. `play.storagePath` gives the result.
52
+ *
53
+ * @defaultValue `"default"`
54
+ */
55
+ namespace?: string;
56
+ /** `null` keeps nothing; leaving it out (or `'opfs'`) mirrors the save folder to OPFS. */
57
+ persist?: 'opfs' | null;
58
+ }
59
+ /** Engine events beyond the contract's core set. */
60
+ export interface FbneoEvents {
61
+ /** Save files were just written to `fbneo/<namespace>/` (names relative to it). */
62
+ saves: {
63
+ files: string[];
64
+ };
65
+ }
66
+ export interface FbneoPayloads extends EnginePayloads {
67
+ config: FbneoConfig;
68
+ options: FbneoOptions;
69
+ assets: FbneoAssets;
70
+ storage: FbneoStorage;
71
+ events: FbneoEvents;
24
72
  }
25
- export declare const DEFAULT_FBNEO_OPTIONS: Required<FbneoOptions>;
26
- export declare const FBNEO_OPTIONS_SCHEMA: JSONSchema;
73
+ /** The canvas's backing size; FBNeo scales each game's picture into it. */
74
+ export declare const FBNEO_VIDEO: {
75
+ readonly width: 640;
76
+ readonly height: 480;
77
+ readonly aspect: "4:3";
78
+ };
79
+ export declare const FBNEO_SPEC: EngineSpec<FbneoPayloads>;
27
80
  //# sourceMappingURL=fbneo.options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fbneo.options.d.ts","sourceRoot":"","sources":["../../src/fbneo.options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IACtC,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAQxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,UA8ClC,CAAC"}
1
+ {"version":3,"file":"fbneo.options.d.ts","sourceRoot":"","sources":["../../src/fbneo.options.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5E,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,WAAW,GACX,IAAI,GACJ,CAAC,MAAM,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;AAEvF,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,YAAY,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IACtC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,oEAAoE;IACpE,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,yEAAyE;AACzE,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5B;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,2EAA2E;AAC3E,eAAO,MAAM,WAAW;;;;CAAsD,CAAC;AAE/E,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC,aAAa,CAqDhD,CAAC"}
@@ -1,55 +1,56 @@
1
- export const DEFAULT_FBNEO_OPTIONS = {
2
- romFileName: 'game.zip',
3
- driver: '',
4
- renderFilter: 'pixelated',
5
- audioSampleRate: 44100,
6
- vsync: true,
7
- integerScale: false,
8
- windowScale: 2,
9
- };
10
- export const FBNEO_OPTIONS_SCHEMA = {
11
- type: 'object',
12
- additionalProperties: false,
13
- properties: {
14
- romFileName: {
15
- type: 'string',
16
- default: 'game.zip',
17
- description: 'ROM zip filename written to Emscripten MEMFS when loading a game.',
1
+ /** The canvas's backing size; FBNeo scales each game's picture into it. */
2
+ export const FBNEO_VIDEO = { width: 640, height: 480, aspect: '4:3' };
3
+ export const FBNEO_SPEC = {
4
+ config: {
5
+ renderFilter: {
6
+ default: 'pixelated',
7
+ enum: ['pixelated', 'smooth'],
8
+ live: true,
9
+ description: 'Scaling: crisp pixels or linear filtering.',
18
10
  },
11
+ jsUrl: { live: false, description: 'Emscripten glue URL. Defaults to ./fbneo.js.' },
12
+ wasmUrl: { live: false, description: 'WASM URL. Defaults to ./fbneo.wasm.' },
13
+ },
14
+ options: {
19
15
  driver: {
20
- type: 'string',
21
16
  default: '',
22
- description: 'FBNeo driver/game name to load (e.g. "mslug"). If empty, inferred from romFileName without extension.',
17
+ live: false,
18
+ description: 'FBNeo driver (ROM-set short name, e.g. "mslug"). Empty: taken from romFileName.',
23
19
  },
24
- renderFilter: {
25
- type: 'string',
26
- enum: ['pixelated', 'smooth'],
27
- default: 'pixelated',
28
- description: 'Canvas scaling filter: pixelated for crisp pixels, smooth for linear filtering.',
29
- },
30
- audioSampleRate: {
31
- type: 'integer',
32
- default: 44100,
33
- minimum: 11025,
34
- maximum: 96000,
35
- description: 'Target audio sample rate in Hz.',
36
- },
37
- vsync: {
38
- type: 'boolean',
39
- default: true,
40
- description: 'Enable vertical sync.',
41
- },
42
- integerScale: {
43
- type: 'boolean',
44
- default: false,
45
- description: 'Use integer scaling (no fractional stretching).',
46
- },
47
- windowScale: {
48
- type: 'integer',
49
- default: 2,
50
- minimum: 1,
51
- maximum: 8,
52
- description: 'Window scale multiplier for the internal render resolution.',
20
+ romFileName: {
21
+ default: '',
22
+ live: false,
23
+ description: 'The ROM zip file name; its stem is the driver when driver is empty.',
24
+ },
25
+ neogeo: {
26
+ default: 'mvs',
27
+ enum: ['mvs', 'aes'],
28
+ live: false,
29
+ description: 'Neo Geo sets: mvs (arcade, FBNeo default) or aes (home console: AES BIOS, memory card).',
30
+ },
31
+ },
32
+ assets: {
33
+ rom: {
34
+ allowedTypes: ['.zip', '.7z'],
35
+ live: false,
36
+ description: 'The arcade ROM set, named after its driver. Required to start.',
37
+ },
38
+ bios: {
39
+ allowedTypes: ['.zip'],
40
+ live: false,
41
+ description: 'Optional system BIOS set (neogeo.zip for Neo Geo).',
42
+ },
43
+ },
44
+ storage: {
45
+ namespace: {
46
+ default: 'default',
47
+ live: false,
48
+ description: "Folder for this game's saves, inside the engine's own fbneo/ folder (OPFS fbneo/<namespace>/).",
49
+ },
50
+ persist: {
51
+ enum: ['opfs', null],
52
+ live: false,
53
+ description: 'null keeps nothing; otherwise saves are mirrored to OPFS.',
53
54
  },
54
55
  },
55
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fbneo.options.js","sourceRoot":"","sources":["../../src/fbneo.options.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,WAAW,EAAE,UAAU;IACvB,MAAM,EAAE,EAAE;IACV,YAAY,EAAE,WAAW;IACzB,eAAe,EAAE,KAAK;IACtB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAe;IAC9C,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,mEAAmE;SACjF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EACT,uGAAuG;SAC1G;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;YAC7B,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,iFAAiF;SAC/F;QACD,eAAe,EAAE;YACf,IAAI,E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SACnF;QACD,MAAM,EAAE;YACN,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YACpB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,yFAAyF;SACvG;KACF;IACD,MAAM,EAAE;QACN,GAAG,EAAE;YACH,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;YAC7B,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,gEAAgE;SAC9E;QACD,IAAI,EAAE;YACJ,YAAY,EAAE,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,oDAAoD;SAClE;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAE;YACT,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,gGAAgG;SAC9G;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;YACpB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,2DAA2D;SACzE;KACF;CACF,CAAC"}
@@ -1,10 +1,159 @@
1
- import type { EngineConfig, EngineInstance } from '@wasm-gaming/engine-specs';
2
- import { manifest } from './fbneo.manifest.js';
3
- export { manifest };
4
- export declare function load(config: EngineConfig): Promise<EngineInstance>;
5
- declare const _default: {
6
- manifest: import("@wasm-gaming/engine-specs").EngineManifest;
7
- load: typeof load;
1
+ /**
2
+ * The engine package's entry point: an `EngineSDK` for FBNeo (FinalBurn Neo), the
3
+ * arcade emulator.
4
+ *
5
+ * ```js
6
+ * import FbneoSDK from '@wasm-gaming/fbneo-wasm';
7
+ *
8
+ * const play = await new FbneoSDK()
9
+ * .options({ driver: 'mslug' }) // or romFileName: 'mslug.zip'
10
+ * .assets({ rom: () => readZip(), bios: () => readBios() })
11
+ * .storage({ namespace: 'mslug' }) // → OPFS fbneo/mslug/
12
+ * .mount(document.querySelector('#stage'))
13
+ * .start();
14
+ *
15
+ * play.pause('menu'); play.resume('menu');
16
+ * await play.restart(); // soft reset
17
+ * await play.destroy(); // saves flushed, loop stopped
18
+ * ```
19
+ *
20
+ * Everything a host drives is the contract's (`@wasm-gaming/engine-specs`); what is
21
+ * this engine's own: {@link FbneoConfig} and friends, owner-aware
22
+ * {@link FbneoPlay.pause} / {@link FbneoPlay.resume}, {@link FbneoPlay.states},
23
+ * {@link FbneoPlay.storagePath} and the `saves` event.
24
+ *
25
+ * Saves: the build points FBNeo's NVRAM/EEPROM and hiscore paths at MEMFS `/save`.
26
+ * The SDK seeds it from OPFS `fbneo/<namespace>/` before boot and mirrors it back
27
+ * after asking FBNeo to write (`web_persist`): every 10 s, on pause, when the page is
28
+ * hidden and on destroy. Upstream only wrote at exit, which a web page never reaches.
29
+ */
30
+ import { EnginePlayBase, EngineSDKBase, EventEmitter, type EngineInit, type EngineSDKConstructor, type EventsOf } from '@wasm-gaming/engine-specs';
31
+ import { type FbneoOptions, type FbneoPayloads } from './fbneo.options.js';
32
+ export type { FbneoAsset, FbneoAssets, FbneoConfig, FbneoEvents, FbneoOptions, FbneoPayloads, FbneoStorage, } from './fbneo.options.js';
33
+ export { FBNEO_SPEC, FBNEO_VIDEO } from './fbneo.options.js';
34
+ /**
35
+ * Where an engine keeps one namespace: `<engineId>/<namespace>`, relative to the OPFS
36
+ * root. Identical to the other engines': segments cleaned, `.` and `..` dropped,
37
+ * anything outside `[A-Za-z0-9._-]` → `_`, nothing usable → `default`; a leading
38
+ * `<engineId>/` is stripped once.
39
+ */
40
+ export declare function storagePath(engineId: string, namespace: unknown): {
41
+ namespace: string;
42
+ path: string;
43
+ prefixed: boolean;
8
44
  };
9
- export default _default;
45
+ /**
46
+ * The FBNeo driver for a session: `driver` when given, else the ROM file name's stem
47
+ * (`mslug.zip`, `C:\roms\mslug.7z` → `mslug`). Empty when neither says.
48
+ */
49
+ export declare function driverName(options: {
50
+ driver?: string;
51
+ romFileName?: string;
52
+ }): string;
53
+ /** The Neo Geo BIOS FBNeo should run, from what the BIOS zip holds (by CRC). */
54
+ export interface NeoGeoBiosChoice {
55
+ /** `aes`: the real AES BIOS; `unibios`: Universe BIOS 4.0 in its AES mode. */
56
+ bios: 'aes' | 'unibios';
57
+ /** The driver's settings to apply: `[group, option]`, as FBNeo names them. */
58
+ dips: Array<[string, string]>;
59
+ }
60
+ /**
61
+ * How to boot a Neo Geo as the AES (the home console) with the BIOS zip at hand: the
62
+ * real AES World BIOS when it is there, else Universe BIOS 4.0 in AES mode, else null.
63
+ */
64
+ export declare function neoGeoAesBios(entries: Array<{
65
+ crc: string;
66
+ }>): NeoGeoBiosChoice | null;
67
+ /** The player's save-state slots: 0-3. */
68
+ export declare const STATE_SLOTS = 4;
69
+ /**
70
+ * The *unsaved* suspend point: written when the player leaves, offered when they come
71
+ * back, and saved into a numbered slot only when they ask.
72
+ */
73
+ export declare const AUTO_STATE_SLOT = 9;
74
+ /** One save-state slot. */
75
+ export interface FbneoStateSlot {
76
+ slot: number;
77
+ /** When the state was written, or null for an empty slot. */
78
+ savedAt: Date | null;
79
+ /** The frame saved with it (PNG), when the host handed one over. */
80
+ thumbnail: Blob | null;
81
+ /** Protected: cannot be overwritten or removed until unlocked. */
82
+ locked: boolean;
83
+ }
84
+ /** Save states: whole-machine snapshots kept in the save folder (and OPFS). */
85
+ export interface FbneoStates {
86
+ /** The player's slots, 0-3. */
87
+ list(): FbneoStateSlot[];
88
+ /** Any slot, {@link AUTO_STATE_SLOT} included. */
89
+ get(slot: number): FbneoStateSlot;
90
+ /** Save the running game into `slot` (paused or not). Refuses a locked slot. */
91
+ save(slot: number, options?: {
92
+ thumbnail?: Blob | null;
93
+ }): Promise<void>;
94
+ /** Load `slot` into the running game; false when it is empty or FBNeo refused it. */
95
+ load(slot: number): boolean;
96
+ /** Copy a state (and its frame) into another slot — the unsaved point into a numbered one. */
97
+ copy(from: number, to: number): Promise<void>;
98
+ lock(slot: number, locked: boolean): Promise<void>;
99
+ remove(slot: number): Promise<void>;
100
+ }
101
+ /** The live engine: one booted FBNeo and its session. */
102
+ export declare class FbneoPlay extends EnginePlayBase<FbneoPayloads> {
103
+ #private;
104
+ constructor(init?: EngineInit<FbneoPayloads>, events?: EventEmitter<EventsOf<FbneoPayloads>>);
105
+ /** The normalised namespace this session uses. */
106
+ get namespace(): string;
107
+ /** Where this session's saves live, relative to the OPFS root: `fbneo/<namespace>`. */
108
+ get storagePath(): string;
109
+ /** The driver (ROM-set short name) this session booted. */
110
+ get driver(): string;
111
+ /** How a Neo Geo set was booted as the AES: `{ mode, bios, card }`; null otherwise. */
112
+ get neogeo(): {
113
+ mode: 'aes';
114
+ bios: 'aes' | 'unibios';
115
+ card: boolean;
116
+ } | null;
117
+ /** Who holds the pause, or null while running. */
118
+ get pausedBy(): string | null;
119
+ /**
120
+ * The current frame as a PNG (also while paused: the picture is kept). Null when
121
+ * there is nothing to read.
122
+ */
123
+ snapshot(): Promise<Blob | null>;
124
+ /** Save states — see {@link FbneoStates}. */
125
+ get states(): FbneoStates;
126
+ /**
127
+ * Freeze emulation and sound. The first caller owns the pause, and only that
128
+ * owner's {@link resume} lifts it, so an overlay cannot resume a game the host had
129
+ * already frozen. Saves are flushed, since a paused game is often a closed one.
130
+ */
131
+ pause(owner?: string): void;
132
+ resume(owner?: string): void;
133
+ /**
134
+ * Ask FBNeo to write its NVRAM, then copy whatever changed in `/save` to OPFS
135
+ * `fbneo/<namespace>/`. Emits `saves` with the files that moved. Safe to call any
136
+ * time; overlapping calls share one flush.
137
+ */
138
+ flushSaves(): Promise<void>;
139
+ protected mounted(target: HTMLElement): void;
140
+ protected open(_options: FbneoOptions): Promise<void>;
141
+ protected patched(kind: string, patch: object): void;
142
+ protected close(): Promise<void>;
143
+ }
144
+ /**
145
+ * The factory a host constructs: static identity, the configuration chain, and a
146
+ * `start()` that boots FBNeo and opens a session.
147
+ */
148
+ export declare class FbneoSDK extends EngineSDKBase<FbneoPayloads> {
149
+ static readonly id = "fbneo";
150
+ /** Kept in step with package.json by `node scripts/sync-version.mjs`. */
151
+ static readonly version = "0.3.0";
152
+ static readonly name = "FinalBurn Neo";
153
+ static readonly description = "FBNeo, the arcade emulator (Capcom CPS-1/2/3, SNK Neo Geo, Sega System 16 and more), compiled to WebAssembly. Ships no games: the player provides the ROM sets, and they never leave their browser.";
154
+ protected createPlay(init: EngineInit<FbneoPayloads>, events: EventEmitter<EventsOf<FbneoPayloads>>): FbneoPlay;
155
+ }
156
+ /** CI's conformance line: if this class stops satisfying the contract, `make test` fails. */
157
+ export declare const FBNEO_ENGINE: EngineSDKConstructor<FbneoPayloads>;
158
+ export default FbneoSDK;
10
159
  //# sourceMappingURL=fbneo.sdk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fbneo.sdk.d.ts","sourceRoot":"","sources":["../../src/fbneo.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAEZ,cAAc,EAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAE,CAAC;AAyGpB,wBAAsB,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAyIxE;;;;;AAED,wBAAkC"}
1
+ {"version":3,"file":"fbneo.sdk.d.ts","sourceRoot":"","sources":["../../src/fbneo.sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAA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