Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to confirm image unplug #1219

Open
wilserv opened this issue Apr 29, 2023 · 12 comments
Open

Need to confirm image unplug #1219

wilserv opened this issue Apr 29, 2023 · 12 comments

Comments

@wilserv
Copy link

wilserv commented Apr 29, 2023

Please make it optional

@tomcw
Copy link
Contributor

tomcw commented Apr 29, 2023

Just to check what you are requesting...

I think you are saying that when you unplug a hard disk image from the Config UI, you get prompted with:

image

And you are asking for this be be optional, correct?

@wilserv
Copy link
Author

wilserv commented Apr 29, 2023 via email

@tomcw
Copy link
Contributor

tomcw commented Apr 29, 2023

Let me check that I understand what you are asking for...

So a (debugger) command to "disable hard disk 1 attached to slot 7" would:

  • unplug the hard drive from the HDD controller from the Apple II's point of view
  • "unlock" the disk image association with AppleWin, so that CiderPress can read/write to the disk image file
  • but AppleWin would still have the image associated with that drive (albeit "disabled")

Then later you could issue a command to "re-enable hard disk 1 attached to slot 7", which would:

  • re-connect the hard disk to the HDD controller (from the Apple II's POV)
  • "lock" the disk image association with AppleWin, so that CiderPress only has read-only access to the disk image file

Something like that?

And are you talking just about hard disk images? Or floppy images too?

@wilserv
Copy link
Author

wilserv commented Apr 29, 2023 via email

@sicklittlemonkey
Copy link
Contributor

Sounds like eject would be easier (with the warning disabled) and re-insert easier perhaps from the drive right-click menu.

@xotmatrix
Copy link

Sort of an ancillary request but being able to select recently mounted images from the HDD dropdown menu would be great for me.

@Michaelangel007
Copy link
Contributor

Michaelangel007 commented Apr 30, 2023

@tomcw We could have [x] Disable disk locking. The natural place would be to put this on the right-click disk pop-up menu as Nick suggests. (I had the same solution as well when I posted this in c.e.a2.)

Part of the problem is we don't have drive icons for hard drive images and perhaps we should. Having to constantly using the dialog box to juggle hard drive images makes the whole process far more clunky then it needs to be.

Adding hard drive icons means Which hotkeys does someone use to access them? since every function key is currently being used. (Ideally the user could "slide" the icons in the order THEY use them but we're far from that.)

Looking at WinFrame's WM_KEYUP I see Shift-F3 and Shift-F4 are available to access hard drives.

One way I see [x] Disable disk locking working could be:

  1. When a floppy/hard disk is mounted, keep the original filename
  2. If "Disable disk locking" is not set mount the original file, otherwise make a copy of the file to a temp file, mount the temp file
  3. Have a watchdog thread to see if the original file has been modified
  4. As long as there is currently no writing to the disk then automatically "virtually" re-mount the original file by doing steps 2 and 3 again.

Additionally, we could also display the last N floppy/hard disk file names in the pop-up menu so people could quickly re-mount previous disk images.

I envision the new pop-up looking like this

+----------------------------+
|   Eject                    |
| X Read / Write             |
|   Read only                |
|   Send to CiderPress       |
|   ---                      |
| X Disable disk locking     |
|   ---                      |
|   [Last used disk image 1] |
|   [Last used disk image 2] |
|   [Last used disk image 3] |
+----------------------------+

Edit: Add pop-up ASCII art.

@Michaelangel007
Copy link
Contributor

Michaelangel007 commented Apr 30, 2023

Tech info on a file watch dog "thread." There are various solutions:

@fadden
Copy link

fadden commented Apr 30, 2023

For the OP use case, where the user is switching between apps, it could also make sense to just close all disk image files when the emulator is paused, and reopen them when un-paused ("Pause for External I/O"). It might be prudent to disallow that if a disk is spinning or otherwise engaged in an I/O operation.

I'm a little nervous about allowing a file edit free-for-all because data can be cached on the CiderPress side, though that can be mitigated with the use of file change watchers. (Right now you can use File > Reopen, but that seems unreliable.) I just realized that you can have the same disk image open for writing in two instances of CiderPress. Not great. :-|

If we want to get carried away, we also have the option of coordinating the programs. CiderPress says "let me borrow that disk image for a bit", makes some changes, and then hands it back. The disk would be unavailable to the emulated system for the duration (transparently if the emulator is also paused). AppleWin would need to advertise a "disk image sharing service" that applications interested in making live updates could subscribe to.

@tomcw
Copy link
Contributor

tomcw commented Apr 30, 2023

it could also make sense to just close all disk image files when the emulator is paused...

Instead of pause, what if AppleWin had a power off/on for the virtual Apple II.
That way the user is making a decision to power off the (virtual) machine that's analogous to the real world, ie. my Apple II isn't doing any disk I/O, so it's okay to power it off.

EG:

  • On Apple II power off, then AppleWin closes all disk image file-handles.
  • CiderPress can then be used for writing to the disk image.
  • Then on Apple II power on, AppleWin re-opens those disk images.

@tomcw
Copy link
Contributor

tomcw commented Apr 30, 2023

NB. if a disk's file data were cached on the Apple II system (eg. by the OS or resident program), then a power off completely eradicates that as a problem.

@tomcw
Copy link
Contributor

tomcw commented May 1, 2024

My comment about "power-off -> CiderPress writes to image -> power-on" only relates to HD images (ie. for a real Apple II you'd power off to change HD). As for FD images, it's possible to eject / write (eg. SD card for FloppyEmu) / insert. And also you may want the Apple II machine state to remain as-is (so no power-off/on).

Of course you can already unplug-HD/eject-FD from AppleWin, but this is a longwinded process.

Really it's about reducing workflow friction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants