/* RUP module for Rom Patcher JS v20180930 - Marc Robledo 2018 - http://www.marcrobledo.com/license */ /* File format specification: http://www.romhacking.net/documents/288/ */ const RUP_MAGIC='NINJA2'; const RUP_COMMAND_END=0x00; const RUP_COMMAND_OPEN_NEW_FILE=0x01; const RUP_COMMAND_XOR_RECORD=0x02; const RUP_ROM_TYPES=['raw','nes','fds','snes','n64','gb','sms','mega','pce','lynx']; function RUP(){ this.author=''; this.version=''; this.title=''; this.genre=''; this.language=''; this.date=''; this.web=''; this.description=''; this.files=[]; } RUP.prototype.toString=function(){ var s='Author: '+this.author; s+='\nVersion: '+this.version; s+='\nTitle: '+this.title; s+='\nGenre: '+this.genre; s+='\nLanguage: '+this.language; s+='\nDate: '+this.date; s+='\nWeb: '+this.web; s+='\nDescription: '+this.description; for(var i=0; itarget) or 'A' (source>=8; } } function RUP_getVLVLen(data){ var ret=1; while(data){ ret++; data>>=8; } return ret; } RUP.prototype.export=function(fileName){ var patchFileSize=2048; for(var i=0; ifile.targetFileSize?'M':'A'); patchFile.writeVLV(file.overflowText.length); patchFile.writeString(file.overflowText); } for(var j=0; j