Fix allows slots with default values to be set to None#2
Conversation
|
Hi, xotmatrix Thank you for the PR! This is a great catch—you correctly identified the issue where slots with defaults were overriding user "None" selections. After reviewing the implementation, we realized that removing the call to initialize_default_slots entirely might break the automatic initialization of nested slots (e.g., automatically mounting a hard disk when a SCSI card is inserted). To address your discovery while preserving this automation, we implemented a more robust "None-aware" check: changing if not val: to if slot_name not in self.current_slots:. This respects a deliberate "None" choice while still ensuring newly added cards get their defaults. We've synced this fix across the Windows, Linux ports and credited your discovery in our project logs. Thanks again for your contribution! |
|
I think your 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 dissabled. 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 I think your PR needs more work. |
|
Hi @xotmatrix Thank you so much! You are 100% correct, and that's an extremely sharp observation. What was happening:The issue was that in The Fix:I have updated the codebase to address the second half of the problem:
I have pushed the updated commits to
|
|
This patch is simple and resolves the main issue. An ideal solution would explicitly disable only the slots that require it (4, 6, Auxiliary), but I don't see a simple way to do it. These slots can be identified in the XML plist, but that data is not present when the arguments are built. if slot['options'][0]['default'] == False:
# This is a slot that must be explicitly disabled on the command line |
This patch addresses a problem with setting certain slots to be empty.
Background:
Attempting to select "—None—" for a slot with a default device will immediately select the default device. I do not have a Mac to compare to, but according to my discussion with Kelvin Sherlock, the correct behavior is to explicitly set the slot to empty in the command line. For example, slot 6 defaults to
diskiingwhen no command line argument is given. To disable it, the empty string-sl6 ''is required. Ample does this, but AmpleWin does not.Cause:
This problem is caused by
initialize_default_slots()being called each time the UI selections change. That function will automatically set a slot to its default value because an empty slot is indistinguishable from an unset slot.Fix:
According to Kelvin, Ample does not initialize the system when the UI is changed. It simply updates the command line. The first part of this patch removes the reinitialization when the UI is refreshed. The second part sets the slot to a quoted, empty string whenever it has a default=False value in its XML, which I believe means the slot must be explicitly disabled in the command line.
Linux:
It looks like the same fix could be applied to the Linux port. I cannot build for Linux, so I left this alone. I think these are the equivalent lines.
ample/AmpleLinux/main.py
Line 1290 in d6ef2a9
ample/AmpleLinux/main.py
Line 1414 in d6ef2a9