Skip to content

Commit

Permalink
Allow downloading cdrom images, don't show button if disk image not a…
Browse files Browse the repository at this point in the history
…vailable
  • Loading branch information
copy committed Jul 31, 2016
1 parent 42d8c02 commit cb38b79
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
7 changes: 4 additions & 3 deletions debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ <h4>Debugger</h4>
<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">
Expand Down
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ <h4>Setup</h4>
<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">
Expand Down
13 changes: 8 additions & 5 deletions src/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
{
Expand Down

0 comments on commit cb38b79

Please sign in to comment.