Skip to content

Add hotswappable CD-ROM mode with runtime disc switching#47

Merged
techomancer merged 3 commits into
techomancer:mainfrom
GenSayer:cd-hotswapping
Jun 26, 2026
Merged

Add hotswappable CD-ROM mode with runtime disc switching#47
techomancer merged 3 commits into
techomancer:mainfrom
GenSayer:cd-hotswapping

Conversation

@GenSayer

Copy link
Copy Markdown
Contributor

Introduces a hotswappable flag for CD-ROM devices that enables on-the-fly disc switching via keyboard shortcuts (RCtrl+F12 native, Ctrl+F12 GUI) without pre-configuring a changer queue or restarting the emulator.

New features:

  • hotswappable = true per-drive config (iris.toml + GUI checkbox)
  • Runtime disc loading via file picker (RCtrl+F12 / Ctrl+F12)
  • Empty tray on startup when path omitted (hotswappable only)
  • GUI config editor: browse button loads discs immediately
  • GUI: "Extra changer discs" hidden when hotswappable=true

Validation:

  • Errors when hotswappable=false + empty path (suggests enabling, cleaner error message than before)
  • Errors when hotswappable=true + discs list (mutually exclusive)
  • Ctrl+F12 disabled with helpful message when hotswappable=false

Console logging:

  • "CD-ROM hotswap: ejected '', tray empty" (hotswappable eject)
  • "CD-ROM changer: switched to ''" (legacy changer cycle)
  • "SCSI SGI_EJECT: tray emptied" (hotswappable SGI eject)

Config example:
[scsi.4] cdrom = true hotswappable = true # path optional — start with empty tray

Changes: 13 files, 699 lines

  • Core: config.rs, scsi.rs, wd33c93a.rs, machine.rs, main.rs, ui.rs
  • GUI: config_ui.rs, main.rs, handle.rs, scsi_menu.rs, dialogs/new_machine.rs
  • Docs: iris.toml
  • Build: Cargo.toml (added rfd for file picker)

GenSayer added 2 commits June 23, 2026 20:19
Introduces a `hotswappable` flag for CD-ROM devices that enables
on-the-fly disc switching via keyboard shortcuts (RCtrl+F12 native,
Ctrl+F12 GUI) without pre-configuring a changer queue or restarting
the emulator.

Fixes three bugs in legacy changer mode:
- load_disc() accumulated discs at index 0 instead of replacing
- eject through IRIX failed when hotswappable=true (len guard)

New features:
- hotswappable = true per-drive config (iris.toml + GUI checkbox)
- Runtime disc loading via file picker (RCtrl+F12 / Ctrl+F12)
- Empty tray on startup when path omitted (hotswappable only)
- GUI config editor: browse button loads discs immediately
- GUI: "Extra changer discs" hidden when hotswappable=true

Validation:
- Errors when hotswappable=false + empty path (suggests enabling, cleaner error message than before)
- Errors when hotswappable=true + discs list (mutually exclusive)
- Ctrl+F12 disabled with helpful message when hotswappable=false

Console logging:
- "CD-ROM hotswap: ejected '<path>', tray empty" (hotswappable eject)
- "CD-ROM changer: switched to '<path>'" (legacy changer cycle)
- "SCSI SGI_EJECT: tray emptied" (hotswappable SGI eject)

Config example:
  [scsi.4]
  cdrom = true
  hotswappable = true
  # path optional — start with empty tray

Changes: 13 files, 699 lines
- Core: config.rs, scsi.rs, wd33c93a.rs, machine.rs, main.rs, ui.rs
- GUI: config_ui.rs, main.rs, handle.rs, scsi_menu.rs, dialogs/new_machine.rs
- Docs: iris.toml
- Build: Cargo.toml (added rfd for file picker)
@techomancer

Copy link
Copy Markdown
Owner

lets skip this "hotswappable" flag
if it is cdrom with no file defined at start so be it.
then you can load an iso and it will be available
if there is only one iso and it is ejected then it becomes empty
but you can always queue more isos, so if there is more than one, it should cycle between them
i think this will most reasonable behavior

…omancer asked

Basically, if cdrom is not defined at start, then the cd drive starts empty. Then, you can load an iso and it will be available. If there is only one iso and it is ejected, then it becomes empty. But you can always queue more isos, so if there is more than one, it should cycle between them.
@GenSayer

Copy link
Copy Markdown
Contributor Author

CD swapping logic changed to the behavior you wanted. Is the code good enough to be merged now?

@techomancer

Copy link
Copy Markdown
Owner

i think it looks but lets squash it into single commit the churn doesnt bring any value to the history

@techomancer techomancer merged commit 02fd334 into techomancer:main Jun 26, 2026
1 check passed
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