Online loader_configurator for web browser
This commit is contained in:
53
.github/workflows/deploy_configurator.yml
vendored
Normal file
53
.github/workflows/deploy_configurator.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Simple workflow for deploying static content to GitHub Pages
|
||||||
|
name: Deploy static content to Pages (Configurator)
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Runs on pushes targeting the default branch
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow one concurrent deployment
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Single deploy job since we're just deploying
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v2
|
||||||
|
- name: HTML/CSS/JS Minifier
|
||||||
|
# You may pin to the exact commit or the version.
|
||||||
|
# uses: devatherock/minify-js@a25175eaf2c438680b21b73882d4837418e9d58b
|
||||||
|
uses: devatherock/minify-js@v1.0.3
|
||||||
|
with:
|
||||||
|
# File to minify or a folder containing files to minify. By default, all files in current folder and its subfolders will be minified
|
||||||
|
directory: './Source/loaderConfigurator/src' # optional
|
||||||
|
# Path where the minified files will be saved. By default, the minified files will be saved in the original file path
|
||||||
|
output: './Source/loaderConfigurator/dist' # optional
|
||||||
|
# Indicates if the output files should have the suffix '.min' added after the name. Default is true
|
||||||
|
add_suffix: false # optional
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v1
|
||||||
|
with:
|
||||||
|
# Upload entire repository
|
||||||
|
path: './Source/loaderConfigurator/dist'
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v1
|
||||||
@@ -93,9 +93,8 @@ This project will not be actively maintained or regularly updated along with Atm
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
- Loader configurator
|
- [Online loader configurator](https://kazushime.github.io/Switch-OC-Suite/)
|
||||||
- Grab [ldr_config.py](https://github.com/KazushiMe/Switch-OC-Suite/raw/master/ldr_config.py) and modify values in `cust_conf` dict.
|
- Tested with latest Chrome(107) and Safari (16) (as of November 2022), older browsers may not work properly.
|
||||||
- `python ldr_config.py loader.kip -s` will save your configuration in-place.
|
|
||||||
|
|
||||||
5. **Hekate-ipl bootloader**
|
5. **Hekate-ipl bootloader**
|
||||||
- Rename the kip to `loader.kip` and add `kip1=atmosphere/kips/loader.kip` in `bootloader/hekate_ipl.ini`
|
- Rename the kip to `loader.kip` and add `kip1=atmosphere/kips/loader.kip` in `bootloader/hekate_ipl.ini`
|
||||||
|
|||||||
3
Source/loaderConfigurator/.gitignore
vendored
Normal file
3
Source/loaderConfigurator/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
package-lock.json
|
||||||
8
Source/loaderConfigurator/package.json
Normal file
8
Source/loaderConfigurator/package.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"tailwindcss": "^3.2.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tw-elements": "^1.0.0-alpha12"
|
||||||
|
}
|
||||||
|
}
|
||||||
292
Source/loaderConfigurator/src/index.html
Normal file
292
Source/loaderConfigurator/src/index.html
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link href="./output.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<div id="form" class="form-group p-6 rounded-lg shadow-lg bg-white max-w-sm">
|
||||||
|
<label for="file" class="inline-block mb-2 text-gray-700">Upload loader.kip</label>
|
||||||
|
<input id="file" type="file" class="form-control form-entry">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var buffer;
|
||||||
|
|
||||||
|
function FindMagicOffset(buffer) {
|
||||||
|
let view = new DataView(buffer);
|
||||||
|
for (let i = 0; i < view.byteLength; i += 4) {
|
||||||
|
if (view.getUint32(i, true) == 0x54535543) { // "CUST"
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error("Invalid loader.kip file");
|
||||||
|
}
|
||||||
|
|
||||||
|
function CustEntry(name, size, desc, minmax = [0, 1_000_000], step = 1, extra_validator = undefined) {
|
||||||
|
this.name = name;
|
||||||
|
this.size = size;
|
||||||
|
this.value = null;
|
||||||
|
this.offset = null;
|
||||||
|
this.desc = desc;
|
||||||
|
this.min = minmax[0];
|
||||||
|
this.max = minmax[1];
|
||||||
|
this.step = step;
|
||||||
|
this.validator = extra_validator;
|
||||||
|
}
|
||||||
|
|
||||||
|
function InitCustTable() {
|
||||||
|
let cust = [
|
||||||
|
new CustEntry(
|
||||||
|
"custRev",
|
||||||
|
2,
|
||||||
|
"Cust Version, must be 2",
|
||||||
|
[2, 2],
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"mtcConf",
|
||||||
|
2,
|
||||||
|
"<b>DRAM Timing</b>\
|
||||||
|
<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE (Default): Auto adjust timings for LPDDR4 ≤3733 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>: ENTIRE_TABLE_ERISTA: Not implemented.</li>\
|
||||||
|
<li><b>3</b>: ENTIRE_TABLE_MARIKO: Not implemented.</li>",
|
||||||
|
[0, 3],
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"marikoCpuMaxClock",
|
||||||
|
4,
|
||||||
|
"<b>Mariko CPU Max Clock in kHz</b>\
|
||||||
|
<li>System default: 1785000</li>\
|
||||||
|
<li>≥ 2193000 will enable overvolting (> 1120 mV)</li>",
|
||||||
|
[1785_000, 3000_000],
|
||||||
|
100,
|
||||||
|
(x) => { return (x % 100) == 0; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"marikoCpuBoostClock",
|
||||||
|
4,
|
||||||
|
"<b>Mariko CPU Boost Clock in kHz</b>\
|
||||||
|
<li>System default: 1785000</li>\
|
||||||
|
<li>Must not be higher than marikoCpuMaxClock</li>",
|
||||||
|
[1785_000, 3000_000],
|
||||||
|
100,
|
||||||
|
(x) => { return (x % 100) == 0; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"marikoCpuMaxVolt",
|
||||||
|
4,
|
||||||
|
"<b>Mariko CPU Max Voltage in mV</b>\
|
||||||
|
<li>System default: 1120</li>\
|
||||||
|
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
||||||
|
[1100, 1300],
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"marikoGpuMaxClock",
|
||||||
|
4,
|
||||||
|
"<b>Mariko GPU Max Clock in kHz</b>\
|
||||||
|
<li>System default: 921600</li>\
|
||||||
|
<li>Tegra X1+ official maximum: 1267200</li>",
|
||||||
|
[768_000, 1536_000],
|
||||||
|
100,
|
||||||
|
(x) => { return (x % 100) == 0; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"marikoEmcMaxClock",
|
||||||
|
4,
|
||||||
|
"<b>Mariko RAM Max Clock in kHz</b>\
|
||||||
|
<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>",
|
||||||
|
[1612_800, 2400_000],
|
||||||
|
3200,
|
||||||
|
(x) => { return (x % 3200) == 0; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"eristaCpuOCEnable",
|
||||||
|
4,
|
||||||
|
"<b>Erista CPU Enable Overclock</b>\
|
||||||
|
<li>Not usable unless CPU cvb table is filled in</li>",
|
||||||
|
[0, 1]
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"eristaCpuMaxVolt",
|
||||||
|
4,
|
||||||
|
"<b>Erista CPU Max Voltage in mV</b>\
|
||||||
|
<li>Acceptable range: 1100 ≤ x ≤ 1400</li>\
|
||||||
|
<li>Not enabled by default</li>",
|
||||||
|
[0, 1400],
|
||||||
|
100,
|
||||||
|
(x) => { return x >= 1100; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"eristaEmcMaxClock",
|
||||||
|
4,
|
||||||
|
"<b>Erista RAM Max Clock in kHz</b>\
|
||||||
|
<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>",
|
||||||
|
[1600_000, 2400_000],
|
||||||
|
3200,
|
||||||
|
(x) => { return (x % 3200) == 0; }
|
||||||
|
),
|
||||||
|
new CustEntry(
|
||||||
|
"eristaEmcVolt",
|
||||||
|
4,
|
||||||
|
"<b>Erista RAM Voltage in uV</b>\
|
||||||
|
<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
||||||
|
<li>Not enabled by default</li>",
|
||||||
|
[0, 1250_000],
|
||||||
|
12500,
|
||||||
|
(x) => { return (x % 12500) == 0 && x >= 1100_000; }
|
||||||
|
),
|
||||||
|
];
|
||||||
|
return cust;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ValidateCust(cust) {
|
||||||
|
for (let i of cust) {
|
||||||
|
if (i.value == 0)
|
||||||
|
continue;
|
||||||
|
if (i.value < i.min || i.value > i.max) {
|
||||||
|
document.getElementById(i.name).focus();
|
||||||
|
throw new Error(`Expected range: ${i.min} ≤ ${i.name} ≤ ${i.max}, got ${i.value}`);
|
||||||
|
}
|
||||||
|
if (i.validator && !i.validator(i.value)) {
|
||||||
|
document.getElementById(i.name).focus();
|
||||||
|
throw new Error(`Invalid value: ${i.value}(${$i.name})\nValidator: ${i.validator}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SaveCust(cust, buffer) {
|
||||||
|
let dict = Object.assign({}, ...cust.map((x) => ({[x.name]: x})));
|
||||||
|
let view = new DataView(buffer);
|
||||||
|
for (let i of cust) {
|
||||||
|
if (i.name == "custRev") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let id = i.name;
|
||||||
|
i.value = document.getElementById(id).value;
|
||||||
|
switch (i.size) {
|
||||||
|
case 2:
|
||||||
|
view.setUint16(i.offset, i.value, true);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
view.setUint32(i.offset, i.value, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
document.getElementById(i.name).focus();
|
||||||
|
throw new Error("Unknown size at", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ValidateCust(cust);
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.href = window.URL.createObjectURL(new Blob([buffer], {type: "application/octet-stream"}));
|
||||||
|
a.download = "loader.kip";
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function UpdateHTMLForm(cust) {
|
||||||
|
let dict = Object.assign({}, ...cust.map((x) => ({[x.name]: x})));
|
||||||
|
let form = document.getElementById("form");
|
||||||
|
for (let i of cust) {
|
||||||
|
if (i.name == "custRev") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let id = i.name;
|
||||||
|
let input = document.getElementById(id);
|
||||||
|
if (!input) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
div.classList.add("form-floating", "my-3");
|
||||||
|
let label = document.createElement("label");
|
||||||
|
label.setAttribute("for", id);
|
||||||
|
label.innerHTML = id;
|
||||||
|
label.classList.add("form-entry");
|
||||||
|
input = document.createElement("input");
|
||||||
|
input.classList.add("form-control", "form-entry");
|
||||||
|
input.min = dict[i.name].min;
|
||||||
|
input.max = dict[i.name].max;
|
||||||
|
input.id = id;
|
||||||
|
input.type = "number";
|
||||||
|
input.step = dict[i.name].step;
|
||||||
|
div.appendChild(input);
|
||||||
|
div.appendChild(label);
|
||||||
|
|
||||||
|
let desc = dict[i.name].desc;
|
||||||
|
if (desc) {
|
||||||
|
let tip = document.createElement("small");
|
||||||
|
tip.innerHTML = desc;
|
||||||
|
tip.classList.add("form-entry");
|
||||||
|
tip.setAttribute("for", id);
|
||||||
|
div.appendChild(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
form.appendChild(div);
|
||||||
|
}
|
||||||
|
input.value = dict[i.name].value;
|
||||||
|
}
|
||||||
|
let btn = document.getElementById("save");
|
||||||
|
if (!btn) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
div.classList.add("flex", "space-x-2", "justify-center");
|
||||||
|
btn = document.createElement("button");
|
||||||
|
btn.innerHTML = "Save Changes"
|
||||||
|
btn.id = "save";
|
||||||
|
btn.classList.add("save-btn");
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
try {
|
||||||
|
SaveCust(cust, buffer);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
alert(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
div.appendChild(btn);
|
||||||
|
form.appendChild(div);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ParseCust(magicOffset, buffer) {
|
||||||
|
let view = new DataView(buffer);
|
||||||
|
let cust = InitCustTable();
|
||||||
|
let offset = magicOffset + 4;
|
||||||
|
for (let i of cust) {
|
||||||
|
i.offset = offset;
|
||||||
|
switch (i.size) {
|
||||||
|
case 2:
|
||||||
|
i.value = view.getUint16(offset, true);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
i.value = view.getUint32(offset, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
document.getElementById(i.name).focus();
|
||||||
|
throw new Error("Unknown size at", i);
|
||||||
|
}
|
||||||
|
offset += i.size;
|
||||||
|
}
|
||||||
|
ValidateCust(cust);
|
||||||
|
UpdateHTMLForm(cust);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileInput = document.getElementById("file");
|
||||||
|
fileInput.addEventListener('change', (event) => {
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.readAsArrayBuffer(event.target.files[0]);
|
||||||
|
reader.onloadend = (progEvent) => {
|
||||||
|
if (progEvent.target.readyState === FileReader.DONE) {
|
||||||
|
buffer = progEvent.target.result;
|
||||||
|
try {
|
||||||
|
let offset = FindMagicOffset(buffer);
|
||||||
|
ParseCust(offset, buffer);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
alert(e);
|
||||||
|
fileInput.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
4024
Source/loaderConfigurator/src/output.css
Normal file
4024
Source/loaderConfigurator/src/output.css
Normal file
File diff suppressed because it is too large
Load Diff
19
Source/loaderConfigurator/src/style.css
Normal file
19
Source/loaderConfigurator/src/style.css
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
label.form-entry {
|
||||||
|
@apply inline-block mb-2 text-gray-700;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.form-entry {
|
||||||
|
@apply block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none;
|
||||||
|
}
|
||||||
|
|
||||||
|
small.form-entry {
|
||||||
|
@apply block mt-1 text-xs text-gray-600 px-3 py-1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.save-btn {
|
||||||
|
@apply inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out;
|
||||||
|
}
|
||||||
10
Source/loaderConfigurator/tailwind.config.js
Normal file
10
Source/loaderConfigurator/tailwind.config.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: ['./src/*.html', './node_modules/tw-elements/dist/js/**/*.js'],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
require('tw-elements/dist/plugin')
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -412,7 +412,7 @@ void Governor::Main(void* args) {
|
|||||||
bool GPUThrottled = false;
|
bool GPUThrottled = false;
|
||||||
|
|
||||||
while (self->m_running) {
|
while (self->m_running) {
|
||||||
bool shouldUpdateContext = update_ticks++ >= UPDATE_CONTEXT_RATE;
|
bool shouldUpdateContext = ++update_ticks >= UPDATE_CONTEXT_RATE;
|
||||||
if (shouldUpdateContext) {
|
if (shouldUpdateContext) {
|
||||||
update_ticks = 0;
|
update_ticks = 0;
|
||||||
uint32_t hz = Clocks::GetCurrentHz(SysClkModule_GPU);
|
uint32_t hz = Clocks::GetCurrentHz(SysClkModule_GPU);
|
||||||
|
|||||||
Reference in New Issue
Block a user