@wasm-gaming/fbneo-wasm 0.1.1 → 0.2.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 (65) hide show
  1. package/README.md +133 -76
  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 +66 -19
  7. package/dist/fbneo/fbneo.options.d.ts.map +1 -1
  8. package/dist/fbneo/fbneo.options.js +39 -44
  9. package/dist/fbneo/fbneo.options.js.map +1 -1
  10. package/dist/fbneo/fbneo.sdk.d.ts +137 -8
  11. package/dist/fbneo/fbneo.sdk.d.ts.map +1 -1
  12. package/dist/fbneo/fbneo.sdk.js +588 -184
  13. package/dist/fbneo/fbneo.sdk.js.map +1 -1
  14. package/dist/fbneo/fbneo.wasm +4 -0
  15. package/dist/fbneo/neo.d.ts +83 -0
  16. package/dist/fbneo/neo.d.ts.map +1 -0
  17. package/dist/fbneo/neo.js +357 -0
  18. package/dist/fbneo/neo.js.map +1 -0
  19. package/dist/fbneo/romset.d.ts +0 -0
  20. package/dist/fbneo/romset.d.ts.map +1 -1
  21. package/dist/fbneo/romset.js +0 -0
  22. package/dist/fbneo/romset.js.map +1 -1
  23. package/{data → dist/fbneo}/romsets/capcom.json +0 -144
  24. package/{data → dist/fbneo}/romsets/index.json +7 -7
  25. package/{data → dist/fbneo}/romsets/konami.json +0 -8
  26. package/{data → dist/fbneo}/romsets/megadrive.json +0 -18
  27. package/dist/fbneo/romsets/neogeo.json +39274 -0
  28. package/{data → dist/fbneo}/romsets/nes.json +0 -81
  29. package/{data → dist/fbneo}/romsets/pgm.json +0 -73
  30. package/{data → dist/fbneo}/romsets/pre90s.json +396 -273
  31. package/{data → dist/fbneo}/romsets/pst90s.json +0 -152
  32. package/{data → dist/fbneo}/romsets/sega.json +0 -175
  33. package/{data → dist/fbneo}/romsets/sms.json +0 -9
  34. package/{data → dist/fbneo}/romsets/taito.json +0 -24
  35. package/{data → dist/fbneo}/romsets/toaplan.json +0 -60
  36. package/package.json +15 -15
  37. package/src/app/app.css +112 -0
  38. package/src/app/app.js +646 -0
  39. package/src/fbneo.options.ts +107 -63
  40. package/src/fbneo.sdk.ts +644 -212
  41. package/src/neo.ts +463 -0
  42. package/src/romset.ts +0 -0
  43. package/data/romsets/neogeo.json +0 -28260
  44. package/dist/fbneo/fbneo.manifest.d.ts +0 -4
  45. package/dist/fbneo/fbneo.manifest.d.ts.map +0 -1
  46. package/dist/fbneo/fbneo.manifest.js +0 -33
  47. package/dist/fbneo/fbneo.manifest.js.map +0 -1
  48. package/dist/manifest.json +0 -91
  49. package/src/fbneo.manifest.ts +0 -38
  50. /package/{data → dist/fbneo}/romsets/atari.json +0 -0
  51. /package/{data → dist/fbneo}/romsets/cave.json +0 -0
  52. /package/{data → dist/fbneo}/romsets/channelf.json +0 -0
  53. /package/{data → dist/fbneo}/romsets/coleco.json +0 -0
  54. /package/{data → dist/fbneo}/romsets/cps3.json +0 -0
  55. /package/{data → dist/fbneo}/romsets/dataeast.json +0 -0
  56. /package/{data → dist/fbneo}/romsets/galaxian.json +0 -0
  57. /package/{data → dist/fbneo}/romsets/irem.json +0 -0
  58. /package/{data → dist/fbneo}/romsets/midway.json +0 -0
  59. /package/{data → dist/fbneo}/romsets/msx.json +0 -0
  60. /package/{data → dist/fbneo}/romsets/pce.json +0 -0
  61. /package/{data → dist/fbneo}/romsets/pgm2.json +0 -0
  62. /package/{data → dist/fbneo}/romsets/psikyo.json +0 -0
  63. /package/{data → dist/fbneo}/romsets/sg1000.json +0 -0
  64. /package/{data → dist/fbneo}/romsets/snes.json +0 -0
  65. /package/{data → dist/fbneo}/romsets/spectrum.json +0 -0
@@ -1,27 +1,74 @@
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;
30
+ }
31
+ export interface FbneoAssets {
32
+ /** The game's ROM set: a `.zip` (or `.7z`) named after its driver. Required to start. */
33
+ rom?: FbneoAsset;
34
+ /** A system BIOS set some games need (`neogeo.zip` for Neo Geo). */
35
+ bios?: FbneoAsset;
36
+ }
37
+ /** Where this engine's files live, and whether they outlive the page. */
38
+ export interface FbneoStorage {
9
39
  /**
10
- * The FBNeo driver/game name to load (e.g. "mslug", "sf2", "kof98").
11
- * If omitted, the driver is inferred from `romFileName` (without extension).
40
+ * Per-game folder for NVRAM/EEPROM, hiscores and save states.
41
+ *
42
+ * Relative to the engine's own folder: the SDK always prefixes `fbneo/`, so the files
43
+ * land in OPFS `fbneo/<namespace>/` and no namespace can reach another engine's
44
+ * files. Segments are cleaned (`.`/`..` dropped, odd characters → `_`); anything
45
+ * unusable becomes `"default"`. `play.storagePath` gives the result.
46
+ *
47
+ * @defaultValue `"default"`
12
48
  */
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;
49
+ namespace?: string;
50
+ /** `null` keeps nothing; leaving it out (or `'opfs'`) mirrors the save folder to OPFS. */
51
+ persist?: 'opfs' | null;
52
+ }
53
+ /** Engine events beyond the contract's core set. */
54
+ export interface FbneoEvents {
55
+ /** Save files were just written to `fbneo/<namespace>/` (names relative to it). */
56
+ saves: {
57
+ files: string[];
58
+ };
59
+ }
60
+ export interface FbneoPayloads extends EnginePayloads {
61
+ config: FbneoConfig;
62
+ options: FbneoOptions;
63
+ assets: FbneoAssets;
64
+ storage: FbneoStorage;
65
+ events: FbneoEvents;
24
66
  }
25
- export declare const DEFAULT_FBNEO_OPTIONS: Required<FbneoOptions>;
26
- export declare const FBNEO_OPTIONS_SCHEMA: JSONSchema;
67
+ /** The canvas's backing size; FBNeo scales each game's picture into it. */
68
+ export declare const FBNEO_VIDEO: {
69
+ readonly width: 640;
70
+ readonly height: 480;
71
+ readonly aspect: "4:3";
72
+ };
73
+ export declare const FBNEO_SPEC: EngineSpec<FbneoPayloads>;
27
74
  //# 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;CACtB;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,CA+ChD,CAAC"}
@@ -1,55 +1,50 @@
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.',
20
+ romFileName: {
21
+ default: '',
22
+ live: false,
23
+ description: 'The ROM zip file name; its stem is the driver when driver is empty.',
29
24
  },
30
- audioSampleRate: {
31
- type: 'integer',
32
- default: 44100,
33
- minimum: 11025,
34
- maximum: 96000,
35
- description: 'Target audio sample rate in Hz.',
25
+ },
26
+ assets: {
27
+ rom: {
28
+ allowedTypes: ['.zip', '.7z'],
29
+ live: false,
30
+ description: 'The arcade ROM set, named after its driver. Required to start.',
36
31
  },
37
- vsync: {
38
- type: 'boolean',
39
- default: true,
40
- description: 'Enable vertical sync.',
32
+ bios: {
33
+ allowedTypes: ['.zip'],
34
+ live: false,
35
+ description: 'Optional system BIOS set (neogeo.zip for Neo Geo).',
41
36
  },
42
- integerScale: {
43
- type: 'boolean',
44
- default: false,
45
- description: 'Use integer scaling (no fractional stretching).',
37
+ },
38
+ storage: {
39
+ namespace: {
40
+ default: 'default',
41
+ live: false,
42
+ description: "Folder for this game's saves, inside the engine's own fbneo/ folder (OPFS fbneo/<namespace>/).",
46
43
  },
47
- windowScale: {
48
- type: 'integer',
49
- default: 2,
50
- minimum: 1,
51
- maximum: 8,
52
- description: 'Window scale multiplier for the internal render resolution.',
44
+ persist: {
45
+ enum: ['opfs', null],
46
+ live: false,
47
+ description: 'null keeps nothing; otherwise saves are mirrored to OPFS.',
53
48
  },
54
49
  },
55
50
  };
@@ -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,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,iCAAiC;SAC/C;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,uBAAuB;SACrC;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,SAAS;YAC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D;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,139 @@
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 player's save-state slots: 0-3. */
54
+ export declare const STATE_SLOTS = 4;
55
+ /**
56
+ * The *unsaved* suspend point: written when the player leaves, offered when they come
57
+ * back, and saved into a numbered slot only when they ask.
58
+ */
59
+ export declare const AUTO_STATE_SLOT = 9;
60
+ /** One save-state slot. */
61
+ export interface FbneoStateSlot {
62
+ slot: number;
63
+ /** When the state was written, or null for an empty slot. */
64
+ savedAt: Date | null;
65
+ /** The frame saved with it (PNG), when the host handed one over. */
66
+ thumbnail: Blob | null;
67
+ /** Protected: cannot be overwritten or removed until unlocked. */
68
+ locked: boolean;
69
+ }
70
+ /** Save states: whole-machine snapshots kept in the save folder (and OPFS). */
71
+ export interface FbneoStates {
72
+ /** The player's slots, 0-3. */
73
+ list(): FbneoStateSlot[];
74
+ /** Any slot, {@link AUTO_STATE_SLOT} included. */
75
+ get(slot: number): FbneoStateSlot;
76
+ /** Save the running game into `slot` (paused or not). Refuses a locked slot. */
77
+ save(slot: number, options?: {
78
+ thumbnail?: Blob | null;
79
+ }): Promise<void>;
80
+ /** Load `slot` into the running game; false when it is empty or FBNeo refused it. */
81
+ load(slot: number): boolean;
82
+ /** Copy a state (and its frame) into another slot — the unsaved point into a numbered one. */
83
+ copy(from: number, to: number): Promise<void>;
84
+ lock(slot: number, locked: boolean): Promise<void>;
85
+ remove(slot: number): Promise<void>;
86
+ }
87
+ /** The live engine: one booted FBNeo and its session. */
88
+ export declare class FbneoPlay extends EnginePlayBase<FbneoPayloads> {
89
+ #private;
90
+ constructor(init?: EngineInit<FbneoPayloads>, events?: EventEmitter<EventsOf<FbneoPayloads>>);
91
+ /** The normalised namespace this session uses. */
92
+ get namespace(): string;
93
+ /** Where this session's saves live, relative to the OPFS root: `fbneo/<namespace>`. */
94
+ get storagePath(): string;
95
+ /** The driver (ROM-set short name) this session booted. */
96
+ get driver(): string;
97
+ /** Who holds the pause, or null while running. */
98
+ get pausedBy(): string | null;
99
+ /**
100
+ * The current frame as a PNG (also while paused: the picture is kept). Null when
101
+ * there is nothing to read.
102
+ */
103
+ snapshot(): Promise<Blob | null>;
104
+ /** Save states — see {@link FbneoStates}. */
105
+ get states(): FbneoStates;
106
+ /**
107
+ * Freeze emulation and sound. The first caller owns the pause, and only that
108
+ * owner's {@link resume} lifts it, so an overlay cannot resume a game the host had
109
+ * already frozen. Saves are flushed, since a paused game is often a closed one.
110
+ */
111
+ pause(owner?: string): void;
112
+ resume(owner?: string): void;
113
+ /**
114
+ * Ask FBNeo to write its NVRAM, then copy whatever changed in `/save` to OPFS
115
+ * `fbneo/<namespace>/`. Emits `saves` with the files that moved. Safe to call any
116
+ * time; overlapping calls share one flush.
117
+ */
118
+ flushSaves(): Promise<void>;
119
+ protected mounted(target: HTMLElement): void;
120
+ protected open(_options: FbneoOptions): Promise<void>;
121
+ protected patched(kind: string, patch: object): void;
122
+ protected close(): Promise<void>;
123
+ }
124
+ /**
125
+ * The factory a host constructs: static identity, the configuration chain, and a
126
+ * `start()` that boots FBNeo and opens a session.
127
+ */
128
+ export declare class FbneoSDK extends EngineSDKBase<FbneoPayloads> {
129
+ static readonly id = "fbneo";
130
+ /** Kept in step with package.json by `node scripts/sync-version.mjs`. */
131
+ static readonly version = "0.2.0";
132
+ static readonly name = "FinalBurn Neo";
133
+ 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.";
134
+ protected createPlay(init: EngineInit<FbneoPayloads>, events: EventEmitter<EventsOf<FbneoPayloads>>): FbneoPlay;
135
+ }
136
+ /** CI's conformance line: if this class stops satisfying the contract, `make test` fails. */
137
+ export declare const FBNEO_ENGINE: EngineSDKConstructor<FbneoPayloads>;
138
+ export default FbneoSDK;
10
139
  //# 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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