Slot Configuration Persistence Fix for AmpleWin/Linux#52
Conversation
…on. Implements robust None-aware slot initialization.
|
Cross-posting for visibility. Apologies.
|
… to prevent MAME using defaults
|
No worries. PR updated! Thanks again.
|
Hi Kelvin (@ksherlock), hope you're doing well!
I'm the contributor working on the Windows/Linux ports of Ample. Recently, a community member (@xotmatrix) pointed out a critical bug in the slot configuration logic. I have implemented a comprehensive, two-fold fix that fully aligns with the high standards of your original macOS version.
The Issues & Fixes
1. UI Level: Slot Initialization Loop
"") for a slot with default equipment, any UI refresh or machine configuration change would revert it back to the default device.if not self.current_slots.get(slot_name):. Since an empty string""is falsy in Python, it incorrectly assumed the slot was unconfigured and force-filled the default device.initialize_default_slotsinAmpleWinandAmpleLinuxto use a key existence check instead:if slot_name not in self.current_slots:. This preserves explicit user selections (including empty strings for "None") while still auto-filling defaults for new card insertions.2. Emulator Level: Command-Line Argument Omission
mame_launcher.py(and also in the WASM loader forAmpleWeb), the argument builder was filtering out empty string values using a truthiness check (if option:/if (value)). As a result, the launcher completely omitted the slot from MAME's command line, letting MAME fall back to its internal hardware defaults.build_argsinAmpleWin/AmpleLinuxto checkif option is not None:, andbuildMameArgsinAmpleWebto checkif (value !== undefined && value !== null). This ensures that explicit empty string arguments (-[slot_name] "") are generated and passed to MAME, disabling/emptying the slot device in the running emulator.Testing Verified
—None—.—None—in the UI.-sl6 ""and launches successfully.