/* APS (N64) module for RomPatcher.js v20180428 - Marc Robledo 2017-2018 - http://www.marcrobledo.com/license */ /* File format specification: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64) */ var RECORD_RLE=0x0000; var RECORD_SIMPLE=1; var APS_MAGIC='APS10'; function APS(){ this.records=[]; this.headerType=0; this.encodingMethod=0; this.description='no description'; this.header={}; } APS.prototype.addRecord=function(o, d){ this.records.push({offset:o, type:RECORD_SIMPLE, data:d}) } APS.prototype.addRLERecord=function(o, l, b){ this.records.push({offset:o, type:RECORD_RLE, length:l, byte:b}) } APS.prototype.toString=function(){ nSimpleRecords=0; nRLERecords=0; for(var i=0; i=original.fileSize?0x00:original.readByte(seek); var b2=modified.readByte(seek); if(b1!==b2){ var RLERecord=true; var differentBytes=[]; var offset=seek; while(b1!==b2 && differentBytes.length<255){ differentBytes.push(b2); if(b2!==differentBytes[0]) RLERecord=false; seek++; if(seek===modified.fileSize) break; b1=seek>=original.fileSize?0x00:original.readByte(seek); b2=modified.readByte(seek); } if(RLERecord && differentBytes.length>2){ tempFile.addRLERecord(offset, differentBytes.length, differentBytes[0]); }else{ tempFile.addRecord(offset, differentBytes); } //seek++; }else{ seek++; } } return tempFile }