diff --git a/files/GCMCodes.zip b/files/GCMCodes.zip index 64a36c8..5a55b4a 100644 Binary files a/files/GCMCodes.zip and b/files/GCMCodes.zip differ diff --git a/gctGenerator.js b/gctGenerator.js index 43fea63..255f300 100644 --- a/gctGenerator.js +++ b/gctGenerator.js @@ -1,90 +1,95 @@ if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { - HTMLElement.prototype.click = function() { + HTMLElement.prototype.click = function () { var evt = this.ownerDocument.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this.dispatchEvent(evt); - } + } } -document.getElementById("checklist").addEventListener("click", function(ev) { - if (ev.target && ev.target.nodeName == "LI") { +document.getElementById("codelist").addEventListener("click", function (ev) { + if (ev.target && ev.target.nodeName.toUpperCase() === "LI") ev.target.classList.toggle("checked"); - } }); function parseXML(name) { - var xml = new XMLHttpRequest(); - var file = "codes/" + name + ".xml"; - xml.onreadystatechange = function() { - if (this.status == 200 && this.readyState == 4) { - var xmlData = xml.responseXML; - xmlData = (new DOMParser()).parseFromString(xml.responseText, "text/xml"); - xmlData = xmlData.getElementsByTagName("code"); + var xml = new XMLHttpRequest(); + var file = "codes/" + name + ".xml"; + xml.onreadystatechange = function () { + if (this.status == 200 && this.readyState == 4) { + var xmlData = xml.responseXML; + xmlData = (new DOMParser()).parseFromString(xml.responseText, "text/xml"); + xmlData = xmlData.getElementsByTagName("code"); - var i = 0; - for (; i < xmlData.length; i++) { - var li = document.createElement("li"); - var desc = xmlData[i].getElementsByTagName("title")[0].textContent; - var t = document.createTextNode(desc); - li.appendChild(t); - li.setAttribute("data-codename", btoa(xmlData[i].getElementsByTagName("title")[0].textContent)); - li.setAttribute("data-codeauthor", btoa(xmlData[i].getElementsByTagName("author")[0].textContent)); - li.setAttribute("data-codedesc", btoa(xmlData[i].getElementsByTagName("description")[0].textContent)); - li.setAttribute("data-codeversion", btoa(xmlData[i].getElementsByTagName("version")[0].textContent)); - li.setAttribute("data-codedate", btoa(xmlData[i].getElementsByTagName("date")[0].textContent)); - li.setAttribute("data-codesrc", btoa(xmlData[i].getElementsByTagName("source")[0].textContent.replace(/[\s\n\r\t]+/gm, ""))); - li.setAttribute("onmouseover", "updateDescription(this)"); - document.getElementById("checklist").appendChild(li); + var i = 0; + for (; i < xmlData.length; i++) { + var li = document.createElement("li"); + var desc = xmlData[i].getElementsByTagName("title")[0].textContent; + var t = document.createTextNode(desc); + li.appendChild(t); + li.setAttribute("data-codename", btoa(xmlData[i].getElementsByTagName("title")[0].textContent)); + li.setAttribute("data-codeauthor", btoa(xmlData[i].getElementsByTagName("author")[0].textContent)); + li.setAttribute("data-codedesc", btoa(xmlData[i].getElementsByTagName("description")[0].textContent)); + li.setAttribute("data-codeversion", btoa(xmlData[i].getElementsByTagName("version")[0].textContent)); + li.setAttribute("data-codedate", btoa(xmlData[i].getElementsByTagName("date")[0].textContent)); + li.setAttribute("data-codesrc", btoa(xmlData[i].getElementsByTagName("source")[0].textContent.replace(/[\s\n\r\t]+/gm, ""))); + li.setAttribute("onmouseover", "updateCodeDescription(this)"); + document.getElementById("codelist").appendChild(li); + } + + var buttons = document.getElementsByTagName("button"); + for (var i = 0; i < buttons.length; i++) buttons[i].disabled = false; + + document.getElementById("sel-gamever").disabled = false; } + }; - var buttons = document.getElementsByTagName("button"); - for (var i = 0; i < buttons.length; i++) buttons[i].disabled = false; + xml.open("GET", file); + xml.send(); +} - document.getElementById("gameversion").disabled = false; - } - }; - - xml.open("GET", file); - xml.send(); +function toggleFastCode() { + document.getElementById("cc").classList.toggle("hidden"); } function updateFastCode(name) { var xml = new XMLHttpRequest(); - var file = "codes/fast/" + name + ".json"; - xml.onreadystatechange = function() { + + xml.onreadystatechange = function () { if (this.status == 200 && this.readyState == 4) { document.getElementById("route_levels").setAttribute("data-json", btoa(xml.responseText)); } } - xml.open("GET",file); + + xml.open("GET", "codes/fast/" + name + ".json"); xml.send(); } function downloadFile(data, filename) { - var file = new Blob([data], { - type: "application/octet-stream" + type: "application/octet-stream" }); - if (window.navigator.msSaveOrOpenBlob) window.navigator.msSaveOrOpenBlob(file, filename.replace("GMSJ0A","GMSJ01")); + if (window.navigator.msSaveOrOpenBlob) window.navigator.msSaveOrOpenBlob(file, filename.replace("GMSJ0A", "GMSJ01")); else { var a = document.createElement("a"), - url = window.URL.createObjectURL(file); + url = window.URL.createObjectURL(file); a.href = url; - a.download = filename.replace("GMSJ0A","GMSJ01"); + a.download = filename.replace("GMSJ0A", "GMSJ01"); a.click(); - setTimeout(function() { window.URL.revokeObjectURL(url); }, 500); - } + setTimeout(function () { + window.URL.revokeObjectURL(url); + }, 500); + } } function generateGCT() { - if (document.getElementById("gameversion").value === "Choose Version") { - alert("Select the game version!"); - return; + if (document.getElementById("sel-gamever").value === "Choose Version") { + alert("Select the game version!"); + return; } var data = "00D0C0DE00D0C0DE"; - var codeList = document.getElementById("checklist").getElementsByTagName("li"); + var codeList = document.getElementById("codelist").getElementsByTagName("li"); var valueSelected = false; for (var i = 0; i < codeList.length; i++) { if (codeList[i].className === "checked") { @@ -95,7 +100,7 @@ function generateGCT() { var fastcode = getFastCode(); - if(fastcode !== false) { + if (fastcode !== false) { data += fastcode; valueSelected = true; } @@ -108,7 +113,7 @@ function generateGCT() { rawData[x] = parseInt(data.substr(x * 2, 2), 16); } - downloadFile(rawData, document.getElementById("gameversion").value + ".gct"); + downloadFile(rawData, document.getElementById("sel-gamever").value + ".gct"); } else { alert("No cheat(s) selected!"); } @@ -116,15 +121,15 @@ function generateGCT() { function generateTXT() { - var dolphin = (document.getElementById("downloadformat").value === "ini"); + var dolphin = (document.getElementById("sel-format").value === "ini"); - if (document.getElementById("gameversion").value === "Choose Version") { + if (document.getElementById("sel-gamever").value === "Choose Version") { alert("Select the game version!"); return; } if (dolphin) var data = "Paste the following on top of your games .ini file:\r\n[Gecko]"; - else var data = document.getElementById("gameversion").value.replace("GMSJ0A","GMSJ01") + "\r\nSuper Mario Sunshine"; - var codeList = document.getElementById("checklist").getElementsByTagName("li"); + else var data = document.getElementById("sel-gamever").value.replace("GMSJ0A", "GMSJ01") + "\r\nSuper Mario Sunshine"; + var codeList = document.getElementById("codelist").getElementsByTagName("li"); var valueSelected = false; for (var i = 0; i < codeList.length; i++) { if (codeList[i].className === "checked") { @@ -139,7 +144,7 @@ function generateTXT() { var fastcode = getFastCode(); - if(fastcode !== false) { + if (fastcode !== false) { data += "\r\n"; if (dolphin) data += "$"; else data += "\r\n"; @@ -149,31 +154,43 @@ function generateTXT() { } if (valueSelected) - downloadFile(data, document.getElementById("gameversion").value + ".txt"); + downloadFile(data, document.getElementById("sel-gamever").value + ".txt"); else alert("No cheat(s) selected!"); } function downloadCodes() { - if (document.getElementById("downloadformat").value === "gct") generateGCT(); + if (document.getElementById("sel-format").value === "gct") generateGCT(); else generateTXT(); } function updateCodelist() { + disableButtons(); + document.getElementById("sel-gamever").disabled = true; + resetDescription(); - document.getElementById("gameversion").disabled = true; - var buttons = document.getElementsByTagName("button"); - for (var i = 0; i < buttons.length; i++) buttons[i].disabled = true; - document.getElementById("checklist").innerHTML = ""; - var gameVersion = document.getElementById("gameversion").value; + document.getElementById("codelist").innerHTML = ""; + + let gameVersion = document.getElementById("sel-gamever").value; parseXML(gameVersion); updateFastCode(gameVersion); - document.getElementById("left").style.visibility = "visible"; - while (document.getElementsByClassName("initialhidden").length > 0) { - document.getElementsByClassName("initialhidden")[0].classList.remove("initialhidden"); + + toggleHiddenContainers(); +} + +function disableButtons() { + var buttons = document.getElementsByTagName("button"); + for (var i = 0; i < buttons.length; i++) buttons[i].disabled = true; +} + +function toggleHiddenContainers() { + let hiddenElements = document.querySelectorAll(".hidden"); + + for (let i = 0; i < hiddenElements.length; i++) { + if (hiddenElements[i].id !== "cc") hiddenElements[i].classList.remove("hidden"); } } -function updateDescription(s) { +function updateCodeDescription(s) { document.getElementById("descriptionbox").innerHTML = "
Author(s): " + atob(s.getAttribute("data-codeauthor")) + "
Version: " +
@@ -183,68 +200,59 @@ function updateDescription(s) {
}
function updateUIDescription(s) {
- if (s.id === "route_notext")
- document.getElementById("descriptionbox").innerHTML = "Remove Dialogue
Replaces all Dialogue with \"!!!\". 'Always' and 'Not in Pianta 5' will override the dialogue skip from the DPad Functions.
"; - else if (s.id === "route_nofmvs") - document.getElementById("descriptionbox").innerHTML = "Makes FMVs skippable. 'Always' has the same effect as the 'FMV Skips' code. Also, having 'FMV Skips' enabled will override 'Not in Pinna' - so don't use both simultaneously.
"; - else if (s.id === "route_order") - document.getElementById("descriptionbox").innerHTML = "The order in which levels are loaded:
The code loads levels in the order of the list.
The code picks levels at random, excluding levels that you’ve finished already.
The code picks levels at random, even levels that you’ve finished already.
"; - else if (s.id === "route_ending") - document.getElementById("descriptionbox").innerHTML = "What to do after you complete the final level on the list. This has no effect if the level order is set to Fully random.
"; - else if (s.id === "downloadformat") - document.getElementById("descriptionbox").innerHTML = "You can choose between 3 file formats:
Download a GCT file for use with Nintendont
Download a textfile containing the formatted codes for use with Dolphin. Copy the contents of the file on top of your games .ini file.
You can open the .ini file by right clicking the game in Dolphin. In the context menu select 'Properties' and then 'Edit configuration'.
Download the cheats in a textfile formatted for use with the Gecko Cheat Manager. Place the txt file in SD:/txtcodes/.
A zip archive containing pregenerated txt files with all available codes on this site can be downloaded here.
"; - else if (s.id === "stageloader") - document.getElementById("descriptionbox").innerHTML = "Select yes if you want to use a custom stage loader, which automatically loads the levels you choose, similiar to 'Fast Any%'.
"; + if (s && s.getAttribute("data-description")) + document.getElementById("descriptionbox").innerHTML = s.getAttribute("data-description"); } function resetDescription() { - document.getElementById("descriptionbox").innerHTML = "" + changelogData[i].getElementsByTagName("date")[0].textContent + ": ";
-
+
+ for (var i = 0, changeCount = 0; i < changelogData.length && changeCount < 3; i++) {
+ recentchanges += "
This page is a simple guide to explain the recommended way to install practice codes on your Nintendo Wii.
+ + + + + + + +This page is a simple guide to explain the recommended way to + install practice codes on your Nintendo Wii.
First of all you're gonna have to install Homebrew on your Wii. Make sure your SD card is formatted to FAT32 and then click this link for a detailed guide on how to get Homebrew on your Wii. Ignore the "So, what's next?" section.
+First of all you're gonna have to install Homebrew on your Wii. Make sure your SD card is formatted + to FAT32 and then click + this link for a detailed guide on how to get Homebrew on your Wii. Ignore the "So, what's next?" + section.
Using Nintendont is the recommended way to use practice codes. To download the most recent build you can click this link.
-Unpack the archive and place the Nintendont folder with all of its contents in the "apps" folder of your SD card. If there is no "apps" folder create one in the root of your SD card.
+Using Nintendont is the recommended way to + use practice codes. To download the most recent build you can click this link.
+Unpack the archive and place the Nintendont folder with all of its contents in the "apps" folder of your + SD card. If there is no "apps" folder create one in the root of your SD card.
Visit the main site and select your game version from the dropdown menu. Then select all the cheats you want to have enabled from the list, choose GCT as file format and hit "Download". The name of the file you downloaded should be "GMSX01.gct" with X being E, P or J depending on the version you selected.
+Visit the main site and select your game version from the dropdown + menu. Then select all the cheats you want to have enabled from the list, choose GCT as file format and hit + "Download". The name of the file you downloaded should be "GMSX01.gct" with X being E, P or J depending on the + version you selected.
Note: JP 1.0 and JP 1.1 both use the same ID (GMSJ01). To identify if you own JP 1.0 or 1.1 check the back of your disc. It'll read "DOL-GMSJ-0-00" for 1.0 and "DOL-GMSJ-0-01" for 1.1.
+Note: JP 1.0 and JP 1.1 both use the same ID (GMSJ01). To identify if you own JP 1.0 or 1.1 check the back + of your disc. It'll read "DOL-GMSJ-0-00" for 1.0 and "DOL-GMSJ-0-01" for 1.1.
Create a "codes" folder in the root of your SD card if there is none and copy the GCT file you just downloaded into that folder.
+Create a "codes" folder in the root of your SD card if there is none and copy the GCT file you just + downloaded into that folder.
Open your Homebrew channel and from there launch Nintendont. Select SD and then press B on your Gamecube controller to see the settings. In your settings, make sure that "Cheats" are "On". You can switch it on/off by pressing A on your controller. (See image below)
- +Open your Homebrew channel and from there launch Nintendont. Select SD and then press B on your Gamecube + controller to see the settings. In your settings, make sure that "Cheats" are "On". You can + switch it on/off by pressing A on your controller. (See image below)
+Press B again to return to the game list and launch your game. And with that you're done already.
Sample folder structure:
This can have multiple reasons:
The Cheat Manager is a homebrew application that allows you to generate GCTs on your Wii. This way you don't have to redownload your cheatfile everytime you want a different combination. However, you're gonna have to use a Wiimote to control the application
+The Cheat Manager is a homebrew application that allows you to generate GCTs on your Wii. This way you don't + have to redownload your cheatfile everytime you want a different combination. However, you're gonna have to use + a Wiimote to control the application
You can download the Cheat Manager from WiiBrew. Unzip the archive and copy the contents into the "apps" folder of your SD card.
+You can download the Cheat Manager from WiiBrew. Unzip the archive and copy the contents into the "apps" + folder of your SD card.
Using the generator on the main site, select all the codes you want to have available on the cheat manager and choose "Cheat Manager TXT" as file format instead of "GCT" to download a text file formatted for use with the cheat manager. Create a "txtcodes" folder in the root of your SD card if there is none and copy the generated text file into that folder. The name of the text file doesn't matter if you use this application, since the games ID is stored in the textfile.
+Using the generator on the main site, select all the codes you want to + have available on the cheat manager and choose "Cheat Manager TXT" as file format instead of + "GCT" to download a text file formatted for use with the cheat manager. Create a "txtcodes" + folder in the root of your SD card if there is none and copy the generated text file into that folder. The name + of the text file doesn't matter if you use this application, since the games ID is stored in the textfile.
Launch the cheat manager and grab your Wiimote. Navigate to your textfile using the DPad and select it with "A". On the following screen press "+" to activate and "-" to deactivate a cheat.
+Launch the cheat manager and grab your Wiimote. Navigate to your textfile using the DPad and select it with + "A". On the following screen press "+" to activate and "-" to deactivate a cheat.
After activating your desired codes press "1" to generate the GCT file. The cheatmanager then creates the GCT file in your "codes" folder, overwriting the old one if there's already a GCT with the same name. If you now launch the game with cheats active the new codes will be loaded.
+After activating your desired codes press "1" to generate the GCT file. The cheatmanager then creates + the GCT file in your "codes" folder, overwriting the old one if there's already a GCT with the same + name. If you now launch the game with cheats active the new codes will be loaded.
To use the codes with Dolphin choose "Dolphin INI" as file format instead of "GCT" to download the codes formatted for use with Dolphin. Then right click the game in Dolphin and click on "Properties" and on the bottom left corner of the property window click the "Edit configuration" button. Close the property window. Open the text file you downloaded and copy everything following the "[Gecko]" tag below the same tag in the configuration you just opened. If there is no "[Gecko]" tag (it should be the first tag), create one on top of your configuration file. Save and close the configuration file.
+To use the codes with Dolphin choose "Dolphin INI" as file format instead of "GCT" to download + the codes formatted for use with Dolphin. Then right click the game in Dolphin and click on "Properties" + and on the bottom left corner of the property window click the "Edit configuration" button. Close the + property window. Open the text file you downloaded and copy everything following the "[Gecko]" tag below + the same tag in the configuration you just opened. If there is no "[Gecko]" tag (it should be the first + tag), create one on top of your configuration file. Save and close the configuration file.
Reopen the property window, select the "Gecko-Codes" tab and check all the codes you want to be active. Most (but not all codes) will work with Dolphin. However, Dolphin has a code limit which is reached rather quickly. So if your game crashes right after it starts, you probably have too many codes active simultaneously.
-Reopen the property window, select the "Gecko-Codes" tab and check all the codes you want to be active. + Most (but not all codes) will work with Dolphin. However, Dolphin has a code limit which is reached rather + quickly. So if your game crashes right after it starts, you probably have too many codes active simultaneously. +
+