Files
izapple2/storage
Iván Izaguirre 11092ed1d8 Keep the disk images unmodified with a save directory
The emulation writes to a disk in the file it was loaded from, so saving a
game modifies the image the user has. With a save directory the changes go
to an overlay file there instead and the image is only ever read.

An overlay stores just the parts the software wrote, indexed by a bitmap in
its header: tracks of 4096 bytes for the diskettes, blocks of 512 for the
ProDOS devices. Nothing is written for the rest, so the file takes as much
space as what was saved and not the size of the disk, which matters for the
hard disks where an image can be 32Mb and a saved game a handful of blocks.
The header also holds a checksum of the image it was made from, so an
overlay is never applied to a different disk with the same name.

As the image is only read, this also makes writable the disks that could not
be written at all: the ones inside a zip or a gzip, the ones loaded from an
URL and the ones embedded in the executable.

The directory comes from the new -saveDir option. The cards that write to
their disks take a savedir parameter of their own that defaults to it, with
'none' to write back to the image.

Also fixes saveTrack leaking a file descriptor on every track written, and
going on to write through a nil file when it could not be opened.
2026-08-07 08:53:22 +02:00
..
2026-07-17 18:29:15 +02:00
2026-02-28 18:10:48 +01:00
2024-11-04 21:49:33 +01:00
2026-02-28 18:10:48 +01:00
2026-02-28 18:10:48 +01:00
2026-07-17 18:29:15 +02:00