From edfe55fec87beb848788fa2db52d11566850420a Mon Sep 17 00:00:00 2001 From: Matteias Collet Date: Thu, 9 Nov 2017 17:33:45 +0100 Subject: [PATCH] add 'Download for Dolphin' (#1) * Add files via upload * Update gctGenerator.js --- changelog.html | 3 +++ changelog.xml | 4 ++++ gctGenerator.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 7 ++++--- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/changelog.html b/changelog.html index 3fb7fc8..daef59b 100644 --- a/changelog.html +++ b/changelog.html @@ -14,6 +14,9 @@

Detailed Changelog

Main Page: https://bitpatty.github.io/gctGenerator/


+

Nov 09, 2017

+

Site changes

+

Added download button for raw codes for Dolphin.

Nov 08, 2017

Added 'Fast 79 Shines' for NTSC-U

Same concept as 'Fast Any%'.

diff --git a/changelog.xml b/changelog.xml index 20bca06..a96148e 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,5 +1,9 @@ + + Nov 9, 2017 + Added 'Download for Dolphin' button. + Nov 8, 2017 Added 'Fast 79 Shines' for NTSC-U. diff --git a/gctGenerator.js b/gctGenerator.js index 16a19c6..2a44574 100644 --- a/gctGenerator.js +++ b/gctGenerator.js @@ -42,6 +42,10 @@ function parseXML(name) { button.style.transitionDuration = 0.6 + i*0.05 + "s"; button.style.opacity = "1"; button.disabled = false; + button = document.getElementById("dolphinDownloadButton"); + button.style.transitionDuration = 0.6 + i*0.05 + "s"; + button.style.opacity = "1"; + button.disabled = false; document.getElementById("gameID").disabled = false; } }; @@ -100,6 +104,50 @@ function generateGCT() { } } +function downloadINI(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); + } +} + +function generateINI() { + + if (document.getElementById("gameID").value === "Choose Version") { + alert("Select the game version!"); + return; + } + var data = "Paste the following on top of your games .ini file:\r\n[Gecko]\r\n"; + var codeList = document.getElementById("checkList").getElementsByTagName("li"); + var valueSelected = false; + for (var i = 0; i < codeList.length; i++) { + if (codeList[i].className === "checked") { + data += "$" + codeList[i].getAttribute("data-codeName") + " (" + codeList[i].getAttribute("data-codeDate") + ") [" + codeList[i].getAttribute("data-codeAuthor") + "]\r\n"; + data += (codeList[i].getAttribute("data-codeSrc").match(/.{8}/g).join(" ")).replace(/(.{17})./g,"$1 \r\n"); + data += "\r\n"; + valueSelected = true; + } + } + + if (valueSelected) { + downloadINI(data, document.getElementById("gameID").value + ".txt"); + } else { + alert("No cheat(s) selected!"); + } +} + function updateCodelist() { resetDescription(); document.getElementById("gameID").disabled = true; @@ -108,6 +156,11 @@ function updateCodelist() { button.style.transitionDuration = "0s"; button.style.opacity = "0"; button.disabled = true; + button = document.getElementById("dolphinDownloadButton"); + button.style.visibility = "visible"; + button.style.transitionDuration = "0s"; + button.style.opacity = "0"; + button.disabled = true; document.getElementById("checkList").innerHTML = ""; var gameVersion = document.getElementById("gameID").value; parseXML(gameVersion); diff --git a/index.html b/index.html index ba79a92..c615795 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + SMS GCT Generator @@ -20,7 +20,8 @@
- + +
@@ -35,7 +36,7 @@

Mario Sunshine Cheatfile Generator

-

Authors: Psy & Milk
Last Updated: Nov 8, 2017

+

Authors: Psy & Milk
Last Updated: Nov 9, 2017

Description:
This is a cheatfile generator for SMS Speedrun practice. A guide on how to use the generator and cheatfiles on your Wii can be found here: Guide

Changelog: