mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
show expected ROM source if patch can validate source, for issue #69
This commit is contained in:
parent
0992132c57
commit
c1293bb3ed
8 changed files with 91 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
/* BPS module for Rom Patcher JS v20180930 - Marc Robledo 2016-2018 - http://www.marcrobledo.com/license */
|
||||
/* BPS module for Rom Patcher JS v20240721 - Marc Robledo 2016-2024 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: https://www.romhacking.net/documents/746/ */
|
||||
|
||||
const BPS_MAGIC='BPS1';
|
||||
|
@ -25,6 +25,12 @@ BPS.prototype.toString=function(){
|
|||
return s
|
||||
}
|
||||
BPS.prototype.validateSource=function(romFile,headerSize){return this.sourceChecksum===crc32(romFile, headerSize)}
|
||||
BPS.prototype.getValidationInfo=function(){
|
||||
return [{
|
||||
'type':'CRC32',
|
||||
'value':padZeroes(this.sourceChecksum,4)
|
||||
}]
|
||||
}
|
||||
BPS.prototype.apply=function(romFile, validate){
|
||||
if(validate && !this.validateSource(romFile)){
|
||||
throw new Error('error_crc_input');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* PMSR (Paper Mario Star Rod) module for Rom Patcher JS v20200225 - Marc Robledo 2020 - http://www.marcrobledo.com/license */
|
||||
/* PMSR (Paper Mario Star Rod) module for Rom Patcher JS v20240721 - Marc Robledo 2020-2024 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: http://origami64.net/attachment.php?aid=790 (dead link) */
|
||||
|
||||
const PMSR_MAGIC='PMSR';
|
||||
|
@ -25,6 +25,12 @@ PMSR.prototype.toString=function(){
|
|||
PMSR.prototype.validateSource=function(romFile){
|
||||
return romFile.fileSize===PAPER_MARIO_USA10_FILE_SIZE && crc32(romFile)===PAPER_MARIO_USA10_CRC32;
|
||||
}
|
||||
PMSR.prototype.getValidationInfo=function(){
|
||||
return [{
|
||||
'type':'CRC32',
|
||||
'value':'a7f5cd7e'
|
||||
}]
|
||||
}
|
||||
PMSR.prototype.apply=function(romFile, validate){
|
||||
if(validate && !this.validateSource(romFile)){
|
||||
throw new Error('error_crc_input');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* RUP module for Rom Patcher JS v20180930 - Marc Robledo 2018 - http://www.marcrobledo.com/license */
|
||||
/* RUP module for Rom Patcher JS v20240721 - Marc Robledo 2018-2024 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: http://www.romhacking.net/documents/288/ */
|
||||
|
||||
const RUP_MAGIC='NINJA2';
|
||||
|
@ -54,6 +54,16 @@ RUP.prototype.validateSource=function(romFile,headerSize){
|
|||
}
|
||||
return false;
|
||||
}
|
||||
RUP.prototype.getValidationInfo=function(){
|
||||
var ret=[];
|
||||
for(var i=0; i<this.files.length; i++){
|
||||
ret.push({
|
||||
'type':'MD5',
|
||||
'value':this.files[i].sourceMD5
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
RUP.prototype.apply=function(romFile, validate){
|
||||
var validFile;
|
||||
if(validate){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* UPS module for Rom Patcher JS v20220315 - Marc Robledo 2017-2022 - http://www.marcrobledo.com/license */
|
||||
/* UPS module for Rom Patcher JS v20240721 - Marc Robledo 2017-2024 - http://www.marcrobledo.com/license */
|
||||
/* File format specification: http://www.romhacking.net/documents/392/ */
|
||||
|
||||
const UPS_MAGIC='UPS1';
|
||||
|
@ -52,6 +52,10 @@ UPS.prototype.export=function(fileName){
|
|||
return tempFile
|
||||
}
|
||||
UPS.prototype.validateSource=function(romFile,headerSize){return crc32(romFile,headerSize)===this.checksumInput}
|
||||
UPS.prototype.getValidationInfo=function(){return [{
|
||||
'type':'CRC32',
|
||||
'value':padZeroes(this.checksumInput,4)
|
||||
}];}
|
||||
UPS.prototype.apply=function(romFile, validate){
|
||||
if(validate && !this.validateSource(romFile)){
|
||||
throw new Error('error_crc_input');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue