// // ndsFS.js //-------------------- // Reads nds roms using nitroFS and provides access to files by directory structure. // by RHY3756547 // window.ndsFS = function(input) { this.load = load; this.getFile = getFile; this.list = list; var arc = this; var handlers = []; window.onmousemove = function(evt) { mouseX = evt.pageX; mouseY = evt.pageY; } this.scopeEval = function(code) {return eval(code)} //for debug purposes function load(buffer) { arc.buffer = buffer; //we will use this data in the future. var view = new DataView(buffer); arc.view = view; arc.sections = {}; arc.nameOff = view.getUint32(0x40, true); arc.fileOff = view.getUint32(0x48, true) arc.sections["BTNF"] = {}; handlers["BTNF"](view, arc.nameOff, arc.sections["BTNF"]) //file name table /*arc.sections["BTAF"] = {}; handlers["BTAF"](view, , arc.sections["BTAF"]) //file alloc table */ } function getFile(name) { var path = name.split("/"); var start = (path[0] == "")?1:0; //fix dirs relative to root (eg "/hi/test.bin") var table = arc.sections["BTNF"].directories; var curDir = table[0].entries; //root for (var i=start; i