From 2a1a1c4d07cc5088f330d96e0385131d0751858b Mon Sep 17 00:00:00 2001 From: Marc Robledo Date: Sun, 23 Jul 2017 12:33:13 +0200 Subject: [PATCH] added APS support --- README.md | 6 +- RomPatcher.js | 16 +++- aps.js | 212 +++++++++++++++++++++++++++++++++++++++++++ index.html | 7 +- ips-patcher.appcache | 3 +- manifest.appcache | 3 +- 6 files changed, 239 insertions(+), 8 deletions(-) create mode 100644 aps.js diff --git a/README.md b/README.md index 4dd3499..5c1256e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # RomPatcher.js -An IPS/UPS ROM patcher made in HTML5. +A ROM patcher made in HTML5. **Features:** +* Supported formats: + * IPS + * UPS + * APS (N64) * can patch and create patches * compatible with IPS and UPS formats * shows ROM CRC32, MD5 and SHA-1 before patching diff --git a/RomPatcher.js b/RomPatcher.js index 1a5725f..b30d73e 100644 --- a/RomPatcher.js +++ b/RomPatcher.js @@ -52,8 +52,12 @@ function _readPatchFile(){ patch=readIPSFile(tempFile); }else if(tempFile.readString(0,4)===UPS_MAGIC){ patch=readUPSFile(tempFile); - }else{ - MarcDialogs.alert('Invalid IPS/UPS file'); + }else if(tempFile.readString(0,5)===APS_MAGIC){ + patch=readAPSFile(tempFile); + }/*else if(tempFile.readString(0,4)===APSGBA_MAGIC){ + patch=readAPSGBAFile(tempFile); + }*/else { + MarcDialogs.alert('Invalid IPS/UPS/APS file'); } } function openPatchFile(f){tempFile=new MarcBinFile(f, _readPatchFile)} @@ -70,7 +74,7 @@ function applyPatchFile(p,r){ function createPatchFile(){ - var MODES=['ips','ups']; + var MODES=['ips','ups','aps','apsn64'/*,'apsgba'*/]; var mode=0; for(var i=0; ioriginal.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 +} \ No newline at end of file diff --git a/index.html b/index.html index acafc27..b7c3399 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,7 @@ + @@ -45,7 +46,7 @@
-
+
@@ -59,7 +60,7 @@

Create patch

-
Create an IPS/UPS patch from two different ROMs
+
Create an IPS/UPS/APS patch from two different ROMs
@@ -80,6 +81,8 @@
+ +
diff --git a/ips-patcher.appcache b/ips-patcher.appcache index 634a356..be07f02 100644 --- a/ips-patcher.appcache +++ b/ips-patcher.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -#v20170722b +#v20170723 # WARNING: THIS FILE WILL BE DEPRECATED #CACHE: index.html @@ -9,6 +9,7 @@ favicon.png logo.png ips.js ups.js +aps.js ByteFlipper.js # force these files to be loaded in network diff --git a/manifest.appcache b/manifest.appcache index b935861..70d9fe7 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -#v20170722b +#v2017073 #CACHE: index.html RomPatcher.css @@ -8,6 +8,7 @@ favicon.png logo.png ips.js ups.js +aps.js ByteFlipper.js # force these files to be loaded in network