Save 5KiB heap space from pcv; Separate configurator entries with tabs
This commit is contained in:
@@ -73,7 +73,7 @@ Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW.
|
|||||||
| GPU OC | 1305 MHz Max | N/A |
|
| GPU OC | 1305 MHz Max | N/A |
|
||||||
| RAM OC | 1996 MHz Max | 1862 MHz Max |
|
| RAM OC | 1996 MHz Max | 1862 MHz Max |
|
||||||
| RAM Volt | Disabled | Disabled |
|
| RAM Volt | Disabled | Disabled |
|
||||||
| RAM Timing | Auto-Adjusted | Disabled |
|
| RAM Timing | Auto-Adjusted | N/A |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,6 @@ void SafetyCheck() {
|
|||||||
{ C.commonEmcMemVolt, 1100'000, 1250'000 },
|
{ C.commonEmcMemVolt, 1100'000, 1250'000 },
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("marikoCpuMaxClock: %u\n", C.marikoCpuMaxClock);
|
|
||||||
|
|
||||||
for (auto& i : validators) {
|
for (auto& i : validators) {
|
||||||
if (R_FAILED(i.check()))
|
if (R_FAILED(i.check()))
|
||||||
CRASH("Triggered");
|
CRASH("Triggered");
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ def file_replace_str(file_path, search_replace_list):
|
|||||||
|
|
||||||
dir_path = os.path.dirname(__file__)
|
dir_path = os.path.dirname(__file__)
|
||||||
|
|
||||||
ldr_main = os.path.join(dir_path, "ldr_main.cpp")
|
os.chdir(dir_path)
|
||||||
file_replace_str(ldr_main, [("constinit u8 g_heap_memory[16_KB];", "constinit u8 g_heap_memory[16_KB + 5_KB];")])
|
os.system("git reset --hard")
|
||||||
|
|
||||||
ldr_process_creation = os.path.join(dir_path, "ldr_process_creation.cpp")
|
ldr_process_creation = os.path.join(dir_path, "ldr_process_creation.cpp")
|
||||||
file_replace_str(ldr_process_creation,
|
file_replace_str(ldr_process_creation,
|
||||||
|
|||||||
56
pages/dist/index.html
vendored
56
pages/dist/index.html
vendored
@@ -4,12 +4,43 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Switch OC Suite > Project Homepage | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
<title>Switch OC Suite | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
||||||
</title>
|
</title>
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
||||||
<style>
|
<style>
|
||||||
|
nav[role="tab-control"] > button {
|
||||||
|
border-radius: 0;
|
||||||
|
border-left-width: calc(var(--border-width) / 2);
|
||||||
|
border-right-width: calc(var(--border-width) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:first-child {
|
||||||
|
border-top-left-radius: var(--border-radius);
|
||||||
|
border-bottom-left-radius: var(--border-radius);
|
||||||
|
border-left-width: var(--border-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:last-child {
|
||||||
|
border-top-right-radius: var(--border-radius);
|
||||||
|
border-bottom-right-radius: var(--border-radius);
|
||||||
|
border-right-width: var(--border-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:not(.secondary) {
|
||||||
|
pointer-events: none;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cust-element {
|
||||||
|
margin: 1.5rem 0 1.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cust-element > blockquote {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
div#download_btn_grid > a {
|
div#download_btn_grid > a {
|
||||||
margin: 0.5rem 0;
|
margin: 0.5rem 0;
|
||||||
}
|
}
|
||||||
@@ -50,7 +81,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h2>Read Me</h2>
|
<h2>Read Me</h2>
|
||||||
<h3>DISCLAIMER: 🚨USE AT YOUR OWN RISK!🚨</h3>
|
<h3>🚨DISCLAIMER: THIS IS PROVIDED AS IS. USE AT YOUR OWN RISK!🚨</h3>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<li>
|
<li>
|
||||||
Overclocking in general will shorten the lifespan of some
|
Overclocking in general will shorten the lifespan of some
|
||||||
@@ -337,15 +368,22 @@
|
|||||||
<header>
|
<header>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h2>Configurator</h2>
|
<h2>Configurator</h2>
|
||||||
<h3>Configure frequencies and voltages to suit your hardware and yourself.</h3>
|
<h3>Configure frequencies and voltages to suit your hardware and preferences.</h3>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
</header>
|
</header>
|
||||||
<form id="form">
|
<body>
|
||||||
<label for="file">File loader.kip
|
<nav role="tab-control">
|
||||||
<input id="file" type="file">
|
<button class="" id="tab_all" data-filter="0" disabled>Show All</button>
|
||||||
<small id="cust_rev"></small>
|
<button class="outline secondary" id="tab_erista" data-filter="1" disabled>For Erista</button>
|
||||||
</label>
|
<button class="outline secondary" id="tab_mariko" data-filter="2" disabled>For Mariko</button>
|
||||||
</form>
|
</nav>
|
||||||
|
<form id="form">
|
||||||
|
<label for="file">
|
||||||
|
<input id="file" type="file">
|
||||||
|
<p id="cust_rev">Upload loader.kip here</p>
|
||||||
|
</label>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
<footer>
|
<footer>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<button id="load_default" role="button" disabled>Load Default</button>
|
<button id="load_default" role="button" disabled>Load Default</button>
|
||||||
|
|||||||
145
pages/dist/main.js
vendored
145
pages/dist/main.js
vendored
@@ -10,10 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
/* Config: Cust */
|
/* Config: Cust */
|
||||||
const CUST_REV = 3;
|
const CUST_REV = 3;
|
||||||
var buffer;
|
var buffer;
|
||||||
|
var CustPlatform;
|
||||||
|
(function (CustPlatform) {
|
||||||
|
CustPlatform[CustPlatform["Undefined"] = 0] = "Undefined";
|
||||||
|
CustPlatform[CustPlatform["Erista"] = 1] = "Erista";
|
||||||
|
CustPlatform[CustPlatform["Mariko"] = 2] = "Mariko";
|
||||||
|
CustPlatform[CustPlatform["All"] = 3] = "All";
|
||||||
|
})(CustPlatform || (CustPlatform = {}));
|
||||||
|
;
|
||||||
class CustEntry {
|
class CustEntry {
|
||||||
constructor(id, name, size, desc, defval, minmax = [0, 1000000], step = 1, zeroable = true) {
|
constructor(id, name, platform, size, desc, defval, minmax = [0, 1000000], step = 1, zeroable = true) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.platform = platform;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
this.defval = defval;
|
this.defval = defval;
|
||||||
@@ -21,14 +30,12 @@ class CustEntry {
|
|||||||
this.max = minmax[1];
|
this.max = minmax[1];
|
||||||
this.step = step;
|
this.step = step;
|
||||||
this.zeroable = zeroable;
|
this.zeroable = zeroable;
|
||||||
this.value = null;
|
|
||||||
this.offset = null;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
validate() {
|
validate() {
|
||||||
let tip = new ErrorToolTip(this.id);
|
let tip = new ErrorToolTip(this.id);
|
||||||
tip.clear();
|
tip.clear();
|
||||||
if (Number.isNaN(this.value) || this.value === null) {
|
if (Number.isNaN(this.value) || !this.value) {
|
||||||
tip.setMsg(`Invalid value: Not a number`);
|
tip.setMsg(`Invalid value: Not a number`);
|
||||||
tip.show();
|
tip.show();
|
||||||
return false;
|
return false;
|
||||||
@@ -48,21 +55,24 @@ class CustEntry {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
update() {
|
|
||||||
this.value = Number(document.getElementById(this.id).value);
|
|
||||||
}
|
|
||||||
getInputElement() {
|
getInputElement() {
|
||||||
return document.getElementById(this.id);
|
return document.getElementById(this.id);
|
||||||
}
|
}
|
||||||
createForm() {
|
updateValueFromElement() {
|
||||||
|
this.value = Number(this.getInputElement().value);
|
||||||
|
}
|
||||||
|
isAvailableFor(platform) {
|
||||||
|
return platform === CustPlatform.Undefined || this.platform === platform || this.platform === CustPlatform.All;
|
||||||
|
}
|
||||||
|
createElement() {
|
||||||
let form = document.getElementById("form");
|
let form = document.getElementById("form");
|
||||||
let input = this.getInputElement();
|
let input = this.getInputElement();
|
||||||
if (!input) {
|
if (!input) {
|
||||||
let grid = document.createElement("div");
|
let grid = document.createElement("div");
|
||||||
grid.classList.add("grid");
|
grid.classList.add("grid", "cust-element");
|
||||||
// Label and input
|
// Label and input
|
||||||
input = document.createElement("input");
|
input = document.createElement("input");
|
||||||
input.min = String(this.min);
|
input.min = String(this.zeroable ? 0 : this.min);
|
||||||
input.max = String(this.max);
|
input.max = String(this.max);
|
||||||
input.id = this.id;
|
input.id = this.id;
|
||||||
input.type = "number";
|
input.type = "number";
|
||||||
@@ -74,49 +84,62 @@ class CustEntry {
|
|||||||
grid.appendChild(label);
|
grid.appendChild(label);
|
||||||
// Description in blockquote style
|
// Description in blockquote style
|
||||||
let desc = document.createElement("blockquote");
|
let desc = document.createElement("blockquote");
|
||||||
desc.style["margin-top"] = "0";
|
|
||||||
desc.innerHTML = this.desc;
|
desc.innerHTML = this.desc;
|
||||||
desc.setAttribute("for", this.id);
|
desc.setAttribute("for", this.id);
|
||||||
grid.appendChild(desc);
|
grid.appendChild(desc);
|
||||||
grid.style["margin-top"] = "3rem";
|
|
||||||
form.appendChild(grid);
|
form.appendChild(grid);
|
||||||
let tooltip = new ErrorToolTip(this.id);
|
let tooltip = new ErrorToolTip(this.id);
|
||||||
tooltip.addChangeListener();
|
tooltip.addChangeListener();
|
||||||
}
|
}
|
||||||
input.value = String(this.value);
|
input.value = String(this.value);
|
||||||
}
|
}
|
||||||
clearForm() {
|
setElementDefaultValue() {
|
||||||
|
document.getElementById(this.id).value = String(this.defval);
|
||||||
|
}
|
||||||
|
removeElement() {
|
||||||
let input = this.getInputElement();
|
let input = this.getInputElement();
|
||||||
if (input) {
|
if (input) {
|
||||||
input.parentElement.parentElement.remove();
|
input.parentElement.parentElement.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
showElement() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement.parentElement.style.removeProperty("display");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hideElement() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement.parentElement.style.setProperty("display", "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var CustTable = [
|
var CustTable = [
|
||||||
new CustEntry("mtcConf", "DRAM Timing", 2, "<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
new CustEntry("mtcConf", "DRAM Timing", CustPlatform.Mariko, 2, "<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
||||||
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.", 0, [0, 2], 1),
|
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.", 0, [0, 2], 1),
|
||||||
new CustEntry("marikoCpuMaxClock", "Mariko CPU Max Clock in kHz", 4, "<li>System default: 1785000</li>\
|
new CustEntry("marikoCpuMaxClock", "Mariko CPU Max Clock in kHz", CustPlatform.Mariko, 4, "<li>System default: 1785000</li>\
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>", 2397000, [1785000, 3000000], 1),
|
<li>2397000 might be unreachable for some SoCs.</li>", 2397000, [1785000, 3000000], 1),
|
||||||
new CustEntry("marikoCpuBoostClock", "Mariko CPU Boost Clock in kHz", 4, "<li>System default: 1785000</li>\
|
new CustEntry("marikoCpuBoostClock", "Mariko CPU Boost Clock in kHz", CustPlatform.Mariko, 4, "<li>System default: 1785000</li>\
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
||||||
<li>This will be set regardless of whether sys-clk is enabled.</li>", 1785000, [1020000, 3000000], 1, false),
|
<li>This will be set regardless of whether sys-clk is enabled.</li>", 1785000, [1020000, 3000000], 1, false),
|
||||||
new CustEntry("marikoCpuMaxVolt", "Mariko CPU Max Voltage in mV", 4, "<li>System default: 1120</li>\
|
new CustEntry("marikoCpuMaxVolt", "Mariko CPU Max Voltage in mV", CustPlatform.Mariko, 4, "<li>System default: 1120</li>\
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 5),
|
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 5),
|
||||||
new CustEntry("marikoGpuMaxClock", "Mariko GPU Max Clock in kHz", 4, "<li>System default: 921600</li>\
|
new CustEntry("marikoGpuMaxClock", "Mariko GPU Max Clock in kHz", CustPlatform.Mariko, 4, "<li>System default: 921600</li>\
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
<li>Tegra X1+ official maximum: 1267200</li>\
|
||||||
<li>1305600 might be unreachable for some SoCs.</li>", 1305600, [768000, 1536000], 100),
|
<li>1305600 might be unreachable for some SoCs.</li>", 1305600, [768000, 1536000], 100),
|
||||||
new CustEntry("marikoEmcMaxClock", "Mariko RAM Max Clock in kHz", 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
new CustEntry("marikoEmcMaxClock", "Mariko RAM Max Clock in kHz", CustPlatform.Mariko, 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1996800, [1600000, 2400000], 3200),
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1996800, [1600000, 2400000], 3200),
|
||||||
new CustEntry("marikoEmcVddqVolt", "EMC Vddq (Mariko Only) Voltage in uV", 4, "<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
new CustEntry("marikoEmcVddqVolt", "EMC Vddq (Mariko Only) Voltage in uV", CustPlatform.Mariko, 4, "<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
||||||
<li>Value should be divided evenly by 5000</li>\
|
<li>Value should be divided evenly by 5000</li>\
|
||||||
<li>Default: 600000</li>\
|
<li>Default: 600000</li>\
|
||||||
<li>Not enabled by default.</li>\
|
<li>Not enabled by default.</li>\
|
||||||
<li>This will not work without sys-clk-OC.</li>", 0, [550000, 650000], 5000),
|
<li>This will not work without sys-clk-OC.</li>", 0, [550000, 650000], 5000),
|
||||||
new CustEntry("eristaCpuMaxVolt", "Erista CPU Max Voltage in mV", 4, "<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 1),
|
new CustEntry("eristaCpuMaxVolt", "Erista CPU Max Voltage in mV", CustPlatform.Erista, 4, "<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 1),
|
||||||
new CustEntry("eristaEmcMaxClock", "Erista RAM Max Clock in kHz", 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
new CustEntry("eristaEmcMaxClock", "Erista RAM Max Clock in kHz", CustPlatform.Erista, 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1862400, [1600000, 2400000], 3200),
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1862400, [1600000, 2400000], 3200),
|
||||||
new CustEntry("commonEmcMemVolt", "EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV", 4, "<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
new CustEntry("commonEmcMemVolt", "EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV", CustPlatform.All, 4, "<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
||||||
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
||||||
<li>Mariko Default: 1100000 (It will not work without sys-clk-OC)</li>\
|
<li>Mariko Default: 1100000 (It will not work without sys-clk-OC)</li>\
|
||||||
<li>Not enabled by default</li>", 0, [1100000, 1250000], 12500),
|
<li>Not enabled by default</li>", 0, [1100000, 1250000], 12500),
|
||||||
@@ -175,9 +198,9 @@ class ErrorToolTip {
|
|||||||
function SaveCust(buffer) {
|
function SaveCust(buffer) {
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let storage = {};
|
let storage = {};
|
||||||
for (let i of CustTable) {
|
CustTable.forEach(i => {
|
||||||
i.update();
|
i.updateValueFromElement();
|
||||||
if (!i.validate() || i.value === null) {
|
if (!i.validate() || !i.value) {
|
||||||
document.getElementById(i.id).focus();
|
document.getElementById(i.id).focus();
|
||||||
throw new Error(`Invalid ${i.name}`);
|
throw new Error(`Invalid ${i.name}`);
|
||||||
}
|
}
|
||||||
@@ -198,7 +221,7 @@ function SaveCust(buffer) {
|
|||||||
throw new Error(`Unknown size at ${i.name}`);
|
throw new Error(`Unknown size at ${i.name}`);
|
||||||
}
|
}
|
||||||
storage[i.id] = i.value;
|
storage[i.id] = i.value;
|
||||||
}
|
});
|
||||||
storage["custRev"] = CUST_REV;
|
storage["custRev"] = CUST_REV;
|
||||||
localStorage.setItem("last_saved", JSON.stringify(storage));
|
localStorage.setItem("last_saved", JSON.stringify(storage));
|
||||||
let a = document.createElement("a");
|
let a = document.createElement("a");
|
||||||
@@ -218,43 +241,42 @@ function LastSaved() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function LoadLastSaved() {
|
function CustNavTabsInit() {
|
||||||
if (LastSaved()) {
|
const custNavTabs = Array.from(document.querySelectorAll(`nav[role="tab-control"] > button`));
|
||||||
let storage = localStorage.getItem("last_saved");
|
custNavTabs.forEach(i => {
|
||||||
let sObj = JSON.parse(storage);
|
i.removeAttribute("disabled");
|
||||||
for (let key in sObj) {
|
let platform = Number(i.getAttribute("data-filter"));
|
||||||
if (key == "custRev") {
|
i.addEventListener('click', (_evt) => {
|
||||||
continue;
|
const unfocusedClasses = ["outline", "secondary"];
|
||||||
}
|
i.classList.remove(...unfocusedClasses);
|
||||||
document.getElementById(key).value = sObj[key];
|
custNavTabs.filter(j => j != i).forEach(k => k.classList.add(...unfocusedClasses));
|
||||||
}
|
CustTable.forEach(e => {
|
||||||
}
|
if (e.isAvailableFor(platform)) {
|
||||||
}
|
e.showElement();
|
||||||
function LoadDefault() {
|
}
|
||||||
for (let i of CustTable) {
|
else {
|
||||||
document.getElementById(i.id).value = String(i.defval);
|
e.hideElement();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
function ClearHTMLForm() {
|
});
|
||||||
for (let i of CustTable) {
|
});
|
||||||
i.clearForm();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function UpdateHTMLForm() {
|
function UpdateHTMLForm() {
|
||||||
for (let i of CustTable) {
|
CustTable.forEach(i => i.createElement());
|
||||||
i.createForm();
|
|
||||||
}
|
|
||||||
let default_btn = document.getElementById("load_default");
|
let default_btn = document.getElementById("load_default");
|
||||||
default_btn.removeAttribute("disabled");
|
default_btn.removeAttribute("disabled");
|
||||||
default_btn.addEventListener('click', () => {
|
default_btn.addEventListener('click', () => {
|
||||||
LoadDefault();
|
CustTable.forEach(i => i.setElementDefaultValue());
|
||||||
});
|
});
|
||||||
let last_btn = document.getElementById("load_saved");
|
let last_btn = document.getElementById("load_saved");
|
||||||
if (LastSaved()) {
|
if (LastSaved()) {
|
||||||
last_btn.style.removeProperty("display");
|
last_btn.style.removeProperty("display");
|
||||||
last_btn.removeAttribute("disabled");
|
last_btn.removeAttribute("disabled");
|
||||||
last_btn.addEventListener('click', () => {
|
last_btn.addEventListener('click', () => {
|
||||||
LoadLastSaved();
|
// Load last saved from localStorage
|
||||||
|
JSON.parse(localStorage.getItem("last_saved"))
|
||||||
|
.filter((key) => key != "custRev")
|
||||||
|
.forEach((key) => document.getElementById(key).value = key);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -276,12 +298,12 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let offset = magicOffset + 4;
|
let offset = magicOffset + 4;
|
||||||
let rev = view.getUint16(offset, true);
|
let rev = view.getUint16(offset, true);
|
||||||
|
offset += 2;
|
||||||
if (rev != CUST_REV) {
|
if (rev != CUST_REV) {
|
||||||
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
||||||
}
|
}
|
||||||
document.getElementById("cust_rev").innerHTML = `Cust V${CUST_REV} is loaded.`;
|
document.getElementById("cust_rev").innerHTML = `Cust V${CUST_REV} is loaded.`;
|
||||||
offset += 2;
|
CustTable.forEach(i => {
|
||||||
for (let i of CustTable) {
|
|
||||||
i.offset = offset;
|
i.offset = offset;
|
||||||
switch (i.size) {
|
switch (i.size) {
|
||||||
case 2:
|
case 2:
|
||||||
@@ -296,7 +318,7 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
}
|
}
|
||||||
offset += i.size;
|
offset += i.size;
|
||||||
i.validate();
|
i.validate();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
const fileInput = document.getElementById("file");
|
const fileInput = document.getElementById("file");
|
||||||
fileInput.addEventListener('change', (event) => {
|
fileInput.addEventListener('change', (event) => {
|
||||||
@@ -304,11 +326,12 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
reader.readAsArrayBuffer(event.target.files[0]);
|
reader.readAsArrayBuffer(event.target.files[0]);
|
||||||
reader.onloadend = (progEvent) => {
|
reader.onloadend = (progEvent) => {
|
||||||
if (progEvent.target.readyState === FileReader.DONE) {
|
if (progEvent.target.readyState === FileReader.DONE) {
|
||||||
buffer = progEvent.target.result;
|
buffer = (progEvent.target.result);
|
||||||
try {
|
try {
|
||||||
let offset = FindMagicOffset(buffer);
|
let offset = FindMagicOffset(buffer);
|
||||||
ClearHTMLForm();
|
CustTable.forEach(i => i.removeElement());
|
||||||
ParseCust(offset, buffer);
|
ParseCust(offset, buffer);
|
||||||
|
CustNavTabsInit();
|
||||||
UpdateHTMLForm();
|
UpdateHTMLForm();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -333,21 +356,21 @@ function fetchRelease() {
|
|||||||
}
|
}
|
||||||
const resultFromSuite = yield responseFromSuite.json();
|
const resultFromSuite = yield responseFromSuite.json();
|
||||||
const latestVerFromSuite = resultFromSuite.tag_name;
|
const latestVerFromSuite = resultFromSuite.tag_name;
|
||||||
const correspondingVerFromAMS = latestVerFromSuite.split(".").slice(0, 3).join(".");
|
const amsVer = latestVerFromSuite.split(".").slice(0, 3).join(".");
|
||||||
const loaderKip = resultFromSuite.assets.filter((obj) => {
|
const loaderKip = resultFromSuite.assets.filter((obj) => {
|
||||||
return obj.name.endsWith("loader.kip");
|
return obj.name.endsWith("loader.kip");
|
||||||
})[0];
|
})[0];
|
||||||
const sdOut = resultFromSuite.assets.filter((obj) => {
|
const sdOut = resultFromSuite.assets.filter((obj) => {
|
||||||
return obj.name.endsWith(".zip");
|
return obj.name.endsWith(".zip");
|
||||||
})[0];
|
})[0];
|
||||||
const amsReleaseUrl = `https://github.com/Atmosphere-NX/Atmosphere/releases/tags/${correspondingVerFromAMS}`;
|
const amsReleaseUrl = `https://github.com/Atmosphere-NX/Atmosphere/releases/tags/${amsVer}`;
|
||||||
let info = {
|
let info = {
|
||||||
OCSuiteVer: latestVerFromSuite,
|
OCSuiteVer: latestVerFromSuite,
|
||||||
LoaderKipUrl: loaderKip.browser_download_url,
|
LoaderKipUrl: loaderKip.browser_download_url,
|
||||||
LoaderKipTime: loaderKip.updated_at,
|
LoaderKipTime: loaderKip.updated_at,
|
||||||
SdOutZipUrl: sdOut.browser_download_url,
|
SdOutZipUrl: sdOut.browser_download_url,
|
||||||
SdOutZipTime: sdOut.updated_at,
|
SdOutZipTime: sdOut.updated_at,
|
||||||
AMSVer: correspondingVerFromAMS,
|
AMSVer: amsVer,
|
||||||
AMSUrl: amsReleaseUrl
|
AMSUrl: amsReleaseUrl
|
||||||
};
|
};
|
||||||
return info;
|
return info;
|
||||||
|
|||||||
@@ -4,12 +4,43 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Switch OC Suite > Project Homepage | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
<title>Switch OC Suite | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
||||||
</title>
|
</title>
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
||||||
<style>
|
<style>
|
||||||
|
nav[role="tab-control"] > button {
|
||||||
|
border-radius: 0;
|
||||||
|
border-left-width: calc(var(--border-width) / 2);
|
||||||
|
border-right-width: calc(var(--border-width) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:first-child {
|
||||||
|
border-top-left-radius: var(--border-radius);
|
||||||
|
border-bottom-left-radius: var(--border-radius);
|
||||||
|
border-left-width: var(--border-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:last-child {
|
||||||
|
border-top-right-radius: var(--border-radius);
|
||||||
|
border-bottom-right-radius: var(--border-radius);
|
||||||
|
border-right-width: var(--border-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav[role="tab-control"] > button:not(.secondary) {
|
||||||
|
pointer-events: none;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cust-element {
|
||||||
|
margin: 1.5rem 0 1.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cust-element > blockquote {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
div#download_btn_grid > a {
|
div#download_btn_grid > a {
|
||||||
margin: 0.5rem 0;
|
margin: 0.5rem 0;
|
||||||
}
|
}
|
||||||
@@ -50,7 +81,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h2>Read Me</h2>
|
<h2>Read Me</h2>
|
||||||
<h3>DISCLAIMER: 🚨USE AT YOUR OWN RISK!🚨</h3>
|
<h3>🚨DISCLAIMER: THIS IS PROVIDED AS IS. USE AT YOUR OWN RISK!🚨</h3>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<li>
|
<li>
|
||||||
Overclocking in general will shorten the lifespan of some
|
Overclocking in general will shorten the lifespan of some
|
||||||
@@ -337,15 +368,22 @@
|
|||||||
<header>
|
<header>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h2>Configurator</h2>
|
<h2>Configurator</h2>
|
||||||
<h3>Configure frequencies and voltages to suit your hardware and yourself.</h3>
|
<h3>Configure frequencies and voltages to suit your hardware and preferences.</h3>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
</header>
|
</header>
|
||||||
<form id="form">
|
<body>
|
||||||
<label for="file">File loader.kip
|
<nav role="tab-control">
|
||||||
<input id="file" type="file">
|
<button class="" id="tab_all" data-filter="0" disabled>Show All</button>
|
||||||
<small id="cust_rev"></small>
|
<button class="outline secondary" id="tab_erista" data-filter="1" disabled>For Erista</button>
|
||||||
</label>
|
<button class="outline secondary" id="tab_mariko" data-filter="2" disabled>For Mariko</button>
|
||||||
</form>
|
</nav>
|
||||||
|
<form id="form">
|
||||||
|
<label for="file">
|
||||||
|
<input id="file" type="file">
|
||||||
|
<p id="cust_rev">Upload loader.kip here</p>
|
||||||
|
</label>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
<footer>
|
<footer>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<button id="load_default" role="button" disabled>Load Default</button>
|
<button id="load_default" role="button" disabled>Load Default</button>
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
/* Config: Cust */
|
/* Config: Cust */
|
||||||
const CUST_REV = 3;
|
const CUST_REV = 3;
|
||||||
var buffer: string | ArrayBuffer;
|
var buffer: ArrayBuffer;
|
||||||
|
|
||||||
|
enum CustPlatform {
|
||||||
|
Undefined = 0,
|
||||||
|
Erista = 1,
|
||||||
|
Mariko = 2,
|
||||||
|
All = 3,
|
||||||
|
};
|
||||||
|
|
||||||
class CustEntry {
|
class CustEntry {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
platform: CustPlatform;
|
||||||
size: number;
|
size: number;
|
||||||
desc: string;
|
desc: string;
|
||||||
defval: number;
|
defval: number;
|
||||||
@@ -12,12 +20,13 @@ class CustEntry {
|
|||||||
max: number;
|
max: number;
|
||||||
step: number; // also as quotient
|
step: number; // also as quotient
|
||||||
zeroable: boolean;
|
zeroable: boolean;
|
||||||
value: number | null;
|
value?: number;
|
||||||
offset: number | null;
|
offset?: number;
|
||||||
|
|
||||||
constructor(id: string, name: string, size: number, desc: string, defval: number, minmax: [number, number] = [0, 1_000_000], step: number = 1, zeroable: boolean = true) {
|
constructor(id: string, name: string, platform: CustPlatform, size: number, desc: string, defval: number, minmax: [number, number] = [0, 1_000_000], step: number = 1, zeroable: boolean = true) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.platform = platform;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
this.defval = defval;
|
this.defval = defval;
|
||||||
@@ -25,14 +34,12 @@ class CustEntry {
|
|||||||
this.max = minmax[1];
|
this.max = minmax[1];
|
||||||
this.step = step;
|
this.step = step;
|
||||||
this.zeroable = zeroable;
|
this.zeroable = zeroable;
|
||||||
this.value = null;
|
|
||||||
this.offset = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
validate(): boolean {
|
validate(): boolean {
|
||||||
let tip = new ErrorToolTip(this.id);
|
let tip = new ErrorToolTip(this.id);
|
||||||
tip.clear();
|
tip.clear();
|
||||||
if (Number.isNaN(this.value) || this.value === null) {
|
if (Number.isNaN(this.value) || !this.value) {
|
||||||
tip.setMsg(`Invalid value: Not a number`);
|
tip.setMsg(`Invalid value: Not a number`);
|
||||||
tip.show();
|
tip.show();
|
||||||
return false;
|
return false;
|
||||||
@@ -52,24 +59,28 @@ class CustEntry {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
update() {
|
|
||||||
this.value = Number((document.getElementById(this.id) as HTMLInputElement).value);
|
|
||||||
}
|
|
||||||
|
|
||||||
getInputElement(): HTMLInputElement | null {
|
getInputElement(): HTMLInputElement | null {
|
||||||
return document.getElementById(this.id) as HTMLInputElement;
|
return document.getElementById(this.id) as HTMLInputElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
createForm() {
|
updateValueFromElement() {
|
||||||
|
this.value = Number(this.getInputElement()!.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
isAvailableFor(platform: CustPlatform): boolean {
|
||||||
|
return platform === CustPlatform.Undefined || this.platform === platform || this.platform === CustPlatform.All;
|
||||||
|
}
|
||||||
|
|
||||||
|
createElement() {
|
||||||
let form = document.getElementById("form")!;
|
let form = document.getElementById("form")!;
|
||||||
let input = this.getInputElement();
|
let input = this.getInputElement();
|
||||||
if (!input) {
|
if (!input) {
|
||||||
let grid = document.createElement("div");
|
let grid = document.createElement("div");
|
||||||
grid.classList.add("grid");
|
grid.classList.add("grid", "cust-element");
|
||||||
|
|
||||||
// Label and input
|
// Label and input
|
||||||
input = document.createElement("input");
|
input = document.createElement("input");
|
||||||
input.min = String(this.min);
|
input.min = String(this.zeroable ? 0 : this.min);
|
||||||
input.max = String(this.max);
|
input.max = String(this.max);
|
||||||
input.id = this.id;
|
input.id = this.id;
|
||||||
input.type = "number";
|
input.type = "number";
|
||||||
@@ -82,32 +93,49 @@ class CustEntry {
|
|||||||
|
|
||||||
// Description in blockquote style
|
// Description in blockquote style
|
||||||
let desc = document.createElement("blockquote");
|
let desc = document.createElement("blockquote");
|
||||||
desc.style["margin-top"] = "0";
|
|
||||||
desc.innerHTML = this.desc;
|
desc.innerHTML = this.desc;
|
||||||
desc.setAttribute("for", this.id);
|
desc.setAttribute("for", this.id);
|
||||||
grid.appendChild(desc);
|
grid.appendChild(desc);
|
||||||
|
|
||||||
grid.style["margin-top"] = "3rem";
|
|
||||||
form.appendChild(grid);
|
form.appendChild(grid);
|
||||||
|
|
||||||
let tooltip = new ErrorToolTip(this.id);
|
let tooltip = new ErrorToolTip(this.id);
|
||||||
tooltip.addChangeListener();
|
tooltip.addChangeListener();
|
||||||
}
|
}
|
||||||
input.value = String(this.value!);
|
input.value = String(this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearForm() {
|
setElementDefaultValue() {
|
||||||
|
(document.getElementById(this.id) as HTMLInputElement).value = String(this.defval);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeElement() {
|
||||||
let input = this.getInputElement();
|
let input = this.getInputElement();
|
||||||
if (input) {
|
if (input) {
|
||||||
input.parentElement!.parentElement!.remove();
|
input.parentElement!.parentElement!.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showElement() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement!.parentElement!.style.removeProperty("display");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hideElement() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement!.parentElement!.style.setProperty("display", "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var CustTable: Array<CustEntry> = [
|
var CustTable: Array<CustEntry> = [
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"mtcConf",
|
"mtcConf",
|
||||||
"DRAM Timing",
|
"DRAM Timing",
|
||||||
|
CustPlatform.Mariko,
|
||||||
2,
|
2,
|
||||||
"<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
"<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
||||||
@@ -119,6 +147,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuMaxClock",
|
"marikoCpuMaxClock",
|
||||||
"Mariko CPU Max Clock in kHz",
|
"Mariko CPU Max Clock in kHz",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>System default: 1785000</li>\
|
"<li>System default: 1785000</li>\
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>",
|
<li>2397000 might be unreachable for some SoCs.</li>",
|
||||||
@@ -129,6 +158,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuBoostClock",
|
"marikoCpuBoostClock",
|
||||||
"Mariko CPU Boost Clock in kHz",
|
"Mariko CPU Boost Clock in kHz",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>System default: 1785000</li>\
|
"<li>System default: 1785000</li>\
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
||||||
@@ -141,6 +171,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuMaxVolt",
|
"marikoCpuMaxVolt",
|
||||||
"Mariko CPU Max Voltage in mV",
|
"Mariko CPU Max Voltage in mV",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>System default: 1120</li>\
|
"<li>System default: 1120</li>\
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
||||||
@@ -151,6 +182,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoGpuMaxClock",
|
"marikoGpuMaxClock",
|
||||||
"Mariko GPU Max Clock in kHz",
|
"Mariko GPU Max Clock in kHz",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>System default: 921600</li>\
|
"<li>System default: 921600</li>\
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
<li>Tegra X1+ official maximum: 1267200</li>\
|
||||||
@@ -162,6 +194,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoEmcMaxClock",
|
"marikoEmcMaxClock",
|
||||||
"Mariko RAM Max Clock in kHz",
|
"Mariko RAM Max Clock in kHz",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
||||||
@@ -172,6 +205,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoEmcVddqVolt",
|
"marikoEmcVddqVolt",
|
||||||
"EMC Vddq (Mariko Only) Voltage in uV",
|
"EMC Vddq (Mariko Only) Voltage in uV",
|
||||||
|
CustPlatform.Mariko,
|
||||||
4,
|
4,
|
||||||
"<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
"<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
||||||
<li>Value should be divided evenly by 5000</li>\
|
<li>Value should be divided evenly by 5000</li>\
|
||||||
@@ -185,6 +219,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaCpuMaxVolt",
|
"eristaCpuMaxVolt",
|
||||||
"Erista CPU Max Voltage in mV",
|
"Erista CPU Max Voltage in mV",
|
||||||
|
CustPlatform.Erista,
|
||||||
4,
|
4,
|
||||||
"<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
"<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
||||||
1235,
|
1235,
|
||||||
@@ -194,6 +229,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaEmcMaxClock",
|
"eristaEmcMaxClock",
|
||||||
"Erista RAM Max Clock in kHz",
|
"Erista RAM Max Clock in kHz",
|
||||||
|
CustPlatform.Erista,
|
||||||
4,
|
4,
|
||||||
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
||||||
@@ -204,6 +240,7 @@ var CustTable: Array<CustEntry> = [
|
|||||||
new CustEntry(
|
new CustEntry(
|
||||||
"commonEmcMemVolt",
|
"commonEmcMemVolt",
|
||||||
"EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV",
|
"EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV",
|
||||||
|
CustPlatform.All,
|
||||||
4,
|
4,
|
||||||
"<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
"<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
||||||
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
||||||
@@ -275,9 +312,9 @@ function SaveCust(buffer) {
|
|||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let storage = {};
|
let storage = {};
|
||||||
|
|
||||||
for (let i of CustTable) {
|
CustTable.forEach(i => {
|
||||||
i.update();
|
i.updateValueFromElement();
|
||||||
if (!i.validate() || i.value === null) {
|
if (!i.validate() || !i.value) {
|
||||||
document.getElementById(i.id)!.focus();
|
document.getElementById(i.id)!.focus();
|
||||||
throw new Error(`Invalid ${i.name}`);
|
throw new Error(`Invalid ${i.name}`);
|
||||||
}
|
}
|
||||||
@@ -297,7 +334,7 @@ function SaveCust(buffer) {
|
|||||||
throw new Error(`Unknown size at ${i.name}`);
|
throw new Error(`Unknown size at ${i.name}`);
|
||||||
}
|
}
|
||||||
storage[i.id] = i.value;
|
storage[i.id] = i.value;
|
||||||
}
|
});
|
||||||
|
|
||||||
storage["custRev"] = CUST_REV;
|
storage["custRev"] = CUST_REV;
|
||||||
localStorage.setItem("last_saved", JSON.stringify(storage));
|
localStorage.setItem("last_saved", JSON.stringify(storage));
|
||||||
@@ -320,40 +357,34 @@ function LastSaved() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function LoadLastSaved() {
|
function CustNavTabsInit() {
|
||||||
if (LastSaved()) {
|
const custNavTabs = Array.from(document.querySelectorAll(`nav[role="tab-control"] > button`)) as HTMLElement[];
|
||||||
let storage = localStorage.getItem("last_saved");
|
custNavTabs.forEach(i => {
|
||||||
let sObj = JSON.parse(storage!);
|
i.removeAttribute("disabled");
|
||||||
for (let key in sObj) {
|
let platform = Number(i.getAttribute("data-filter")!) as CustPlatform;
|
||||||
if (key == "custRev") {
|
i.addEventListener('click', (_evt) => {
|
||||||
continue;
|
const unfocusedClasses = ["outline", "secondary"];
|
||||||
}
|
i.classList.remove(...unfocusedClasses);
|
||||||
(document.getElementById(key) as HTMLInputElement).value = sObj[key];
|
custNavTabs.filter(j => j != i).forEach(k => k.classList.add(...unfocusedClasses));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function LoadDefault() {
|
CustTable.forEach(e => {
|
||||||
for (let i of CustTable) {
|
if (e.isAvailableFor(platform)) {
|
||||||
(document.getElementById(i.id) as HTMLInputElement).value = String(i.defval);
|
e.showElement();
|
||||||
}
|
} else {
|
||||||
}
|
e.hideElement();
|
||||||
|
}
|
||||||
function ClearHTMLForm() {
|
});
|
||||||
for (let i of CustTable) {
|
});
|
||||||
i.clearForm();
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateHTMLForm() {
|
function UpdateHTMLForm() {
|
||||||
for (let i of CustTable) {
|
CustTable.forEach(i => i.createElement());
|
||||||
i.createForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
let default_btn = document.getElementById("load_default")!;
|
let default_btn = document.getElementById("load_default")!;
|
||||||
default_btn.removeAttribute("disabled");
|
default_btn.removeAttribute("disabled");
|
||||||
default_btn.addEventListener('click', () => {
|
default_btn.addEventListener('click', () => {
|
||||||
LoadDefault();
|
CustTable.forEach(i => i.setElementDefaultValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
let last_btn = document.getElementById("load_saved")!;
|
let last_btn = document.getElementById("load_saved")!;
|
||||||
@@ -361,7 +392,10 @@ function UpdateHTMLForm() {
|
|||||||
last_btn.style.removeProperty("display");
|
last_btn.style.removeProperty("display");
|
||||||
last_btn.removeAttribute("disabled");
|
last_btn.removeAttribute("disabled");
|
||||||
last_btn.addEventListener('click', () => {
|
last_btn.addEventListener('click', () => {
|
||||||
LoadLastSaved();
|
// Load last saved from localStorage
|
||||||
|
JSON.parse(localStorage.getItem("last_saved")!)
|
||||||
|
.filter((key: string) => key != "custRev")
|
||||||
|
.forEach((key: string) => (document.getElementById(key) as HTMLInputElement).value = key);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
last_btn.style.setProperty("display", "none");
|
last_btn.style.setProperty("display", "none");
|
||||||
@@ -379,17 +413,17 @@ function UpdateHTMLForm() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ParseCust(magicOffset, buffer) {
|
function ParseCust(magicOffset: number, buffer: ArrayBuffer) {
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let offset = magicOffset + 4;
|
let offset = magicOffset + 4;
|
||||||
let rev = view.getUint16(offset, true);
|
let rev = view.getUint16(offset, true);
|
||||||
|
offset += 2;
|
||||||
if (rev != CUST_REV) {
|
if (rev != CUST_REV) {
|
||||||
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
||||||
}
|
}
|
||||||
document.getElementById("cust_rev")!.innerHTML = `Cust V${CUST_REV} is loaded.`;
|
document.getElementById("cust_rev")!.innerHTML = `Cust V${CUST_REV} is loaded.`;
|
||||||
|
|
||||||
offset += 2;
|
CustTable.forEach(i => {
|
||||||
for (let i of CustTable) {
|
|
||||||
i.offset = offset;
|
i.offset = offset;
|
||||||
switch (i.size) {
|
switch (i.size) {
|
||||||
case 2:
|
case 2:
|
||||||
@@ -404,7 +438,7 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
}
|
}
|
||||||
offset += i.size;
|
offset += i.size;
|
||||||
i.validate();
|
i.validate();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileInput = document.getElementById("file") as HTMLInputElement;
|
const fileInput = document.getElementById("file") as HTMLInputElement;
|
||||||
@@ -413,11 +447,12 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
reader.readAsArrayBuffer((event.target as HTMLInputElement).files![0]);
|
reader.readAsArrayBuffer((event.target as HTMLInputElement).files![0]);
|
||||||
reader.onloadend = (progEvent) => {
|
reader.onloadend = (progEvent) => {
|
||||||
if (progEvent.target!.readyState === FileReader.DONE) {
|
if (progEvent.target!.readyState === FileReader.DONE) {
|
||||||
buffer = progEvent.target!.result!;
|
buffer = (progEvent.target!.result!) as ArrayBuffer;
|
||||||
try {
|
try {
|
||||||
let offset = FindMagicOffset(buffer);
|
let offset = FindMagicOffset(buffer);
|
||||||
ClearHTMLForm();
|
CustTable.forEach(i => i.removeElement());
|
||||||
ParseCust(offset, buffer);
|
ParseCust(offset, buffer);
|
||||||
|
CustNavTabsInit();
|
||||||
UpdateHTMLForm();
|
UpdateHTMLForm();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@@ -426,7 +461,7 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
/* GitHub Release fetch */
|
/* GitHub Release fetch */
|
||||||
type ReleaseInfo = {
|
type ReleaseInfo = {
|
||||||
@@ -453,7 +488,7 @@ async function fetchRelease(): Promise<ReleaseInfo | void> {
|
|||||||
|
|
||||||
const resultFromSuite = await responseFromSuite.json();
|
const resultFromSuite = await responseFromSuite.json();
|
||||||
const latestVerFromSuite = resultFromSuite.tag_name;
|
const latestVerFromSuite = resultFromSuite.tag_name;
|
||||||
const correspondingVerFromAMS = latestVerFromSuite.split(".").slice(0, 3).join(".");
|
const amsVer = latestVerFromSuite.split(".").slice(0, 3).join(".");
|
||||||
|
|
||||||
const loaderKip = resultFromSuite.assets.filter((obj) => {
|
const loaderKip = resultFromSuite.assets.filter((obj) => {
|
||||||
return obj.name.endsWith("loader.kip");
|
return obj.name.endsWith("loader.kip");
|
||||||
@@ -461,7 +496,7 @@ async function fetchRelease(): Promise<ReleaseInfo | void> {
|
|||||||
const sdOut = resultFromSuite.assets.filter((obj) => {
|
const sdOut = resultFromSuite.assets.filter((obj) => {
|
||||||
return obj.name.endsWith(".zip");
|
return obj.name.endsWith(".zip");
|
||||||
})[0];
|
})[0];
|
||||||
const amsReleaseUrl = `https://github.com/Atmosphere-NX/Atmosphere/releases/tags/${correspondingVerFromAMS}`;
|
const amsReleaseUrl = `https://github.com/Atmosphere-NX/Atmosphere/releases/tags/${amsVer}`;
|
||||||
|
|
||||||
let info: ReleaseInfo = {
|
let info: ReleaseInfo = {
|
||||||
OCSuiteVer: latestVerFromSuite,
|
OCSuiteVer: latestVerFromSuite,
|
||||||
@@ -469,7 +504,7 @@ async function fetchRelease(): Promise<ReleaseInfo | void> {
|
|||||||
LoaderKipTime: loaderKip.updated_at,
|
LoaderKipTime: loaderKip.updated_at,
|
||||||
SdOutZipUrl: sdOut.browser_download_url,
|
SdOutZipUrl: sdOut.browser_download_url,
|
||||||
SdOutZipTime: sdOut.updated_at,
|
SdOutZipTime: sdOut.updated_at,
|
||||||
AMSVer: correspondingVerFromAMS,
|
AMSVer: amsVer,
|
||||||
AMSUrl: amsReleaseUrl
|
AMSUrl: amsReleaseUrl
|
||||||
};
|
};
|
||||||
return info;
|
return info;
|
||||||
|
|||||||
Reference in New Issue
Block a user