configurator: update and modularize

This commit is contained in:
souldbminersmwc
2025-10-01 19:10:21 -04:00
parent 3dfb95f542
commit bfa20ca526
33 changed files with 738 additions and 690 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,5 @@
*.DS_Store
.vscode/
build/
build/
dist/
.pyc

View File

@@ -83,9 +83,8 @@ volatile CustomizeTable C = {
* Value should be divided evenly by 5'000
* Default: 600'000
* Not enabled by default.
* This will not work without sys-clk-OC.
*/
.marikoEmcVddqVolt = 0,
.marikoEmcVddqVolt = 600000,
.marikoCpuUV = 0,
@@ -118,6 +117,13 @@ volatile CustomizeTable C = {
.mem_burst_latency = 0,
.marikoCpuVmin = 600,
.eristaGpuVmin = 810,
.marikoGpuVmin = 610,
.marikoGpuVmax = 800,
// NOTE: These tables should NOT BE USED and are only here as placeholders. Always try and find your own optimal tables.
// Ensure the voltages actually increase or stay the sameot
@@ -167,13 +173,6 @@ volatile CustomizeTable C = {
},
.marikoCpuVmin = 600,
.eristaGpuVmin = 810,
.marikoGpuVmin = 610,
.marikoGpuVmax = 800,
/* Advanced Settings:
* - Erista CPU DVFS Table:

View File

@@ -78,16 +78,16 @@
u32 t7_tWTR;
u32 t8_tREFI;
u32 mem_burst_latency;
u32 marikoGpuVoltArray[24];
u32 eristaGpuVoltArray[14];
u32 marikoCpuVmin;
u32 eristaGpuVmin;
u32 marikoGpuVmin;
u32 marikoGpuVmax;
u32 marikoGpuVoltArray[24];
u32 eristaGpuVoltArray[14];
CustomizeCpuDvfsTable eristaCpuDvfsTable;
CustomizeCpuDvfsTable marikoCpuDvfsTable;
CustomizeCpuDvfsTable marikoCpuDvfsTableSLT;

View File

@@ -48,7 +48,7 @@
const std::array<u32, 10> tWTR_values = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
// Preset Six
const std::array<u32, 6> tREFpb_values = {488, 976, 1952, 3256, 9999, 9999};
const std::array<u32, 6> tREFpb_values = {488, 976, 1952, 3256, 6512, 9999};
// const u32 TIMING_PRESET_ONE = C.ramTimingPresetOne;
// const u32 TIMING_PRESET_TWO = C.ramTimingPresetTwo;
@@ -64,7 +64,7 @@
// Write Latency
const u32 WL = 14 + C.mem_burst_latency;
// Read Latency
const u32 RL = 32 - C.mem_burst_latency;
const u32 RL = 32 + C.mem_burst_latency;
// tRFCpb (refresh cycle time per bank) in ns for 8Gb density
const u32 tRFCpb = !C.t5_tRFC ? 140 : tRFC_values[C.t5_tRFC-1];

View File

@@ -1,5 +1,5 @@
pip install -U pyinstaller
pip install dpg
pip install pyinstaller
pip install dearpygui
pip install numpy
pip install psutil
pip install pil

View File

@@ -24,28 +24,20 @@ import dearpygui.dearpygui as dpg
import common
import kip as k
import gpu as g
import settings as s
def populate():
freqs_hz_cpu = [
1020000, 1122000, 1224000, 1326000, 1428000, 1581000, 1683000,
1785000, 1887000, 1963500, 2091000, 2193000, 2295000, 2397000,
2499000, 2601000, 2703000, 2805000, 2907000
]
freqs_mhz_cpu = [
1020.0, 1122.0, 1224.0, 1326.0, 1428.0, 1581.0, 1683.0,
1785.0, 1887.0, 1963.5, 2091.0, 2193.0, 2295.0, 2397.0,
2499.0, 2601.0, 2703.0, 2805.0, 2907.0
]
freqs_mhz_cpu_label = [f"{f} MHz" for f in freqs_mhz_cpu]
freqs_mhz_cpu_label = [f"{f} MHz" for f in s.freqs_mhz_cpu]
offsets = list(range(0, 101, 5))
processed_offsets = ["Disabled" if v == 0 else f"-{v}mV" for v in offsets]
voltages = [0] + list(range(1000, 1160 + 1, 5)) # 0 first for Disabled
voltages = [0] + list(range(1000, 1160 + 1, s.mariko_voltage_step)) # 0 first for Disabled
processed_voltages = ["Disabled" if v == 0 else f"{v}mV" for v in voltages]
processed_voltages_default = ["Default" if v == 0 else f"{v}mV" for v in voltages]
voltages_e = [0] + list(range(1120, 1255 + 1, 5)) + [1257] # 0 first for Disabled
voltages_e = [0] + list(range(1120, 1255 + 1, s.mariko_voltage_step)) + [1257] # 0 first for Disabled
processed_voltages_e = ["Disabled" if v == 0 else f"{v}mV" for v in voltages_e]
processed_voltages_default_e = ["Default" if v == 0 else f"{v}mV" for v in voltages_e]
vmin_voltages = list(range(500, 700 + 1, 5)) # 0 first for Disabled
vmin_voltages = list(range(s.mariko_cpu_min_vmin, s.mariko_cpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
vmin_processed_voltages = ["Disabled" if v == 0 else f"{v}mV" for v in vmin_voltages]
dpg.add_separator(label="Frequencies")

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
class Defaults:
class Defaults: # This almost always never needs to be updated as pulling from the kip takes priority
def __init__(self):
self.autosave = 0
self.custrev = 0

View File

@@ -25,6 +25,7 @@ import kip as k
import common
from pathlib import Path
import ini
import settings as s
def unimplemented():
pass
@@ -58,33 +59,19 @@ def toggle_gpu_sched(sender, app_data):
common.show_popup("Success", f"Set GPU Scheduling to {app_data}")
def populate():
offsets = list(range(0, 51, 5))
offsets = list(range(0, s.mariko_gpu_offset_max + 1, s.mariko_voltage_step))
processed_offsets = ["Disabled" if v == 0 else f"-{v} mV" for v in offsets]
voltages = [0] + list(range(480, 960 + 1, 5)) # 0 first for Disabled
voltages = [0] + list(range(s.mariko_gpu_min_volt, s.mariko_gpu_max_volt + 1, s.mariko_voltage_step)) # 0 first for Disabled
processed_voltages = ["Disabled" if v == 0 else f"{v} mV" for v in voltages]
voltages_e = [0] + list(range(700, 1100 + 1, 5)) # 0 first for Disabled
voltages_e = [0] + list(range(s.erista_gpu_min_volt, s.erista_gpu_max_volt + 1, s.mariko_voltage_step)) # 0 first for Disabled
processed_voltages_e = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_e]
processed_voltages_default = ["Default" if v == 0 else f"{v} mV" for v in voltages]
voltages_vmin = [0] + list(range(480, 650 + 1, 5)) # 0 first for Disabled
voltages_vmin = [0] + list(range(s.mariko_gpu_min_volt, s.mariko_gpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
processed_voltages_vmin = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_vmin]
voltages_vmin_e = [0] + list(range(700, 850 + 1, 5)) # 0 first for Disabled
voltages_vmin_e = [0] + list(range(s.erista_gpu_min_volt, s.erista_gpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
processed_voltages_vmin_e = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_vmin_e]
freqs_khz = [
76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000,
844800, 921600, 998400, 1075200, 1152000, 1228800, 1267200, 1305600, 1344000, 1382400, 1420800,
1459200, 1497600, 1536000
]
freqs_khz_e = [
76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000,
844800, 921600, 998400, 1075200 #, 1152000, 1228800 # Disabled by default as these freqs can cause board damage
]
freqs_mhz = [
76.8, 153.6, 230.4, 307.2, 384.0, 460.8, 537.6, 614.4, 691.2, 768.0,
844.8, 921.6, 998.4, 1075.2, 1152.0, 1228.8, 1267.2, 1305.6, 1344.0, 1382.4,
1420.8, 1459.2, 1497.6, 1536.0
]
freqs_mhz_label = [f"{f} MHz" for f in freqs_mhz]
freqs_mhz_label = [f"{f} MHz" for f in s.freqs_mhz]
dpg.add_separator(label="Frequencies")
@@ -182,51 +169,67 @@ def populate():
dpg.add_separator(label="Custom Table (Mariko)")
for freq in freqs_khz:
if(freq > 1535000):
for freq in s.freqs_khz:
if(freq > s.mariko_meme_threshold):
mhz_color = s.danger_color
mhz_label = f"{freq / 1000:.1f} MHz"
elif(freq > 1382400):
mhz_label = f"{freq / 1000:.1f} MHz (DANGEROUS)"
elif(freq > 1152000):
mhz_label = f"{freq / 1000:.1f} MHz (UNSAFE)"
safety_label = ""
elif(freq > s.mariko_dangerous_gpu_threshold):
mhz_color = s.danger_color
mhz_label = f"{freq / 1000:.1f} MHz"
safety_label = "(DANGEROUS)"
elif(freq > s.mariko_unsafe_gpu_threshold):
mhz_color = s.unsafe_color
mhz_label = f"{freq / 1000:.1f} MHz"
safety_label = "(UNSAFE)"
else:
mhz_label = f"{freq / 1000:.1f} MHz"
safety_label = ""
mhz_color = s.safe_color
mhz_tag = f"combo_{freq}"
if freq == 1536000:
if freq == s.mariko_meme_threshold:
with dpg.group(horizontal=True): # align horizontally
dpg.add_combo(
items=processed_voltages,
default_value="Disabled",
label=mhz_label,
tag="g_volt_" + str(freq),
callback=k.grab_kip_storage_values_no_mult
)
dpg.add_text("(")
dpg.add_image("coolerhd", width=16, height=16)
dpg.add_text(")")
dpg.add_text(f"{mhz_label} (", color=mhz_color)
dpg.add_image("coolerhd", width=20, height=20)
dpg.add_text(")", color=mhz_color)
else:
dpg.add_combo(
items=processed_voltages,
default_value="Disabled",
label=mhz_label,
tag="g_volt_" + str(freq),
callback=k.grab_kip_storage_values_no_mult
)
with dpg.group(horizontal=True):
dpg.add_combo(
items=processed_voltages,
default_value="Disabled",
tag="g_volt_" + str(freq),
callback=k.grab_kip_storage_values_no_mult
)
dpg.add_text(default_value=f"{mhz_label} {safety_label}", color=mhz_color)
dpg.add_separator(label="Custom Table (Erista)")
for freq in freqs_khz_e:
if(freq > 1151000):
mhz_label = f"{freq / 1000:.1f} MHz (DANGEROUS)"
elif(freq > 922000):
mhz_label = f"{freq / 1000:.1f} MHz (UNSAFE)"
else:
for freq in s.freqs_khz_e:
if(freq > s.erista_dangerous_gpu_threshold):
mhz_label = f"{freq / 1000:.1f} MHz"
mhz_tag = f"combo_e_{freq}"
dpg.add_combo(
items=processed_voltages_e,
default_value="Disabled",
label=mhz_label,
tag="g_volt_e_" + str(freq),
callback=k.grab_kip_storage_values_no_mult
)
safety_label = "(DANGEROUS)"
mhz_color = s.danger_color
elif(freq > s.erista_unsafe_gpu_threshold):
mhz_color = s.unsafe_color
mhz_label = f"{freq / 1000:.1f} MHz"
safety_label = "(UNSAFE)"
else:
mhz_color = s.safe_color
mhz_label = f"{freq / 1000:.1f} MHz"
safety_label = ""
with dpg.group(horizontal=True):
dpg.add_combo(
items=processed_voltages_e,
default_value="Disabled",
tag="g_volt_e_" + str(freq),
callback=k.grab_kip_storage_values_no_mult
)
dpg.add_text(default_value=f"{mhz_label} {safety_label}", color=mhz_color)

View File

@@ -2,30 +2,7 @@ import os
import re
import common as c
def ensure_dir_exists(path):
path_str = str(path)
os.makedirs(os.path.dirname(path_str), exist_ok=True)
import os
import re
import common as c
def ensure_dir_exists(path):
os.makedirs(os.path.dirname(path), exist_ok=True)
import os
import re
import common as c
def ensure_dir_exists(path: str):
"""Ensure the parent directory of the INI file exists."""
os.makedirs(os.path.dirname(path), exist_ok=True)
import os
import re
import common as c
def ensure_dir_exists(path):
os.makedirs(os.path.dirname(path), exist_ok=True)
def set_ini_values(ini_path, section, entries):

View File

@@ -28,6 +28,7 @@ import urllib.request
import zipfile
import kip as k
from defaults import d
import settings as s
def autosave_toggle(sender, app_data):
d.autosave=app_data
@@ -42,9 +43,6 @@ def get_drives():
# Change if you plan to fork
kip_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/loader.kip"
hoc_clk_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/hoc-clk.zip"
ams_download_link=""
def download_and_extract_zip(c, download_url, zip_filename="temp.zip", success_message="Installed file!"):
"""
@@ -92,7 +90,7 @@ def downloadLoader(): # This has to be different as it extracts to a custom loca
else:
try:
directory_make = c.drive + "atmosphere/kips/"
urllib.request.urlretrieve(kip_download_link, directory_make + "hoc.kip")
urllib.request.urlretrieve(s.kip_download_link, directory_make + "hoc.kip")
except Exception as e:
c.show_popup(title="Error", content=f"Download failed:\n{e}")
finally:
@@ -109,7 +107,7 @@ def check_atmosphere(sender, app_data, user_data):
k.kip_file_path = f"{atmosphere_path}/kips/hoc.kip"
k.read_kip(c.drive + "atmosphere/kips/hoc.kip")
print(f"Reading kip from drive {c.drive}")
k.load_all_vars()
s.load_all_vars()
elif os.path.isdir(atmosphere_path) and os.path.isfile(package3_path):
dpg.set_value("status_text", "Atmosphere install found!")
else:

View File

@@ -3,157 +3,22 @@ import struct
from defaults import d
import common as c
import gpu as g
import cpu
import defaults as df
import re
import ctypes
import settings as s
g_freq_str = None
kip_file_path = None
variables = [
("custRev", "u32"),
("mtcConf", "u32"),
("commonCpuBoostClock", "u32"),
("commonEmcMemVolt", "u32"),
("eristaCpuMaxVolt", "u32"),
("eristaEmcMaxClock", "u32"),
("marikoCpuMaxVolt", "u32"),
("marikoEmcMaxClock", "u32"),
("marikoEmcVddqVolt", "u32"),
("marikoCpuUV", "u32"),
("marikoGpuUV", "u32"),
("eristaCpuUV", "u32"),
("eristaGpuUV", "u32"),
("enableMarikoGpuUnsafeFreqs", "u32"),
("enableEristaGpuUnsafeFreqs", "u32"),
("enableMarikoCpuUnsafeFreqs", "u32"),
("enableEristaCpuUnsafeFreqs", "u32"),
("commonGpuVoltOffset", "u32"),
("marikoEmcDvbShift", "u32"),
# advanced config
("t1_tRCD", "u32"),
("t2_tRP", "u32"),
("t3_tRAS", "u32"),
("t4_tRRD", "u32"),
("t5_tRFC", "u32"),
("t6_tRTW", "u32"),
("t7_tWTR", "u32"),
("t8_tREFI", "u32"),
("mem_burst_latency", "u32"),
("g_volt_76800", "u32"),
("g_volt_153600", "u32"),
("g_volt_230400", "u32"),
("g_volt_307200", "u32"),
("g_volt_384000", "u32"),
("g_volt_460800", "u32"),
("g_volt_537600", "u32"),
("g_volt_614400", "u32"),
("g_volt_691200", "u32"),
("g_volt_768000", "u32"),
("g_volt_844800", "u32"),
("g_volt_921600", "u32"),
("g_volt_998400", "u32"),
("g_volt_1075200", "u32"),
("g_volt_1152000", "u32"),
("g_volt_1228800", "u32"),
("g_volt_1267200", "u32"),
("g_volt_1305600", "u32"),
("g_volt_1344000", "u32"),
("g_volt_1382400", "u32"),
("g_volt_1420800", "u32"),
("g_volt_1459200", "u32"),
("g_volt_1497600", "u32"),
("g_volt_1536000", "u32"),
("g_volt_e_76800", "u32"),
("g_volt_e_153600", "u32"),
("g_volt_e_230400", "u32"),
("g_volt_e_307200", "u32"),
("g_volt_e_384000", "u32"),
("g_volt_e_460800", "u32"),
("g_volt_e_537600", "u32"),
("g_volt_e_614400", "u32"),
("g_volt_e_691200", "u32"),
("g_volt_e_768000", "u32"),
("g_volt_e_844800", "u32"),
("g_volt_e_921600", "u32"),
("g_volt_e_998400", "u32"),
("g_volt_e_1075200", "u32"),
# ("g_volt_e_1152000", "u32"),
# ("g_volt_e_1228800", "u32"),
("marikoCpuVmin", "u32"),
("eristaGpuVmin", "u32"),
("marikoGpuVmin", "u32"),
("marikoGpuVmax", "u32"),
]
fmt_map = {
"u32": "I",
"double": "d",
}
def make_struct_format(vars_list):
fmt = "="
for name, t in vars_list:
fmt += fmt_map[t]
fmt += s.fmt_map[t]
if name == "tFAW":
fmt += "4x" # i hate hardcoding but this is what it is
return fmt
def load_all_vars():
c.load_entry_object("custRev", 0)
c.load_entry_object("mtcConf", 0)
c.load_entry_object("commonCpuBoostClock", 1)
c.load_entry_object("commonEmcMemVolt", 2)
c.load_entry_object("eristaCpuMaxVolt", 3)
c.load_entry_object("eristaEmcMaxClock", 1)
c.load_entry_object("marikoCpuMaxVolt", 3)
c.load_entry_object("marikoEmcMaxClock", 1)
c.load_entry_object("marikoEmcVddqVolt", 2)
c.load_entry_object("marikoCpuUV", 5)
c.load_entry_object("marikoGpuUV", 4)
c.load_entry_object("eristaCpuUV", 5)
c.load_entry_object("eristaGpuUV", 4)
c.load_entry_object("enableMarikoGpuUnsafeFreqs", 0)
c.load_entry_object("enableEristaGpuUnsafeFreqs", 0)
c.load_entry_object("enableMarikoCpuUnsafeFreqs", 0)
c.load_entry_object("enableEristaCpuUnsafeFreqs", 0)
c.load_entry_object("commonGpuVoltOffset", 3)
c.load_entry_object("marikoEmcDvbShift", 0)
# Advanced memory config
c.load_entry_object("t1_tRCD", 5)
c.load_entry_object("t2_tRP", 5)
c.load_entry_object("t3_tRAS", 5)
c.load_entry_object("t4_tRRD", 5)
c.load_entry_object("t5_tRFC", 5)
c.load_entry_object("t6_tRTW", 5)
c.load_entry_object("t7_tWTR", 5)
c.load_entry_object("t8_tREFI", 5)
c.load_entry_object("mem_burst_latency", 5)
# GPU voltage arrays
for freq in [
"76800", "153600", "230400", "307200", "384000", "460800", "537600",
"614400", "691200", "768000", "844800", "921600", "998400", "1075200",
"1152000", "1228800", "1267200", "1305600", "1344000", "1382400",
"1420800", "1459200", "1497600", "1536000"
]:
c.load_entry_object(f"g_volt_{freq}", 3)
for e_freq in [
"76800", "153600", "230400", "307200", "384000", "460800", "537600",
"614400", "691200", "768000", "844800", "921600", "998400", "1075200"# ,
# "1152000", "1228800"
]:
c.load_entry_object(f"g_volt_e_{e_freq}", 3)
c.load_entry_object("marikoCpuVmin", 3)
c.load_entry_object("eristaGpuVmin", 3)
c.load_entry_object("marikoGpuVmin", 3)
c.load_entry_object("marikoGpuVmax", 3)
def freq_to_label(freq):
if freq > 1382400:
@@ -168,7 +33,7 @@ def store(sender, app_data):
kip_file_path = app_data['file_path_name']
print("Selected" + kip_file_path)
read_kip(kip_file_path)
load_all_vars()
s.load_all_vars()
def grab_kip_storage_values(sender, app_data):
tag = dpg.get_item_alias(sender)
@@ -217,7 +82,7 @@ def grab_value_freq_conversion(sender, app_data):
def write_kip():
global kip_file_path
MAGIC = b"CUST"
struct_fmt = make_struct_format(variables)
struct_fmt = make_struct_format(s.variables)
struct_size = struct.calcsize(struct_fmt)
if kip_file_path is None:
msg = "You need to select a file to use Autosave!" if d.autosave else "You need to select a file to save the KIP!"
@@ -231,7 +96,7 @@ def write_kip():
return
pos = idx + len(MAGIC)
values = []
for attr_name, t in variables:
for attr_name, t in s.variables:
val = getattr(d, attr_name)
if t == "u32":
val = int(val) & 0xFFFFFFFF
@@ -250,7 +115,7 @@ def write_kip():
def read_kip(filename):
MAGIC = b"CUST"
struct_fmt = make_struct_format(variables)
struct_fmt = make_struct_format(s.variables)
struct_size = struct.calcsize(struct_fmt)
with open(filename, "rb") as f:
data = f.read()
@@ -260,12 +125,12 @@ def read_kip(filename):
pos = idx + len(MAGIC)
raw = data[pos:pos + struct_size]
values = struct.unpack(struct_fmt, raw)
for (attr_name, _), val in zip(variables, values):
for (attr_name, _), val in zip(s.variables, values):
setattr(d, attr_name, val)
print("=== value layout ===")
offset = 0
for (attr_name, t) in variables:
code = fmt_map[t]
for (attr_name, t) in s.variables:
code = s.fmt_map[t]
align = 8 if code == "d" else 4
padding = (-offset) % align
if padding:

View File

@@ -28,8 +28,7 @@ import re
import installer as ins
from defaults import d
import ram as r
skinTarget = 54 # default value
import settings as s
def get_ini_path():
if not common.drive or common.drive == 0:
@@ -37,150 +36,12 @@ def get_ini_path():
return None
return Path(str(common.drive)) / "atmosphere/config/system_settings.ini"
PROFILES = {
"V1_Erista": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[6396, 119440]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5817, 129580]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6182, 112480]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5464, 174190]"',
},
"V2_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[6357, 168124]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5675, 203453]"',
},
"Lite_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5594, 209601]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5235, 199759]"',
},
"OLED_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[8051, -45213]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[7176, -33954]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[7831, 57590]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[9029, 4274]"',
},
}
BATTERY_SAVE_OPTIONS = {
"bgtc": {
"enable_halfawake": "u32!0x0",
"minimum_interval_normal": "u32!0x7FFFFFFF",
"minimum_interval_save": "u32!0x7FFFFFFF",
"battery_threshold_save": "u32!0x64",
"battery_threshold_stop": "u32!0x64",
},
"npns": {
"background_processing": "u8!0x0",
"sleep_periodic_interval": "u32!0x7FFFFFFF",
"sleep_processing_timeout": "u32!0x0",
"sleep_max_try_count": "u32!0x0",
},
"ns.notification": {
"enable_download_task_list": "u8!0x0",
"enable_download_ticket": "u8!0x0",
"enable_network_update": "u8!0x0",
"enable_random_wait": "u8!0x0",
"enable_request_on_cold_boot": "u8!0x0",
"enable_send_rights_usage_status_request": "u8!0x0",
"enable_sync_elicense_request": "u8!0x0",
"enable_version_list": "u8!0x0",
"retry_interval_min": "u32!0x7FFFFFFF",
"retry_interval_max": "u32!0x7FFFFFFF",
"version_list_waiting_limit_bias": "u32!0x7FFFFFFF",
"version_list_waiting_limit_min": "u32!0x7FFFFFFF",
},
"account": {
"na_required_for_network_service": "u8!0x0",
"na_license_verification_enabled": "u8!0x0",
},
"account.daemon": {
"background_awaking_periodicity": "u32!0x7FFFFFFF",
"initial_schedule_delay": "u32!0x7FFFFFFF",
"profile_sync_interval": "u32!0x7FFFFFFF",
"na_info_refresh_interval": "u32!0x7FFFFFFF",
},
"capsrv": {
"enable_album_screenshot_filedata_verification": "u8!0x0",
"enable_album_movie_filehash_verification": "u8!0x0",
"enable_album_movie_filesign_verification": "u8!0x0",
},
"friends": {
"background_processing": "u8!0x0",
},
"notification.presenter": {
"snooze_interval_in_seconds": "u32!0x7FFFFFFF",
"connection_retry_count": "u32!0x0",
"alarm_pattern_total_repeat_count": "u32!0x0",
"alarm_pattern_with_vibration_repeat_count": "u32!0x0",
},
"prepo": {
"transmission_interval_min": "u32!0x7FFFFFFF",
"transmission_retry_interval_min": "u32!0x7FFFFFFF",
"transmission_retry_interval_max": "u32!0x7FFFFFFF",
"transmission_interval_in_sleep": "u32!0x7FFFFFFF",
"statistics_save_interval_min": "u32!0x7FFFFFFF",
"statistics_post_interval": "u32!0x7FFFFFFF",
"save_system_report": "u8!0x0",
},
"olsc": {
"default_auto_upload_global_setting": "u8!0x0",
"default_auto_download_global_setting": "u8!0x0",
"autonomy_registration_interval_seconds": "u32!0x7FFFFFFF",
"network_service_license_info_cache_expiration_seconds": "u32!0x7FFFFFFF",
"postponed_transfer_task_processing_interval_seconds": "u32!0x7FFFFFFF",
"retry_offset_seconds": "u32!0x7FFFFFFF",
"network_trouble_detection_span_seconds": "u32!0x7FFFFFFF",
"network_connection_polling_interval_seconds": "u32!0x7FFFFFFF",
"is_save_data_backup_policy_check_required": "u8!0x0",
"is_global_transfer_task_autonomy_registration_enabled": "u8!0x0",
"is_on_event_transfer_task_registration_enabled": "u8!0x0",
"is_periodic_transfer_task_registration_enabled": "u8!0x0",
},
"ntc": {
"is_autonomic_correction_enabled": "u8!0x0",
"autonomic_correction_interval_seconds": "u32!0x7FFFFFFF",
"autonomic_correction_failed_retry_interval_seconds": "u32!0x7FFFFFFF",
"autonomic_correction_immediate_try_count_max": "u32!0x0",
"autonomic_correction_immediate_try_interval_milliseconds": "u32!0x7FFFFFFF",
},
"systemupdate": {
"bgnup_retry_seconds": "u32!0x7FFFFFFF",
},
"ns.rights": {
"skip_account_validation_on_rights_check": "u8!0x1",
"next_available_time_of_unexpected_error": "u32!0x7FFFFFFF",
},
"pctl": {
"intermittent_task_interval_seconds": "u32!0x7FFFFFFF",
},
"sprofile": {
"adjust_polling_interval_by_profile": "u8!0x0",
"polling_interval_sec_max": "u32!0x7FFFFFFF",
"polling_interval_sec_min": "u32!0x7FFFFFFF",
},
}
PSM_OPTIONS = [
{"name": "1024mA", "value": "u32!0x400"},
{"name": "1280mA", "value": "u32!0x500"},
{"name": "1536mA", "value": "u32!0x600"},
{"name": "1660mA (Lite Default)", "value": "u32!0x67C"},
{"name": "1792mA", "value": "u32!0x700"},
{"name": "2048mA (Default)", "value": "u32!0x800"},
{"name": "2304mA (UNSAFE)", "value": "u32!0x900"},
{"name": "2560mA (UNSAFE)", "value": "u32!0xA00"},
{"name": "2816mA (DANGEROUS)", "value": "u32!0xB00"},
{"name": "3072mA (DANGEROUS)", "value": "u32!0xC00"},
]
def set_psm_value(sender, app_data):
ini_path = get_ini_path()
if not ini_path:
return
value = next((x["value"] for x in PSM_OPTIONS if x["name"] == app_data), None)
value = next((x["value"] for x in s.PSM_OPTIONS if x["name"] == app_data), None)
if value:
ini.set_ini_values(str(ini_path), "psm", {"current_psm_mA": value})
common.show_popup("Success", f"Charge Limit set to {app_data}")
@@ -220,11 +81,11 @@ def remove_tc_entries():
def set_ini_from_profile(sender, app_data, user_data):
profile_name = user_data
if profile_name not in PROFILES:
if profile_name not in s.PROFILES:
print(f"Profile '{profile_name}' not found.")
return
entries = PROFILES[profile_name]
entries = s.PROFILES[profile_name]
ini_path = get_ini_path()
if not ini_path:
return
@@ -233,23 +94,14 @@ def set_ini_from_profile(sender, app_data, user_data):
print(f"Applied profile {profile_name} under [tc]")
def update_skin_target(sender, app_data):
global skinTarget
skinTarget = app_data
print("skinTarget =", skinTarget)
s.skinTarget = app_data
print("skinTarget =", s.skinTarget)
ini_path = get_ini_path()
if not ini_path:
return
entries = {
"use_configurations_on_fwdbg": "u8!0x1",
"tskin_rate_table_console_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
"tskin_rate_table_handheld_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
"holdable_tskin": "u32!0xEA60",
"touchable_tskin": "u32!0xEA60"
}
ini.set_ini_values(str(ini_path), "tc", entries)
ini.set_ini_values(str(ini_path), "tc", s.skin_t_entries)
def toggle_battery_save(sender, user_data):
@@ -259,7 +111,7 @@ def toggle_battery_save(sender, user_data):
ini_path = Path(common.drive) / "atmosphere/config/system_settings.ini"
for section, entries in BATTERY_SAVE_OPTIONS.items():
for section, entries in s.BATTERY_SAVE_OPTIONS.items():
if dpg.get_item_alias(sender) == "enable_battery_fix": # hardcoded but otherwise it doesnt work :(
ini.set_ini_values(str(ini_path), section, entries)
else:
@@ -277,7 +129,7 @@ def populate():
dpg.add_slider_int(
label="Skin Target (Recommended - 54°C)",
min_value=50, max_value=60,
default_value=skinTarget,
default_value=s.skinTarget,
callback=update_skin_target
)
dpg.add_button(label="Reset Fan Curve", callback=remove_tc_entries)
@@ -311,9 +163,6 @@ def populate():
reversenx_link = "https://github.com/masagrator/ReverseNX-RT/releases/latest/download/ReverseNX-RT-ovl.ovl"
dpg.add_button(label="Install ReverseNX-RT", callback=lambda: ins.download_and_install(c=common, install_path=common.drive + "switch/.overlays/", download_url=reversenx_link, filename="ReverseNX-RT-ovl.ovl", success_message="Installed ReverseNX-RT!"))
status_monitor_link = "https://github.com/ppkantorski/Status-Monitor-Overlay/releases/latest/download/ Status-Monitor-Overlay.ovl "
dpg.add_button(label="Install Status Monitor", callback=lambda: ins.download_and_install(c=common, install_path=common.drive + "switch/.overlays/", download_url=status_monitor_link, filename=" Status-Monitor-Overlay.ovl", success_message="Installed Status Monitor!"))
dpg.add_separator(label="Danger Zone")
dpg.add_text("These options are known to cause hardware issues, PMIC issues or overheating.\nUse with extreme caution!", color=(255, 165, 0, 255))
@@ -322,7 +171,7 @@ def populate():
dpg.add_spacer(height=10)
psm_items = [x["name"] for x in PSM_OPTIONS]
psm_items = [x["name"] for x in s.PSM_OPTIONS]
dpg.add_combo(items=psm_items, label="Battery Charge Limit", callback=set_psm_value, tag="psm_dropdown", default_value="2048mA (Default)")
dpg.add_spacer(height=5)
@@ -341,21 +190,14 @@ def set_white_tiger_clocks(app_data):
# 1400mv emc max
# 1375mv cpu max
# 750mv vdd2 mariko max
base_vddq_uv = [
0, 550000, 555000, 560000, 565000, 570000, 575000, 580000,
585000, 590000, 595000, 600000, 605000, 610000, 615000,
620000, 625000, 630000, 635000, 640000, 645000, 650000
]
base_vddq_uv = list(range(550000, 650001, 5000))
vddq_uv = [0] + list(range(250000, 750001, 5000)) if app_data else base_vddq_uv
vddq_mv = [v // 1000 for v in vddq_uv]
vddq_mv_label = ["Default (600 mV)" if f == 0 else f"{f} mV" for f in vddq_mv]
dpg.configure_item("marikoEmcVddqVolt", items=vddq_mv_label)
base_voltages_uv = [
0, 1050000, 1062500, 1075000, 1087500, 1100000, 1112500, 1125000,
1137500, 1150000, 1162500, 1175000, 1187500, 1200000, 1212500, 1237500
]
base_voltages_uv = list(range(1050000, 1212500 + 1, 12500))
voltages_uv = base_voltages_uv + list(range(1225000, 1400000 + 1, 12500)) if app_data else base_voltages_uv
voltages_mv = [v / 1000 for v in voltages_uv]
voltages_mv_label = ["Default (1175 mV)" if f == 0 else f"{f} mV" for f in voltages_mv]

View File

@@ -20,237 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import dearpygui.dearpygui as dpg
from defaults import d
import common as c
timing_vars = [
"d.t1_tRCD",
"d.t2_tRP",
"d.t3_tRAS",
"d.t4_tRRD",
"d.t5_tRFC",
"d.t6_tRTW",
"d.t7_tWTR",
"d.t8_tREFI"
]
timing_preset_default = [
0, # tRCD
0, # tRP
0, # tRAS
0, # tRRD
0, # tRFC
0, # tRTW
0, # tWTR
0, # tREFI
]
timing_preset_aamgcl_c = [
4, # tRCD
4, # tRP
5, # tRAS
5, # tRRD
5, # tRFC
5, # tRTW
7, # tWTR
6, # tREFI
]
timing_preset_aamgcl_st = [
4, # tRCD
4, # tRP
8, # tRAS
6, # tRRD
5, # tRFC
7, # tRTW
8, # tWTR
6, # tREFI
]
timing_preset_mgcj_c = [
3, # tRCD
2, # tRP
4, # tRAS
2, # tRRD
4, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_mgcj_st = [
4, # tRCD
3, # tRP
8, # tRAS
2, # tRRD
5, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_ab_mgcl_c = [
4, # tRCD
4, # tRP
4, # tRAS
4, # tRRD
4, # tRFC
5, # tRTW
6, # tWTR
6, # tREFI
]
timing_preset_ab_mgcl_st = [
4, # tRCD
4, # tRP
8, # tRAS
5, # tRRD
5, # tRFC
6, # tRTW
8, # tWTR
6, # tREFI
]
timing_preset_hb_mgch_c = [
4, # tRCD
4, # tRP
4, # tRAS
0, # tRRD
1, # tRFC
5, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_hb_mgch_st = [
4, # tRCD
5, # tRP
9, # tRAS
1, # tRRD
2, # tRFC
6, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_wtf_c = [
4, # tRCD
4, # tRP
2, # tRAS
5, # tRRD
4, # tRFC
6, # tRTW
3, # tWTR
6, # tREFI
]
timing_preset_wtf_st = [
5, # tRCD
5, # tRP
4, # tRAS
5, # tRRD
5, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wte_c = [
2, # tRCD
2, # tRP
2, # tRAS
2, # tRRD
4, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_wte_st = [
3, # tRCD
5, # tRP
3, # tRAS
3, # tRRD
5, # tRFC
4, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wtb_c = [
4, # tRCD
4, # tRP
5, # tRAS
5, # tRRD
2, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wtb_st = [
6, # tRCD
6, # tRP
7, # tRAS
7, # tRRD
2, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_nee_c = [
3, # tRCD
3, # tRP
2, # tRAS
2, # tRRD
5, # tRFC
5, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_nee_st = [
4, # tRCD
4, # tRP
4, # tRAS
3, # tRRD
7, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_nme_c = [
2, # tRCD
2, # tRP
1, # tRAS
0, # tRRD
1, # tRFC
4, # tRTW
3, # tWTR
6, # tREFI
]
timing_preset_nme_st = [
3, # tRCD
3, # tRP
4, # tRAS
0, # tRRD
1, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
import settings as s
def load_defaults():
apply_timing_preset(timing_preset_default)
apply_timing_preset(s.timing_preset_default)
def temporary_presets_unavailable():
c.show_popup_big("We need your help!", "This timing preset currently unavailable due to lack of data. If you have a ram module and want to contribute your data, reach out to me (soul_9017) on the OC discord")
def apply_timing_preset(preset):
if len(preset) != len(timing_vars):
if len(preset) != len(s.timing_vars):
raise ValueError("Preset invalid!")
for var_name, value in zip(timing_vars, preset):
for var_name, value in zip(s.timing_vars, preset):
setattr(d, var_name.split('.')[-1], value)
flag = 0 if var_name.endswith("tBL") else 5
@@ -265,25 +48,25 @@ def apply_reg_timings(sender, app_data):
case "Choose your RAM Type!":
c.show_popup("Error", "You must select a ram type to apply a preset")
case "Samsung AA-MGCL/MGCR":
apply_timing_preset(timing_preset_aamgcl_c)
apply_timing_preset(s.timing_preset_aamgcl_c)
case "SK Hynix NEI/NEE/x267":
apply_timing_preset(timing_preset_nee_c)
apply_timing_preset(s.timing_preset_nee_c)
case "Micron WT:B":
apply_timing_preset(timing_preset_wtb_c)
apply_timing_preset(s.timing_preset_wtb_c)
case "Micron AUT:B":
apply_timing_preset(timing_preset_wtb_c)
apply_timing_preset(s.timing_preset_wtb_c)
case "Micron WT:F":
apply_timing_preset(timing_preset_wtf_c)
apply_timing_preset(s.timing_preset_wtf_c)
case "Samsung AM-MGCJ":
apply_timing_preset(timing_preset_mgcj_c)
apply_timing_preset(s.timing_preset_mgcj_c)
case "Micron WT:E":
apply_timing_preset(timing_preset_wte_c)
apply_timing_preset(s.timing_preset_wte_c)
case "Samsung AB-MGCL":
apply_timing_preset(timing_preset_ab_mgcl_c)
apply_timing_preset(s.timing_preset_ab_mgcl_c)
case "SK Hynix NME":
apply_timing_preset(timing_preset_nme_c)
apply_timing_preset(s.timing_preset_nme_c)
case "Samsung HB-MGCH":
apply_timing_preset(timing_preset_hb_mgch_c)
apply_timing_preset(s.timing_preset_hb_mgch_c)
case _:
temporary_presets_unavailable()
@@ -293,25 +76,25 @@ def apply_st_timings(sender, app_data):
case "Choose your RAM Type!":
c.show_popup("Error", "You must select a ram type to apply a preset")
case "Samsung AA-MGCL/MGCR":
apply_timing_preset(timing_preset_aamgcl_st)
apply_timing_preset(s.timing_preset_aamgcl_st)
case "SK Hynix NEI/NEE/x267":
apply_timing_preset(timing_preset_nee_st)
apply_timing_preset(s.timing_preset_nee_st)
case "Micron WT:B":
apply_timing_preset(timing_preset_wtb_st)
apply_timing_preset(s.timing_preset_wtb_st)
case "Micron AUT:B":
apply_timing_preset(timing_preset_wtb_st)
apply_timing_preset(s.timing_preset_wtb_st)
case "Micron WT:F":
apply_timing_preset(timing_preset_wtf_st)
apply_timing_preset(s.timing_preset_wtf_st)
case "Samsung AM-MGCJ":
apply_timing_preset(timing_preset_mgcj_st)
apply_timing_preset(s.timing_preset_mgcj_st)
case "Micron WT:E":
apply_timing_preset(timing_preset_wte_st)
apply_timing_preset(s.timing_preset_wte_st)
case "Samsung AB-MGCL":
apply_timing_preset(timing_preset_ab_mgcl_st)
apply_timing_preset(s.timing_preset_ab_mgcl_st)
case "SK Hynix NME":
apply_timing_preset(timing_preset_nme_st)
apply_timing_preset(s.timing_preset_nme_st)
case "Samsung HB-MGCH":
apply_timing_preset(timing_preset_hb_mgch_st)
apply_timing_preset(s.timing_preset_hb_mgch_st)
case _:
temporary_presets_unavailable()

View File

@@ -25,33 +25,17 @@ import common
import kip as k
import preset
from defaults import d
import settings as s
def populate():
# Values in kHz
adjusted_freqs_khz = [
0, 1600000, 1633000, 1666000, 1700000, 1733000, 1766000, 1800000, 1833000, 1866000, 1900000,
1933000, 1966000, 2000000, 2033000, 2066000, 2100000, 2133000, 2166000, 2200000, 2233000,
2266000, 2300000, 2333000, 2366000, 2400000, 2433000, 2466000, 2500000, 2533000, 2566000,
2600000, 2633000, 2666000, 2700000, 2733000, 2766000, 2800000, 2833000, 2866000, 2900000,
2933000, 2966000, 3000000, 3033000, 3066000, 3100000, 3133000, 3166000, 3200000, 3233000,
3266000, 3300000, 3333000, 3366000, 3400000, 3433000, 3466000, 3500000
]
voltages_uv = [
0, 1050000, 1062500, 1075000, 1087500, 1100000, 1112500, 1125000,
1137500, 1150000, 1162500, 1175000, 1187500, 1200000, 1212500, 1237500
]
vddq_uv = [
0, 550000, 555000, 560000, 565000, 570000, 575000, 580000, 585000, 590000, 595000,
600000, 605000, 610000, 615000, 620000, 625000, 630000, 635000, 640000, 645000,
650000
]
voltages_mv = [v / 1000 for v in voltages_uv]
voltages_mv = [v / 1000 for v in s.voltages_uv]
voltages_mv_label = ["Default (1175 mV)" if f == 0 else f"{f} mV" for f in voltages_mv]
vddq_mv = [v / 1000 for v in vddq_uv]
vddq_mv = [v / 1000 for v in s.vddq_uv]
vddq_mv_label = ["Default (600 mV)" if f == 0 else f"{f} mV" for f in vddq_mv]
# Values in MHz (converted)
values_mhz = [v / 1000 for v in adjusted_freqs_khz]
values_mhz = [v / 1000 for v in s.adjusted_freqs_khz]
values_mhz_label_m = ["Default (1996.8 MHz)" if f == 0 else f"{f} MHz" for f in values_mhz]
values_mhz_label_e = ["Default (1862.4 MHz)" if f == 0 else f"{f} MHz" for f in values_mhz]
dvb = [i for i in range(10)]

View File

@@ -0,0 +1,603 @@
import common as c
# Links
kip_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/loader.kip"
hoc_clk_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/hoc-clk.zip"
nx_ovlloader_link = "https://github.com/ppkantorski/nx-ovlloader/releases/latest/download/nx-ovlloader+.zip"
ultrahand_link = "https://github.com/ppkantorski/Ultrahand-Overlay/releases/latest/download/ovlmenu.ovl"
status_monitor_link = "https://github.com/ppkantorski/Status-Monitor-Overlay/releases/latest/download/ Status-Monitor-Overlay.ovl "
saltynx_link = "https://github.com/masagrator/SaltyNX/releases/latest/download/SaltyNX.zip"
reversenx_link = "https://github.com/masagrator/ReverseNX-RT/releases/latest/download/ReverseNX-RT-ovl.ovl"
# Frequencies
freqs_khz = [
76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000,
844800, 921600, 998400, 1075200, 1152000, 1228800, 1267200, 1305600, 1344000, 1382400, 1420800,
1459200, 1497600, 1536000
]
freqs_khz_e = [
76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000,
844800, 921600, 998400, 1075200 #, 1152000, 1228800 # Disabled by default as these freqs can cause board damage
]
freqs_mhz = [
76.8, 153.6, 230.4, 307.2, 384.0, 460.8, 537.6, 614.4, 691.2, 768.0,
844.8, 921.6, 998.4, 1075.2, 1152.0, 1228.8, 1267.2, 1305.6, 1344.0, 1382.4,
1420.8, 1459.2, 1497.6, 1536.0
]
adjusted_freqs_khz = [
0, 1600000, 1633000, 1666000, 1700000, 1733000, 1766000, 1800000, 1833000, 1866000, 1900000,
1933000, 1966000, 2000000, 2033000, 2066000, 2100000, 2133000, 2166000, 2200000, 2233000,
2266000, 2300000, 2333000, 2366000, 2400000, 2433000, 2466000, 2500000, 2533000, 2566000,
2600000, 2633000, 2666000, 2700000, 2733000, 2766000, 2800000, 2833000, 2866000, 2900000,
2933000, 2966000, 3000000, 3033000, 3066000, 3100000, 3133000, 3166000, 3200000, 3233000,
3266000, 3300000, 3333000, 3366000, 3400000, 3433000, 3466000, 3500000
]
voltages_uv = [
0, 1050000, 1062500, 1075000, 1087500, 1100000, 1112500, 1125000,
1137500, 1150000, 1162500, 1175000, 1187500, 1200000, 1212500, 1237500
]
vddq_uv = [
0, 550000, 555000, 560000, 565000, 570000, 575000, 580000, 585000, 590000, 595000,
600000, 605000, 610000, 615000, 620000, 625000, 630000, 635000, 640000, 645000,
650000
]
freqs_hz_cpu = [
1020000, 1122000, 1224000, 1326000, 1428000, 1581000, 1683000,
1785000, 1887000, 1963500, 2091000, 2193000, 2295000, 2397000,
2499000, 2601000, 2703000, 2805000, 2907000
]
freqs_mhz_cpu = [
1020.0, 1122.0, 1224.0, 1326.0, 1428.0, 1581.0, 1683.0,
1785.0, 1887.0, 1963.5, 2091.0, 2193.0, 2295.0, 2397.0,
2499.0, 2601.0, 2703.0, 2805.0, 2907.0
]
# Loading/saving
variables = [
("custRev", "u32"),
("mtcConf", "u32"),
("commonCpuBoostClock", "u32"),
("commonEmcMemVolt", "u32"),
("eristaCpuMaxVolt", "u32"),
("eristaEmcMaxClock", "u32"),
("marikoCpuMaxVolt", "u32"),
("marikoEmcMaxClock", "u32"),
("marikoEmcVddqVolt", "u32"),
("marikoCpuUV", "u32"),
("marikoGpuUV", "u32"),
("eristaCpuUV", "u32"),
("eristaGpuUV", "u32"),
("enableMarikoGpuUnsafeFreqs", "u32"),
("enableEristaGpuUnsafeFreqs", "u32"),
("enableMarikoCpuUnsafeFreqs", "u32"),
("enableEristaCpuUnsafeFreqs", "u32"),
("commonGpuVoltOffset", "u32"),
("marikoEmcDvbShift", "u32"),
# advanced config
("t1_tRCD", "u32"),
("t2_tRP", "u32"),
("t3_tRAS", "u32"),
("t4_tRRD", "u32"),
("t5_tRFC", "u32"),
("t6_tRTW", "u32"),
("t7_tWTR", "u32"),
("t8_tREFI", "u32"),
("mem_burst_latency", "u32"),
("marikoCpuVmin", "u32"),
("eristaGpuVmin", "u32"),
("marikoGpuVmin", "u32"),
("marikoGpuVmax", "u32"),
("g_volt_76800", "u32"),
("g_volt_153600", "u32"),
("g_volt_230400", "u32"),
("g_volt_307200", "u32"),
("g_volt_384000", "u32"),
("g_volt_460800", "u32"),
("g_volt_537600", "u32"),
("g_volt_614400", "u32"),
("g_volt_691200", "u32"),
("g_volt_768000", "u32"),
("g_volt_844800", "u32"),
("g_volt_921600", "u32"),
("g_volt_998400", "u32"),
("g_volt_1075200", "u32"),
("g_volt_1152000", "u32"),
("g_volt_1228800", "u32"),
("g_volt_1267200", "u32"),
("g_volt_1305600", "u32"),
("g_volt_1344000", "u32"),
("g_volt_1382400", "u32"),
("g_volt_1420800", "u32"),
("g_volt_1459200", "u32"),
("g_volt_1497600", "u32"),
("g_volt_1536000", "u32"),
("g_volt_e_76800", "u32"),
("g_volt_e_153600", "u32"),
("g_volt_e_230400", "u32"),
("g_volt_e_307200", "u32"),
("g_volt_e_384000", "u32"),
("g_volt_e_460800", "u32"),
("g_volt_e_537600", "u32"),
("g_volt_e_614400", "u32"),
("g_volt_e_691200", "u32"),
("g_volt_e_768000", "u32"),
("g_volt_e_844800", "u32"),
("g_volt_e_921600", "u32"),
("g_volt_e_998400", "u32"),
("g_volt_e_1075200", "u32"),
# ("g_volt_e_1152000", "u32"),
# ("g_volt_e_1228800", "u32"),
]
fmt_map = {
"u32": "I",
"double": "d",
}
def load_all_vars():
c.load_entry_object("custRev", 0)
c.load_entry_object("mtcConf", 0)
c.load_entry_object("commonCpuBoostClock", 1)
c.load_entry_object("commonEmcMemVolt", 2)
c.load_entry_object("eristaCpuMaxVolt", 3)
c.load_entry_object("eristaEmcMaxClock", 1)
c.load_entry_object("marikoCpuMaxVolt", 3)
c.load_entry_object("marikoEmcMaxClock", 1)
c.load_entry_object("marikoEmcVddqVolt", 2)
c.load_entry_object("marikoCpuUV", 5)
c.load_entry_object("marikoGpuUV", 4)
c.load_entry_object("eristaCpuUV", 5)
c.load_entry_object("eristaGpuUV", 4)
c.load_entry_object("enableMarikoGpuUnsafeFreqs", 0)
c.load_entry_object("enableEristaGpuUnsafeFreqs", 0)
c.load_entry_object("enableMarikoCpuUnsafeFreqs", 0)
c.load_entry_object("enableEristaCpuUnsafeFreqs", 0)
c.load_entry_object("commonGpuVoltOffset", 3)
c.load_entry_object("marikoEmcDvbShift", 0)
# Advanced memory config
c.load_entry_object("t1_tRCD", 5)
c.load_entry_object("t2_tRP", 5)
c.load_entry_object("t3_tRAS", 5)
c.load_entry_object("t4_tRRD", 5)
c.load_entry_object("t5_tRFC", 5)
c.load_entry_object("t6_tRTW", 5)
c.load_entry_object("t7_tWTR", 5)
c.load_entry_object("t8_tREFI", 5)
c.load_entry_object("mem_burst_latency", 5)
c.load_entry_object("marikoCpuVmin", 3)
c.load_entry_object("eristaGpuVmin", 3)
c.load_entry_object("marikoGpuVmin", 3)
c.load_entry_object("marikoGpuVmax", 3)
# GPU voltage arrays
for freq in [
"76800", "153600", "230400", "307200", "384000", "460800", "537600",
"614400", "691200", "768000", "844800", "921600", "998400", "1075200",
"1152000", "1228800", "1267200", "1305600", "1344000", "1382400",
"1420800", "1459200", "1497600", "1536000"
]:
c.load_entry_object(f"g_volt_{freq}", 3)
for e_freq in [
"76800", "153600", "230400", "307200", "384000", "460800", "537600",
"614400", "691200", "768000", "844800", "921600", "998400", "1075200"# ,
# "1152000", "1228800"
]:
c.load_entry_object(f"g_volt_e_{e_freq}", 3)
# Timings
timing_vars = [
"d.t1_tRCD",
"d.t2_tRP",
"d.t3_tRAS",
"d.t4_tRRD",
"d.t5_tRFC",
"d.t6_tRTW",
"d.t7_tWTR",
"d.t8_tREFI"
]
timing_preset_default = [
0, # tRCD
0, # tRP
0, # tRAS
0, # tRRD
0, # tRFC
0, # tRTW
0, # tWTR
0, # tREFI
]
timing_preset_aamgcl_c = [
4, # tRCD
4, # tRP
5, # tRAS
5, # tRRD
5, # tRFC
5, # tRTW
7, # tWTR
6, # tREFI
]
timing_preset_aamgcl_st = [
4, # tRCD
4, # tRP
8, # tRAS
6, # tRRD
5, # tRFC
7, # tRTW
8, # tWTR
6, # tREFI
]
timing_preset_mgcj_c = [
3, # tRCD
2, # tRP
4, # tRAS
2, # tRRD
4, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_mgcj_st = [
4, # tRCD
3, # tRP
8, # tRAS
2, # tRRD
5, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_ab_mgcl_c = [
4, # tRCD
4, # tRP
4, # tRAS
4, # tRRD
4, # tRFC
5, # tRTW
6, # tWTR
6, # tREFI
]
timing_preset_ab_mgcl_st = [
4, # tRCD
4, # tRP
8, # tRAS
5, # tRRD
5, # tRFC
6, # tRTW
8, # tWTR
6, # tREFI
]
timing_preset_hb_mgch_c = [
4, # tRCD
4, # tRP
4, # tRAS
0, # tRRD
1, # tRFC
5, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_hb_mgch_st = [
4, # tRCD
5, # tRP
9, # tRAS
1, # tRRD
2, # tRFC
6, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_wtf_c = [
4, # tRCD
4, # tRP
2, # tRAS
5, # tRRD
4, # tRFC
6, # tRTW
3, # tWTR
6, # tREFI
]
timing_preset_wtf_st = [
5, # tRCD
5, # tRP
4, # tRAS
5, # tRRD
5, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wte_c = [
2, # tRCD
2, # tRP
2, # tRAS
2, # tRRD
4, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_wte_st = [
3, # tRCD
5, # tRP
3, # tRAS
3, # tRRD
5, # tRFC
4, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wtb_c = [
4, # tRCD
4, # tRP
5, # tRAS
5, # tRRD
2, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_wtb_st = [
6, # tRCD
6, # tRP
7, # tRAS
7, # tRRD
2, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_nee_c = [
3, # tRCD
3, # tRP
2, # tRAS
2, # tRRD
5, # tRFC
5, # tRTW
4, # tWTR
6, # tREFI
]
timing_preset_nee_st = [
4, # tRCD
4, # tRP
4, # tRAS
3, # tRRD
7, # tRFC
6, # tRTW
5, # tWTR
6, # tREFI
]
timing_preset_nme_c = [
2, # tRCD
2, # tRP
1, # tRAS
0, # tRRD
1, # tRFC
4, # tRTW
3, # tWTR
6, # tREFI
]
timing_preset_nme_st = [
3, # tRCD
3, # tRP
4, # tRAS
0, # tRRD
1, # tRFC
4, # tRTW
4, # tWTR
6, # tREFI
]
# INI
skinTarget = 54 # default value
PROFILES = {
"V1_Erista": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[6396, 119440]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5817, 129580]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6182, 112480]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5464, 174190]"',
},
"V2_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[6357, 168124]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5675, 203453]"',
},
"Lite_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5594, 209601]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5235, 199759]"',
},
"OLED_Mariko": {
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[8051, -45213]"',
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[7176, -33954]"',
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[7831, 57590]"',
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[9029, 4274]"',
},
}
BATTERY_SAVE_OPTIONS = {
"bgtc": {
"enable_halfawake": "u32!0x0",
"minimum_interval_normal": "u32!0x7FFFFFFF",
"minimum_interval_save": "u32!0x7FFFFFFF",
"battery_threshold_save": "u32!0x64",
"battery_threshold_stop": "u32!0x64",
},
"npns": {
"background_processing": "u8!0x0",
"sleep_periodic_interval": "u32!0x7FFFFFFF",
"sleep_processing_timeout": "u32!0x0",
"sleep_max_try_count": "u32!0x0",
},
"ns.notification": {
"enable_download_task_list": "u8!0x0",
"enable_download_ticket": "u8!0x0",
"enable_network_update": "u8!0x0",
"enable_random_wait": "u8!0x0",
"enable_request_on_cold_boot": "u8!0x0",
"enable_send_rights_usage_status_request": "u8!0x0",
"enable_sync_elicense_request": "u8!0x0",
"enable_version_list": "u8!0x0",
"retry_interval_min": "u32!0x7FFFFFFF",
"retry_interval_max": "u32!0x7FFFFFFF",
"version_list_waiting_limit_bias": "u32!0x7FFFFFFF",
"version_list_waiting_limit_min": "u32!0x7FFFFFFF",
},
"account": {
"na_required_for_network_service": "u8!0x0",
"na_license_verification_enabled": "u8!0x0",
},
"account.daemon": {
"background_awaking_periodicity": "u32!0x7FFFFFFF",
"initial_schedule_delay": "u32!0x7FFFFFFF",
"profile_sync_interval": "u32!0x7FFFFFFF",
"na_info_refresh_interval": "u32!0x7FFFFFFF",
},
"capsrv": {
"enable_album_screenshot_filedata_verification": "u8!0x0",
"enable_album_movie_filehash_verification": "u8!0x0",
"enable_album_movie_filesign_verification": "u8!0x0",
},
"friends": {
"background_processing": "u8!0x0",
},
"notification.presenter": {
"snooze_interval_in_seconds": "u32!0x7FFFFFFF",
"connection_retry_count": "u32!0x0",
"alarm_pattern_total_repeat_count": "u32!0x0",
"alarm_pattern_with_vibration_repeat_count": "u32!0x0",
},
"prepo": {
"transmission_interval_min": "u32!0x7FFFFFFF",
"transmission_retry_interval_min": "u32!0x7FFFFFFF",
"transmission_retry_interval_max": "u32!0x7FFFFFFF",
"transmission_interval_in_sleep": "u32!0x7FFFFFFF",
"statistics_save_interval_min": "u32!0x7FFFFFFF",
"statistics_post_interval": "u32!0x7FFFFFFF",
"save_system_report": "u8!0x0",
},
"olsc": {
"default_auto_upload_global_setting": "u8!0x0",
"default_auto_download_global_setting": "u8!0x0",
"autonomy_registration_interval_seconds": "u32!0x7FFFFFFF",
"network_service_license_info_cache_expiration_seconds": "u32!0x7FFFFFFF",
"postponed_transfer_task_processing_interval_seconds": "u32!0x7FFFFFFF",
"retry_offset_seconds": "u32!0x7FFFFFFF",
"network_trouble_detection_span_seconds": "u32!0x7FFFFFFF",
"network_connection_polling_interval_seconds": "u32!0x7FFFFFFF",
"is_save_data_backup_policy_check_required": "u8!0x0",
"is_global_transfer_task_autonomy_registration_enabled": "u8!0x0",
"is_on_event_transfer_task_registration_enabled": "u8!0x0",
"is_periodic_transfer_task_registration_enabled": "u8!0x0",
},
"ntc": {
"is_autonomic_correction_enabled": "u8!0x0",
"autonomic_correction_interval_seconds": "u32!0x7FFFFFFF",
"autonomic_correction_failed_retry_interval_seconds": "u32!0x7FFFFFFF",
"autonomic_correction_immediate_try_count_max": "u32!0x0",
"autonomic_correction_immediate_try_interval_milliseconds": "u32!0x7FFFFFFF",
},
"systemupdate": {
"bgnup_retry_seconds": "u32!0x7FFFFFFF",
},
"ns.rights": {
"skip_account_validation_on_rights_check": "u8!0x1",
"next_available_time_of_unexpected_error": "u32!0x7FFFFFFF",
},
"pctl": {
"intermittent_task_interval_seconds": "u32!0x7FFFFFFF",
},
"sprofile": {
"adjust_polling_interval_by_profile": "u8!0x0",
"polling_interval_sec_max": "u32!0x7FFFFFFF",
"polling_interval_sec_min": "u32!0x7FFFFFFF",
},
}
PSM_OPTIONS = [
{"name": "1024mA", "value": "u32!0x400"},
{"name": "1280mA", "value": "u32!0x500"},
{"name": "1536mA", "value": "u32!0x600"},
{"name": "1660mA (Lite Default)", "value": "u32!0x67C"},
{"name": "1792mA", "value": "u32!0x700"},
{"name": "2048mA (Default)", "value": "u32!0x800"},
{"name": "2304mA (UNSAFE)", "value": "u32!0x900"},
{"name": "2560mA (UNSAFE)", "value": "u32!0xA00"},
{"name": "2816mA (DANGEROUS)", "value": "u32!0xB00"},
{"name": "3072mA (DANGEROUS)", "value": "u32!0xC00"},
]
skin_t_entries = {
"use_configurations_on_fwdbg": "u8!0x1",
"tskin_rate_table_console_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
"tskin_rate_table_handheld_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
"holdable_tskin": "u32!0xEA60",
"touchable_tskin": "u32!0xEA60"
}
# Thresholds
mariko_meme_threshold = 1536000
mariko_dangerous_gpu_threshold = 1382400
mariko_unsafe_gpu_threshold = 1152000
erista_dangerous_gpu_threshold = 1151000
erista_unsafe_gpu_threshold = 922000
mariko_voltage_step = 5
erista_voltage_step = 5
mariko_gpu_offset_max = 50
mariko_gpu_min_volt = 480
erista_gpu_min_volt = 700
mariko_gpu_max_volt = 960
erista_gpu_max_volt = 1000
mariko_gpu_max_vmin = 700
erista_gpu_max_vmin = 850
mariko_cpu_min_vmin = 700
mariko_cpu_max_vmin = 750
# TODO: Make more stuff configurable
# COLORS
danger_color = (255, 0, 0, 255)
unsafe_color = (255, 165, 0, 255)
safe_color = (255, 255, 255, 255)

4
dist/README.md vendored
View File

@@ -53,5 +53,5 @@ Run build.bat or cd into folder and run "python -m PyInstaller --onefile --add-d
## Credits
meha for Switch-Oc-Suite<br>
sys-clk team for sys-clk<br>
b0rd2auth for Ultrahand sys-clk fork<br>
Lightos and Sammybigio2010 for early testing<br>
b0rd2death for Ultrahand sys-clk fork<br>
Lightos and Sammybigio2011 for early testing<br>

Binary file not shown.