浏览代码

Can now export Name/Attribute table data. Fixed bug with loading project files. There is a bug with storing attribute data in project files (or in NESNameTable)

dev
Bryan Miller 5 年前
父节点
当前提交
88823a375c
共有 2 个文件被更改,包括 32 次插入5 次删除
  1. +28
    -1
      app/js/ctrls/CTRLIO.js
  2. +4
    -4
      views/header_menu.html

+ 28
- 1
app/js/ctrls/CTRLIO.js 查看文件

} }
} }


function HANDLE_ExportNameTableASM(e){
var nt = CTRLNameTablesStore.currentNametable;
if (nt !== null){
var basename = CTRLNameTablesStore.currentNTName.replace(/[^a-z0-9\-_.]/gi, '_');
var mode = document.querySelector('input[name="exportnt-op"]:checked').value;

var asm = "";
switch (mode){
case "both":
asm = nt.to_asm(basename + "_NT", basename + "_AT");
break;
case "nametable":
asm = nt.nametable_asm(basename + "_NT");
break;
case "attribtable":
asm = nt.attribtable_asm(basename + "_AT");
break;
}

if (asm !== ""){
var file = new Blob([asm], {type: "text/plain"});
RequestDownload(basename + ".asm", file);
}
}
}

function HANDLE_LoadProjectRequest(){ function HANDLE_LoadProjectRequest(){
var input = document.querySelectorAll("input.project-loader"); var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){ if (input.length > 0){
CTRLPalettesStore.obj = o.paletteStore; CTRLPalettesStore.obj = o.paletteStore;
CTRLBanksStore.obj = o.bankStore; CTRLBanksStore.obj = o.bankStore;
if ("nametableStore" in o) if ("nametableStore" in o)
CTRLNametablesStore.obj = o.nametableStore;
CTRLNameTablesStore.obj = o.nametableStore;
} }
if (this.parentNode.nodeName.toLowerCase() === "form"){ if (this.parentNode.nodeName.toLowerCase() === "form"){
this.parentNode.reset(); this.parentNode.reset();
GlobalEvents.listen("save-project", HANDLE_SaveProject); GlobalEvents.listen("save-project", HANDLE_SaveProject);
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest);
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM); GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM);
GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM);


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

+ 4
- 4
views/header_menu.html 查看文件

Project Project
</a> </a>
<ul class="pure-menu-children"> <ul class="pure-menu-children">
<li class="pure-menu-item" emit="load-project">
<form>
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input>
</form>
<form>
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input>
</form>
<li class="pure-menu-item" emit="load-project">
<a href="#" class="pure-menu-link"> <a href="#" class="pure-menu-link">
<i class="fa fa-folder-open"></i> <i class="fa fa-folder-open"></i>
Load Project Load Project

正在加载...
取消
保存