mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
fixed an important bug while creating IPS patches in some cases
This commit is contained in:
parent
8d0b35d179
commit
e70052e963
3 changed files with 12 additions and 9 deletions
|
@ -12,7 +12,7 @@ limitations under the License.
|
|||
mod by marcrobledo, original from: https://github.com/GoogleChrome/samples/blob/gh-pages/service-worker/basic/service-worker.js
|
||||
*/
|
||||
|
||||
const PRECACHE_ID='v20180918';
|
||||
const PRECACHE_ID='v20180919';
|
||||
const PRECACHE_FILES=[
|
||||
'index.html','./',
|
||||
'RomPatcher.css',
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
<!-- FOOTER -->
|
||||
<footer>
|
||||
Rom Patcher JS <small>rev20180918</small> by <a href="/">Marc Robledo</a>
|
||||
Rom Patcher JS <small>rev20180919</small> by <a href="/">Marc Robledo</a>
|
||||
<br />
|
||||
<i class="icon github"></i> <a href="https://github.com/marcrobledo/RomPatcher.js/" target="_blank">See on GitHub</a>
|
||||
<i class="icon heart"></i> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a>
|
||||
|
|
15
ips.js
15
ips.js
|
@ -1,4 +1,4 @@
|
|||
/* IPS module for RomPatcher.js v20180428 - Marc Robledo 2016-2018 - http://www.marcrobledo.com/license */
|
||||
/* IPS module for RomPatcher.js v20180919 - Marc Robledo 2016-2018 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: http://www.smwiki.net/wiki/IPS_file_format */
|
||||
|
||||
var MAX_IPS_SIZE=16777216;
|
||||
|
@ -166,8 +166,9 @@ function createIPSFromFiles(original, modified){
|
|||
var length=1;
|
||||
|
||||
/* find difference in next 6 bytes (in order to save space) */
|
||||
/* force length to be 0xffff-6 bytes to keep IPS standard */
|
||||
var nearbyDifference=true;
|
||||
while(nearbyDifference){
|
||||
while(nearbyDifference && length<(0xffff-6)){
|
||||
if(seek+6>modified.fileSize){
|
||||
var finalSeek=modified.fileSize-seek-1;
|
||||
length+=finalSeek;
|
||||
|
@ -176,10 +177,7 @@ function createIPSFromFiles(original, modified){
|
|||
}
|
||||
|
||||
for(var i=6;i>0 && nearbyDifference;i--){
|
||||
var bc1=original.readByte(seek+i);
|
||||
var bc2=modified.readByte(seek+i);
|
||||
|
||||
if(bc1!=bc2){
|
||||
if(original.readByte(seek+i)!==modified.readByte(seek+i)){
|
||||
length+=i;
|
||||
seek+=i;
|
||||
break;
|
||||
|
@ -197,7 +195,12 @@ function createIPSFromFiles(original, modified){
|
|||
}
|
||||
|
||||
if(RLERecord){
|
||||
if(length<3){
|
||||
tempFile.addSimpleRecord(originalSeek, data);
|
||||
}else{
|
||||
tempFile.addRLERecord(originalSeek, length, data[0]);
|
||||
}
|
||||
//tempFile.addRLERecord(originalSeek, length, data[0]);
|
||||
}else{
|
||||
tempFile.addSimpleRecord(originalSeek, data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue