Skip to content

Slot Configuration Persistence Fix for AmpleWin/Linux#52

Open
anomixer wants to merge 2 commits into
ksherlock:masterfrom
anomixer:master
Open

Slot Configuration Persistence Fix for AmpleWin/Linux#52
anomixer wants to merge 2 commits into
ksherlock:masterfrom
anomixer:master

Conversation

@anomixer
Copy link
Copy Markdown
Contributor

@anomixer anomixer commented May 11, 2026

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

  • Issue: When selecting "None" (empty string "") for a slot with default equipment, any UI refresh or machine configuration change would revert it back to the default device.
  • Root Cause: The initialization code used a truthiness check: 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.
  • Fix: Updated initialize_default_slots in AmpleWin and AmpleLinux to 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

  • Issue: Although "None" was preserved in the UI, when launching MAME, the default device (e.g. Disk II in slot 6) was still present.
  • Root Cause: In mame_launcher.py (and also in the WASM loader for AmpleWeb), 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.
  • Fix: Updated build_args in AmpleWin/AmpleLinux to check if option is not None:, and buildMameArgs in AmpleWeb to check if (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

  1. Selected a machine (e.g., Apple IIe / IIgs).
  2. Set a default slot (e.g., Slot 6) to —None—.
  3. Changed another setting (e.g., RAM size) -> Result: Slot correctly remains —None— in the UI.
  4. Clicked "Start" to launch MAME -> Result: Launcher prints command line with -sl6 "" and launches successfully.
  5. In MAME, pressed Tab -> Slot Devices -> Result: Slot 6 is completely Empty (Disk II interface is not loaded).
  6. Plugged in a new card -> Result: Its default sub-slot devices are still automatically initialized as intended.

…on. Implements robust None-aware slot initialization.
@xotmatrix
Copy link
Copy Markdown

xotmatrix commented May 18, 2026

Cross-posting for visibility. Apologies.

I think [anomixer's] patch only addresses half of the problem. While this patch allows one to set slot 6 to "None", when you start MAME, the Disk II interface will be present because it hasn't been explicitly disabled.

For slots that have a defined default device, they must be explicitly disabled on the command line. For instance, to empty slot 6, the command line must include -sl6 '' otherwise MAME will use the default value (diskiing Disk II interface).

@anomixer
Copy link
Copy Markdown
Contributor Author

No worries. PR updated! Thanks again.

Cross-posting for visibility. Apologies.

I think [anomixer's] patch only addresses half of the problem. While this patch allows one to set slot 6 to "None", when you start MAME, the Disk II interface will be present because it hasn't been explicitly disabled.
For slots that have a defined default device, they must be explicitly disabled on the command line. For instance, to empty slot 6, the command line must include -sl6 '' otherwise MAME will use the default value (diskiing Disk II interface).

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.

2 participants