@wasm-gaming/fbneo-wasm 0.1.0 → 0.1.1

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 (38) hide show
  1. package/README.md +55 -1
  2. package/data/romsets/atari.json +12183 -0
  3. package/data/romsets/capcom.json +66925 -0
  4. package/data/romsets/cave.json +4888 -0
  5. package/data/romsets/channelf.json +463 -0
  6. package/data/romsets/coleco.json +5921 -0
  7. package/data/romsets/cps3.json +1777 -0
  8. package/data/romsets/dataeast.json +22415 -0
  9. package/data/romsets/galaxian.json +14107 -0
  10. package/data/romsets/index.json +116 -0
  11. package/data/romsets/irem.json +15032 -0
  12. package/data/romsets/konami.json +24788 -0
  13. package/data/romsets/megadrive.json +26370 -0
  14. package/data/romsets/midway.json +13213 -0
  15. package/data/romsets/msx.json +16287 -0
  16. package/data/romsets/neogeo.json +28260 -0
  17. package/data/romsets/nes.json +28382 -0
  18. package/data/romsets/pce.json +4397 -0
  19. package/data/romsets/pgm.json +8933 -0
  20. package/data/romsets/pgm2.json +397 -0
  21. package/data/romsets/pre90s.json +143660 -0
  22. package/data/romsets/psikyo.json +2205 -0
  23. package/data/romsets/pst90s.json +84766 -0
  24. package/data/romsets/sega.json +55046 -0
  25. package/data/romsets/sg1000.json +2300 -0
  26. package/data/romsets/sms.json +13541 -0
  27. package/data/romsets/snes.json +23630 -0
  28. package/data/romsets/spectrum.json +30187 -0
  29. package/data/romsets/taito.json +40397 -0
  30. package/data/romsets/toaplan.json +8237 -0
  31. package/dist/fbneo/romset.d.ts +0 -0
  32. package/dist/fbneo/romset.d.ts.map +1 -0
  33. package/dist/fbneo/romset.js +0 -0
  34. package/dist/fbneo/romset.js.map +1 -0
  35. package/package.json +12 -1
  36. package/src/romset.ts +0 -0
  37. package/dist/fbneo/fbneo.js +0 -2
  38. package/dist/fbneo/fbneo.wasm +0 -0
package/README.md CHANGED
@@ -35,7 +35,61 @@ engine.start();
35
35
  FBNeo identifies a game by the ROM zip **filename** (without extension). Pass the
36
36
  game short name explicitly via `options.driver` (e.g. `"mslug"`, `"sf2"`,
37
37
  `"kof98"`), or let it be inferred from `options.romFileName` / the picked file's
38
- name.
38
+ name. (The bytes are always written to MEMFS as `<driver>.zip`, so the source
39
+ file itself never needs renaming — only its *name* has to resolve to a driver.)
40
+
41
+ ### Identifying a ROM set from its contents
42
+
43
+ When the filename is unreliable (a browser-mangled `mslug (1).zip`) but the ROM
44
+ files inside must keep their canonical names, recover the driver from the zip's
45
+ **contents** with the opt-in `@wasm-gaming/fbneo-wasm/romset` helper. It matches
46
+ the CRC-32s stored in the zip's central directory against a dataset of every
47
+ FBNeo ROM set — the same identity FBNeo uses internally — so it is unaffected by
48
+ re-compression, entry reordering, or split/merged packaging.
49
+
50
+ ```js
51
+ import { RomsetIndex, resolveDriver } from '@wasm-gaming/fbneo-wasm/romset';
52
+
53
+ // Load the dataset for the system(s) you support (per-system JSON, loaded on demand).
54
+ const neogeo = await fetch('/romsets/neogeo.json').then((r) => r.json());
55
+ const index = new RomsetIndex([neogeo]);
56
+
57
+ const match = resolveDriver(romZipBytes, index); // { driver: 'mslug', coverage: 1, ... } | null
58
+ const engine = await load({
59
+ canvas,
60
+ assets: { rom: romZipBytes },
61
+ options: { driver: match?.driver }, // fall back to your own logic when null
62
+ });
63
+ ```
64
+
65
+ The dataset ships as `data/romsets/<system>.json` (also served at `/romsets/…`
66
+ from the built `dist/`); `data/romsets/index.json` lists the systems and game
67
+ counts. Regenerate it from a pinned FBNeo checkout with `make romsets`.
68
+
69
+ Because the match is by CRC-32 — and FBNeo itself looks ROM chips up by CRC
70
+ before falling back to their names — a set is usually accepted as downloaded:
71
+ extra files, subdirectories, and non-canonical chip filenames inside the zip do
72
+ not matter. Only the zip's *name* has to resolve to a driver, which is exactly
73
+ what this helper supplies.
74
+
75
+ ### Neo Geo `.neo` files (NeoSD / Terraonion)
76
+
77
+ FBNeo reads `.zip` and `.7z` ROM sets only. A `.neo` — the single-file format for
78
+ NeoSD/Terraonion flash carts, and how most Neo Geo homebrew is distributed — is a
79
+ 4 KiB header followed by each ROM region as one contiguous blob (with the sprite
80
+ region byte-interleaved as the cartridge wires it), so it cannot be handed to the
81
+ engine as-is. Convert it to a bootable ROM set first:
82
+
83
+ ```sh
84
+ node scripts/neo2romset.mjs mygame.neo --out ./roms
85
+ ```
86
+
87
+ It identifies the driver by matching the `.neo`'s region sizes against FBNeo's own
88
+ chip tables, rebuilds the individual chip dumps (de-interleaving sprites, undoing
89
+ the `HARDWARE_SNK_SWAPP` program-ROM swap), and CRC-verifies every chip before
90
+ writing `<driver>.zip` — so it fails loudly rather than emitting a broken set. It
91
+ reads the chip tables from a FBNeo checkout (`.tmp/fbneo-build/…` by default, as
92
+ left by `make build-wasm-ci`; override with `--src`).
39
93
 
40
94
  ### Options
41
95