commit 67f19039fb4aab77a29290ab67ab3edf4e6e6935 Author: William Toohey Date: Sat Jan 28 14:41:42 2017 +1000 Initial commit diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..2561f7b --- /dev/null +++ b/.htaccess @@ -0,0 +1,8 @@ +IndexOptions IgnoreCase NameWidth=* DescriptionWidth=* SuppressHTMLPreamble +IndexOrderDefault Ascending Name +IndexIgnore header.html footer.html css js + +HeaderName header.html +ReadmeName footer.html + +Options +Indexes \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c53fa40 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# BemaniPatcher +A tool to easily apply known hex edits to any DLL, with examples for Bemani games. + +Should work on most modern browsers. + +Live version hosted [on my website](http://mon.im/bemanipatcher/). \ No newline at end of file diff --git a/copula.html b/copula.html new file mode 100644 index 0000000..ad35d89 --- /dev/null +++ b/copula.html @@ -0,0 +1,83 @@ + + + + + IIDX Copula DLL Modder + + + + + + + + +

IIDX Copula DLL Modder

+ + +
+
+
+ + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..ad4d5e1 --- /dev/null +++ b/css/style.css @@ -0,0 +1,33 @@ +.fileInput { + display: none +} + +#error { + color: red; +} + +#success { + color: DarkGreen; +} + +#success.hidden { + display: none; +} + +body { + margin: 40px auto; + max-width: 650px; + line-height: 1.6; + font-size: 18px; + color: #444; + padding: 0 10px; +} + +h1,h2,h3{ + line-height: 1.2; +} + +h1 a{ + color: inherit; + text-decoration: inherit; +} \ No newline at end of file diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..ab879d4 --- /dev/null +++ b/footer.html @@ -0,0 +1,3 @@ +
Converted to an ugly web-tool by mon
+ + \ No newline at end of file diff --git a/header.html b/header.html new file mode 100644 index 0000000..d9a04ad --- /dev/null +++ b/header.html @@ -0,0 +1,6 @@ + + + Bemani DLL Patching Tools + + +

Pick a game!

\ No newline at end of file diff --git a/js/FileSaver.min.js b/js/FileSaver.min.js new file mode 100644 index 0000000..9a1e397 --- /dev/null +++ b/js/FileSaver.min.js @@ -0,0 +1,2 @@ +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ +var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,d){if(!d){t=p(t)}var v=this,w=t.type,m=w===s,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&i)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;a(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return navigator.msSaveOrOpenBlob(e,t)}}w.abort=function(){};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define("FileSaver.js",function(){return saveAs})} diff --git a/js/dllpatcher.js b/js/dllpatcher.js new file mode 100644 index 0000000..a99ef0d --- /dev/null +++ b/js/dllpatcher.js @@ -0,0 +1,156 @@ +dllFile = null; +mods = null; +filename = null; +errorLog = ""; + +DllPatcher = function(fname, args) { + mods = args; + filename = fname; + loadPatchUI(); +}; + +loadFile = function(file) { + var reader = new FileReader(); + + reader.onload = function(e) { + dllFile = new Uint8Array(e.target.result); + if(validatePatches()) { + $("#success").removeClass("hidden"); + $("#success").html("DLL loaded successfully!"); + } else { + $("#success").addClass("hidden"); + } + $('#error').html(errorLog); + updatePatchUI(); + }; + + reader.readAsArrayBuffer(file); +}; + +saveDll = function() { + if(!dllFile || !mods || !filename) + return; + var fname = filename; + + for(var i = 0; i < mods.length; i++) { + id = mods[i].shortname; + var enabled = document.getElementById(id).checked; + replaceAll(dllFile, mods[i].patches, enabled); + if(enabled) { + fname += '-' + id; + } + } + fname += '.dll'; + + var blob = new Blob([dllFile], {type: "application/octet-stream"}); + saveAs(blob, fname); +} + +loadPatchUI = function() { + var patchDiv = $('#patches'); + for(var i = 0; i < mods.length; i++) { + var id = mods[i].shortname; + var name = mods[i].name; + patchDiv.append('
'); + } +} + +updatePatchUI = function() { + for(var i = 0; i < mods.length; i++) { + var id = mods[i].shortname; + var elem = document.getElementById(id); + elem.checked = checkPatchBytes(mods[i].patches) == "on"; + } +} + +buildError = function(patchName, message) { + var msg = '"' + patchName + '" ' + message; + console.log(msg); + errorLog += msg + '
'; +} + +validatePatches = function() { + errorLog = ""; + success = true; + for(var i = 0; i < mods.length; i++) { + var patch = mods[i]; + var status = checkPatchBytes(patch.patches); + if(status == "on") { + console.log('"' + patch.name + '"', "is enabled!"); + } else if(status == "off") { + console.log('"' + patch.name + '"', "is disabled!"); + } else { + success = false; + buildError(patch.name, "is neither on nor off! Have you got the right dll?"); + } + } + return success; +} + +checkPatchBytes = function(patches) { + var patchStatus = ""; + for(var i = 0; i < patches.length; i++) { + patch = patches[i]; + if(bytesMatch(dllFile, patch.offset, patch.off)) { + if(patchStatus == "") { + patchStatus = "off"; + } else if(patchStatus != "off"){ + return "on/off mismatch within patch"; + } + } else if(bytesMatch(dllFile, patch.offset, patch.on)) { + if(patchStatus == "") { + patchStatus = "on"; + } else if(patchStatus != "on"){ + return "on/off mismatch within patch"; + } + } else { + return "patch neither on nor off"; + } + } + return patchStatus; +} + +bytesMatch = function(buffer, offset, bytes) { + for(var i = 0; i < bytes.length; i++) { + if(buffer[offset+i] != bytes[i]) + return false; + } + return true; +}; + +replaceAll = function(buffer, patches, featureOn) { + for(var i = 0; i < patches.length; i++) { + replace(buffer, patches[i].offset, featureOn? patches[i].on : patches[i].off); + } +} + +replace = function(buffer, offset, bytes) { + for(var i = 0; i < bytes.length; i++) { + buffer[offset+i] = bytes[i]; + } +} + +whichBytesMatch = function(buffer, offset, bytesArray) { + for(var i = 0; i < bytesArray.length; i++) { + if(bytesMatch(buffer, offset, bytesArray[i])) + return i; + } + 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]); + }); +}); \ No newline at end of file diff --git a/popn22eclale.html b/popn22eclale.html new file mode 100644 index 0000000..f18419f --- /dev/null +++ b/popn22eclale.html @@ -0,0 +1,121 @@ + + + + + pop'n music éclale DLL Modder + + + + + + + + +

pop'n music éclale DLL Modder

+ + +
+
+
+ + + diff --git a/sdvx3-s2.html b/sdvx3-s2.html new file mode 100644 index 0000000..c21610b --- /dev/null +++ b/sdvx3-s2.html @@ -0,0 +1,77 @@ + + + + + SDVX III Season 2 DLL Modder + + + + + + + + +

SDVX III Season 2 DLL Modder

+ + +
+
+
+ + +