mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-11 10:30:09 +00:00
generically search for disk types
This commit is contained in:
parent
3af3834b8e
commit
5c7af60f16
@ -70,6 +70,11 @@
|
|||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
static disk_factory *disk_factories[] = {
|
||||||
|
disk_sparsebundle_factory,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
// File handles are pointers to these structures
|
// File handles are pointers to these structures
|
||||||
struct mac_file_handle {
|
struct mac_file_handle {
|
||||||
char *name; // Copy of device/file name
|
char *name; // Copy of device/file name
|
||||||
@ -619,16 +624,17 @@ void *Sys_open(const char *name, bool read_only)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME
|
for (disk_factory **f = disk_factories; *f; ++f) {
|
||||||
disk_generic *generic = disk_sparsebundle_factory(name, read_only);
|
disk_generic *generic = (*f)(name, read_only);
|
||||||
if (generic) {
|
if (generic) {
|
||||||
mac_file_handle *fh = open_filehandle(name);
|
mac_file_handle *fh = open_filehandle(name);
|
||||||
fh->generic_disk = generic;
|
fh->generic_disk = generic;
|
||||||
fh->file_size = generic->size();
|
fh->file_size = generic->size();
|
||||||
fh->read_only = generic->is_read_only();
|
fh->read_only = generic->is_read_only();
|
||||||
fh->is_media_present = true;
|
fh->is_media_present = true;
|
||||||
sys_add_mac_file_handle(fh);
|
sys_add_mac_file_handle(fh);
|
||||||
return fh;
|
return fh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int open_flags = (read_only ? O_RDONLY : O_RDWR);
|
int open_flags = (read_only ? O_RDONLY : O_RDWR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user