1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-06-27 16:25:54 +00:00

fix: fix the glitch that cut the end of the file if it's larger than the changed file patch was originally created with

This commit is contained in:
laqieer 2022-03-15 21:38:50 +08:00
parent 98aa4f3580
commit 367cdfe4fe

View file

@ -59,13 +59,17 @@ UPS.prototype.apply=function(romFile, validate){
/* 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
if(!validate && sizeOutput < this.sizeInput){
sizeOutput = this.sizeInput
sizeInput = this.sizeInput
if(!validate && sizeInput < romFile.fileSize){
sizeInput = romFile.fileSize
if(sizeOutput < sizeInput){
sizeOutput = sizeInput
}
}
/* copy original file */
tempFile=new MarcFile(sizeOutput);
romFile.copyToFile(tempFile, 0, this.sizeInput);
romFile.copyToFile(tempFile, 0, sizeInput);
romFile.seek(0);