Skip to content

Source machine definitions from the PinMAME machine reference - #40

Merged
freezy merged 9 commits into
masterfrom
feature/remote-game-definitions
Oct 11, 2026
Merged

freezy merged 9 commits into
masterfrom
feature/remote-game-definitions

Conversation

@freezy

@freezy freezy commented Oct 11, 2026

Copy link
Copy Markdown
Member

Summary

Machine definitions no longer come from hard-coded C# game classes. The editor loads them from the PinMAME machine reference (pinmame-game-defs), and a table's hardware is populated from the selected machine and ROM. PinMAME also no longer depends on a Visual PinMAME installation: it keeps its data in VPE's own folder and reads ROMs from a configurable ROM folder.

Catalog definitions

  • Machine and ROM pickers: the inspector lets you search the catalog for a machine and pick its ROM. The default ROM is the parent ROM, not the alphabetically first one.
  • Populate Hardware: fills the switch, coil, lamp and wire mappings from the machine's definition. The candidate lists are kept on the component, so the managers' dropdowns work offline. Changing the machine or ROM refreshes them without touching the mappings.
  • Older tables: tables that used the retired game classes keep working through a legacy alias resolver (s_flipper_lower_left, c_game_on, …). Player builds only receive the mappings, never the catalog.
  • Catalog to VPE conversion:
    • normally_closed is the physical contact. PinMAME already inverts optos per game (invSw), so only the coin door is passed on as normally closed.
    • The generic lower flipper switches 111–114 follow PinMAME's numbering (odd: EOS, even: button). They take precedence over the matrix flipper switches, which PinMAME only mirrors.
    • Virtual inputs and outputs with a public role are kept, e.g. flipper buttons outside the matrix and synthetic flipper coils. Mirrors and internal state are dropped.

Assignment by position

The catalog's playfield positions are matched against the table's items to link hardware that isn't linked yet. Existing links are kept.

Validated against the Terminator 2 table, starting from empty mappings:

Matches the table Different from the table Left for manual mapping
Lamps 74 0 4
Switches 38 3 2

The remaining switch differences come from disagreements between the catalog and the table, not from the matching itself.

How it matches:

  • Items are paired with targets in order of increasing cost. A machine item that isn't modelled on the table therefore doesn't push a neighbour away.
  • A match is only rejected as ambiguous when two targets could really swap their items. A slightly offset row of inserts still matches.
  • Items at the same position, like a mech's switches, are told apart by name.
  • Devices whose positions the catalog marks as conflicted get no playfield positions, and neither do cabinet inputs.
  • Spatial assignment is disabled when the mappings were populated for another machine. It also never links a second device to hardware that already has one per position.

Runtime

  • Output events: a PinMAME output now drives every mapping row that resolves to it, e.g. coil 19 and the c_game_on alias. Before, only the last row fired.
  • Mech switches: a mech switch ID that isn't a PinMAME switch is skipped instead of aborting the mech setup.
  • Unresolved mapping IDs: they log a warning at runtime instead of an error that recommends repopulating, which would wipe the mappings.

Data folder and ROM folder

Dependencies

  • GamelogicPaths is on VisualPinball.Engine master. package.json still depends on org.visualpinball.engine.unity 0.0.1-preview.119 and needs the first release that contains it.

Known gaps

  • Several issues in the catalog data will be reported to pinmame-game-defs: Terminator 2's 111–114 button/EOS labels, its jet bumpers 42/43, and the meaning of normally_closed.
  • Items positioned by drag points or child objects (slingshots, area triggers, drop target banks) are placed at the playfield origin.
  • Several lights at one insert, as in VPX-converted tables, are rejected as ambiguous.
  • These two will be addressed once the Centaur and Tron tables are ready for validation.

Testing

  • Unit tests: 27 pass. The catalog corpus test fails only on X-Men LE's GI on a solenoid, which predates this branch.
  • Whole catalog: converting all 793 published definitions before and after shows only the intended changes.
  • Terminator 2 in the editor: the game starts, all switches resolve, and the mech registers. The ROM is found through the new folder setup.

freezy added 8 commits August 13, 2026 22:47
VPE no longer depends on a Visual PinMAME installation. NVRAM, config and
high scores live in PinMAME's folder below VPE's data root, and ROMs are
searched in the host's ROM folder (GamelogicPaths.RomFolder). The editor
stores that folder per machine and falls back to VPM's ROM folder. A game's
NVRAM, high scores and config are copied from VPM the first time VPE runs it.

Needs PinMame 1.1.0 (SetPath/GetPath, FindVpmPath).
Runtime:
- One PinMAME output now drives every mapping row it resolves to, e.g. coil
  19 and the c_game_on alias. Before, the last row won and the others never
  fired. Several numeric spellings of one output ("1", "01") go out once.
- Mech switches that aren't PinMAME switches are skipped instead of aborting
  mech setup.
- Unresolved mapping IDs warn at runtime only, without suggesting a
  repopulate that would wipe the mappings.
- Fix legacy machine IDs for Flash Gordon and the Stern Star Trek, Tron and
  Walking Dead variants.
- The ROM check before start only warns, since PinMAME's audit reports
  clones with the parent's files as missing.

Catalog conversion:
- normally_closed is the physical contact, which PinMAME already inverts for
  optos. Only the coin door is normally closed for VPE now.
- Switches 111-114 follow PinMAME's numbering (odd EOS, even button), and
  win over matrix flipper switches, which PinMAME only mirrors.
- Keep virtual devices with a public role or virtual inputs, e.g. flipper
  buttons outside the matrix and synthetic flipper coils.
- Default to the parent ROM instead of the alphabetically first one.

Editor:
- Changing machine or ROM refreshes the hardware candidates instead of
  clearing them.
- Spatial assignment is disabled when the mappings belong to another
  machine, and no longer links a second device to hardware that already has
  one per position.
- Import VPM's NVRAM before Create Displays runs the ROM.
- The picker's None row no longer wins searches for other machines.
- The editor service records Undo and prefab overrides.
The editor's ROM folder is now GamelogicPaths.HostRomFolder, and a player
app's own folder only overrides it for its play session: the override is
cleared when the editor returns to edit mode, so editor actions like Create
Displays use the editor's folder again. Folder lists are normalized.
They provide the path API the data folder needs (SetPath/GetPath,
FindVpmPath) and keep a ROM folder override across PinmameSetConfig().
Validated against a table's actual mapping, about half of its lamps were
rejected and a few matched wrongly. Now:

- Items are paired with targets in order of increasing cost, so each item
  goes to the target that fits it best. A target whose item isn't on the
  table no longer takes a neighbour's item and pushes that one away.
- A match is only ambiguous when another item fits about as well and is
  free, or its owner could just as well swap. A row of inserts that's
  slightly offset now matches instead of being rejected as a whole.
- A match is only contested by a target that fits the item about as well,
  not by any target that merely wants it.
- Items at the same position, like the switches of a mech, are told apart
  by name.
- Devices whose positions the definition marks as conflicted, and cabinet
  inputs, get no playfield positions.
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The latest changes appear safe to merge, with all previous findings addressed.

Summary

The PR replaces compiled machine definitions with editor-loaded catalog data and keeps runtime tables on saved mappings.

  • The editor turns a selected machine definition into table hardware mappings.
  • Catalog positions can fill empty hardware links on the playfield.
  • Older table aliases still resolve, and unmapped mech switches are skipped.
  • PinMAME stores game state in VPE’s folder and uses configurable ROM folders.
  • CI builds the plugin and checks catalog conversions against a pinned corpus.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Catalog[Machine reference] --> Editor[Editor loads machine and ROM]
  Editor --> Candidates[Saved hardware choices]
  Editor --> Mappings[Table mappings]
  Undo[Undo or Redo] --> Reload[Reload restored selection]
  Reload --> Editor
  Mappings --> Player[Player runs selected ROM]
Loading

Reviews (2) · Last reviewed commit: "editor: Address review findings on the P..." · Reviewed by Greptile

Comment thread VisualPinball.Engine.PinMAME.Unity/Editor/PinMameGamelogicEngineInspector.cs Outdated
- Undo and redo reload the inspector's selection from the component, so it
  never keeps the other machine's definition. Spatial assignment also
  requires the loaded definition to be the component's machine.
- Loading the component's machine fills the hardware candidates when the
  component has none (older or unpacked tables), and Refresh updates them.
  The selection and the mappings stay as they are.
- A cabinet input that rests active (initial_active), like the coin door,
  is normally closed for VPE. One that nothing operates, like a playfield
  glass or memory-protect switch, becomes constant.
- Tests for the default ROM.
@freezy
freezy merged commit 1ca6f0b into master Oct 11, 2026
17 checks passed
@freezy
freezy deleted the feature/remote-game-definitions branch October 11, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant