浏览代码

CTRLIO added functionality for exporting palette as 6502 assembly text.

dev
Bryan Miller 5 年前
父节点
当前提交
aead6b8485
共有 1 个文件被更改,包括 12 次插入10 次删除
  1. +12
    -10
      app/js/ctrls/CTRLIO.js

+ 12
- 10
app/js/ctrls/CTRLIO.js 查看文件

@@ -96,16 +96,7 @@ function HANDLE_FileDrop(e){
function HANDLE_SaveProject(e){
//var a = document.createElement("a");
var file = new Blob([JSONFromProject()], {type: "text/plain"});
RequestDownload("nesproject.json", file);
/*a.href = window.URL.createObjectURL(file);
a.download = "nesproject.json";
var body = document.querySelector("body");
body.appendChild(a);
a.click();
setTimeout(function(){ // fixes firefox html removal bug
window.URL.revokeObjectURL(url);
a.remove();
}, 500);*/
RequestDownload("nesproject.json", file);
}


@@ -132,6 +123,16 @@ function HANDLE_ExportCHR(e){
GlobalEvents.emit("modal-close");
}

function HANDLE_ExportPalASM(e){
var pal = CTRLPalettesStore.currentPalette;
var palname = CTRLPalettesStore.currentPaletteName.replace(/[^a-z0-9\-_.]/gi, '_');
if (pal !== null && palname !== ""){
var asmtxt = pal.to_asm(palname);
var file = new Blob([asmtxt], {type: "text/plain"});
RequestDownload(palname + ".asm", file);
}
}

function HANDLE_LoadProjectRequest(){
var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){
@@ -180,6 +181,7 @@ class CTRLIO{
GlobalEvents.listen("change_surface", HANDLE_SurfChange);
GlobalEvents.listen("save-project", HANDLE_SaveProject);
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest);
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM);

var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){

正在加载...
取消
保存