diff --git a/beatstream2.html b/beatstream2.html index f54bcd5..e55fc80 100644 --- a/beatstream2.html +++ b/beatstream2.html @@ -13,19 +13,16 @@ new DllPatcher("beatstream", [ { name : "E: drive fix", - shortname : "efix", tooltip: "Fix crash caused by no E: drive", patches : [{offset : 0x8645FC, off: [0x65, 0x3A, 0x2F], on : [0x64, 0x65, 0x76]}] }, { name : "Unlock all songs", - shortname : "songunlock", patches : [{offset : 0x16CCB1, off: [0x48, 0x83, 0xFD, 0x10, 0x72, 0x03, 0x48, 0x8B, 0x09, 0x41], on : [0xBE, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x3A, 0x01, 0x00, 0x00]}] }, { name : "Nightmare difficulty unlock", - shortname : "diffunlock", patches : [{offset : 0x16EADE, off: [0x8B, 0xCB, 0xE8, 0xDB, 0xB4, 0x0E], on : [0xB0, 0x01, 0xE9, 0xAD, 0x00, 0x00]}] }, diff --git a/copula.html b/copula.html index 1722893..1cd50c8 100644 --- a/copula.html +++ b/copula.html @@ -13,86 +13,71 @@ new DllPatcher("bm2dx", [ { name : "Timer Freeze", - shortname : "freeze", patches : [{offset : 0x8F98E, off: [0x74], on : [0xEB]}] }, { name : "Premium Free", - shortname : "pfree", patches : [{offset : 0x562BA, off: [0x75], on : [0xEB]}] }, // By mon - modifies a few more bytes than needed but whatever { name : "Premium Free (2 player mode)", - shortname : "pfree2", patches : [{offset : 0x56424, off: [0x74, 0x2f], on : [0x90, 0x90]}, {offset : 0x56435, off: [0x0f, 0x85, 0x3b], on : [0xe9, 0x3c, 0xff]}, {offset : 0x5643a, off: [0xff], on : [0x90]}] }, { name : "Premium Free Timer Freeze", - shortname : "pfreeze", patches : [{offset : 0x4F8FD, off: [0x48], on : [0x90]}] }, { name : "Unlock All Songs", - shortname : "unlock", patches : [{offset : 0x4FD84, off: [0x74, 0x16], on : [0x90, 0x90]}] }, { name : "Level 12 Unlocked", - shortname : "12", patches : [{offset : 0x4FE35, off: [0x83, 0xFF, 0x02, 0x74, 0x0B, 0x83, 0xFF, 0x05, 0x74, 0x06, 0xB0, 0x01], on : [0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90]}] }, { name : "Cursor lock", - shortname : "cursor", tooltip : "After song finishes, song select remains on previous song", patches : [{offset : 0x63722, off: [0x74, 0x23], on : [0x90, 0x90]}] }, { name : "CS-Style Song Start Delay", - shortname : "delay", tooltip : "Holding Start will pause the song at the beginning until you release it", patches : [{offset : 0x6F3FF, off: [0x7C], on : [0xEB]}] }, { name : "Disable HCN Tutorial", - shortname : "hcntut", tooltip : "Don't show tutorial for Hell Charge Notes", patches : [{offset : 0x6F3E6, off: [0x5E, 0xE9, 0x24, 0xFF, 0xFF, 0xFF], on : [0x00, 0x00, 0x00, 0x00, 0x00, 0x00]}] }, { name : "Dark Mode", - shortname : "dark", patches : [{offset : 0x68833, off: [0x74, 0x32], on : [0x90, 0x90]}] }, { name : "Volume Bug Fix", - shortname : "vol", tooltip : "If your volume gets forced to max, turn this on", patches : [{offset : 0xCB2B9, off: [0x00], on : [0x01]}] }, { type : "union", name : "FREE PLAY text", - shortname : "freetext", offset : 0x1379A, patches : [ { name : "On", - shortname : "default", patch : [0x88, 0x3D, 0x11, 0x10], }, { name : "Off", - shortname : "off", patch : [0x87, 0x3D, 0x11, 0x10], }, { name : "Replace with song name", - shortname : "song", patch : [0x54, 0x1D, 0x42, 0x11], }, ] diff --git a/ddr2014.html b/ddr2014.html index 2a18a89..0382a28 100644 --- a/ddr2014.html +++ b/ddr2014.html @@ -13,14 +13,12 @@ new DllPatcher("mdxja_", [ {// Created by Renard1911 name : "Premium Free", - shortname : "pfree", tooltip: "Song clears/scores only. Profile progress and custom settings do not save. Reboot game to re-query for scores.", patches : [{offset : 0x23C5, off: [0xFF, 0x80, 0xE4, 0x16, 0x00, 0x00], on : [0x90, 0x90, 0x90, 0x90, 0x90, 0x90]}] }, // These patches were auto-generated and thus very verbose { name : "Unlock all songs", - shortname : "unlock", patches : [{offset : 0x205c70, off: [0xeb], on : [0x00]}, {offset : 0x205c74, off: [0xf7, 0x01], on : [0x00, 0x00]}, {offset : 0x205c78, off: [0xf5], on : [0x00]}, diff --git a/js/dllpatcher.js b/js/dllpatcher.js index f1b0880..02bb480 100644 --- a/js/dllpatcher.js +++ b/js/dllpatcher.js @@ -1,21 +1,29 @@ (function(window, document) { "use strict"; +// form labels often need unique IDs - this can be used to generate some +window.DllPatcher_uniqueid = 0; +var createID = function() { + window.DllPatcher_uniqueid++; + return "dllpatch_" + window.DllPatcher_uniqueid; +} + // Each unique kind of patch should have createUI, validatePatch, applyPatch, // updateUI var StandardPatch = function(options) { this.name = options.name; - this.shortname = options.shortname; this.patches = options.patches; this.tooltip = options.tooltip; }; StandardPatch.prototype.createUI = function(parent) { - var id = this.shortname; + var id = createID(); var label = this.name; var patch = $('
', {'class' : 'patch'}); - patch.append(''); + this.checkbox = $('')[0]; + patch.append(this.checkbox); + patch.append(''); if(this.tooltip) { patch.append('
' + this.tooltip + '
'); } @@ -23,9 +31,7 @@ StandardPatch.prototype.createUI = function(parent) { }; StandardPatch.prototype.updateUI = function(file) { - var id = this.shortname; - var elem = document.getElementById(id); - elem.checked = this.checkPatchBytes(file) == "on"; + this.checkbox.checked = this.checkPatchBytes(file) == "on"; }; StandardPatch.prototype.validatePatch = function(file) { @@ -40,10 +46,7 @@ StandardPatch.prototype.validatePatch = function(file) { }; StandardPatch.prototype.applyPatch = function(file) { - var id = this.shortname; - var enabled = document.getElementById(id).checked; - this.replaceAll(file, enabled); - return enabled ? this.shortname : ""; + this.replaceAll(file, this.checkbox.checked); }; StandardPatch.prototype.replaceAll = function(file, featureOn) { @@ -82,20 +85,26 @@ StandardPatch.prototype.checkPatchBytes = function(file) { // The DEFAULT state is always the 1st element in the patches array var UnionPatch = function(options) { this.name = options.name; - this.shortname = options.shortname; this.offset = options.offset; this.patches = options.patches; }; UnionPatch.prototype.createUI = function(parent) { + this.radios = []; + var radio_id = createID(); + var container = $("
", {"class": "patch-union"}); container.append('' + this.name + ':'); for(var i = 0; i < this.patches.length; i++) { var patch = this.patches[i]; - var id = this.shortname + '-' + patch.shortname; + var id = createID(); var label = patch.name; var patchDiv = $('
', {'class' : 'patch'}); - patchDiv.append(''); + var radio = $('')[0]; + this.radios.push(radio); + + patchDiv.append(radio); + patchDiv.append(''); if(patch.tooltip) { patchDiv.append('
' + patch.tooltip + '
'); } @@ -107,12 +116,12 @@ UnionPatch.prototype.createUI = function(parent) { UnionPatch.prototype.updateUI = function(file) { for(var i = 0; i < this.patches.length; i++) { if(bytesMatch(file, this.offset, this.patches[i].patch)) { - document.getElementById(this.shortname + '-' + this.patches[i].shortname).checked = true; + this.radios[i].checked = true; return; } } // Default fallback - document.getElementById(this.shortname + '-' + this.patches[0].shortname).checked = true; + this.radios[0].checked = true; }; UnionPatch.prototype.validatePatch = function(file) { @@ -127,14 +136,12 @@ UnionPatch.prototype.validatePatch = function(file) { UnionPatch.prototype.applyPatch = function(file) { var patch = this.getSelected(); - var name = this.shortname + patch.shortname; replace(file, this.offset, patch.patch); - return patch.shortname == "default" ? "" : name; }; UnionPatch.prototype.getSelected = function() { for(var i = 0; i < this.patches.length; i++) { - if(document.getElementById(this.shortname + '-' + this.patches[i].shortname).checked) { + if(this.radios[i].checked) { return this.patches[i]; } } @@ -244,11 +251,7 @@ DllPatcher.prototype.saveDll = function() { var fname = this.filename; for(var i = 0; i < this.mods.length; i++) { - var enabledStr = this.mods[i].applyPatch(this.dllFile); - /* disabled as it can get kinda hectic with many patches - if(enabledStr) { - fname += '-' + enabledStr; - } */ + this.mods[i].applyPatch(this.dllFile); } fname += '.dll'; diff --git a/jubeatprop.html b/jubeatprop.html index 025f147..0d11cf0 100644 --- a/jubeatprop.html +++ b/jubeatprop.html @@ -13,19 +13,16 @@ new DllPatcher("jubeat", [ { name : "Disable tutorial", - shortname : "notut", patches : [{offset : 0x81F79, off: [0x0F, 0x85, 0xC7], on : [0xE9, 0xC6, 0x01]}] }, { name : "SELECT MUSIC timer lock", - shortname : "selectlock", patches : [{offset : 0x16E64D, off : [0x75], on : [0xEB]}] }, ]); new DllPatcher("music_db", [ { name : "Unlock all songs", - shortname : "unlock", patches : [{offset : 0x266D, off: [0x02], on : [0x1f]}] }, ]); diff --git a/jubeatqubell.html b/jubeatqubell.html index 0442d4f..7c9f32f 100644 --- a/jubeatqubell.html +++ b/jubeatqubell.html @@ -13,19 +13,16 @@ new DllPatcher("jubeat", [ { name : "Disable tutorial", - shortname : "notut", patches : [{offset : 0xAAC32, off: [0x75, 0x4A, 0x53, 0x68, 0x00], on : [0xE9, 0x90, 0x00, 0x00, 0x00]}] }, { name : "SELECT MUSIC timer lock", - shortname : "selectlock", patches : [{offset : 0x80576, off : [0x75], on : [0xEB]}] }, ]); new DllPatcher("music_db", [ { name : "Unlock all songs", - shortname : "unlock", patches : [{offset : 0x17DF, off: [0x74, 0x09], on : [0x90, 0x90]}] }, ]); diff --git a/pendual.html b/pendual.html index ecf8e96..bfc96d5 100644 --- a/pendual.html +++ b/pendual.html @@ -6,14 +6,6 @@ -