From cb38b794317c3cc74eae7d840ce98ebe879cf254 Mon Sep 17 00:00:00 2001 From: copy Date: Sun, 31 Jul 2016 16:15:03 +0200 Subject: [PATCH] Allow downloading cdrom images, don't show button if disk image not available --- debug.html | 7 ++++--- index.html | 7 ++++--- src/browser/main.js | 13 ++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/debug.html b/debug.html index c5cb5a18bb..ca837e7635 100644 --- a/debug.html +++ b/debug.html @@ -134,9 +134,10 @@

Debugger

- - - + + + + diff --git a/index.html b/index.html index 31e30a6ece..f3ab96116d 100644 --- a/index.html +++ b/index.html @@ -102,9 +102,10 @@

Setup

- - - + + + + diff --git a/src/browser/main.js b/src/browser/main.js index aeb42796b1..dda62c83cd 100644 --- a/src/browser/main.js +++ b/src/browser/main.js @@ -433,6 +433,8 @@ settings.memory_size = infos.memory_size; settings.vga_memory_size = infos.vga_memory_size; + settings.id = infos.id; + if(infos.boot_order !== undefined) { settings.boot_order = infos.boot_order; @@ -850,17 +852,17 @@ $("reset").blur(); }; - // writable image types add_image_download_button(settings.hda, "hda"); add_image_download_button(settings.hdb, "hdb"); add_image_download_button(settings.fda, "fda"); add_image_download_button(settings.fdb, "fdb"); + add_image_download_button(settings.cdrom, "cdrom"); function add_image_download_button(obj, type) { var elem = $("get_" + type + "_image"); - if(!obj) + if(!obj || obj.size > 100 * 1024 * 1024) { elem.style.display = "none"; return; @@ -869,11 +871,12 @@ elem.onclick = function(e) { let buffer = emulator.disk_images[type]; + let filename = settings.id + (type === "cdrom" ? ".iso" : ".img"); if(buffer.get_as_file) { - var file = buffer.get_as_file("disk.img"); - download(file, "disk.img"); + var file = buffer.get_as_file(filename); + download(file, filename); } else { @@ -881,7 +884,7 @@ { if(b) { - dump_file(b, "disk.img"); + dump_file(b, filename); } else {