add 'Download for Dolphin' (#1)

* Add files via upload

* Update gctGenerator.js
This commit is contained in:
Matteias Collet 2017-11-09 17:33:45 +01:00 committed by GitHub
parent 441056b01a
commit edfe55fec8
4 changed files with 64 additions and 3 deletions

View file

@ -14,6 +14,9 @@
<h1 style="text-align: center; width: 100%;">Detailed Changelog</h1>
<p style="margin: 0; width: 100%; text-align: center;">Main Page: <a href="https://bitpatty.github.io/gctGenerator/">https://bitpatty.github.io/gctGenerator/</a></p>
<br />
<h2 id="171109"><a href="#171109">Nov 09, 2017</a> </h2>
<h3 id="1711091"><a href="#1711091">Site changes</a></h3>
<p>Added download button for raw codes for Dolphin.</p>
<h2 id="171108"><a href="#171108">Nov 08, 2017</a> </h2>
<h3 id="1711081"><a href="#1711081">Added 'Fast 79 Shines' for NTSC-U</a></h3>
<p>Same concept as 'Fast Any%'.</p>

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<updates>
<update>
<date>Nov 9, 2017</date>
<change>Added 'Download for Dolphin' button.</change>
</update>
<update>
<date>Nov 8, 2017</date>
<change>Added 'Fast 79 Shines' for NTSC-U.</change>

View file

@ -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);

View file

@ -3,7 +3,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="description" content="Generates cheatfiles for Super Mario Sunshine speedrun practice.">
<meta name="keywords" content="mario sunshine, speedrun, practice codes">
<meta name="keywords" content="mario sunshine, speedrun, practice codes">
<link rel="stylesheet" href="style/style.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<title>SMS GCT Generator</title>
@ -20,7 +20,8 @@
</select>
<ul id="checkList">
</ul>
<button id="downloadButton" onclick="generateGCT()" style="visibility:hidden;">Download</button>
<button id="downloadButton" onclick="generateGCT()" style="visibility:hidden;">Download GCT</button>
<button id="dolphinDownloadButton" onclick="generateINI()" style="visibility:hidden; background-color:#5c90aa;">Download for Dolphin</button>
</center>
</div>
<div style="margin-left: 420px;">
@ -35,7 +36,7 @@
<p>
<h2>Mario Sunshine Cheatfile Generator</h2>
</p>
<p><i>Authors: <a href="https://twitter.com/psychonauter">Psy</a> & <a href="https://twitter.com/srlmilk">Milk</a><br />Last Updated: Nov 8, 2017</i></p>
<p><i>Authors: <a href="https://twitter.com/psychonauter">Psy</a> & <a href="https://twitter.com/srlmilk">Milk</a><br />Last Updated: Nov 9, 2017</i></p>
<p>Description:<br />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: <a target="_blank" href="guide.html">Guide</a></p>
<h4>Changelog:</h4>
<p id="changelog"></p>