mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-04-05 11:38:54 +00:00
download ROM image
This commit is contained in:
parent
52b58f471c
commit
e68c901c3f
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
||||
[submodule "tss"]
|
||||
path = tss
|
||||
url = ./tss
|
||||
[submodule "FileSaver.js"]
|
||||
path = FileSaver.js
|
||||
url = ./FileSaver.js
|
||||
|
1
FileSaver.js
Submodule
1
FileSaver.js
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit aa9f4e0e03bd1892482ff5e24ca91d42312dbf18
|
@ -186,6 +186,7 @@ canvas.pixelated {
|
||||
<li><a class="dropdown-item" href="#" id="item_new_file">New File...</a></li>
|
||||
<li><a class="dropdown-item" href="#" id="item_share_file">Share File as GitHub Gist...</a></li>
|
||||
<li><a class="dropdown-item" href="#" id="item_reset_file">Revert to Original...</a></li>
|
||||
<li><a class="dropdown-item" href="#" id="item_download_rom">Download ROM Image...</a></li>
|
||||
<!--
|
||||
<li class="dropdown dropdown-submenu">
|
||||
<a tabindex="-1" href="#">Platform</a>
|
||||
@ -283,7 +284,9 @@ canvas.pixelated {
|
||||
<script src="local/williams/defender.js"></script>
|
||||
<script src="local/williams/robotron.js"></script>
|
||||
|
||||
<script src="FileSaver.js/FileSaver.min.js"></script>
|
||||
<script src="octokat.js/dist/octokat.js"></script>
|
||||
|
||||
<script src="src/emu.js"></script>
|
||||
<script src="src/util.js"></script>
|
||||
<script src="src/disasm.js"></script>
|
||||
|
18
src/ui.js
18
src/ui.js
@ -241,6 +241,11 @@ function _createNewFile(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function getCurrentFilename() {
|
||||
var toks = current_preset_id.split("/");
|
||||
return toks[toks.length-1];
|
||||
}
|
||||
|
||||
function _shareFile(e) {
|
||||
if (current_output == null) {
|
||||
alert("Please fix errors before sharing.");
|
||||
@ -249,8 +254,7 @@ function _shareFile(e) {
|
||||
var github = new Octokat();
|
||||
var files = {};
|
||||
var text = editor.getValue();
|
||||
var toks = current_preset_id.split("/");
|
||||
files[toks[toks.length-1]] = {"content": text};
|
||||
files[getCurrentFilename()] = {"content": text};
|
||||
var gistdata = {
|
||||
"description": '8bitworkshop.com {"platform":"' + platform_id + '"}',
|
||||
"public": true,
|
||||
@ -275,6 +279,15 @@ function _resetPreset(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function _downloadROMImage(e) {
|
||||
if (current_output == null) {
|
||||
alert("Please fix errors before downloading ROM.");
|
||||
return true;
|
||||
}
|
||||
var blob = new Blob([current_output], {type: "application/octet-stream"});
|
||||
saveAs(blob, getCurrentFilename()+".rom");
|
||||
}
|
||||
|
||||
function populateExamples(sel) {
|
||||
sel.append($("<option />").text("--------- Chapters ---------").attr('disabled',true));
|
||||
for (var i=0; i<PRESETS.length; i++) {
|
||||
@ -837,6 +850,7 @@ function setupDebugControls(){
|
||||
$("#item_share_file").click(_shareFile);
|
||||
$("#item_reset_file").click(_resetPreset);
|
||||
$("#item_debug_expr").click(_breakExpression);
|
||||
$("#item_download_rom").click(_downloadROMImage);
|
||||
}
|
||||
|
||||
function showWelcomeMessage() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user