win: Add helper methods for mounting images

This commit is contained in:
David Hrdlička
2020-04-26 14:19:58 +02:00
parent c728ece0ee
commit 6838117fdd
2 changed files with 56 additions and 0 deletions

View File

@@ -77,6 +77,20 @@ mo_eject(uint8_t id)
}
void
mo_mount(uint8_t id, wchar_t *fn, uint8_t wp)
{
mo_t *dev = (mo_t *) mo_drives[id].priv;
mo_disk_close(dev);
mo_drives[id].read_only = wp;
mo_load(dev, fn);
mo_insert(dev);
config_save();
}
void
mo_reload(uint8_t id)
{
@@ -116,6 +130,20 @@ zip_eject(uint8_t id)
}
void
zip_mount(uint8_t id, wchar_t *fn, uint8_t wp)
{
zip_t *dev = (zip_t *) zip_drives[id].priv;
zip_disk_close(dev);
zip_drives[id].read_only = wp;
zip_load(dev, fn);
zip_insert(dev);
config_save();
}
void
zip_reload(uint8_t id)
{

View File

@@ -262,4 +262,32 @@ media_menu_init()
/* Populate the Media and status bar menus. */
media_menu_reset();
}
static void
fdd_mount(uint8_t id, wchar_t *fn, uint8_t wp)
{
fdd_close(id);
ui_writeprot[id] = wp;
fdd_load(id, fn);
config_save();
}
static void
cdrom_mount(uint8_t id, wchar_t *fn)
{
cdrom[id].prev_host_drive = cdrom[id].host_drive;
wcscpy(cdrom[id].prev_image_path, cdrom[id].image_path);
if (cdrom[id].ops && cdrom[id].ops->exit)
cdrom[id].ops->exit(&(cdrom[id]));
cdrom[id].ops = NULL;
memset(cdrom[id].image_path, 0, sizeof(cdrom[id].image_path));
cdrom_image_open(&(cdrom[id]), fn);
/* Signal media change to the emulated machine. */
if (cdrom[id].insert)
cdrom[id].insert(cdrom[id].priv);
cdrom[id].host_drive = (wcslen(cdrom[id].image_path) == 0) ? 0 : 200;
config_save();
}