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