@wasm-gaming/fbneo-wasm 0.1.1 → 0.1.2

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 CHANGED
@@ -66,6 +66,11 @@ The dataset ships as `data/romsets/<system>.json` (also served at `/romsets/…`
66
66
  from the built `dist/`); `data/romsets/index.json` lists the systems and game
67
67
  counts. Regenerate it from a pinned FBNeo checkout with `make romsets`.
68
68
 
69
+ Each ROM entry carries its internal name (`n`) and CRC-32 (`c`). `neogeo.json`
70
+ additionally carries each chip's size (`s`) and hardware region (`r`) — the chip
71
+ *layout* — which is what lets the `neo` helper below rebuild a ROM set from a
72
+ flash-cart image.
73
+
69
74
  Because the match is by CRC-32 — and FBNeo itself looks ROM chips up by CRC
70
75
  before falling back to their names — a set is usually accepted as downloaded:
71
76
  extra files, subdirectories, and non-canonical chip filenames inside the zip do
@@ -78,18 +83,36 @@ FBNeo reads `.zip` and `.7z` ROM sets only. A `.neo` — the single-file format
78
83
  NeoSD/Terraonion flash carts, and how most Neo Geo homebrew is distributed — is a
79
84
  4 KiB header followed by each ROM region as one contiguous blob (with the sprite
80
85
  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:
86
+ engine as-is. The opt-in `@wasm-gaming/fbneo-wasm/neo` helper rebuilds the chip
87
+ split FBNeo expects, in the browser and with no dependencies:
88
+
89
+ ```js
90
+ import { isNeoFile, neoToRomset } from '@wasm-gaming/fbneo-wasm/neo';
91
+
92
+ const neogeo = await fetch('/romsets/neogeo.json').then((r) => r.json());
93
+
94
+ if (isNeoFile(bytes)) {
95
+ const { driver, zip } = neoToRomset(bytes, neogeo); // throws if it cannot be rebuilt
96
+ await load({ canvas, assets: { rom: zip }, options: { driver } });
97
+ }
98
+ ```
99
+
100
+ It identifies the driver by matching the `.neo`'s region sizes against the chip
101
+ layouts in `data/romsets/neogeo.json`, rebuilds the individual chip dumps
102
+ (de-interleaving sprites, undoing the `HARDWARE_SNK_SWAPP` program-ROM swap), and
103
+ CRC-32 verifies every chip before returning — so it throws loudly rather than
104
+ handing the engine a broken set. The zip it returns is *stored*, not deflated:
105
+ FBNeo decompresses each chip immediately, so compressing would only be undone.
106
+
107
+ The same conversion is available offline, which is handy for preparing a set once
108
+ rather than on every page load:
82
109
 
83
110
  ```sh
84
- node scripts/neo2romset.mjs mygame.neo --out ./roms
111
+ node scripts/neo2romset.mjs mygame.neo --out ./roms # needs `make build-lib`
85
112
  ```
86
113
 
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`).
114
+ Sets whose program ROM lives inside the SMA custom chip cannot be reproduced by a
115
+ straight carve; those fail CRC verification and are reported rather than written.
93
116
 
94
117
  ### Options
95
118
 
@@ -816,10 +816,6 @@
816
816
  "n": "rt_23.13b",
817
817
  "c": "abfca165"
818
818
  },
819
- {
820
- "n": "rt_23.13b",
821
- "c": "7d5a77a7"
822
- },
823
819
  {
824
820
  "n": "rt_30.12c",
825
821
  "c": "26b211ab"
@@ -2445,10 +2441,6 @@
2445
2441
  "n": "q5_35.11f",
2446
2442
  "c": "abacee26"
2447
2443
  },
2448
- {
2449
- "n": "q5_35.11f",
2450
- "c": "59961612"
2451
- },
2452
2444
  {
2453
2445
  "n": "q5_41.11h",
2454
2446
  "c": "d3654067"
@@ -12672,10 +12664,6 @@
12672
12664
  {
12673
12665
  "n": "ps-q4.4k",
12674
12666
  "c": "bed42f03"
12675
- },
12676
- {
12677
- "n": "sound.bin",
12678
- "c": "aeec9dc6"
12679
12667
  }
12680
12668
  ]
12681
12669
  },
@@ -14302,22 +14290,6 @@
14302
14290
  "n": "sh-street-a-sd145.1",
14303
14291
  "c": "a258de13"
14304
14292
  },
14305
- {
14306
- "n": "9.u5",
14307
- "c": "25ae23bc"
14308
- },
14309
- {
14310
- "n": "11.u2",
14311
- "c": "e5819676"
14312
- },
14313
- {
14314
- "n": "10.u3",
14315
- "c": "0ad7fb2b"
14316
- },
14317
- {
14318
- "n": "8.u6",
14319
- "c": "b6b8a84b"
14320
- },
14321
14293
  {
14322
14294
  "n": "c-se005.bin",
14323
14295
  "c": "c781bf87"
@@ -17510,10 +17482,6 @@
17510
17482
  "sf2rk2": {
17511
17483
  "parent": "sf2",
17512
17484
  "roms": [
17513
- {
17514
- "n": "u222.bin",
17515
- "c": "49422b6f"
17516
- },
17517
17485
  {
17518
17486
  "n": "u222.bin",
17519
17487
  "c": "10eea0b4"
@@ -17550,18 +17518,10 @@
17550
17518
  "n": "sound.u191",
17551
17519
  "c": "a4823a1b"
17552
17520
  },
17553
- {
17554
- "n": "u210.bin",
17555
- "c": "44d62caa"
17556
- },
17557
17521
  {
17558
17522
  "n": "u210.bin",
17559
17523
  "c": "6cfffb11"
17560
17524
  },
17561
- {
17562
- "n": "u31.bin",
17563
- "c": "3a85a275"
17564
- },
17565
17525
  {
17566
17526
  "n": "u31.bin",
17567
17527
  "c": "3e9b4e52"
@@ -21658,10 +21618,6 @@
21658
21618
  "sf2amf6": {
21659
21619
  "parent": "sf2ce",
21660
21620
  "roms": [
21661
- {
21662
- "n": "stf2th-5.bin",
21663
- "c": "3127302c"
21664
- },
21665
21621
  {
21666
21622
  "n": "stf2th-7.bin",
21667
21623
  "c": "03991fba"
@@ -22408,54 +22364,6 @@
22408
22364
  "n": "tat-12.bin",
22409
22365
  "c": "6ee19b94"
22410
22366
  },
22411
- {
22412
- "n": "mask01.bin",
22413
- "c": "5733d44e"
22414
- },
22415
- {
22416
- "n": "mask05.bin",
22417
- "c": "42d7635d"
22418
- },
22419
- {
22420
- "n": "mask03.bin",
22421
- "c": "e24eb699"
22422
- },
22423
- {
22424
- "n": "mask07.bin",
22425
- "c": "a18ac61a"
22426
- },
22427
- {
22428
- "n": "mask02.bin",
22429
- "c": "a480eeb7"
22430
- },
22431
- {
22432
- "n": "mask06.bin",
22433
- "c": "dc03b5c7"
22434
- },
22435
- {
22436
- "n": "mask04.bin",
22437
- "c": "64c474af"
22438
- },
22439
- {
22440
- "n": "mask08.bin",
22441
- "c": "f6db1877"
22442
- },
22443
- {
22444
- "n": "mask09.bin",
22445
- "c": "169d85a6"
22446
- },
22447
- {
22448
- "n": "mask10.bin",
22449
- "c": "0c638630"
22450
- },
22451
- {
22452
- "n": "mask11.bin",
22453
- "c": "32a3a841"
22454
- },
22455
- {
22456
- "n": "mask12.bin",
22457
- "c": "6ee19b94"
22458
- },
22459
22367
  {
22460
22368
  "n": "2.bin",
22461
22369
  "c": "08f6b60e"
@@ -22565,10 +22473,6 @@
22565
22473
  "n": "s92_09.bin",
22566
22474
  "c": "08f6b60e"
22567
22475
  },
22568
- {
22569
- "n": "jyg-5.bin.maybe.bad",
22570
- "c": "5b98f225"
22571
- },
22572
22476
  {
22573
22477
  "n": "s92_18.bin",
22574
22478
  "c": "7f162009"
@@ -22577,10 +22481,6 @@
22577
22481
  "n": "s92_19.bin",
22578
22482
  "c": "beade53f"
22579
22483
  },
22580
- {
22581
- "n": "jyg-4.bin",
22582
- "c": "5c9054e3"
22583
- },
22584
22484
  {
22585
22485
  "n": "29.bin",
22586
22486
  "c": "6de44671"
@@ -22682,10 +22582,6 @@
22682
22582
  "n": "s92_09.bin",
22683
22583
  "c": "08f6b60e"
22684
22584
  },
22685
- {
22686
- "n": "jyg-5.bin.maybe.bad",
22687
- "c": "5b98f225"
22688
- },
22689
22585
  {
22690
22586
  "n": "s92_18.bin",
22691
22587
  "c": "7f162009"
@@ -22694,10 +22590,6 @@
22694
22590
  "n": "s92_19.bin",
22695
22591
  "c": "beade53f"
22696
22592
  },
22697
- {
22698
- "n": "jyg-4.bin",
22699
- "c": "5c9054e3"
22700
- },
22701
22593
  {
22702
22594
  "n": "e.bin",
22703
22595
  "c": "6de44671"
@@ -23083,10 +22975,6 @@
23083
22975
  "n": "4.mdta",
23084
22976
  "c": "bd98ff15"
23085
22977
  },
23086
- {
23087
- "n": "pf4 sh058.ic89",
23088
- "c": "40fdf624"
23089
- },
23090
22978
  {
23091
22979
  "n": "pf4 sh058.ic89",
23092
22980
  "c": "16289710"
@@ -24174,10 +24062,6 @@
24174
24062
  "sf2ceuab2": {
24175
24063
  "parent": "sf2ce",
24176
24064
  "roms": [
24177
- {
24178
- "n": "u221.epr",
24179
- "c": "d8276822"
24180
- },
24181
24065
  {
24182
24066
  "n": "k4-222",
24183
24067
  "c": "db567b66"
@@ -63160,10 +63044,6 @@
63160
63044
  "vhunt2d": {
63161
63045
  "parent": "vhunt2",
63162
63046
  "roms": [
63163
- {
63164
- "n": "vh2j_d.06",
63165
- "c": "f320ea30"
63166
- },
63167
63047
  {
63168
63048
  "n": "vh2j_d.03a",
63169
63049
  "c": "696e0157"
@@ -63253,22 +63133,6 @@
63253
63133
  "vsav2d": {
63254
63134
  "parent": "vsav2",
63255
63135
  "roms": [
63256
- {
63257
- "n": "vs2j_d.03",
63258
- "c": "5ee19aee"
63259
- },
63260
- {
63261
- "n": "vs2j_d.04",
63262
- "c": "80116c47"
63263
- },
63264
- {
63265
- "n": "vs2j_d.05",
63266
- "c": "dc74a062"
63267
- },
63268
- {
63269
- "n": "vs2j_d.08",
63270
- "c": "97554918"
63271
- },
63272
63136
  {
63273
63137
  "n": "vs2j_d.03",
63274
63138
  "c": "50865f7b"
@@ -63447,14 +63311,6 @@
63447
63311
  "xmvsfu1d": {
63448
63312
  "parent": "xmvsf",
63449
63313
  "roms": [
63450
- {
63451
- "n": "xvsd.05a",
63452
- "c": "de347b11"
63453
- },
63454
- {
63455
- "n": "xvsd.07",
63456
- "c": "f761ded7"
63457
- },
63458
63314
  {
63459
63315
  "n": "xvsud.03h",
63460
63316
  "c": "4e2e76b7"
@@ -42,7 +42,7 @@
42
42
  },
43
43
  {
44
44
  "system": "megadrive",
45
- "games": 2925
45
+ "games": 2923
46
46
  },
47
47
  {
48
48
  "system": "midway",
@@ -54,11 +54,11 @@
54
54
  },
55
55
  {
56
56
  "system": "neogeo",
57
- "games": 687
57
+ "games": 682
58
58
  },
59
59
  {
60
60
  "system": "nes",
61
- "games": 3153
61
+ "games": 3144
62
62
  },
63
63
  {
64
64
  "system": "pce",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  {
68
68
  "system": "pgm",
69
- "games": 200
69
+ "games": 199
70
70
  },
71
71
  {
72
72
  "system": "pgm2",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  {
76
76
  "system": "pre90s",
77
- "games": 2071
77
+ "games": 2074
78
78
  },
79
79
  {
80
80
  "system": "psikyo",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  {
88
88
  "system": "sega",
89
- "games": 665
89
+ "games": 658
90
90
  },
91
91
  {
92
92
  "system": "sg1000",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  {
96
96
  "system": "sms",
97
- "games": 1504
97
+ "games": 1503
98
98
  },
99
99
  {
100
100
  "system": "snes",
@@ -19503,10 +19503,6 @@
19503
19503
  "n": "i10.bin",
19504
19504
  "c": "22a3d9d6"
19505
19505
  },
19506
- {
19507
- "n": "1.e8",
19508
- "c": "35a85077"
19509
- },
19510
19506
  {
19511
19507
  "n": "1.e8",
19512
19508
  "c": "f040c484"
@@ -19607,10 +19603,6 @@
19607
19603
  {
19608
19604
  "n": "064eab04_sr.10e",
19609
19605
  "c": "56bb2e75"
19610
- },
19611
- {
19612
- "n": "064eab05_sr.10g",
19613
- "c": "0aad4619"
19614
19606
  }
19615
19607
  ]
19616
19608
  },
@@ -26347,24 +26347,6 @@
26347
26347
  "c": "bf9ba3bc"
26348
26348
  }
26349
26349
  ]
26350
- },
26351
- "md_spritemask": {
26352
- "parent": null,
26353
- "roms": [
26354
- {
26355
- "n": "SpriteMaskingTestRom.bin",
26356
- "c": "6986aa96"
26357
- }
26358
- ]
26359
- },
26360
- "md_testinstspeed": {
26361
- "parent": null,
26362
- "roms": [
26363
- {
26364
- "n": "test_inst_speed.bin",
26365
- "c": "093f3d29"
26366
- }
26367
- ]
26368
26350
  }
26369
26351
  }
26370
26352
  }