diff --git a/README.md b/README.md
index 2f9ef6a..8662896 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ A ROM patcher made in HTML5.
* Supported formats:
* IPS
* UPS
- * APS
+ * APS (N64/GBA)
* BPS
* RUP
* PPF
diff --git a/_cache_service_worker.js b/_cache_service_worker.js
index cf9e35c..7b26362 100644
--- a/_cache_service_worker.js
+++ b/_cache_service_worker.js
@@ -14,7 +14,7 @@
*/
var PRECACHE_ID='rom-patcher-js';
-var PRECACHE_VERSION='v27b';
+var PRECACHE_VERSION='v28';
var PRECACHE_URLS=[
'/RomPatcher.js/','/RomPatcher.js/index.html',
'/RomPatcher.js/manifest.json',
@@ -41,7 +41,8 @@ var PRECACHE_URLS=[
'/RomPatcher.js/js/zip.js/inflate.js',
'/RomPatcher.js/js/formats/ips.js',
'/RomPatcher.js/js/formats/ups.js',
- '/RomPatcher.js/js/formats/aps.js',
+ '/RomPatcher.js/js/formats/aps_n64.js',
+ '/RomPatcher.js/js/formats/aps_gba.js',
'/RomPatcher.js/js/formats/bps.js',
'/RomPatcher.js/js/formats/rup.js',
'/RomPatcher.js/js/formats/ppf.js',
diff --git a/index.html b/index.html
index a342ebe..a08b149 100644
--- a/index.html
+++ b/index.html
@@ -40,7 +40,8 @@
-
+
+
@@ -179,7 +180,7 @@
- Rom Patcher JS v2.7.1 by Marc Robledo
+ Rom Patcher JS v2.8 by Marc Robledo
See on GitHub
Donate
diff --git a/js/RomPatcher.js b/js/RomPatcher.js
index de5070c..66652a0 100644
--- a/js/RomPatcher.js
+++ b/js/RomPatcher.js
@@ -1,4 +1,4 @@
-/* Rom Patcher JS v20230202 - Marc Robledo 2016-2023 - http://www.marcrobledo.com/license */
+/* Rom Patcher JS v20230331 - Marc Robledo 2016-2023 - http://www.marcrobledo.com/license */
const TOO_BIG_ROM_SIZE=67108863;
const HEADERS_INFO=[
@@ -663,8 +663,10 @@ function _readPatchFile(){
patch=parseIPSFile(patchFile);
}else if(header.startsWith(UPS_MAGIC)){
patch=parseUPSFile(patchFile);
- }else if(header.startsWith(APS_MAGIC)){
+ }else if(header.startsWith(APS_N64_MAGIC)){
patch=parseAPSFile(patchFile);
+ }else if(header.startsWith(APS_GBA_MAGIC)){
+ patch=APSGBA.fromFile(patchFile);
}else if(header.startsWith(BPS_MAGIC)){
patch=parseBPSFile(patchFile);
}else if(header.startsWith(RUP_MAGIC)){
diff --git a/js/crc.js b/js/crc.js
index 4187570..4c8240d 100644
--- a/js/crc.js
+++ b/js/crc.js
@@ -108,126 +108,19 @@ function adler32(marcFile, offset, len){
-/* CRC16 */
-/*
-const CRC16_TABLE=(function(){
- var c,crcTable=[];
- for(var n=0;n<256;n++){
- c=n;
- for(var k=0;k<8;k++)
- c=((c&1)?(0x8408^(c>>>1)):(c>>>1));
- crcTable[n]=c;
+/* CRC16/CCITT-FALSE */
+function crc16(marcFile, offset, len){
+ var crc=0xffff;
+
+ offset=offset? offset : 0;
+ len=len && len>0? len : marcFile.fileSize;
+
+ for(var i=0; i>> 0 ? (crc << 1) ^ 0x1021 : crc << 1;
+ }
}
- return crcTable;
-}());
-function crc16(marcFile){
- var crc=0^(-1);
- for(var i=0;i>>8)&0x0ff)^CRC16_TABLE[(crc^marcFile._u8array[i])&0xff];
-
- return ((crc^(-1))>>>0) & 0xffff;
+ return crc & 0xffff;
}
-*/
-
-
-
-
-
-
-
-/* specific ROM checksums */
-/* this is unused code, might be used in a future so ROM checksums can be fixed after patching */
-const CONSOLES=[
- {
- title:'Sega Mega Drive/Genesis',
- MEGADRIVE_LOGO:[0x53, 0x45, 0x47, 0x41, 0x20, 0x4d, 0x45, 0x47, 0x41, 0x20, 0x44, 0x52],
- GENESIS_LOGO:[0x53, 0x45, 0x47, 0x41, 0x20, 0x47, 0x45, 0x4e, 0x45, 0x53, 0x49, 0x53],
- checkHeader:function(marcFile){
- var megadrive=true;
- var genesis=true;
- for(var i=0; i<12 && (megadrive || genesis); i++){
- if(marcFile._u8array[0x100+i]!==this.MEGADRIVE_LOGO[i])
- megadrive=false;
- if(marcFile._u8array[0x100+i]!==this.GENESIS_LOGO[i])
- genesis=false;
- }
- return megadrive || genesis;
- },
- getChecksum:function(marcFile){
- return (marcFile._u8array[0x018e]<<8) + marcFile._u8array[0x018f];
- },
- recalculateChecksum:function(marcFile){
- var checksum=0;
-
- for(var i=0x200; i>>0)) & 0xffff;
-
- return checksum
- },
- updateChecksum:function(marcFile, newChecksum){
- marcFile._u8array[0x18e]=newChecksum>>8;
- marcFile._u8array[0x18f]=newChecksum & 0xff;
- }
- },{
- title:'Game Boy',
- NINTENDO_LOGO:[0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d, 0x00, 0x0b, 0x03, 0x73, 0x00, 0x83, 0x00, 0x0c, 0x00, 0x0d],
- checkHeader:function(marcFile){
- for(var i=0; i>> 0) & 0xffff;
- for(i=0x0150;i>> 0) & 0xffff;
- if(globalChecksumOld!==globalChecksumNew){
- marcFile._u8array[0x014e]=globalChecksumNew>>8;
- marcFile._u8array[0x014f]=globalChecksumNew & 0xff;
- }
- }
- }
-];
-function checkConsole(marcFile){
- return false;
-}
-function fixConsoleChecksum(marcFile){
- var system=false;
- for(var i=0; i { // listen for messages from the main thread
patch=parseIPSFile(patchFile);
}else if(header.startsWith(UPS_MAGIC)){
patch=parseUPSFile(patchFile);
- }else if(header.startsWith(APS_MAGIC)){
+ }else if(header.startsWith(APS_N64_MAGIC)){
patch=parseAPSFile(patchFile);
+ }else if(header.startsWith(APS_GBA_MAGIC)){
+ patch=APSGBA.fromFile(patchFile);
}else if(header.startsWith(BPS_MAGIC)){
patch=parseBPSFile(patchFile);
}else if(header.startsWith(RUP_MAGIC)){
diff --git a/js/worker_create.js b/js/worker_create.js
index d023b70..2cbf47f 100644
--- a/js/worker_create.js
+++ b/js/worker_create.js
@@ -4,7 +4,7 @@ self.importScripts(
'./MarcFile.js',
'./crc.js',
'./formats/ips.js',
- './formats/aps.js',
+ './formats/aps_n64.js',
'./formats/ups.js',
'./formats/bps.js',
'./formats/ppf.js',