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

@@ -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();
}