1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-07-27 16:48:31 +00:00

adding command line support

This commit is contained in:
Jonathan Arndt 2023-06-29 11:29:54 -06:00
parent c87df560e9
commit faee7e6a43
18 changed files with 557 additions and 40 deletions

View file

@ -4,7 +4,9 @@
const APS_GBA_MAGIC='APS1';
const APS_GBA_BLOCK_SIZE=0x010000; //64Kb
const APS_GBA_RECORD_SIZE=4 + 2 + 2 + APS_GBA_BLOCK_SIZE;
if(typeof module !== "undefined" && module.exports){
module.exports = {APS_GBA_MAGIC, APSGBA};
}
function APSGBA(){
this.sourceSize=0;
this.targetSize=0;

View file

@ -5,7 +5,9 @@ const APS_N64_MAGIC='APS10';
const APS_RECORD_RLE=0x0000;
const APS_RECORD_SIMPLE=0x01;
const APS_N64_MODE=0x01;
if(typeof module !== "undefined" && module.exports){
module.exports = {APS_N64_MAGIC, parseAPSFile};
}
function APS(){
this.records=[];
this.headerType=0;

View file

@ -6,7 +6,9 @@ const BPS_ACTION_SOURCE_READ=0;
const BPS_ACTION_TARGET_READ=1;
const BPS_ACTION_SOURCE_COPY=2;
const BPS_ACTION_TARGET_COPY=3;
if(typeof module !== "undefined" && module.exports){
module.exports = {BPS_MAGIC, parseBPSFile};
}
function BPS(){
this.sourceSize=0;

View file

@ -1,13 +1,17 @@
/* IPS module for Rom Patcher JS v20220417 - Marc Robledo 2016-2022 - http://www.marcrobledo.com/license */
/* File format specification: http://www.smwiki.net/wiki/IPS_file_format */
const IPS_MAGIC='PATCH';
const IPS_MAX_SIZE=0x1000000; //16 megabytes
const IPS_RECORD_RLE=0x0000;
const IPS_RECORD_SIMPLE=0x01;
if(typeof module !== "undefined" && module.exports){
module.exports = {IPS_MAGIC, IPS_MAX_SIZE, IPS_RECORD_RLE, IPS_RECORD_SIMPLE, IPS, parseIPSFile};
}
function IPS(){
this.records=[];
this.truncate=false;

View file

@ -5,7 +5,9 @@ const PMSR_MAGIC='PMSR';
const YAY0_MAGIC='Yay0';
const PAPER_MARIO_USA10_CRC32=0xa7f5cd7e;
const PAPER_MARIO_USA10_FILE_SIZE=41943040;
if(typeof module !== "undefined" && module.exports){
module.exports = {PMSR_MAGIC, parseMODFile};
}
function PMSR(){
this.targetSize=0;

View file

@ -2,12 +2,14 @@
/* File format specification: https://www.romhacking.net/utilities/353/ */
const PPF_MAGIC='PPF';
const PPF_IMAGETYPE_BIN=0x00;
const PPF_IMAGETYPE_GI=0x01;
const PPF_BEGIN_FILE_ID_DIZ_MAGIC='@BEG';//@BEGIN_FILE_ID.DIZ
if(typeof module !== "undefined" && module.exports){
module.exports = {PPF_MAGIC, parsePPFFile};
}
function PPF(){
this.version=3;
this.imageType=PPF_IMAGETYPE_BIN;

View file

@ -6,7 +6,9 @@ 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'];
if(typeof module !== "undefined" && module.exports){
module.exports = {RUP_MAGIC, parseRUPFile};
}
function RUP(){
this.author='';

View file

@ -2,7 +2,9 @@
/* File format specification: http://www.romhacking.net/documents/392/ */
const UPS_MAGIC='UPS1';
if(typeof module !== "undefined" && module.exports){
module.exports = {UPS_MAGIC, UPS, parseUPSFile};
}
function UPS(){
this.records=[];
this.sizeInput=0;

View file

@ -6,7 +6,6 @@
some code and ideas borrowed from:
https://hack64.net/jscripts/libpatch.js?6
*/
//const VCDIFF_MAGIC=0xd6c3c400;
const VCDIFF_MAGIC='\xd6\xc3\xc4';
/*
@ -17,7 +16,10 @@ const XDELTA_100_MAGIC='%XDZ002';
const XDELTA_104_MAGIC='%XDZ003';
const XDELTA_110_MAGIC='%XDZ004';
*/
if(typeof module !== "undefined" && module.exports){
module.exports = {VCDIFF_MAGIC, parseVCDIFF};
MarcFile = require("../MarcFile").MarcFile;
}
function VCDIFF(patchFile){
this.file=patchFile;

View file

@ -2,6 +2,9 @@
const ZIP_MAGIC='\x50\x4b\x03\x04';
if(typeof module !== "undefined" && module.exports){
module.exports = {ZIP_MAGIC, ZIPManager};
}
var ZIPManager=(function(){
const FILTER_PATCHES=/\.(ips|ups|bps|aps|rup|ppf|mod|xdelta|vcdiff)$/i;
//const FILTER_ROMS=/(?<!\.(txt|diz|rtf|docx?|xlsx?|html?|pdf|jpe?g|gif|png|bmp|webp|zip|rar|7z))$/i; //negative lookbehind is not compatible with Safari https://stackoverflow.com/a/51568859