get-started: replace all var with let, use DEVICE_N3DS and DEVICE_O3DS defines

This commit is contained in:
lifehackerhansol 2023-05-30 10:56:51 -07:00
parent c5d5a1c5f8
commit d73f3d06fc
No known key found for this signature in database
GPG key ID: 80FB184AFC0B3B0E

View file

@ -5,6 +5,9 @@
SPDX-License-Identifier: MIT SPDX-License-Identifier: MIT
*/ */
const DEVICE_N3DS = 1;
const DEVICE_O3DS = 0;
// Soundhax // Soundhax
// 1.0-11.3, all regions, all consoles // 1.0-11.3, all regions, all consoles
function can_soundhax(major, minor, native, region, model) { function can_soundhax(major, minor, native, region, model) {
@ -45,11 +48,11 @@ function can_ssloth(major, minor, native, region, model) {
} else if (region == "K") { } else if (region == "K") {
if if
( (
(model && minor == 4 && native == 33) || (model == DEVICE_N3DS && minor == 4 && native == 33) ||
(model && minor == 5 && native == 34) || (model == DEVICE_N3DS && minor == 5 && native == 34) ||
(model && minor == 6 && native == 35) || (model == DEVICE_N3DS && minor == 6 && native == 35) ||
(model && minor == 7 && native == 35) || (model == DEVICE_N3DS && minor == 7 && native == 35) ||
(model && minor == 8 && native == 35) || (model == DEVICE_N3DS && minor == 8 && native == 35) ||
(minor == 9 && native == 36) || (minor == 9 && native == 36) ||
(minor == 10 && native == 37) || (minor == 10 && native == 37) ||
(minor == 12 && native == 38) || (minor == 12 && native == 38) ||
@ -73,7 +76,7 @@ function can_ssloth(major, minor, native, region, model) {
// Soundhax and SSLoth should be validated before this // Soundhax and SSLoth should be validated before this
function can_safecerthax(major, minor, native, region, model) { function can_safecerthax(major, minor, native, region, model) {
let do_redirect = false; let do_redirect = false;
if (model == 0) { if (model == DEVICE_O3DS) {
if (major <= 10) do_redirect = true; if (major <= 10) do_redirect = true;
else if (major == 11 && minor <= 14) do_redirect = true; else if (major == 11 && minor <= 14) do_redirect = true;
} }
@ -93,7 +96,7 @@ function can_superskaterhax(major, minor, native, region, model) {
let do_redirect_sysupdate = false; let do_redirect_sysupdate = false;
let do_redirect = false; let do_redirect = false;
// N3DS only // N3DS only
if(model == 1) { if(model == DEVICE_N3DS) {
if (major == 11) { if (major == 11) {
if (["E", "J", "U"].includes(region)) { if (["E", "J", "U"].includes(region)) {
if (minor == 17) do_redirect = true; if (minor == 17) do_redirect = true;
@ -124,13 +127,14 @@ function can_superskaterhax(major, minor, native, region, model) {
function can_miimine(major, minor, native, region, model) { function can_miimine(major, minor, native, region, model) {
let do_redirect = false; let do_redirect = false;
if (major == 11) { if (model == DEVICE_O3DS) {
if (model == 0 && minor == 15) { if (major == 11 && minor == 15) {
// KOR and TWN can do normal seedminer // KOR and TWN can do normal seedminer
// All other O3DS must Mii mine // All other O3DS must Mii mine
if (region != "K" && region != "T") do_redirect = true; if (region != "K" && region != "T") do_redirect = true;
} }
} }
if (do_redirect) { if (do_redirect) {
window.location.href = "seedminer-(mii)"; window.location.href = "seedminer-(mii)";
return true; return true;
@ -150,8 +154,8 @@ function can_seedminer(major, minor, native, region, model) {
else if (region == "T") do_redirect_twn = true; else if (region == "T") do_redirect_twn = true;
} }
// KOR O3DS on any version should update to 11.16 // KOR O3DS on any version should update to 11.16
else if (model == 0 && region == "K") do_redirect_sysupdate_kor = true; else if (model == DEVICE_O3DS && region == "K") do_redirect_sysupdate_kor = true;
// KOR O3DS on any version should update to 11.16 // TWN on any version should update to 11.16
else if (region == "T") do_redirect_sysupdate_twn = true; else if (region == "T") do_redirect_sysupdate_twn = true;
if (do_redirect_sysupdate_twn) { if (do_redirect_sysupdate_twn) {
@ -199,12 +203,12 @@ function can_seedminer(major, minor, native, region, model) {
- Unhackable - Unhackable
*/ */
function redirect() { function redirect() {
var major = document.getElementById("major"); let major = document.getElementById("major");
var minor = document.getElementById("minor"); let minor = document.getElementById("minor");
var nver = document.getElementById("nver"); let nver = document.getElementById("nver");
var region = document.getElementById("region"); let region = document.getElementById("region");
var isN3DS = document.getElementById("new3DS").checked; let isN3DS = document.getElementById("new3DS").checked;
var isO3DS = document.getElementById("old3DS").checked; let isO3DS = document.getElementById("old3DS").checked;
document.getElementById("result_noneSelected").style.display = "none"; document.getElementById("result_noneSelected").style.display = "none";
document.getElementById("result_invalidVersion").style.display = "none"; document.getElementById("result_invalidVersion").style.display = "none";
document.getElementById("result_methodUnavailable").style.display = "none"; document.getElementById("result_methodUnavailable").style.display = "none";
@ -217,10 +221,10 @@ function redirect() {
return; return;
} }
// O3DS = 0 // Realistically only one of these should be possible with the given elements
// N3DS = 1 let model = -1;
var model = 0; if(isO3DS) model = DEVICE_O3DS
if(isN3DS) model = 1; else if(isN3DS) model = DEVICE_N3DS;
let redirected = [ let redirected = [
can_soundhax, can_soundhax,