// // ingameRes.js //-------------------- // Provides access to general ingame resources. // by RHY3756547 // window.GraphicTester = function(rom) { findGraphicsRecursive(rom); function listRecursive(resource, path) { path = path || ""; var files = resource.list(); for (var i=0; i x.toLowerCase().endsWith(".nclr")); var graphics = files.filter(x => x.toLowerCase().endsWith(".ncgr")); for (var i=0; i !x.endsWith(".nce.ncgr")), "b"); if (palFile != null && grFile != null) { var scr = new nscr(resource.getFile(file)); var pal = new nclr(resource.getFile(palFile)); var graphic = new ncgr(resource.getFile(grFile)); var flattener = new TileFlattener(pal, graphic, scr); var render = flattener.toCanvas(true, 0, 0); var split = document.createElement("h3"); split.innerText = path + file; document.body.appendChild(split); split = document.createElement("h4"); split.innerText = path + palFile + " " + path + grFile; document.body.appendChild(split); document.body.appendChild(render); } } if (file.toLowerCase().endsWith(".ncer")) { //cell resource //try to find a pal //...not a friend, like a color palette var palFile = mostSimilarString(file, pals, "o"); var grFile = mostSimilarString(file, graphics, "o"); if (palFile != null && grFile != null) { var cer = new ncer(resource.getFile(file)); var pal = new nclr(resource.getFile(palFile)); var graphic = new ncgr(resource.getFile(grFile)); var flattener = new TileFlattener(pal, graphic, cer); var split = document.createElement("h3"); split.innerText = path + file; document.body.appendChild(split); split = document.createElement("h4"); split.innerText = path + palFile + " " + path + grFile; document.body.appendChild(split); //render all images var imageCount = cer.cebk.imageCount; for (var j=0; j bestScore) { bestScore = score; bestString = list[i]; } } return bestString; } function countStr(text, char) { var count = 0; for (var i=0; i