From 137b280c6cab2fa7e182c9824e97b2a1c65a3cd6 Mon Sep 17 00:00:00 2001 From: Matteias Collet Date: Fri, 3 Jul 2020 03:53:48 +0200 Subject: [PATCH] minor cleanup --- package.json | 4 +- site/.vuepress/components/ButtonComponent.vue | 2 - site/.vuepress/components/DownloadButton.vue | 63 +++++++++++++++++-- .../components/scripts/codeFormatter.js | 61 ------------------ 4 files changed, 60 insertions(+), 70 deletions(-) delete mode 100644 site/.vuepress/components/scripts/codeFormatter.js diff --git a/package.json b/package.json index bfbd3d3..48c8cad 100755 --- a/package.json +++ b/package.json @@ -28,7 +28,5 @@ "dependencies": { "vuedraggable": "^2.23.2" }, - "pre-commit": [ - "codes:clean" - ] + "pre-commit": [] } diff --git a/site/.vuepress/components/ButtonComponent.vue b/site/.vuepress/components/ButtonComponent.vue index 1607644..f5ef417 100644 --- a/site/.vuepress/components/ButtonComponent.vue +++ b/site/.vuepress/components/ButtonComponent.vue @@ -5,8 +5,6 @@ diff --git a/site/.vuepress/components/scripts/codeFormatter.js b/site/.vuepress/components/scripts/codeFormatter.js deleted file mode 100644 index 24cafe7..0000000 --- a/site/.vuepress/components/scripts/codeFormatter.js +++ /dev/null @@ -1,61 +0,0 @@ -export default class CodeFormatter { - static generateGCT(codes, version) { - let code = '00D0C0DE00D0C0DE'; - codes.forEach((c) => (code += c.source)); - code += 'FF00000000000000'; - - let rawData = new Uint8Array(code.length / 2); - - for (let x = 0; x < rawData.length; x++) { - rawData[x] = parseInt(code.substr(x * 2, 2), 16); - } - - this.downloadFile(rawData, `${version}.gct`); - } - - static generateDolphinINI(codes, version) { - let data = 'Paste the following on top of your games .ini file:\r\n[Gecko]'; - - codes.forEach((code) => { - data += `\r\n$${code.title} (${code.date}) [${code.author}]\r\n`; - data += code.source - .match(/.{8}/g) - .join(' ') - .replace(/(.{17})./g, '$1\r\n'); - }); - - this.downloadFile(data, `${version}.txt`); - } - - static generateCheatManagerTXT(codes, version) { - let data = `${version}\r\nSuper Mario Sunshine`; - - codes.forEach((code) => { - data += `\r\n\r\n${code.title} (${code.date}) [${code.author}]\r\n`; - data += code.source - .match(/.{8}/g) - .join(' ') - .replace(/(.{17})./g, '$1\r\n'); - }); - - this.downloadFile(data, `${version}.txt`); - } - - static downloadFile(data, filename) { - var file = new Blob([data], { - type: 'application/octet-stream', - }); - - if (window.navigator.msSaveOrOpenBlob) window.navigator.msSaveOrOpenBlob(file, filename); - else { - var a = document.createElement('a'), - url = window.URL.createObjectURL(file); - a.href = url; - a.download = filename; - a.click(); - setTimeout(function () { - window.URL.revokeObjectURL(url); - }, 500); - } - } -}