mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
updated everything to match the new style and features
This commit is contained in:
parent
4d038e4ac6
commit
e807f5ede0
4 changed files with 92 additions and 56 deletions
File diff suppressed because one or more lines are too long
94
index.html
94
index.html
|
@ -1,85 +1,82 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html manifest="manifest.appcache">
|
<html manifest="manifest.appcache">
|
||||||
<head>
|
<head>
|
||||||
<title>ROMPatcher.js</title>
|
<title>RomPatcher.js</title>
|
||||||
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
|
||||||
<meta name="description" content="This small web app allows you to apply IPS/UPS patches to your ROM dump files."/>
|
<meta name="description" content="A web-based IPS/UPS ROM patcher."/>
|
||||||
<meta name="keywords" content="ips,ups,patcher,online,html5,rom,patch,hack,translation"/>
|
<meta name="keywords" content="ips,ups,patcher,online,html5,rom,patch,hack,translation"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||||
<link rel="shortcut icon" href="./RomPatcher.png"/>
|
<link rel="shortcut icon" href="./favicon.png"/>
|
||||||
<link type="text/css" rel="stylesheet" href="./RomPatcher.css" media="all"/>
|
<link type="text/css" rel="stylesheet" href="./RomPatcher.css" media="all"/>
|
||||||
<script type="text/javascript" src="./RomPatcher.js"></script>
|
<script type="text/javascript" src="./RomPatcher.js"></script>
|
||||||
<script type="text/javascript" src="./ips.js"></script>
|
<script type="text/javascript" src="./ips.js"></script>
|
||||||
<script type="text/javascript" src="./ups.js"></script>
|
<script type="text/javascript" src="./ups.js"></script>
|
||||||
|
<script type="text/javascript" src="./ByteFlipper.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<!-- HEADER -->
|
<!-- HEADER -->
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<h1>RomPatcher.js</h1>
|
<div id="header-top">
|
||||||
<h2>
|
<div class="row wrapper">
|
||||||
by <a href="/" class="author">Marc Robledo</a>
|
<h1 class="six columns text-left"><img src="logo.png" /><span class="hidden">RomPatcher.js</span></h1>
|
||||||
<a href="https://github.com/marcrobledo/RomPatcher.js/" target="_blank" class="button"><span class="sprite github"></span> See on GitHub</a>
|
<div class="six columns header-buttons text-right">
|
||||||
<a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow" class="donate button"><span class="sprite heart"></span> Donate</a>
|
by <a href="/">Marc Robledo</a>
|
||||||
</h2>
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- APP -->
|
||||||
|
<div class="wrapper" id="the-app">
|
||||||
<div id="cards">
|
<h3 class="red">Apply patch</h3>
|
||||||
<div class="card card-notice text-center">
|
<div class="container-description">Apply an IPS/UPS patch to your ROM</div>
|
||||||
This small web app allows you to apply a IPS/UPS patch to your favorite retro games.
|
<div class="container">
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card card-red">
|
|
||||||
<h3>Apply patch</h3>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="three columns"><label for="input-file-rom">ROM file:</label></div>
|
<div class="six columns text-right"><label for="input-file-rom">ROM file:</label></div>
|
||||||
<div class="nine columns">
|
<div class="six columns">
|
||||||
<input type="file" id="input-file-rom" />
|
<input type="file" id="input-file-rom" />
|
||||||
<textarea disabled id="rom-info" rows="3" style="width:100%"></textarea>
|
<div id="rom-info" class="mono" style="font-size:12px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="three columns"><label for="input-file-patch">Patch file (IPS/UPS):</label></div>
|
<div class="six columns text-right"><label for="input-file-patch">Patch file (IPS/UPS):</label></div>
|
||||||
<div class="nine columns">
|
<div class="six columns">
|
||||||
<input type="file" id="input-file-patch" />
|
<input type="file" id="input-file-patch" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button class="with-icon icon9" onclick="applyPatchFile(patch, romFile)">Apply patch</button>
|
<button class="with-icon icon9" onclick="applyPatchFile(patch, romFile)"><i class="icon check"></i> Apply patch</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 class="blue">Create patch</h3>
|
||||||
|
<div class="container-description">Create an IPS/UPS patch from two different ROMs </div>
|
||||||
<div class="card card-green">
|
<div class="container">
|
||||||
<h3>Create patch</h3>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="three columns"><label for="input-file-rom1">Original ROM:</label></div>
|
<div class="six columns text-right"><label for="input-file-rom1">Original ROM:</label></div>
|
||||||
<div class="six columns end">
|
<div class="six columns end">
|
||||||
<input type="file" id="input-file-rom1" />
|
<input type="file" id="input-file-rom1" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="three columns"><label for="input-file-rom2">Modified ROM:</label></div>
|
<div class="six columns text-right"><label for="input-file-rom2">Modified ROM:</label></div>
|
||||||
<div class="six columns end">
|
<div class="six columns end">
|
||||||
<input type="file" id="input-file-rom2" />
|
<input type="file" id="input-file-rom2" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="three columns">Patch type</div>
|
<div class="six columns text-right">Patch type</div>
|
||||||
<div class="six columns end">
|
<div class="six columns end">
|
||||||
<input type="radio" id="radio-ips" name="patch-type" checked /><label for="radio-ips">IPS</label>
|
<input type="radio" id="radio-ips" name="patch-type" checked /><label for="radio-ips">IPS</label>
|
||||||
<input type="radio" id="radio-ups" name="patch-type" /><label for="radio-ups">UPS</label>
|
<input type="radio" id="radio-ups" name="patch-type" /><label for="radio-ups">UPS</label>
|
||||||
|
@ -87,13 +84,32 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button class="with-icon icon9" onclick="createPatchFile()">Create patch</button>
|
<button class="with-icon icon9" onclick="createPatchFile()"><i class="icon settings"></i> Create patch</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 class="green">Byte flipper</h3>
|
||||||
|
<div class="container-description">This tool can flip bytes on a file in order to change its endianness</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="six columns text-right"><label for="input-file-flip">File</label></div>
|
||||||
|
<div class="six columns"><input type="file" id="input-file-flip" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="six columns text-right">Bytes to flip</div>
|
||||||
|
<div class="six columns">
|
||||||
|
<input type="radio" value="4" id="radio4" name="radio-bytes" checked /><label for="radio4">4 <small>(N64 ROMs and savegames)</small></label>
|
||||||
|
<input type="radio" value="8" id="radio8" name="radio-bytes" /><label for="radio8">8 <small>(old GBA flashcards)</small></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<button onclick="flipBytesInFile()" id="button-save"><i class="icon settings"></i> Flip bytes</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
7
ips.js
7
ips.js
|
@ -1,5 +1,6 @@
|
||||||
/* IPS module for RomPatcher.js v20170721 - Marc Robledo 2016-2017 - http://www.marcrobledo.com/license */
|
/* IPS module for RomPatcher.js v20170722 - Marc Robledo 2016-2017 - http://www.marcrobledo.com/license */
|
||||||
/* File format specification: http://www.smwiki.net/wiki/IPS_file_format */
|
/* File format specification: http://www.smwiki.net/wiki/IPS_file_format */
|
||||||
|
|
||||||
var MAX_IPS_SIZE=16777216;
|
var MAX_IPS_SIZE=16777216;
|
||||||
var RECORD_RLE=0x0000;
|
var RECORD_RLE=0x0000;
|
||||||
var RECORD_SIMPLE=1;
|
var RECORD_SIMPLE=1;
|
||||||
|
@ -79,12 +80,12 @@ IPS.prototype.apply=function(romFile){
|
||||||
var rec=this.records[i];
|
var rec=this.records[i];
|
||||||
if(rec.type===RECORD_RLE){
|
if(rec.type===RECORD_RLE){
|
||||||
if(rec.offset+rec.length>romFile.fileSize){
|
if(rec.offset+rec.length>romFile.fileSize){
|
||||||
alert('Invalid ROM file (too big?).');
|
MarcDialogs.alert('Invalid ROM file (too big?).');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(rec.offset+rec.data.length>romFile.fileSize){
|
if(rec.offset+rec.data.length>romFile.fileSize){
|
||||||
alert('Invalid ROM file (too big?).');
|
MarcDialogs.alert('Invalid ROM file (too big?).');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
9
ups.js
9
ups.js
|
@ -1,7 +1,8 @@
|
||||||
/* UPS module for RomPatcher.js v20170721 - Marc Robledo 2017 - http://www.marcrobledo.com/license */
|
/* UPS module for RomPatcher.js v20170721 - Marc Robledo 2017 - http://www.marcrobledo.com/license */
|
||||||
/* File format specification: http://www.romhacking.net/documents/392/ */
|
/* File format specification: http://www.romhacking.net/documents/392/ */
|
||||||
/* https://github.com/btimofeev/UniPatcher/blob/master/app/src/main/java/org/emunix/unipatcher/patcher/UPS.java */
|
|
||||||
var UPS_MAGIC='UPS1';
|
var UPS_MAGIC='UPS1';
|
||||||
|
|
||||||
function UPS(){
|
function UPS(){
|
||||||
this.records=[];
|
this.records=[];
|
||||||
this.sizeInput=0;
|
this.sizeInput=0;
|
||||||
|
@ -63,7 +64,7 @@ UPS.prototype.export=function(){
|
||||||
}
|
}
|
||||||
UPS.prototype.apply=function(romFile){
|
UPS.prototype.apply=function(romFile){
|
||||||
if(crc32(romFile)!==this.checksumInput){
|
if(crc32(romFile)!==this.checksumInput){
|
||||||
alert('Invalid input ROM.');
|
MarcDialogs.alert('Invalid input ROM');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ UPS.prototype.apply=function(romFile){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(crc32(tempFile)!==this.checksumOutput){
|
if(crc32(tempFile)!==this.checksumOutput){
|
||||||
alert('Invalid output ROM.');
|
MarcDialogs.alert('Invalid output ROM');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ function readUPSFile(file){
|
||||||
patchFile.checksumPatch=tempFile.readInt(seek+8);
|
patchFile.checksumPatch=tempFile.readInt(seek+8);
|
||||||
|
|
||||||
if(patchFile.checksumPatch!==crc32(file, true)){
|
if(patchFile.checksumPatch!==crc32(file, true)){
|
||||||
alert('Invalid patch checksum.');
|
MarcDialogs.alert('Invalid patch checksum');
|
||||||
}
|
}
|
||||||
return patchFile;
|
return patchFile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue