mirror of
https://github.com/mon/BemaniPatcher.git
synced 2026-04-24 23:08:05 -05:00
Jubeat prop support, multi-DLL support, remove globals, dynamic UI creation, fix SDVX score
This commit is contained in:
parent
6fb581f44b
commit
2c5a91dcea
|
|
@ -10,7 +10,7 @@
|
|||
<script type="text/javascript" src="js/dllpatcher.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
DllPatcher("bm2dx", [
|
||||
new DllPatcher("bm2dx", [
|
||||
{
|
||||
name : "Timer Freeze",
|
||||
shortname : "freeze",
|
||||
|
|
@ -78,11 +78,5 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>IIDX Copula DLL Modder</h1>
|
||||
<input class="fileInput" type="file" name="files[]" id="file" />
|
||||
<label for="file"><strong>Choose a file</strong> or drag and drop.</label>
|
||||
<div id="success"></div>
|
||||
<div id="error"></div>
|
||||
<div id="patches"></div>
|
||||
<button id="save" onclick="saveDll();">Save DLL</button>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,18 +2,30 @@
|
|||
display: none
|
||||
}
|
||||
|
||||
#error {
|
||||
.fileLabel {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#success {
|
||||
.success {
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
#success.hidden {
|
||||
.success.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.patchContainer {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.dragover {
|
||||
background-color: rgb(200,200,200);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 40px auto;
|
||||
max-width: 650px;
|
||||
|
|
|
|||
158
js/dllpatcher.js
158
js/dllpatcher.js
|
|
@ -1,12 +1,10 @@
|
|||
dllFile = null;
|
||||
mods = null;
|
||||
filename = null;
|
||||
errorLog = "";
|
||||
(function(window, document) {
|
||||
"use strict";
|
||||
|
||||
// Each unique kind of patch should have createUI, validatePatch, applyPatch,
|
||||
// updateUI
|
||||
|
||||
StandardPatch = function(options) {
|
||||
var StandardPatch = function(options) {
|
||||
this.name = options.name;
|
||||
this.shortname = options.shortname;
|
||||
this.patches = options.patches;
|
||||
|
|
@ -37,7 +35,7 @@ StandardPatch.prototype.validatePatch = function(file) {
|
|||
};
|
||||
|
||||
StandardPatch.prototype.applyPatch = function(file) {
|
||||
id = this.shortname;
|
||||
var id = this.shortname;
|
||||
var enabled = document.getElementById(id).checked;
|
||||
this.replaceAll(file, enabled);
|
||||
return enabled ? this.shortname : "";
|
||||
|
|
@ -77,7 +75,7 @@ StandardPatch.prototype.checkPatchBytes = function(file) {
|
|||
// updateUI
|
||||
|
||||
// The DEFAULT state is always the 1st element in the patches array
|
||||
UnionPatch = function(options) {
|
||||
var UnionPatch = function(options) {
|
||||
this.name = options.name;
|
||||
this.shortname = options.shortname;
|
||||
this.offset = options.offset;
|
||||
|
|
@ -133,84 +131,135 @@ UnionPatch.prototype.getSelected = function() {
|
|||
return null;
|
||||
}
|
||||
|
||||
DllPatcher = function(fname, args) {
|
||||
mods = [];
|
||||
var DllPatcher = function(fname, args) {
|
||||
this.mods = [];
|
||||
for(var i = 0; i < args.length; i++) {
|
||||
mod = args[i];
|
||||
var mod = args[i];
|
||||
if(mod.type) {
|
||||
if(mod.type == "union") {
|
||||
mods.push(new UnionPatch(mod));
|
||||
this.mods.push(new UnionPatch(mod));
|
||||
}
|
||||
} else { // standard patch
|
||||
mods.push(new StandardPatch(mod));
|
||||
this.mods.push(new StandardPatch(mod));
|
||||
}
|
||||
}
|
||||
filename = fname;
|
||||
loadPatchUI();
|
||||
this.filename = fname;
|
||||
this.createUI();
|
||||
this.loadPatchUI();
|
||||
};
|
||||
|
||||
loadFile = function(file) {
|
||||
var reader = new FileReader();
|
||||
DllPatcher.prototype.createUI = function() {
|
||||
var self = this;
|
||||
var container = $("<div>", {"class": "patchContainer"});
|
||||
container.html('<h3>' + this.filename + '.dll</h3>');
|
||||
|
||||
container.on('drag dragstart dragend dragover dragenter dragleave drop', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
})
|
||||
.on('drop', function(e) {
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(files && files.length > 0)
|
||||
self.loadFile(files[0]);
|
||||
})
|
||||
.on('dragover dragenter', function() {
|
||||
container.addClass('dragover');
|
||||
})
|
||||
.on('dragleave dragend drop', function() {
|
||||
container.removeClass('dragover');
|
||||
});
|
||||
|
||||
this.fileInput = $("<input>",
|
||||
{"class": "fileInput",
|
||||
"id" : this.filename + '-file',
|
||||
"type" : 'file'});
|
||||
var label = $("<label>", {"class": "fileLabel", "for": this.filename + '-file'});
|
||||
label.html('<strong>Choose a file</strong> or drag and drop.');
|
||||
|
||||
this.fileInput.on('change', function(e) {
|
||||
if(this.files && this.files.length > 0)
|
||||
self.loadFile(this.files[0]);
|
||||
});
|
||||
|
||||
this.successDiv = $("<div>", {"class": "success"});
|
||||
this.errorDiv = $("<div>", {"class": "error"});
|
||||
this.patchDiv = $("<div>", {"class": "patches"});
|
||||
|
||||
var saveButton = $("<button>");
|
||||
saveButton.text('Save DLL');
|
||||
saveButton.on('click', this.saveDll.bind(this));
|
||||
|
||||
container.append(this.fileInput);
|
||||
container.append(label);
|
||||
container.append(this.successDiv);
|
||||
container.append(this.errorDiv);
|
||||
container.append(this.patchDiv);
|
||||
container.append(saveButton);
|
||||
$('body').append(container);
|
||||
}
|
||||
|
||||
DllPatcher.prototype.loadFile = function(file) {
|
||||
var reader = new FileReader();
|
||||
var self = this;
|
||||
|
||||
reader.onload = function(e) {
|
||||
dllFile = new Uint8Array(e.target.result);
|
||||
if(validatePatches()) {
|
||||
$("#success").removeClass("hidden");
|
||||
$("#success").html("DLL loaded successfully!");
|
||||
self.dllFile = new Uint8Array(e.target.result);
|
||||
if(self.validatePatches()) {
|
||||
self.successDiv.removeClass("hidden");
|
||||
self.successDiv.html("DLL loaded successfully!");
|
||||
} else {
|
||||
$("#success").addClass("hidden");
|
||||
self.successDiv.addClass("hidden");
|
||||
}
|
||||
$('#error').html(errorLog);
|
||||
updatePatchUI();
|
||||
self.errorDiv.html(self.errorLog);
|
||||
self.updatePatchUI();
|
||||
};
|
||||
|
||||
reader.readAsArrayBuffer(file);
|
||||
};
|
||||
|
||||
saveDll = function() {
|
||||
if(!dllFile || !mods || !filename)
|
||||
DllPatcher.prototype.saveDll = function() {
|
||||
if(!this.dllFile || !this.mods || !this.filename)
|
||||
return;
|
||||
var fname = filename;
|
||||
var fname = this.filename;
|
||||
|
||||
for(var i = 0; i < mods.length; i++) {
|
||||
var enabledStr = mods[i].applyPatch(dllFile);
|
||||
for(var i = 0; i < this.mods.length; i++) {
|
||||
var enabledStr = this.mods[i].applyPatch(this.dllFile);
|
||||
if(enabledStr) {
|
||||
fname += '-' + enabledStr;
|
||||
}
|
||||
}
|
||||
fname += '.dll';
|
||||
|
||||
var blob = new Blob([dllFile], {type: "application/octet-stream"});
|
||||
var blob = new Blob([this.dllFile], {type: "application/octet-stream"});
|
||||
saveAs(blob, fname);
|
||||
}
|
||||
|
||||
loadPatchUI = function() {
|
||||
var patchDiv = $('#patches');
|
||||
for(var i = 0; i < mods.length; i++) {
|
||||
mods[i].createUI(patchDiv);
|
||||
DllPatcher.prototype.loadPatchUI = function() {
|
||||
for(var i = 0; i < this.mods.length; i++) {
|
||||
this.mods[i].createUI(this.patchDiv);
|
||||
}
|
||||
}
|
||||
|
||||
updatePatchUI = function() {
|
||||
for(var i = 0; i < mods.length; i++) {
|
||||
mods[i].updateUI(dllFile);
|
||||
DllPatcher.prototype.updatePatchUI = function() {
|
||||
for(var i = 0; i < this.mods.length; i++) {
|
||||
this.mods[i].updateUI(this.dllFile);
|
||||
}
|
||||
}
|
||||
|
||||
validatePatches = function() {
|
||||
errorLog = "";
|
||||
success = true;
|
||||
for(var i = 0; i < mods.length; i++) {
|
||||
var error = mods[i].validatePatch(dllFile);
|
||||
DllPatcher.prototype.validatePatches = function() {
|
||||
this.errorLog = "";
|
||||
var success = true;
|
||||
for(var i = 0; i < this.mods.length; i++) {
|
||||
var error = this.mods[i].validatePatch(this.dllFile);
|
||||
if(error) {
|
||||
errorLog += error + "<br/>";
|
||||
this.errorLog += error + "<br/>";
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bytesMatch = function(buffer, offset, bytes) {
|
||||
var bytesMatch = function(buffer, offset, bytes) {
|
||||
for(var i = 0; i < bytes.length; i++) {
|
||||
if(buffer[offset+i] != bytes[i])
|
||||
return false;
|
||||
|
|
@ -218,13 +267,13 @@ bytesMatch = function(buffer, offset, bytes) {
|
|||
return true;
|
||||
};
|
||||
|
||||
replace = function(buffer, offset, bytes) {
|
||||
var replace = function(buffer, offset, bytes) {
|
||||
for(var i = 0; i < bytes.length; i++) {
|
||||
buffer[offset+i] = bytes[i];
|
||||
}
|
||||
}
|
||||
|
||||
whichBytesMatch = function(buffer, offset, bytesArray) {
|
||||
var whichBytesMatch = function(buffer, offset, bytesArray) {
|
||||
for(var i = 0; i < bytesArray.length; i++) {
|
||||
if(bytesMatch(buffer, offset, bytesArray[i]))
|
||||
return i;
|
||||
|
|
@ -232,19 +281,6 @@ whichBytesMatch = function(buffer, offset, bytesArray) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$('html').on('drag dragstart dragend dragover dragenter dragleave drop', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
})
|
||||
.on('drop', function(e) {
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(files && files.length > 0)
|
||||
loadFile(files[0]);
|
||||
});
|
||||
|
||||
$('#file').on('change', function(e) {
|
||||
if(this.files && this.files.length > 0)
|
||||
loadFile(this.files[0]);
|
||||
});
|
||||
});
|
||||
window.DllPatcher = DllPatcher;
|
||||
|
||||
})(window, document);
|
||||
33
jubeatprop.html
Normal file
33
jubeatprop.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jubeat prop DLL Modder</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<!-- don't hate -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/FileSaver.min.js"></script>
|
||||
<script type="text/javascript" src="js/dllpatcher.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
new DllPatcher("jubeat", [
|
||||
{
|
||||
name : "Disable tutorial",
|
||||
shortname : "notut",
|
||||
patches : [{offset : 0x81F79, off: [0x0F, 0x85, 0xC7], on : [0xE9, 0xC6, 0x01]}]
|
||||
},
|
||||
]);
|
||||
new DllPatcher("music_db", [
|
||||
{
|
||||
name : "Unlock all songs",
|
||||
shortname : "unlock",
|
||||
patches : [{offset : 0x266D, off: [0x02], on : [0x1f]}]
|
||||
},
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>jubeat prop DLL Modder</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
<script type="text/javascript" src="js/dllpatcher.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
DllPatcher("popn22", [
|
||||
new DllPatcher("popn23", [
|
||||
{
|
||||
name : "Song/EX unlock",
|
||||
shortname : "unlock",
|
||||
|
|
@ -111,11 +111,5 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>pop'n music éclale DLL Modder</h1>
|
||||
<input class="fileInput" type="file" name="files[]" id="file" />
|
||||
<label for="file"><strong>Choose a file</strong> or drag and drop.</label>
|
||||
<div id="success"></div>
|
||||
<div id="error"></div>
|
||||
<div id="patches"></div>
|
||||
<button id="save" onclick="saveDll();">Save DLL</button>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -10,7 +10,8 @@
|
|||
<script type="text/javascript" src="js/dllpatcher.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
DllPatcher("soundvoltex", [
|
||||
// all patches made by DJH unless specified otherwise
|
||||
new DllPatcher("soundvoltex", [
|
||||
{
|
||||
name : "All difficulties unlocked",
|
||||
shortname : "unlocked",
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
patches : [{offset : 0x1554F7, off: [0x32, 0xC0], on : [0xB0, 0x01]}]
|
||||
},
|
||||
{
|
||||
// Created by mon
|
||||
name : "No \"Safe\" banner on jackets",
|
||||
shortname : "nobanner",
|
||||
patches : [{offset : 0x28F4AC, off: [0x73], on : [0x00]}]
|
||||
|
|
@ -38,6 +40,7 @@
|
|||
patches : [{offset : 0x170092, off : [0x00], on : [0x01]}]
|
||||
},
|
||||
{
|
||||
// Ported from the S1 PFree by mon
|
||||
name : "PFree (Unlimited plays)",
|
||||
shortname : "pfree",
|
||||
patches : [{offset : 0x196BDF, off : [0x00], on : [0x02]},
|
||||
|
|
@ -64,6 +67,7 @@
|
|||
0xD1, 0x00, 0x89, 0x85, 0x50],
|
||||
},
|
||||
{
|
||||
// Created by mon
|
||||
name : "Subtractive (NEAR+ERROR subtract score from 10,000,000)",
|
||||
shortname : "subtract",
|
||||
patch : [0x56, 0x57, 0x52, 0x51, 0xBE, 0x90, 0x71, 0x7C, 0x18, 0x8B, 0x46, 0x5C, 0x6A, 0x00, 0x99, 0x6A,
|
||||
|
|
@ -72,9 +76,10 @@
|
|||
0x21, 0x00, 0x8B, 0xFA, 0x8B, 0x56, 0x18, 0x8B, 0xC8, 0x8B, 0x82, 0x80, 0x2C, 0x00, 0x00, 0x01,
|
||||
0xC0, 0x99, 0x52, 0x50, 0x57, 0x51, 0xE8, 0xAC, 0x36, 0x21, 0x00, 0xB9, 0x80, 0x96, 0x98, 0x00,
|
||||
0xBF, 0x00, 0x00, 0x00, 0x00, 0x29, 0xC1, 0x19, 0xD7, 0x8B, 0xDF, 0x8B, 0xF9, 0x59, 0x5A, 0x8B,
|
||||
0x45, 0x08, 0x8B, 0x40, 0x04]
|
||||
0x45, 0x08, 0x8B, 0x40, 0x04, 0xEB, 0x57]
|
||||
},
|
||||
{
|
||||
// Created by mon
|
||||
name : "Average (Osu style % display)",
|
||||
shortname : "avg",
|
||||
patch : [0x56, 0x57, 0x52, 0x51, 0xBE, 0x90, 0x71, 0x7C, 0x18, 0x8B, 0x46, 0x54, 0x99, 0x6A, 0x00, 0x6A,
|
||||
|
|
@ -94,11 +99,5 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>SDVX III Season 2 DLL Modder</h1>
|
||||
<input class="fileInput" type="file" name="files[]" id="file" />
|
||||
<label for="file"><strong>Choose a file</strong> or drag and drop.</label>
|
||||
<div id="success"></div>
|
||||
<div id="error"></div>
|
||||
<div id="patches"></div>
|
||||
<button id="save" onclick="saveDll();">Save DLL</button>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user