mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
GUI redesign among other fixes
This commit is contained in:
parent
eb40a592b5
commit
a56fa9d4e8
13 changed files with 251 additions and 314 deletions
9
ups.js
9
ups.js
|
@ -1,4 +1,4 @@
|
|||
/* UPS module for RomPatcher.js v20180427 - Marc Robledo 2017-2018 - http://www.marcrobledo.com/license */
|
||||
/* UPS module for RomPatcher.js v20180428 - Marc Robledo 2017-2018 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: http://www.romhacking.net/documents/392/ */
|
||||
|
||||
var UPS_MAGIC='UPS1';
|
||||
|
@ -21,7 +21,7 @@ UPS.prototype.toString=function(){
|
|||
s+='\nOutput file checksum: '+this.checksumOutput;
|
||||
return s
|
||||
}
|
||||
UPS.prototype.export=function(){
|
||||
UPS.prototype.export=function(fileName){
|
||||
var encodedSizeInput=encodeVLV(this.sizeInput);
|
||||
var encodedSizeOutput=encodeVLV(this.sizeOutput);
|
||||
var encodedRecords=[];
|
||||
|
@ -38,7 +38,7 @@ UPS.prototype.export=function(){
|
|||
|
||||
tempFile=new MarcBinFile(binFileSize);
|
||||
tempFile.littleEndian=false;
|
||||
tempFile.fileName='patch.ups';
|
||||
tempFile.fileName=fileName+'.ups';
|
||||
tempFile.writeString(0, UPS_MAGIC, UPS_MAGIC.length);
|
||||
|
||||
tempFile.writeBytes(4, encodedSizeInput);
|
||||
|
@ -60,8 +60,9 @@ UPS.prototype.export=function(){
|
|||
|
||||
return tempFile
|
||||
}
|
||||
UPS.prototype.validateSource=function(romFile){return crc32(romFile)===this.checksumInput}
|
||||
UPS.prototype.apply=function(romFile){
|
||||
if(crc32(romFile)!==this.checksumInput){
|
||||
if(!this.validateSource(romFile)){
|
||||
MarcDialogs.alert('Error: invalid input ROM checksum');
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue