From 7ed98bb5e9600e2a93d3a852befafa216bb052b8 Mon Sep 17 00:00:00 2001 From: QbeRoot Date: Sun, 4 Feb 2018 00:20:10 +0100 Subject: [PATCH] added fastcode route endings --- changelog.html | 1 + gctGenerator.js | 21 +++++++++++++++------ index.html | 24 +++++++++++++++++------- style/style.css | 5 +++++ 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/changelog.html b/changelog.html index 68a55ef..ecaf061 100644 --- a/changelog.html +++ b/changelog.html @@ -15,6 +15,7 @@

Added "Random, no duplicates" order that will only load each stage once.

Exiting area or dying now reloads the current stage instead of moving on.

Added IW and ASIW presets.

+

Added options for what to do after the last level; removed Corona and Bowser from the regular level choices.

Feb 02, 2018

Site changes

Integrated Noki Doki’s Stage Loader into the Generator.

diff --git a/gctGenerator.js b/gctGenerator.js index e7d67e7..16f4d97 100644 --- a/gctGenerator.js +++ b/gctGenerator.js @@ -189,6 +189,8 @@ function updateUIDescription(s) { document.getElementById("descriptionbox").innerHTML = "

Skippable Cutscenes

Makes FMVs Skippable. 'Always' has the same effect as the 'FMV Skips' code. Also, having 'FMV Skips' enabled will override 'Not in Pinna 1' - so don't use both simultaneously.

"; else if (s.id === "route_order") document.getElementById("descriptionbox").innerHTML = "

Level Order

The order in which levels are loaded:

As specified

The code loads levels in the order of the list.

Random, no duplicates

The code picks levels at random, excluding levels that you’ve finished already.

Fully random

The code picks levels at random, even levels that you’ve finished already.

"; + else if (s.id === "route_ending") + document.getElementById("descriptionbox").innerHTML = "

Route Ending

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 = "

File Format

You can choose between 3 file formats:

GCT

Download a GCT file for use with Nintendont

Dolphin INI

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'.

Cheat Manager TXT

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") @@ -228,7 +230,6 @@ function updateChangelog() { * ****************************/ -'strict mode' const levels = document.querySelector("#route_levels"); const template = levels.lastElementChild; template.ondragstart = function() { return false; }; @@ -258,13 +259,19 @@ levels.addEventListener("click", function ({target: t}) { if (t.tagName.toUpperCase() === "BUTTON") levels.removeChild(t.parentNode); }) +document.querySelector("#route_ending").disabled = document.querySelector("#route_order").value === "random"; +document.querySelector("#route_order").addEventListener("change", function ({currentTarget: t}) { + document.querySelector("#route_ending").disabled = t.value === "random"; +}) + document.querySelector("#route_presets").addEventListener("change", function ({currentTarget: t}) { if (levels.childElementCount <= 1 || confirm("Loading a preset will erase your current list. Continue?")) { clearLevels(); - const preset = t.value; + const [preset, ending] = t.value.split(";"); for (let i = 0; i <= preset.length - 4; i += 4) appendLevel(preset.substr(i, 4)); + if (ending) document.querySelector("#route_ending").value = ending } - t.value = "" + t.value = ""; }) document.querySelector("#route_clear").addEventListener("click", function () { @@ -338,8 +345,8 @@ function getFastCode() { let game = JSON.parse(atob(document.getElementById("route_levels").getAttribute("data-json"))); const order = document.getElementById("route_order").value; - const levelWords = Math.ceil(levelCodes.length / 2); - const branchBase = 0x14 + 0x24 * (order !== 'list'); + const ending = document.getElementById("route_ending").value; + const branchBase = 0x1C + 0x24 * (order !== 'list'); const asm = []; asm.push("48" + ("00000" + (Math.ceil(levelCodes.length / 2) + 1 << 2 | 1).toString(16).toUpperCase()).slice(-6)); // bl to the code for (let i = levelCodes.length - 1; i >= 0; i -= 2) { @@ -380,7 +387,9 @@ function getFastCode() { } asm.push("2C030000"); // cmpwi r3, 0 - asm.push("4081" + ("000" + (branchBase + 4 * (order !== "random")).toString(16).toUpperCase()).slice(-4)); // ble- done + asm.push("4081000C"); // ble- 0x0C + asm.push("3860" + ending); // li r3, ending + asm.push("4800" + ("000" + (branchBase - 8 + 4 * (order !== "random")).toString(16).toUpperCase()).slice(-4)); // b done if (order !== "list") { asm.push("7CEC42E6"); // mftbl r7 diff --git a/index.html b/index.html index aa45169..6389a6d 100644 --- a/index.html +++ b/index.html @@ -105,6 +105,18 @@ + + + + + + + +
@@ -120,7 +132,6 @@ - @@ -212,7 +223,6 @@ - @@ -223,11 +233,11 @@