mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
Merge pull request #40 from laqieer/fix/ups_cut_glitch
Fix: UPS patch's cut glitch
This commit is contained in:
commit
a45e635696
1 changed files with 12 additions and 3 deletions
|
@ -57,10 +57,19 @@ UPS.prototype.apply=function(romFile, validate){
|
||||||
throw new Error('error_crc_input');
|
throw new Error('error_crc_input');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fix the glitch that cut the end of the file if it's larger than the changed file patch was originally created with */
|
||||||
|
sizeOutput = this.sizeOutput
|
||||||
|
sizeInput = this.sizeInput
|
||||||
|
if(!validate && sizeInput < romFile.fileSize){
|
||||||
|
sizeInput = romFile.fileSize
|
||||||
|
if(sizeOutput < sizeInput){
|
||||||
|
sizeOutput = sizeInput
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* copy original file */
|
/* copy original file */
|
||||||
tempFile=new MarcFile(this.sizeOutput);
|
tempFile=new MarcFile(sizeOutput);
|
||||||
romFile.copyToFile(tempFile, 0, this.sizeInput);
|
romFile.copyToFile(tempFile, 0, sizeInput);
|
||||||
|
|
||||||
romFile.seek(0);
|
romFile.seek(0);
|
||||||
|
|
||||||
|
@ -201,4 +210,4 @@ function createUPSFromFiles(original, modified){
|
||||||
patch.checksumInput=crc32(original);
|
patch.checksumInput=crc32(original);
|
||||||
patch.checksumOutput=crc32(modified);
|
patch.checksumOutput=crc32(modified);
|
||||||
return patch
|
return patch
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue