Permalink
Browse files

Allow downloading cdrom images, don't show button if disk image not a…

…vailable
  • Loading branch information...
1 parent 42d8c02 commit cb38b794317c3cc74eae7d840ce98ebe879cf254 @copy committed Jul 31, 2016
Showing with 16 additions and 11 deletions.
  1. +4 −3 debug.html
  2. +4 −3 index.html
  3. +8 −5 src/browser/main.js
View
@@ -134,9 +134,10 @@
<input type="button" value="Send Ctrl-Alt-Del" id="ctrlaltdel">
<input type="button" value="Send Alt-Tab" id="alttab">
<input type="button" value="Get floppy image" id="get_fda_image">
- <input type="button" value="Get floppy image" id="get_fdb_image">
- <input type="button" value="Get HDA image" id="get_hda_image">
- <input type="button" value="Get HDB image" id="get_hdb_image">
+ <input type="button" value="Get second floppy image" id="get_fdb_image">
+ <input type="button" value="Get hard disk image" id="get_hda_image">
+ <input type="button" value="Get second hard disk image" id="get_hdb_image">
+ <input type="button" value="Get cdrom image" id="get_cdrom_image">
<input type="button" value="Save State" id="save_state">
<input type="button" value="Load State" id="load_state"> <input type="file" style="display: none" id="load_state_input">
<input type="button" value="Memory Dump (raw)" id="memory_dump">
View
@@ -102,9 +102,10 @@
<input type="button" value="Send Ctrl-Alt-Del" id="ctrlaltdel">
<input type="button" value="Send Alt-Tab" id="alttab">
<input type="button" value="Get floppy image" id="get_fda_image">
- <input type="button" value="Get floppy image" id="get_fdb_image">
- <input type="button" value="Get HDA image" id="get_hda_image">
- <input type="button" value="Get HDB image" id="get_hdb_image">
+ <input type="button" value="Get second floppy image" id="get_fdb_image">
+ <input type="button" value="Get hard disk image" id="get_hda_image">
+ <input type="button" value="Get second hard disk image" id="get_hdb_image">
+ <input type="button" value="Get cdrom image" id="get_cdrom_image">
<input type="button" value="Save State" id="save_state">
<input type="button" value="Load State" id="load_state"> <input type="file" style="display: none" id="load_state_input">
<input type="button" value="Memory Dump" id="memory_dump">
View
@@ -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,19 +871,20 @@
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
{
buffer.get_buffer(function(b)
{
if(b)
{
- dump_file(b, "disk.img");
+ dump_file(b, filename);
}
else
{

0 comments on commit cb38b79

Please sign in to comment.