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

fixed a potential bug while creating patches in some specific scenarios

This commit is contained in:
Marc Robledo 2018-04-27 21:06:44 +02:00
parent 5ea4024aaf
commit eb40a592b5
6 changed files with 37 additions and 31 deletions

8
aps.js
View file

@ -1,4 +1,4 @@
/* APS (N64) module for RomPatcher.js v20171112 - Marc Robledo 2017 - http://www.marcrobledo.com/license */
/* APS (N64) module for RomPatcher.js v20180427 - Marc Robledo 2017-2018 - http://www.marcrobledo.com/license */
/* File format specification: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64) */
var RECORD_RLE=0x0000;
@ -181,7 +181,7 @@ function createAPSFromFiles(original, modified, N64header){
var seek=0;
while(seek<modified.fileSize){
var b1=original.readByte(seek);
var b1=seek>=original.fileSize?0x00:original.readByte(seek);
var b2=modified.readByte(seek);
if(b1!==b2){
@ -194,7 +194,9 @@ function createAPSFromFiles(original, modified, N64header){
if(b2!==differentBytes[0])
RLERecord=false;
seek++;
b1=seek>original.fileSize?0x00:original.readByte(seek);
if(seek===modified.fileSize)
break;
b1=seek>=original.fileSize?0x00:original.readByte(seek);
b2=modified.readByte(seek);
}