sysclk: add kip editing feature
This commit is contained in:
@@ -102,6 +102,7 @@ variables = [
|
||||
|
||||
("commonGpuVoltOffset", "u32"),
|
||||
# advanced config
|
||||
("gpuSpeedo", "u32"),
|
||||
|
||||
|
||||
("marikoGpuFullUnlock", "u32"),
|
||||
@@ -215,6 +216,8 @@ def load_all_vars():
|
||||
c.load_entry_object("marikoGpuVmax", 3)
|
||||
|
||||
c.load_entry_object("commonGpuVoltOffset", 3)
|
||||
c.load_entry_object("gpuSpeedo", 3)
|
||||
|
||||
c.load_entry_object("marikoGpuFullUnlock", 3)
|
||||
|
||||
erista_freqs = [
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
#include "rgltr_services.h" // for extern Service g_rgltrSrv, etc.
|
||||
|
||||
|
||||
#include "../../sys-clk/common/include/sysclk/client/ipc.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sysclk/client/ipc.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
@@ -576,16 +575,13 @@ void Misc(void*) {
|
||||
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU];
|
||||
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU];
|
||||
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM];
|
||||
ramLoad[SysClkRamLoad_All] = sysclkCTX.ramLoad[SysClkRamLoad_All];
|
||||
ramLoad[SysClkRamLoad_Cpu] = sysclkCTX.ramLoad[SysClkRamLoad_Cpu];
|
||||
ramLoad[SysClkPartLoad_EMC] = sysclkCTX.PartLoad[SysClkPartLoad_EMC];
|
||||
ramLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.ramLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
// If using EOS, get voltages from sys-clk
|
||||
if (isUsingEOS && realVoltsPolling) {
|
||||
realCPU_mV = sysclkCTX.realVolts[0];
|
||||
realGPU_mV = sysclkCTX.realVolts[1];
|
||||
realRAM_mV = sysclkCTX.realVolts[2];
|
||||
realSOC_mV = sysclkCTX.realVolts[3];
|
||||
}
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.realVolts[HocClkVoltage_GPU];
|
||||
realRAM_mV = sysclkCTX.realVolts[HocClkVoltage_EMCVDD2];
|
||||
realSOC_mV = sysclkCTX.realVolts[HocClkVoltage_SOC];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -496,8 +496,8 @@ public:
|
||||
snprintf(CPU_Load_c, sizeof(CPU_Load_c), "%.1f%%", cpu_usageM);
|
||||
snprintf(GPU_Load_c, sizeof(GPU_Load_c), "%d.%d%%", GPU_Load_u / 10, GPU_Load_u % 10);
|
||||
snprintf(RAM_Load_c, sizeof(RAM_Load_c), "%hu.%hhu%%",
|
||||
ramLoad[SysClkRamLoad_All] / 10,
|
||||
ramLoad[SysClkRamLoad_All] % 10);
|
||||
PartLoad[SysClkPartLoad_EMC] / 10,
|
||||
PartLoad[SysClkPartLoad_EMC] % 10);
|
||||
|
||||
mutexUnlock(&mutex_Misc);
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
);
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
const int RAM_GPU_Load = ramLoad[SysClkRamLoad_All] - ramLoad[SysClkRamLoad_Cpu];
|
||||
const int RAM_GPU_Load = PartLoad[SysClkPartLoad_EMC] - PartLoad[SysClkPartLoad_EMCCpu];
|
||||
snprintf(RAM_load_c, sizeof RAM_load_c,
|
||||
"%u.%u%% CPU %u.%u%% GPU %u.%u%%",
|
||||
ramLoad[SysClkRamLoad_All] / 10, ramLoad[SysClkRamLoad_All] % 10,
|
||||
|
||||
@@ -821,7 +821,7 @@ public:
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
// Use sys-clk's RAM load if available
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%hu%%",
|
||||
ramLoad[SysClkRamLoad_All] / 10);
|
||||
PartLoad[SysClkPartLoad_EMC] / 10);
|
||||
} else {
|
||||
// Calculate percentage manually when sys-clk isn't available
|
||||
const uint64_t RAM_Total_all = RAM_Total_application_u + RAM_Total_applet_u + RAM_Total_system_u + RAM_Total_systemunsafe_u;
|
||||
|
||||
@@ -994,7 +994,7 @@ public:
|
||||
unsigned ramLoadInt;
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
ramLoadInt = ramLoad[SysClkRamLoad_All] / 10;
|
||||
ramLoadInt = PartLoad[SysClkPartLoad_EMC] / 10;
|
||||
|
||||
if (settings.showRAMLoadCPUGPU) {
|
||||
unsigned ramCpuLoadInt = ramLoad[SysClkRamLoad_Cpu] / 10;
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* --------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
||||
* wrote this file. As long as you retain this notice you can do whatever you
|
||||
* want with this stuff. If you meet any of us some day, and you think this
|
||||
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <switch.h>
|
||||
#include <string.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
static Service g_sysclkSrv;
|
||||
static atomic_size_t g_refCnt;
|
||||
|
||||
bool sysclkIpcRunning()
|
||||
{
|
||||
Handle handle;
|
||||
const bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
|
||||
if (!running)
|
||||
{
|
||||
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME));
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
Result sysclkIpcInitialize(void)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
g_refCnt++;
|
||||
|
||||
if (serviceIsActive(&g_sysclkSrv))
|
||||
return 0;
|
||||
|
||||
rc = smGetService(&g_sysclkSrv, SYSCLK_IPC_SERVICE_NAME);
|
||||
|
||||
if (R_FAILED(rc)) sysclkIpcExit();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void sysclkIpcExit(void)
|
||||
{
|
||||
if (--g_refCnt == 0)
|
||||
{
|
||||
serviceClose(&g_sysclkSrv);
|
||||
}
|
||||
}
|
||||
|
||||
Result sysclkIpcGetAPIVersion(u32* out_ver)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetApiVersion, *out_ver);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetVersionString(char* out, size_t len)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetVersionString,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = {{out, len}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetCurrentContext(SysClkContext* out_context)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetCurrentContext, *out_context);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetEnabled(bool enabled)
|
||||
{
|
||||
u8 enabledRaw = (u8)enabled;
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetEnabled, enabledRaw);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
|
||||
{
|
||||
SysClkIpc_SetOverride_Args args = {
|
||||
.module = module,
|
||||
.hz = hz
|
||||
};
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetOverride, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid, *out_profiles);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
{
|
||||
SysClkIpc_SetProfiles_Args args;
|
||||
args.tid = tid;
|
||||
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues, *out_configValues);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues, *configValues);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
{
|
||||
SysClkIpc_GetFreqList_Args args = {
|
||||
.module = module,
|
||||
.maxCount = maxCount
|
||||
};
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{list, maxCount * sizeof(u32)}},
|
||||
);
|
||||
}
|
||||
@@ -49,6 +49,8 @@ Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues);
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues);
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount);
|
||||
Result sysclkIpcSetReverseNXRTMode(ReverseNXMode mode);
|
||||
Result hocClkIpcSetKipData();
|
||||
Result hocClkIpcGetKipData();
|
||||
|
||||
static inline Result sysclkIpcRemoveOverride(SysClkModule module)
|
||||
{
|
||||
|
||||
@@ -60,21 +60,18 @@ typedef enum {
|
||||
|
||||
HocClkConfigValue_EnforceBoardLimit,
|
||||
|
||||
KipConfigValue_MTCConf,
|
||||
KipConfigValue_commonCpuBoostClock,
|
||||
KipConfigValue_custRev,
|
||||
KipConfigValue_mtcConf,
|
||||
KipConfigValue_hpMode,
|
||||
|
||||
/* EMC */
|
||||
KipConfigValue_commonEmcMemVolt,
|
||||
KipConfigValue_eristaCpuMaxVolt,
|
||||
KipConfigValue_eristaEmcMaxClock,
|
||||
KipConfigValue_marikoCpuMaxVolt,
|
||||
KipConfigValue_marikoEmcMaxClock,
|
||||
KipConfigValue_marikoEmcVddqVolt,
|
||||
KipConfigValue_marikoCpuUV,
|
||||
KipConfigValue_marikoGpuUV,
|
||||
KipConfigValue_eristaCpuUV,
|
||||
KipConfigValue_eristaGpuUV,
|
||||
KipConfigValue_commonGpuVoltOffset,
|
||||
KipConfigValue_marikoEmcDvbShift,
|
||||
KipConfigValue_emcDvbShift,
|
||||
|
||||
/* Memory timings */
|
||||
KipConfigValue_t1_tRCD,
|
||||
KipConfigValue_t2_tRP,
|
||||
KipConfigValue_t3_tRAS,
|
||||
@@ -83,20 +80,40 @@ typedef enum {
|
||||
KipConfigValue_t6_tRTW,
|
||||
KipConfigValue_t7_tWTR,
|
||||
KipConfigValue_t8_tREFI,
|
||||
|
||||
KipConfigValue_mem_burst_read_latency,
|
||||
KipConfigValue_mem_burst_write_latency,
|
||||
|
||||
KipConfigValue_marikoCpuHighVmin,
|
||||
KipConfigValue_marikoCpuLowVmin,
|
||||
/* CPU – Erista */
|
||||
KipConfigValue_eristaCpuUV,
|
||||
KipConfigValue_eristaCpuMaxVolt,
|
||||
|
||||
/* CPU – Mariko */
|
||||
KipConfigValue_marikoCpuUVLow,
|
||||
KipConfigValue_marikoCpuUVHigh,
|
||||
KipConfigValue_tableConf,
|
||||
KipConfigValue_marikoCpuLowVmin,
|
||||
KipConfigValue_marikoCpuHighVmin,
|
||||
KipConfigValue_marikoCpuMaxVolt,
|
||||
|
||||
KipConfigValue_eristaCpuBoostClock,
|
||||
KipConfigValue_marikoCpuBoostClock,
|
||||
|
||||
/* GPU – Erista */
|
||||
KipConfigValue_eristaGpuUV,
|
||||
KipConfigValue_eristaGpuVmin,
|
||||
|
||||
/* GPU – Mariko */
|
||||
KipConfigValue_marikoGpuUV,
|
||||
KipConfigValue_marikoGpuVmin,
|
||||
KipConfigValue_marikoGpuVmax,
|
||||
|
||||
KipConfigValue_commonGpuVoltOffset,
|
||||
KipConfigValue_gpuSpeedo,
|
||||
KipConfigValue_marikoGpuFullUnlock,
|
||||
|
||||
// Mariko GPU voltages
|
||||
/* ============================= */
|
||||
/* Mariko GPU voltages (24) */
|
||||
/* ============================= */
|
||||
KipConfigValue_g_volt_76800,
|
||||
KipConfigValue_g_volt_153600,
|
||||
KipConfigValue_g_volt_230400,
|
||||
@@ -122,7 +139,9 @@ typedef enum {
|
||||
KipConfigValue_g_volt_1497600,
|
||||
KipConfigValue_g_volt_1536000,
|
||||
|
||||
// Erista GPU voltages
|
||||
/* ============================= */
|
||||
/* Erista GPU voltages (27) */
|
||||
/* ============================= */
|
||||
KipConfigValue_g_volt_e_76800,
|
||||
KipConfigValue_g_volt_e_115200,
|
||||
KipConfigValue_g_volt_e_153600,
|
||||
@@ -172,24 +191,25 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
return pretty ? "Power logging interval (ms)" : "power_log_interval_ms";
|
||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||
return pretty ? "CSV write interval (ms)" : "csv_write_interval_ms";
|
||||
|
||||
case HocClkConfigValue_UncappedClocks:
|
||||
return pretty ? "Uncapped Clocks" : "uncapped_clocks";
|
||||
case HocClkConfigValue_OverwriteBoostMode:
|
||||
return pretty ? "Overwrite Boost Mode" : "ow_boost";
|
||||
|
||||
case HocClkConfigValue_EristaMaxCpuClock:
|
||||
return pretty ? "Max CPU Clock" : "cpu_max_e";
|
||||
return pretty ? "Erista Max CPU Clock" : "cpu_max_e";
|
||||
case HocClkConfigValue_EristaMaxGpuClock:
|
||||
return pretty ? "Max GPU Clock" : "gpu_max_e";
|
||||
return pretty ? "Erista Max GPU Clock" : "gpu_max_e";
|
||||
case HocClkConfigValue_EristaMaxMemClock:
|
||||
return pretty ? "Max MEM Clock" : "mem_max_e";
|
||||
return pretty ? "Erista Max MEM Clock" : "mem_max_e";
|
||||
|
||||
case HocClkConfigValue_MarikoMaxCpuClock:
|
||||
return pretty ? "Max CPU Clock" : "cpu_max_m";
|
||||
return pretty ? "Mariko Max CPU Clock" : "cpu_max_m";
|
||||
case HocClkConfigValue_MarikoMaxGpuClock:
|
||||
return pretty ? "Max GPU Clock" : "gpu_max_m";
|
||||
return pretty ? "Mariko Max GPU Clock" : "gpu_max_m";
|
||||
case HocClkConfigValue_MarikoMaxMemClock:
|
||||
return pretty ? "Max MEM Clock" : "mem_max_m";
|
||||
return pretty ? "Mariko Max MEM Clock" : "mem_max_m";
|
||||
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
return pretty ? "Thermal Throttle" : "thermal_throttle";
|
||||
@@ -197,53 +217,44 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
case HocClkConfigValue_ThermalThrottleThreshold:
|
||||
return pretty ? "Thermal Throttle Threshold" : "thermal_throttle_threshold";
|
||||
|
||||
case HocClkConfigValue_HandheldGovernor:
|
||||
return pretty ? "Handheld Governor" : "governor";
|
||||
case HocClkConfigValue_DockedGovernor:
|
||||
return pretty ? "Docked Governor" : "governor_docked";
|
||||
case HocClkConfigValue_HandheldGovernor:
|
||||
return pretty ? "Governor" : "governor";
|
||||
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
return pretty ? "Handheld TDP" : "handheld_tdp";
|
||||
|
||||
case HocClkConfigValue_HandheldTDPLimit:
|
||||
return pretty ? "TDP Limit" : "tdp_limit";
|
||||
return pretty ? "Handheld TDP Limit" : "tdp_limit";
|
||||
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
return pretty ? "Lite TDP Limit" : "tdp_limit_l";
|
||||
|
||||
// KIP raw values not normally user-facing
|
||||
case HocClkConfigValue_EnforceBoardLimit:
|
||||
return pretty ? "Enforce Board Limit" : "enforce_board_limit";
|
||||
|
||||
// KIP config values
|
||||
case KipConfigValue_MTCConf:
|
||||
case KipConfigValue_custRev:
|
||||
return pretty ? "Custom Revision" : "kip_cust_rev";
|
||||
case KipConfigValue_mtcConf:
|
||||
return pretty ? "MTC Config" : "kip_mtc_conf";
|
||||
case KipConfigValue_hpMode:
|
||||
return pretty ? "KIP HP Mode" : "kip_hp_mode";
|
||||
case KipConfigValue_commonCpuBoostClock:
|
||||
return pretty ? "Common CPU Boost Clock" : "common_cpu_boost_clock";
|
||||
return pretty ? "HP Mode" : "kip_hp_mode";
|
||||
|
||||
// EMC
|
||||
case KipConfigValue_commonEmcMemVolt:
|
||||
return pretty ? "Common EMC/MEM Voltage" : "common_emc_mem_volt";
|
||||
case KipConfigValue_eristaCpuMaxVolt:
|
||||
return pretty ? "Erista CPU Max Voltage" : "erista_cpu_max_volt";
|
||||
case KipConfigValue_eristaEmcMaxClock:
|
||||
return pretty ? "Erista EMC Max Clock" : "erista_emc_max_clock";
|
||||
case KipConfigValue_marikoCpuMaxVolt:
|
||||
return pretty ? "Mariko CPU Max Voltage" : "mariko_cpu_max_volt";
|
||||
case KipConfigValue_marikoEmcMaxClock:
|
||||
return pretty ? "Mariko EMC Max Clock" : "mariko_emc_max_clock";
|
||||
case KipConfigValue_marikoEmcVddqVolt:
|
||||
return pretty ? "Mariko EMC VDDQ Voltage" : "mariko_emc_vddq_volt";
|
||||
case KipConfigValue_marikoCpuUV:
|
||||
return pretty ? "Mariko CPU Undervolt" : "mariko_cpu_uv";
|
||||
case KipConfigValue_marikoGpuUV:
|
||||
return pretty ? "Mariko GPU Undervolt" : "mariko_gpu_uv";
|
||||
case KipConfigValue_eristaCpuUV:
|
||||
return pretty ? "Erista CPU Undervolt" : "erista_cpu_uv";
|
||||
case KipConfigValue_eristaGpuUV:
|
||||
return pretty ? "Erista GPU Undervolt" : "erista_gpu_uv";
|
||||
case KipConfigValue_commonGpuVoltOffset:
|
||||
return pretty ? "Common GPU Voltage Offset" : "common_gpu_volt_offset";
|
||||
case KipConfigValue_marikoEmcDvbShift:
|
||||
return pretty ? "Mariko EMC DVB Shift" : "mariko_emc_dvb_shift";
|
||||
case KipConfigValue_emcDvbShift:
|
||||
return pretty ? "EMC DVB Shift" : "emc_dvb_shift";
|
||||
|
||||
// Memory timings
|
||||
case KipConfigValue_t1_tRCD:
|
||||
return pretty ? "t1 - tRCD" : "t1_trcd";
|
||||
case KipConfigValue_t2_tRP:
|
||||
@@ -264,20 +275,54 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
return pretty ? "Memory Burst Read Latency" : "mem_burst_read_latency";
|
||||
case KipConfigValue_mem_burst_write_latency:
|
||||
return pretty ? "Memory Burst Write Latency" : "mem_burst_write_latency";
|
||||
case KipConfigValue_marikoCpuHighVmin:
|
||||
return pretty ? "Mariko CPU High Vmin" : "mariko_cpu_high_vmin";
|
||||
|
||||
// CPU – Erista
|
||||
case KipConfigValue_eristaCpuUV:
|
||||
return pretty ? "Erista CPU Undervolt" : "erista_cpu_uv";
|
||||
case KipConfigValue_eristaCpuMaxVolt:
|
||||
return pretty ? "Erista CPU Max Voltage" : "erista_cpu_max_volt";
|
||||
|
||||
// CPU – Mariko
|
||||
case KipConfigValue_marikoCpuUVLow:
|
||||
return pretty ? "Mariko CPU Undervolt (Low)" : "mariko_cpu_uv_low";
|
||||
case KipConfigValue_marikoCpuUVHigh:
|
||||
return pretty ? "Mariko CPU Undervolt (High)" : "mariko_cpu_uv_high";
|
||||
case KipConfigValue_tableConf:
|
||||
return pretty ? "Table Config" : "kip_table_conf";
|
||||
case KipConfigValue_marikoCpuLowVmin:
|
||||
return pretty ? "Mariko CPU Low Vmin" : "mariko_cpu_low_vmin";
|
||||
case KipConfigValue_marikoCpuHighVmin:
|
||||
return pretty ? "Mariko CPU High Vmin" : "mariko_cpu_high_vmin";
|
||||
case KipConfigValue_marikoCpuMaxVolt:
|
||||
return pretty ? "Mariko CPU Max Voltage" : "mariko_cpu_max_volt";
|
||||
|
||||
case KipConfigValue_eristaCpuBoostClock:
|
||||
return pretty ? "Erista CPU Boost Clock" : "erista_cpu_boost_clock";
|
||||
case KipConfigValue_marikoCpuBoostClock:
|
||||
return pretty ? "Mariko CPU Boost Clock" : "mariko_cpu_boost_clock";
|
||||
|
||||
// GPU – Erista
|
||||
case KipConfigValue_eristaGpuUV:
|
||||
return pretty ? "Erista GPU Undervolt" : "erista_gpu_uv";
|
||||
case KipConfigValue_eristaGpuVmin:
|
||||
return pretty ? "Erista GPU Vmin" : "erista_gpu_vmin";
|
||||
|
||||
// GPU – Mariko
|
||||
case KipConfigValue_marikoGpuUV:
|
||||
return pretty ? "Mariko GPU Undervolt" : "mariko_gpu_uv";
|
||||
case KipConfigValue_marikoGpuVmin:
|
||||
return pretty ? "Mariko GPU Vmin" : "mariko_gpu_vmin";
|
||||
case KipConfigValue_marikoGpuVmax:
|
||||
return pretty ? "Mariko GPU Vmax" : "mariko_gpu_vmax";
|
||||
|
||||
case KipConfigValue_commonGpuVoltOffset:
|
||||
return pretty ? "Common GPU Voltage Offset" : "common_gpu_volt_offset";
|
||||
case KipConfigValue_gpuSpeedo:
|
||||
return pretty ? "GPU Speedo" : "gpu_speedo";
|
||||
case KipConfigValue_marikoGpuFullUnlock:
|
||||
return pretty ? "Mariko GPU Full Unlock" : "mariko_gpu_full_unlock";
|
||||
|
||||
// Mariko GPU voltages
|
||||
// Mariko GPU voltages (24)
|
||||
case KipConfigValue_g_volt_76800: return pretty ? "Mariko GPU Volt 76 MHz" : "g_volt_76800";
|
||||
case KipConfigValue_g_volt_153600: return pretty ? "Mariko GPU Volt 153 MHz" : "g_volt_153600";
|
||||
case KipConfigValue_g_volt_230400: return pretty ? "Mariko GPU Volt 230 MHz" : "g_volt_230400";
|
||||
@@ -303,7 +348,7 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
case KipConfigValue_g_volt_1497600: return pretty ? "Mariko GPU Volt 1497 MHz" : "g_volt_1497600";
|
||||
case KipConfigValue_g_volt_1536000: return pretty ? "Mariko GPU Volt 1536 MHz" : "g_volt_1536000";
|
||||
|
||||
// Erista GPU voltages
|
||||
// Erista GPU voltages (27)
|
||||
case KipConfigValue_g_volt_e_76800: return pretty ? "Erista GPU Volt 76 MHz" : "g_volt_e_76800";
|
||||
case KipConfigValue_g_volt_e_115200: return pretty ? "Erista GPU Volt 115 MHz" : "g_volt_e_115200";
|
||||
case KipConfigValue_g_volt_e_153600: return pretty ? "Erista GPU Volt 153 MHz" : "g_volt_e_153600";
|
||||
@@ -395,6 +440,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
case SysClkConfigValue_PollingIntervalMs:
|
||||
return input > 0;
|
||||
|
||||
case SysClkConfigValue_TempLogIntervalMs:
|
||||
case SysClkConfigValue_FreqLogIntervalMs:
|
||||
case SysClkConfigValue_PowerLogIntervalMs:
|
||||
@@ -405,22 +451,17 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case HocClkConfigValue_DockedGovernor:
|
||||
case HocClkConfigValue_HandheldGovernor:
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
case HocClkConfigValue_EnforceBoardLimit:
|
||||
return (input & 0x1) == input;
|
||||
|
||||
case KipConfigValue_MTCConf:
|
||||
case KipConfigValue_commonCpuBoostClock:
|
||||
case KipConfigValue_custRev:
|
||||
case KipConfigValue_mtcConf:
|
||||
case KipConfigValue_hpMode:
|
||||
case KipConfigValue_commonEmcMemVolt:
|
||||
case KipConfigValue_eristaCpuMaxVolt:
|
||||
case KipConfigValue_eristaEmcMaxClock:
|
||||
case KipConfigValue_marikoCpuMaxVolt:
|
||||
case KipConfigValue_marikoEmcMaxClock:
|
||||
case KipConfigValue_marikoEmcVddqVolt:
|
||||
case KipConfigValue_marikoCpuUV:
|
||||
case KipConfigValue_marikoGpuUV:
|
||||
case KipConfigValue_eristaCpuUV:
|
||||
case KipConfigValue_eristaGpuUV:
|
||||
case KipConfigValue_commonGpuVoltOffset:
|
||||
case KipConfigValue_marikoEmcDvbShift:
|
||||
case KipConfigValue_emcDvbShift:
|
||||
case KipConfigValue_t1_tRCD:
|
||||
case KipConfigValue_t2_tRP:
|
||||
case KipConfigValue_t3_tRAS:
|
||||
@@ -431,11 +472,23 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case KipConfigValue_t8_tREFI:
|
||||
case KipConfigValue_mem_burst_read_latency:
|
||||
case KipConfigValue_mem_burst_write_latency:
|
||||
case KipConfigValue_marikoCpuHighVmin:
|
||||
case KipConfigValue_eristaCpuUV:
|
||||
case KipConfigValue_eristaCpuMaxVolt:
|
||||
case KipConfigValue_marikoCpuUVLow:
|
||||
case KipConfigValue_marikoCpuUVHigh:
|
||||
case KipConfigValue_tableConf:
|
||||
case KipConfigValue_marikoCpuLowVmin:
|
||||
case KipConfigValue_marikoCpuHighVmin:
|
||||
case KipConfigValue_marikoCpuMaxVolt:
|
||||
case KipConfigValue_eristaCpuBoostClock:
|
||||
case KipConfigValue_marikoCpuBoostClock:
|
||||
case KipConfigValue_eristaGpuUV:
|
||||
case KipConfigValue_eristaGpuVmin:
|
||||
case KipConfigValue_marikoGpuUV:
|
||||
case KipConfigValue_marikoGpuVmin:
|
||||
case KipConfigValue_marikoGpuVmax:
|
||||
case KipConfigValue_commonGpuVoltOffset:
|
||||
case KipConfigValue_gpuSpeedo:
|
||||
case KipConfigValue_marikoGpuFullUnlock:
|
||||
case KipConfigValue_g_volt_76800:
|
||||
case KipConfigValue_g_volt_153600:
|
||||
@@ -488,7 +541,8 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case KipConfigValue_g_volt_e_998400:
|
||||
case KipConfigValue_g_volt_e_1036800:
|
||||
case KipConfigValue_g_volt_e_1075200:
|
||||
return input >= 0;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -161,12 +161,12 @@ Result sysclkIpcSetReverseNXRTMode(ReverseNXMode mode)
|
||||
|
||||
Result hocClkIpcSetKipData()
|
||||
{
|
||||
u32 temp;
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
}
|
||||
|
||||
Result hocClkIpcGetKipData()
|
||||
{
|
||||
u32 temp;
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
}
|
||||
@@ -25,154 +25,184 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "freq_choice_gui.h"
|
||||
#include "freq_choice_gui.h"
|
||||
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
|
||||
FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz,
|
||||
std::uint32_t* hzList,
|
||||
std::uint32_t hzCount,
|
||||
SysClkModule module,
|
||||
FreqChoiceListener listener,
|
||||
bool checkMax,
|
||||
std::map<uint32_t, std::string> labels)
|
||||
{
|
||||
this->selectedHz = selectedHz;
|
||||
this->hzList = hzList;
|
||||
this->hzCount = hzCount;
|
||||
this->module = module;
|
||||
this->listener = listener;
|
||||
this->checkMax = checkMax;
|
||||
this->labels = labels; // NEW
|
||||
this->configList = new SysClkConfigValueList {};
|
||||
}
|
||||
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
|
||||
FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t *hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener, bool checkMax)
|
||||
{
|
||||
this->selectedHz = selectedHz;
|
||||
this->hzList = hzList;
|
||||
this->hzCount = hzCount;
|
||||
this->module = module;
|
||||
this->listener = listener;
|
||||
this->checkMax = checkMax;
|
||||
this->configList = new SysClkConfigValueList {};
|
||||
}
|
||||
FreqChoiceGui::~FreqChoiceGui()
|
||||
{
|
||||
delete this->configList;
|
||||
}
|
||||
|
||||
tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool selected, int safety)
|
||||
{
|
||||
std::string text = formatListFreqHz(hz);
|
||||
if (selected) text += " \uE14B";
|
||||
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(text, "", false);
|
||||
|
||||
switch (safety)
|
||||
{
|
||||
case 0:
|
||||
listItem->setTextColor(tsl::Color(255, 255, 255, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 255, 255, 255));
|
||||
break;
|
||||
case 1:
|
||||
listItem->setTextColor(tsl::Color(255, 165, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 165, 0, 255));
|
||||
break;
|
||||
case 2:
|
||||
listItem->setTextColor(tsl::Color(255, 0, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 0, 0, 255));
|
||||
break;
|
||||
}
|
||||
|
||||
listItem->setClickListener([this, hz](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == HidNpadButton_A && this->listener) {
|
||||
if (this->listener(hz)) {
|
||||
tsl::goBack();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return listItem;
|
||||
}
|
||||
|
||||
void FreqChoiceGui::listUI()
|
||||
{
|
||||
sysclkIpcGetConfigValues(this->configList);
|
||||
// Add CategoryHeader based on module
|
||||
std::string moduleName = sysclkFormatModule(this->module, false);
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName));
|
||||
|
||||
this->listElement->addItem(this->createFreqListItem(0, this->selectedHz == 0, false));
|
||||
std::uint32_t hz;
|
||||
for (std::uint32_t i = 0; i < this->hzCount; i++)
|
||||
{
|
||||
hz = this->hzList[i];
|
||||
uint32_t mhz = hz / 1000000;
|
||||
// Skip 204 MHz exactly
|
||||
if(checkMax && IsMariko()) {
|
||||
if (this->configList->values[HocClkConfigValue_MarikoMaxCpuClock] < mhz && moduleName == "cpu") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->configList->values[HocClkConfigValue_MarikoMaxGpuClock] < mhz && moduleName == "gpu") {
|
||||
continue;
|
||||
}
|
||||
if (this->configList->values[HocClkConfigValue_MarikoMaxMemClock] < mhz && moduleName == "mem") {
|
||||
continue;
|
||||
}
|
||||
} else if (checkMax && IsErista()) {
|
||||
if (this->configList->values[HocClkConfigValue_EristaMaxCpuClock] < mhz && moduleName == "cpu") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz && moduleName == "gpu") {
|
||||
continue;
|
||||
}
|
||||
if (this->configList->values[HocClkConfigValue_EristaMaxMemClock] < mhz && moduleName == "mem") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (moduleName == "mem" && mhz <= 600)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
uint32_t unsafe_cpu;
|
||||
uint32_t unsafe_gpu;
|
||||
uint32_t danger_cpu;
|
||||
uint32_t danger_gpu;
|
||||
if (IsMariko())
|
||||
{
|
||||
unsafe_cpu = 1964;
|
||||
unsafe_gpu = 1076;
|
||||
danger_cpu = 2398;
|
||||
danger_gpu = 1306;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsafe_cpu = 1786;
|
||||
unsafe_gpu = 922;
|
||||
danger_cpu = 2092;
|
||||
danger_gpu = 999;
|
||||
}
|
||||
tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool selected, int safety)
|
||||
{
|
||||
std::string text = formatListFreqHz(hz);
|
||||
if (selected)
|
||||
text += " \uE14B";
|
||||
|
||||
if (moduleName == "cpu") {
|
||||
if (mhz >= danger_cpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 2));
|
||||
continue;
|
||||
}
|
||||
if (mhz >= unsafe_cpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 1));
|
||||
continue;
|
||||
}
|
||||
if (mhz <= unsafe_cpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 0));
|
||||
// NEW: Right-side label
|
||||
std::string rightText = "";
|
||||
auto it = labels.find(hz);
|
||||
if (it != labels.end())
|
||||
rightText = it->second;
|
||||
|
||||
tsl::elm::ListItem* listItem =
|
||||
new tsl::elm::ListItem(text, rightText, false);
|
||||
|
||||
switch (safety)
|
||||
{
|
||||
case 0:
|
||||
listItem->setTextColor(tsl::Color(255, 255, 255, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 255, 255, 255));
|
||||
break;
|
||||
case 1:
|
||||
listItem->setTextColor(tsl::Color(255, 165, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 165, 0, 255));
|
||||
break;
|
||||
case 2:
|
||||
listItem->setTextColor(tsl::Color(255, 0, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 0, 0, 255));
|
||||
break;
|
||||
}
|
||||
|
||||
// Make annotation grey
|
||||
if (!rightText.empty())
|
||||
listItem->setValueColor(tsl::Color(180, 180, 180, 255));
|
||||
|
||||
listItem->setClickListener([this, hz](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == HidNpadButton_A && this->listener) {
|
||||
if (this->listener(hz)) {
|
||||
tsl::goBack();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return listItem;
|
||||
}
|
||||
|
||||
void FreqChoiceGui::listUI()
|
||||
{
|
||||
sysclkIpcGetConfigValues(this->configList);
|
||||
|
||||
// Header based on CPU/GPU/MEM module
|
||||
std::string moduleName = sysclkFormatModule(this->module, false);
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName));
|
||||
|
||||
// Default option
|
||||
this->listElement->addItem(
|
||||
this->createFreqListItem(0, this->selectedHz == 0, 0));
|
||||
|
||||
for (std::uint32_t i = 0; i < this->hzCount; i++)
|
||||
{
|
||||
std::uint32_t hz = this->hzList[i];
|
||||
uint32_t mhz = hz / 1000000;
|
||||
|
||||
if (checkMax && IsMariko()) {
|
||||
if (moduleName == "cpu" &&
|
||||
this->configList->values[HocClkConfigValue_MarikoMaxCpuClock] < mhz)
|
||||
continue;
|
||||
}
|
||||
} else if (moduleName == "gpu") {
|
||||
if (mhz >= danger_gpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 2));
|
||||
continue;
|
||||
}
|
||||
if (mhz >= unsafe_gpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 1));
|
||||
continue;
|
||||
}
|
||||
if (mhz <= unsafe_gpu) {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 0));
|
||||
|
||||
if (moduleName == "gpu" &&
|
||||
this->configList->values[HocClkConfigValue_MarikoMaxGpuClock] < mhz)
|
||||
continue;
|
||||
}
|
||||
} else if (moduleName == "mem") {
|
||||
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 0));
|
||||
|
||||
if (moduleName == "mem" &&
|
||||
this->configList->values[HocClkConfigValue_MarikoMaxMemClock] < mhz)
|
||||
continue;
|
||||
|
||||
} else if (checkMax && IsErista()) {
|
||||
if (moduleName == "cpu" &&
|
||||
this->configList->values[HocClkConfigValue_EristaMaxCpuClock] < mhz)
|
||||
continue;
|
||||
|
||||
if (moduleName == "gpu" &&
|
||||
this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz)
|
||||
continue;
|
||||
|
||||
if (moduleName == "mem" &&
|
||||
this->configList->values[HocClkConfigValue_EristaMaxMemClock] < mhz)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (moduleName == "mem" && mhz <= 600)
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
this->listElement->jumpToItem("", "");
|
||||
}
|
||||
|
||||
uint32_t unsafe_cpu;
|
||||
uint32_t unsafe_gpu;
|
||||
uint32_t danger_cpu;
|
||||
uint32_t danger_gpu;
|
||||
|
||||
if (IsMariko())
|
||||
{
|
||||
unsafe_cpu = 1964;
|
||||
unsafe_gpu = 1076;
|
||||
danger_cpu = 2398;
|
||||
danger_gpu = 1306;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsafe_cpu = 1786;
|
||||
unsafe_gpu = 922;
|
||||
danger_cpu = 2092;
|
||||
danger_gpu = 999;
|
||||
}
|
||||
|
||||
int safety = 0;
|
||||
|
||||
if (moduleName == "cpu") {
|
||||
|
||||
if (mhz >= danger_cpu)
|
||||
safety = 2;
|
||||
else if (mhz >= unsafe_cpu)
|
||||
safety = 1;
|
||||
else
|
||||
safety = 0;
|
||||
|
||||
} else if (moduleName == "gpu") {
|
||||
|
||||
if (mhz >= danger_gpu)
|
||||
safety = 2;
|
||||
else if (mhz >= unsafe_gpu)
|
||||
safety = 1;
|
||||
else
|
||||
safety = 0;
|
||||
|
||||
} else if (moduleName == "mem") {
|
||||
|
||||
safety = 0;
|
||||
|
||||
}
|
||||
|
||||
this->listElement->addItem(
|
||||
this->createFreqListItem(
|
||||
hz,
|
||||
(mhz == this->selectedHz / 1000000),
|
||||
safety
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
this->listElement->jumpToItem("", "");
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <list>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include "base_menu_gui.h"
|
||||
|
||||
using FreqChoiceListener = std::function<bool(std::uint32_t hz)>;
|
||||
@@ -42,20 +43,24 @@ protected:
|
||||
std::uint32_t selectedHz;
|
||||
std::uint32_t* hzList;
|
||||
std::uint32_t hzCount;
|
||||
SysClkModule module; // added module
|
||||
SysClkModule module;
|
||||
FreqChoiceListener listener;
|
||||
bool checkMax; // new member
|
||||
bool checkMax;
|
||||
|
||||
std::map<uint32_t, std::string> labels;
|
||||
|
||||
tsl::elm::ListItem* createFreqListItem(std::uint32_t hz, bool selected, int safety);
|
||||
|
||||
public:
|
||||
// Updated constructor with checkMaxValue
|
||||
FreqChoiceGui(std::uint32_t selectedHz,
|
||||
std::uint32_t* hzList,
|
||||
std::uint32_t hzCount,
|
||||
SysClkModule module,
|
||||
FreqChoiceListener listener,
|
||||
bool checkMax = true);
|
||||
bool checkMax = true,
|
||||
std::map<uint32_t, std::string> labels = {});
|
||||
|
||||
~FreqChoiceGui();
|
||||
|
||||
void listUI() override;
|
||||
};
|
||||
};
|
||||
@@ -59,7 +59,8 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
const ValueThresholds* thresholds)
|
||||
const ValueThresholds* thresholds,
|
||||
const std::map<uint32_t, std::string>& labels)
|
||||
{
|
||||
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true);
|
||||
|
||||
@@ -82,7 +83,7 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
ValueThresholds thresholdsCopy = (thresholds ? *thresholds : ValueThresholds{});
|
||||
|
||||
listItem->setClickListener(
|
||||
[this, configVal, range, categoryName, thresholdsCopy](u64 keys)
|
||||
[this, configVal, range, categoryName, thresholdsCopy, labels](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == 0)
|
||||
return false;
|
||||
@@ -106,7 +107,8 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
return true;
|
||||
},
|
||||
thresholdsCopy,
|
||||
true
|
||||
true,
|
||||
labels // <── NEW
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -123,7 +125,10 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
ValueThresholds(),
|
||||
false,
|
||||
labels // <── NEW
|
||||
);
|
||||
}
|
||||
|
||||
@@ -135,7 +140,11 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
this->configRanges[configVal] = range;
|
||||
}
|
||||
|
||||
void MiscGui::addFreqButton(SysClkConfigValue configVal, const char* altName, SysClkModule module) {
|
||||
void MiscGui::addFreqButton(SysClkConfigValue configVal,
|
||||
const char* altName,
|
||||
SysClkModule module,
|
||||
const std::map<uint32_t, std::string>& labels)
|
||||
{
|
||||
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true);
|
||||
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName);
|
||||
@@ -145,45 +154,48 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal, const char* altName, Sy
|
||||
snprintf(valueText, sizeof(valueText), "%lu MHz", currentMHz);
|
||||
listItem->setValue(valueText);
|
||||
|
||||
listItem->setClickListener([this, configVal, module](u64 keys) {
|
||||
if ((keys & HidNpadButton_A) == 0)
|
||||
return false;
|
||||
listItem->setClickListener(
|
||||
[this, configVal, module, labels](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == 0)
|
||||
return false;
|
||||
|
||||
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzCount;
|
||||
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzCount;
|
||||
|
||||
Result rc = sysclkIpcGetFreqList(module, hzList, SYSCLK_FREQ_LIST_MAX, &hzCount);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
return false;
|
||||
}
|
||||
Result rc = sysclkIpcGetFreqList(module, hzList, SYSCLK_FREQ_LIST_MAX, &hzCount);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::uint32_t currentHz = this->configList->values[configVal] * 1'000'000;
|
||||
std::uint32_t currentHz = this->configList->values[configVal] * 1'000'000;
|
||||
|
||||
tsl::changeTo<FreqChoiceGui>(
|
||||
currentHz,
|
||||
hzList,
|
||||
hzCount,
|
||||
module,
|
||||
[this, configVal](std::uint32_t hz) {
|
||||
tsl::changeTo<FreqChoiceGui>(
|
||||
currentHz,
|
||||
hzList,
|
||||
hzCount,
|
||||
module,
|
||||
[this, configVal](std::uint32_t hz)
|
||||
{
|
||||
uint64_t mhz = hz / 1'000'000;
|
||||
this->configList->values[configVal] = mhz;
|
||||
|
||||
uint64_t mhz = hz / 1'000'000;
|
||||
this->configList->values[configVal] = mhz;
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
return true;
|
||||
},
|
||||
false,
|
||||
labels
|
||||
);
|
||||
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
return true;
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
this->listElement->addItem(listItem);
|
||||
this->configButtons[configVal] = listItem;
|
||||
@@ -209,14 +221,20 @@ void MiscGui::listUI()
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
addConfigToggle(HocClkConfigValue_ThermalThrottle, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_HandheldTDP, nullptr);
|
||||
|
||||
std::map<uint32_t, std::string> labels_pwr_r = {
|
||||
{8600, "Official Rating"}
|
||||
};
|
||||
std::map<uint32_t, std::string> labels_pwr_l = {
|
||||
{6400, "Official Rating"}
|
||||
};
|
||||
ValueThresholds tdpThresholds(8600, 9500);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_HandheldTDPLimit,
|
||||
"TDP Threshold",
|
||||
ValueRange(5000, 10000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholds
|
||||
&tdpThresholds,
|
||||
labels_pwr_r
|
||||
);
|
||||
|
||||
ValueThresholds tdpThresholdsLite(6400, 7500);
|
||||
@@ -225,7 +243,8 @@ void MiscGui::listUI()
|
||||
"Lite TDP Threshold",
|
||||
ValueRange(4000, 8000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholdsLite
|
||||
&tdpThresholdsLite,
|
||||
labels_pwr_r
|
||||
);
|
||||
|
||||
ValueThresholds throttleThresholds(70, 80);
|
||||
@@ -236,16 +255,113 @@ void MiscGui::listUI()
|
||||
"Temp",
|
||||
&throttleThresholds
|
||||
);
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Max Clocks"));
|
||||
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_m = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode"},
|
||||
{1963000000, "Safe Max"},
|
||||
{2397000000, "Unsafe Max"},
|
||||
{2805000000, "Aboslute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_e = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode & Safe Max"},
|
||||
{2091000000, "Unsafe Max"},
|
||||
{2295000000, "Aboslute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> gpu_freq_label_e = {
|
||||
{76800000, "Boost Mode"},
|
||||
{307200000, "Handheld"},
|
||||
{384000000, "Handheld"},
|
||||
{460800000, "Handheld Safe Max"},
|
||||
{768000000, "Docked"},
|
||||
{844000000, "Safe Max"},
|
||||
{998400000, "Unsafe Max"},
|
||||
{1075200000, "Aboslute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> gpu_freq_label_m = {
|
||||
{76800000, "Boost Mode"},
|
||||
{307200000, "Handheld"},
|
||||
{384000000, "Handheld"},
|
||||
{460800000, "Handheld"},
|
||||
{614400000, "Handheld Safe Max"},
|
||||
{768000000, "Docked"},
|
||||
{1152200000, "Safe Max"},
|
||||
{1305600000, "Unsafe Max"},
|
||||
{1536000000, "Aboslute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> emc_freq_label_e = {
|
||||
{133120000, "Handheld"},
|
||||
{160000000, "Docked & Safe Max"},
|
||||
{213100000, "JEDEC Max"},
|
||||
{236000000, "Absolute Max"},
|
||||
};
|
||||
|
||||
|
||||
std::map<uint32_t, std::string> emc_freq_label_m = {
|
||||
{133120000, "Handheld"},
|
||||
{160000000, "Docked"},
|
||||
{186600000, "Safe Max (3733MT/s)"},
|
||||
{213300000, "Safe Max (4266MT/s)"},
|
||||
{320000000, "Absolute Max"},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(IsMariko()) {
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxCpuClock, nullptr, SysClkModule_CPU);
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxGpuClock, nullptr, SysClkModule_GPU);
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxMemClock, nullptr, SysClkModule_MEM);
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxCpuClock, nullptr, SysClkModule_CPU, cpu_freq_label_m);
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxGpuClock, nullptr, SysClkModule_GPU, gpu_freq_label_m);
|
||||
addFreqButton(HocClkConfigValue_MarikoMaxMemClock, nullptr, SysClkModule_MEM, emc_freq_label_m);
|
||||
} else {
|
||||
addFreqButton(HocClkConfigValue_EristaMaxCpuClock, nullptr, SysClkModule_CPU);
|
||||
addFreqButton(HocClkConfigValue_EristaMaxGpuClock, nullptr, SysClkModule_GPU);
|
||||
addFreqButton(HocClkConfigValue_EristaMaxMemClock, nullptr, SysClkModule_MEM);
|
||||
addFreqButton(HocClkConfigValue_EristaMaxCpuClock, nullptr, SysClkModule_CPU, cpu_freq_label_e);
|
||||
addFreqButton(HocClkConfigValue_EristaMaxGpuClock, nullptr, SysClkModule_GPU, gpu_freq_label_e);
|
||||
addFreqButton(HocClkConfigValue_EristaMaxMemClock, nullptr, SysClkModule_MEM, emc_freq_label_e);
|
||||
}
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("KIP"));
|
||||
|
||||
std::map<uint32_t, std::string> emc_voltage_label = {
|
||||
{1100000, "Default (Mariko)"},
|
||||
{1125000, "Default (Erista)"},
|
||||
{1175000, "Rating"},
|
||||
{1212500, "Safe Max"},
|
||||
};
|
||||
|
||||
|
||||
|
||||
ValueThresholds vdd2Thresholds(1212500, 1250000);
|
||||
addConfigButton(
|
||||
KipConfigValue_commonEmcMemVolt,
|
||||
"EMC VDD2 Voltage",
|
||||
ValueRange(912500, 1350000, 12500, "mV", 1000),
|
||||
"Voltage",
|
||||
&vdd2Thresholds
|
||||
);
|
||||
|
||||
tsl::elm::ListItem* saveBtn = new tsl::elm::ListItem("Save KIP Settings");
|
||||
saveBtn->setClickListener([](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
Result rc = hocClkIpcSetKipData();
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("hocClkIpcSetKipData", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
this->listElement->addItem(saveBtn);
|
||||
}
|
||||
|
||||
void MiscGui::refresh() {
|
||||
|
||||
@@ -27,9 +27,12 @@ protected:
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
const ValueThresholds* thresholds = nullptr);
|
||||
void addFreqButton(SysClkConfigValue configVal, const char* altName, SysClkModule module);
|
||||
void updateConfigToggles();
|
||||
const ValueThresholds* thresholds,
|
||||
const std::map<uint32_t, std::string>& labels = {});
|
||||
void addFreqButton(SysClkConfigValue configVal,
|
||||
const char* altName,
|
||||
SysClkModule module,
|
||||
const std::map<uint32_t, std::string>& labels = {}); void updateConfigToggles();
|
||||
|
||||
tsl::elm::ToggleListItem* enabledToggle;
|
||||
u8 frameCounter = 60;
|
||||
|
||||
@@ -1,145 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
||||
* wrote this file. As long as you retain this notice you can do whatever you
|
||||
* want with this stuff. If you meet any of us some day, and you think this
|
||||
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
#include "value_choice_gui.h"
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
ValueChoiceGui::ValueChoiceGui(std::uint32_t selectedValue,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
ValueChoiceListener listener,
|
||||
const ValueThresholds& thresholds,
|
||||
bool enableThresholds,
|
||||
std::map<std::uint32_t, std::string> labels)
|
||||
: selectedValue(selectedValue),
|
||||
range(range),
|
||||
categoryName(categoryName),
|
||||
listener(listener),
|
||||
thresholds(thresholds),
|
||||
enableThresholds(enableThresholds),
|
||||
labels(labels)
|
||||
{
|
||||
}
|
||||
|
||||
#include "value_choice_gui.h"
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
ValueChoiceGui::~ValueChoiceGui()
|
||||
{
|
||||
}
|
||||
|
||||
ValueChoiceGui::ValueChoiceGui(std::uint32_t selectedValue,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
ValueChoiceListener listener,
|
||||
const ValueThresholds& thresholds,
|
||||
bool enableThresholds)
|
||||
: selectedValue(selectedValue),
|
||||
range(range),
|
||||
categoryName(categoryName),
|
||||
listener(listener),
|
||||
thresholds(thresholds),
|
||||
enableThresholds(enableThresholds)
|
||||
{
|
||||
}
|
||||
std::string ValueChoiceGui::formatValue(std::uint32_t value)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
ValueChoiceGui::~ValueChoiceGui()
|
||||
{
|
||||
}
|
||||
if (value == 0) {
|
||||
return VALUE_DEFAULT_TEXT;
|
||||
}
|
||||
|
||||
std::string ValueChoiceGui::formatValue(std::uint32_t value)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
double displayValue = static_cast<double>(value) / static_cast<double>(range.divisor);
|
||||
|
||||
if (value == 0) {
|
||||
oss << std::fixed << std::setprecision(range.decimalPlaces) << displayValue;
|
||||
|
||||
return VALUE_DEFAULT_TEXT;
|
||||
}
|
||||
if (!range.suffix.empty()) {
|
||||
oss << " " << range.suffix;
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::uint32_t displayValue = value / range.divisor;
|
||||
int ValueChoiceGui::getSafetyLevel(std::uint32_t value)
|
||||
{
|
||||
if (value > thresholds.danger) {
|
||||
return 2;
|
||||
}
|
||||
if (value > thresholds.warning) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
oss << displayValue;
|
||||
if (!range.suffix.empty()) {
|
||||
oss << " " << range.suffix;
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
tsl::elm::ListItem* ValueChoiceGui::createValueListItem(std::uint32_t value, bool selected, int safety)
|
||||
{
|
||||
std::string text = formatValue(value);
|
||||
if (selected) {
|
||||
text += " \uE14B";
|
||||
}
|
||||
|
||||
int ValueChoiceGui::getSafetyLevel(std::uint32_t value)
|
||||
{
|
||||
if (!enableThresholds) {
|
||||
return 0;
|
||||
}
|
||||
std::string rightText = "";
|
||||
auto it = labels.find(value);
|
||||
if (it != labels.end()) {
|
||||
rightText = it->second;
|
||||
}
|
||||
|
||||
std::uint32_t scaledValue = value / range.divisor;
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(text, rightText, false);
|
||||
|
||||
if (scaledValue > thresholds.danger) {
|
||||
return 2;
|
||||
}
|
||||
if (scaledValue > thresholds.warning) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
switch (safety)
|
||||
{
|
||||
case 0:
|
||||
listItem->setTextColor(tsl::Color(255, 255, 255, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 255, 255, 255));
|
||||
break;
|
||||
case 1:
|
||||
listItem->setTextColor(tsl::Color(255, 165, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 165, 0, 255));
|
||||
break;
|
||||
case 2:
|
||||
listItem->setTextColor(tsl::Color(255, 0, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 0, 0, 255));
|
||||
break;
|
||||
}
|
||||
|
||||
tsl::elm::ListItem* ValueChoiceGui::createValueListItem(std::uint32_t value, bool selected, int safety)
|
||||
{
|
||||
std::string text = formatValue(value);
|
||||
if (selected) {
|
||||
text += " \uE14B";
|
||||
}
|
||||
if (!rightText.empty())
|
||||
listItem->setValueColor(tsl::Color(180, 180, 180, 255));
|
||||
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(text, "", false);
|
||||
listItem->setClickListener([this, value](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == HidNpadButton_A && this->listener) {
|
||||
if (this->listener(value)) {
|
||||
tsl::goBack();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
switch (safety)
|
||||
{
|
||||
case 0:
|
||||
listItem->setTextColor(tsl::Color(255, 255, 255, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 255, 255, 255));
|
||||
break;
|
||||
case 1:
|
||||
listItem->setTextColor(tsl::Color(255, 165, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 165, 0, 255));
|
||||
break;
|
||||
case 2:
|
||||
listItem->setTextColor(tsl::Color(255, 0, 0, 255));
|
||||
listItem->setValueColor(tsl::Color(255, 0, 0, 255));
|
||||
break;
|
||||
}
|
||||
return listItem;
|
||||
}
|
||||
|
||||
listItem->setClickListener([this, value](u64 keys)
|
||||
{
|
||||
if ((keys & HidNpadButton_A) == HidNpadButton_A && this->listener) {
|
||||
void ValueChoiceGui::listUI()
|
||||
{
|
||||
if (!categoryName.empty()) {
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(categoryName));
|
||||
}
|
||||
|
||||
if (this->listener(value)) {
|
||||
tsl::goBack();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
this->listElement->addItem(this->createValueListItem(0, this->selectedValue == 0, 0));
|
||||
|
||||
return listItem;
|
||||
}
|
||||
for (std::uint32_t value = range.min; value <= range.max; value += range.step)
|
||||
{
|
||||
int safety = getSafetyLevel(value);
|
||||
bool selected = (value == this->selectedValue);
|
||||
this->listElement->addItem(this->createValueListItem(value, selected, safety));
|
||||
}
|
||||
|
||||
void ValueChoiceGui::listUI()
|
||||
{
|
||||
|
||||
if (!categoryName.empty()) {
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(categoryName));
|
||||
}
|
||||
|
||||
this->listElement->addItem(this->createValueListItem(0, this->selectedValue == 0, 0));
|
||||
|
||||
for (std::uint32_t value = range.min; value <= range.max; value += range.step)
|
||||
{
|
||||
int safety = getSafetyLevel(value);
|
||||
bool selected = (value == this->selectedValue);
|
||||
this->listElement->addItem(this->createValueListItem(value, selected, safety));
|
||||
}
|
||||
|
||||
this->listElement->jumpToItem("", "\uE14B");
|
||||
}
|
||||
this->listElement->jumpToItem("", "\uE14B");
|
||||
}
|
||||
@@ -25,62 +25,69 @@
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include "base_menu_gui.h"
|
||||
|
||||
using ValueChoiceListener = std::function<bool(std::uint32_t value)>;
|
||||
|
||||
#define VALUE_DEFAULT_TEXT "Default"
|
||||
|
||||
struct ValueRange {
|
||||
std::uint32_t min;
|
||||
std::uint32_t max;
|
||||
std::uint32_t step;
|
||||
std::string suffix;
|
||||
std::uint32_t divisor; // Divide input values by this for display
|
||||
|
||||
// Default constructor
|
||||
ValueRange() : min(0), max(0), step(1), suffix(""), divisor(1) {}
|
||||
|
||||
ValueRange(std::uint32_t min, std::uint32_t max, std::uint32_t step,
|
||||
const std::string& suffix = "", std::uint32_t divisor = 1)
|
||||
: min(min), max(max), step(step), suffix(suffix), divisor(divisor) {}
|
||||
};
|
||||
|
||||
struct ValueThresholds {
|
||||
std::uint32_t warning; // Values >= this show orange
|
||||
std::uint32_t danger; // Values >= this show red
|
||||
|
||||
ValueThresholds(std::uint32_t warning = 0, std::uint32_t danger = 0)
|
||||
: warning(warning), danger(danger) {}
|
||||
};
|
||||
|
||||
class ValueChoiceGui : public BaseMenuGui
|
||||
{
|
||||
protected:
|
||||
std::uint32_t selectedValue;
|
||||
ValueRange range;
|
||||
std::string categoryName;
|
||||
ValueChoiceListener listener;
|
||||
ValueThresholds thresholds;
|
||||
bool enableThresholds;
|
||||
|
||||
tsl::elm::ListItem* createValueListItem(std::uint32_t value, bool selected, int safety);
|
||||
std::string formatValue(std::uint32_t value);
|
||||
int getSafetyLevel(std::uint32_t value);
|
||||
|
||||
public:
|
||||
ValueChoiceGui(std::uint32_t selectedValue,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
ValueChoiceListener listener,
|
||||
const ValueThresholds& thresholds = ValueThresholds(),
|
||||
bool enableThresholds = false);
|
||||
~ValueChoiceGui();
|
||||
|
||||
void listUI() override;
|
||||
};
|
||||
#include <list>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "base_menu_gui.h"
|
||||
|
||||
using ValueChoiceListener = std::function<bool(std::uint32_t value)>;
|
||||
|
||||
#define VALUE_DEFAULT_TEXT "Default"
|
||||
|
||||
struct ValueRange {
|
||||
std::uint32_t min;
|
||||
std::uint32_t max;
|
||||
std::uint32_t step;
|
||||
std::string suffix;
|
||||
std::uint32_t divisor;
|
||||
int decimalPlaces;
|
||||
|
||||
ValueRange()
|
||||
: min(0), max(0), step(1), suffix(""), divisor(1), decimalPlaces(0) {}
|
||||
|
||||
ValueRange(std::uint32_t min, std::uint32_t max, std::uint32_t step,
|
||||
const std::string& suffix = "", std::uint32_t divisor = 1, int decimalPlaces = 0)
|
||||
: min(min), max(max), step(step), suffix(suffix),
|
||||
divisor(divisor), decimalPlaces(decimalPlaces) {}
|
||||
};
|
||||
|
||||
struct ValueThresholds {
|
||||
std::uint32_t warning;
|
||||
std::uint32_t danger;
|
||||
|
||||
ValueThresholds(std::uint32_t warning = 0, std::uint32_t danger = 0)
|
||||
: warning(warning), danger(danger) {}
|
||||
};
|
||||
|
||||
class ValueChoiceGui : public BaseMenuGui
|
||||
{
|
||||
protected:
|
||||
std::uint32_t selectedValue;
|
||||
ValueRange range;
|
||||
std::string categoryName;
|
||||
ValueChoiceListener listener;
|
||||
ValueThresholds thresholds;
|
||||
bool enableThresholds;
|
||||
|
||||
// NEW — map of value → right-side text (like version numbers)
|
||||
std::map<std::uint32_t, std::string> labels;
|
||||
|
||||
tsl::elm::ListItem* createValueListItem(std::uint32_t value, bool selected, int safety);
|
||||
std::string formatValue(std::uint32_t value);
|
||||
int getSafetyLevel(std::uint32_t value);
|
||||
|
||||
public:
|
||||
ValueChoiceGui(std::uint32_t selectedValue,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
ValueChoiceListener listener,
|
||||
const ValueThresholds& thresholds = ValueThresholds(),
|
||||
bool enableThresholds = false,
|
||||
std::map<std::uint32_t, std::string> labels = {});
|
||||
~ValueChoiceGui();
|
||||
|
||||
void listUI() override;
|
||||
};
|
||||
@@ -32,12 +32,11 @@
|
||||
#include "process_management.h"
|
||||
#include "errors.h"
|
||||
#include "ipc_service.h"
|
||||
|
||||
#include "kip.h"
|
||||
#define HOSPPC_HAS_BOOST (hosversionAtLeast(7,0,0))
|
||||
|
||||
ClockManager *ClockManager::instance = NULL;
|
||||
|
||||
kip_data_t kip;
|
||||
|
||||
ClockManager *ClockManager::GetInstance()
|
||||
{
|
||||
@@ -80,6 +79,7 @@ ClockManager::ClockManager()
|
||||
this->lastCsvWriteNs = 0;
|
||||
|
||||
this->rnxSync = new ReverseNXSync;
|
||||
this->GetKipData();
|
||||
}
|
||||
|
||||
ClockManager::~ClockManager()
|
||||
@@ -519,203 +519,150 @@ void ClockManager::SetRNXRTMode(ReverseNXMode mode)
|
||||
}
|
||||
|
||||
void ClockManager::SetKipData() {
|
||||
|
||||
// Populate KIP fields from current config. We preserve fields that
|
||||
// don't have corresponding config entries (e.g. custRev, hpMode).
|
||||
kip.mtcConf = (uint32_t)this->config->GetConfigValue(KipConfigValue_MTCConf);
|
||||
kip.commonCpuBoostClock = (uint32_t)this->config->GetConfigValue(KipConfigValue_commonCpuBoostClock);
|
||||
kip.commonEmcMemVolt = (uint32_t)this->config->GetConfigValue(KipConfigValue_commonEmcMemVolt);
|
||||
std::scoped_lock lock{this->contextMutex};
|
||||
|
||||
// Erista
|
||||
kip.eristaCpuMaxVolt = (uint32_t)this->config->GetConfigValue(KipConfigValue_eristaCpuMaxVolt);
|
||||
kip.eristaEmcMaxClock = (uint32_t)this->config->GetConfigValue(KipConfigValue_eristaEmcMaxClock);
|
||||
const char* kip = "sdmc:/atmosphere/kips/hoc.kip";
|
||||
CustomizeTable table;
|
||||
|
||||
// Mariko
|
||||
kip.marikoCpuMaxVolt = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoCpuMaxVolt);
|
||||
kip.marikoEmcMaxClock = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoEmcMaxClock);
|
||||
kip.marikoEmcVddqVolt = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoEmcVddqVolt);
|
||||
// Read the KIP file ONCE
|
||||
if (!cust_read_and_cache(kip, &table)) {
|
||||
FileUtils::LogLine("[clock_manager] Failed to read KIP file");
|
||||
return;
|
||||
}
|
||||
|
||||
// Undervolt / UV
|
||||
kip.marikoCpuUV = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoCpuUV);
|
||||
kip.marikoGpuUV = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoGpuUV);
|
||||
kip.eristaCpuUV = (uint32_t)this->config->GetConfigValue(KipConfigValue_eristaCpuUV);
|
||||
kip.eristaGpuUV = (uint32_t)this->config->GetConfigValue(KipConfigValue_eristaGpuUV);
|
||||
// Update all fields in memory
|
||||
CUST_WRITE_FIELD_BATCH(&table, custRev, this->config->GetConfigValue(KipConfigValue_custRev));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mtcConf, this->config->GetConfigValue(KipConfigValue_mtcConf));
|
||||
CUST_WRITE_FIELD_BATCH(&table, hpMode, this->config->GetConfigValue(KipConfigValue_hpMode));
|
||||
|
||||
// GPU offset / EMC DVB
|
||||
kip.commonGpuVoltOffset = (uint32_t)this->config->GetConfigValue(KipConfigValue_commonGpuVoltOffset);
|
||||
kip.marikoEmcDvbShift = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoEmcDvbShift);
|
||||
CUST_WRITE_FIELD_BATCH(&table, commonEmcMemVolt, this->config->GetConfigValue(KipConfigValue_commonEmcMemVolt));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaEmcMaxClock, this->config->GetConfigValue(KipConfigValue_eristaEmcMaxClock));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoEmcMaxClock, this->config->GetConfigValue(KipConfigValue_marikoEmcMaxClock));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoEmcVddqVolt, this->config->GetConfigValue(KipConfigValue_marikoEmcVddqVolt));
|
||||
CUST_WRITE_FIELD_BATCH(&table, emcDvbShift, this->config->GetConfigValue(KipConfigValue_emcDvbShift));
|
||||
|
||||
// Memory timing values
|
||||
kip.t1_tRCD = (uint32_t)this->config->GetConfigValue(KipConfigValue_t1_tRCD);
|
||||
kip.t2_tRP = (uint32_t)this->config->GetConfigValue(KipConfigValue_t2_tRP);
|
||||
kip.t3_tRAS = (uint32_t)this->config->GetConfigValue(KipConfigValue_t3_tRAS);
|
||||
kip.t4_tRRD = (uint32_t)this->config->GetConfigValue(KipConfigValue_t4_tRRD);
|
||||
kip.t5_tRFC = (uint32_t)this->config->GetConfigValue(KipConfigValue_t5_tRFC);
|
||||
kip.t6_tRTW = (uint32_t)this->config->GetConfigValue(KipConfigValue_t6_tRTW);
|
||||
kip.t7_tWTR = (uint32_t)this->config->GetConfigValue(KipConfigValue_t7_tWTR);
|
||||
kip.t8_tREFI = (uint32_t)this->config->GetConfigValue(KipConfigValue_t8_tREFI);
|
||||
CUST_WRITE_FIELD_BATCH(&table, t1_tRCD, this->config->GetConfigValue(KipConfigValue_t1_tRCD));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t2_tRP, this->config->GetConfigValue(KipConfigValue_t2_tRP));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t3_tRAS, this->config->GetConfigValue(KipConfigValue_t3_tRAS));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t4_tRRD, this->config->GetConfigValue(KipConfigValue_t4_tRRD));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t5_tRFC, this->config->GetConfigValue(KipConfigValue_t5_tRFC));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t6_tRTW, this->config->GetConfigValue(KipConfigValue_t6_tRTW));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t7_tWTR, this->config->GetConfigValue(KipConfigValue_t7_tWTR));
|
||||
CUST_WRITE_FIELD_BATCH(&table, t8_tREFI, this->config->GetConfigValue(KipConfigValue_t8_tREFI));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mem_burst_read_latency, this->config->GetConfigValue(KipConfigValue_mem_burst_read_latency));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mem_burst_write_latency, this->config->GetConfigValue(KipConfigValue_mem_burst_write_latency));
|
||||
|
||||
kip.mem_burst_read_latency = (uint32_t)this->config->GetConfigValue(KipConfigValue_mem_burst_read_latency);
|
||||
kip.mem_burst_write_latency = (uint32_t)this->config->GetConfigValue(KipConfigValue_mem_burst_write_latency);
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuUV, this->config->GetConfigValue(KipConfigValue_eristaCpuUV));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuMaxVolt, this->config->GetConfigValue(KipConfigValue_eristaCpuMaxVolt));
|
||||
|
||||
// Additional voltages
|
||||
kip.marikoCpuHighVmin = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoCpuHighVmin);
|
||||
kip.marikoCpuLowVmin = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoCpuLowVmin);
|
||||
kip.eristaGpuVmin = (uint32_t)this->config->GetConfigValue(KipConfigValue_eristaGpuVmin);
|
||||
kip.marikoGpuVmin = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoGpuVmin);
|
||||
kip.marikoGpuVmax = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoGpuVmax);
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuUVLow, this->config->GetConfigValue(KipConfigValue_marikoCpuUVLow));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuUVHigh, this->config->GetConfigValue(KipConfigValue_marikoCpuUVHigh));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuLowVmin, this->config->GetConfigValue(KipConfigValue_marikoCpuLowVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuHighVmin, this->config->GetConfigValue(KipConfigValue_marikoCpuHighVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuMaxVolt, this->config->GetConfigValue(KipConfigValue_marikoCpuMaxVolt));
|
||||
|
||||
kip.marikoGpuFullUnlock = (uint32_t)this->config->GetConfigValue(KipConfigValue_marikoGpuFullUnlock);
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuBoostClock, this->config->GetConfigValue(KipConfigValue_eristaCpuBoostClock));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuBoostClock, this->config->GetConfigValue(KipConfigValue_marikoCpuBoostClock));
|
||||
|
||||
// Mariko GPU voltages
|
||||
kip.g_volt_76800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_76800);
|
||||
kip.g_volt_153600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_153600);
|
||||
kip.g_volt_230400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_230400);
|
||||
kip.g_volt_307200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_307200);
|
||||
kip.g_volt_384000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_384000);
|
||||
kip.g_volt_460800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_460800);
|
||||
kip.g_volt_537600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_537600);
|
||||
kip.g_volt_614400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_614400);
|
||||
kip.g_volt_691200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_691200);
|
||||
kip.g_volt_768000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_768000);
|
||||
kip.g_volt_844800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_844800);
|
||||
kip.g_volt_921600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_921600);
|
||||
kip.g_volt_998400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_998400);
|
||||
kip.g_volt_1075200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1075200);
|
||||
kip.g_volt_1152000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1152000);
|
||||
kip.g_volt_1228800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1228800);
|
||||
kip.g_volt_1267200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1267200);
|
||||
kip.g_volt_1305600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1305600);
|
||||
kip.g_volt_1344000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1344000);
|
||||
kip.g_volt_1382400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1382400);
|
||||
kip.g_volt_1420800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1420800);
|
||||
kip.g_volt_1459200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1459200);
|
||||
kip.g_volt_1497600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1497600);
|
||||
kip.g_volt_1536000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_1536000);
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaGpuUV, this->config->GetConfigValue(KipConfigValue_eristaGpuUV));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaGpuVmin, this->config->GetConfigValue(KipConfigValue_eristaGpuVmin));
|
||||
|
||||
// Erista GPU voltages
|
||||
kip.g_volt_e_76800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_76800);
|
||||
kip.g_volt_e_115200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_115200);
|
||||
kip.g_volt_e_153600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_153600);
|
||||
kip.g_volt_e_192000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_192000);
|
||||
kip.g_volt_e_230400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_230400);
|
||||
kip.g_volt_e_268800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_268800);
|
||||
kip.g_volt_e_307200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_307200);
|
||||
kip.g_volt_e_345600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_345600);
|
||||
kip.g_volt_e_384000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_384000);
|
||||
kip.g_volt_e_422400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_422400);
|
||||
kip.g_volt_e_460800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_460800);
|
||||
kip.g_volt_e_499200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_499200);
|
||||
kip.g_volt_e_537600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_537600);
|
||||
kip.g_volt_e_576000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_576000);
|
||||
kip.g_volt_e_614400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_614400);
|
||||
kip.g_volt_e_652800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_652800);
|
||||
kip.g_volt_e_691200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_691200);
|
||||
kip.g_volt_e_729600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_729600);
|
||||
kip.g_volt_e_768000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_768000);
|
||||
kip.g_volt_e_806400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_806400);
|
||||
kip.g_volt_e_844800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_844800);
|
||||
kip.g_volt_e_883200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_883200);
|
||||
kip.g_volt_e_921600 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_921600);
|
||||
kip.g_volt_e_960000 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_960000);
|
||||
kip.g_volt_e_998400 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_998400);
|
||||
kip.g_volt_e_1036800 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_1036800);
|
||||
kip.g_volt_e_1075200 = (uint32_t)this->config->GetConfigValue(KipConfigValue_g_volt_e_1075200);
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoGpuUV, this->config->GetConfigValue(KipConfigValue_marikoGpuUV));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoGpuVmin, this->config->GetConfigValue(KipConfigValue_marikoGpuVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoGpuVmax, this->config->GetConfigValue(KipConfigValue_marikoGpuVmax));
|
||||
|
||||
kip_write("loader.kip", &kip, sizeof(kip));
|
||||
CUST_WRITE_FIELD_BATCH(&table, commonGpuVoltOffset, this->config->GetConfigValue(KipConfigValue_commonGpuVoltOffset));
|
||||
CUST_WRITE_FIELD_BATCH(&table, gpuSpeedo, this->config->GetConfigValue(KipConfigValue_gpuSpeedo));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoGpuFullUnlock, this->config->GetConfigValue(KipConfigValue_marikoGpuFullUnlock));
|
||||
|
||||
// Update MARIKO GPU voltages
|
||||
for (int i = 0; i < 24; i++) {
|
||||
table.marikoGpuVoltArray[i] = this->config->GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_76800 + i));
|
||||
}
|
||||
|
||||
// Update ERISTA GPU voltages
|
||||
for (int i = 0; i < 27; i++) {
|
||||
table.eristaGpuVoltArray[i] = this->config->GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_e_76800 + i));
|
||||
}
|
||||
|
||||
// Write the KIP file ONCE with all changes
|
||||
if (!cust_write_table(kip, &table)) {
|
||||
FileUtils::LogLine("[clock_manager] Failed to write KIP file");
|
||||
}
|
||||
}
|
||||
|
||||
void ClockManager::GetKipData() {
|
||||
kip_read("loader.kip", &kip, sizeof(kip));
|
||||
std::scoped_lock lock{this->contextMutex};
|
||||
|
||||
this->config->SetConfigValue(KipConfigValue_MTCConf, kip.mtcConf);
|
||||
this->config->SetConfigValue(KipConfigValue_commonCpuBoostClock, kip.commonCpuBoostClock);
|
||||
this->config->SetConfigValue(KipConfigValue_hpMode, kip.hpMode);
|
||||
this->config->SetConfigValue(KipConfigValue_commonEmcMemVolt, kip.commonEmcMemVolt);
|
||||
this->config->SetConfigValue(KipConfigValue_eristaCpuMaxVolt, kip.eristaCpuMaxVolt);
|
||||
this->config->SetConfigValue(KipConfigValue_eristaEmcMaxClock, kip.eristaEmcMaxClock);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoCpuMaxVolt, kip.marikoCpuMaxVolt);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoEmcMaxClock, kip.marikoEmcMaxClock);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoEmcVddqVolt, kip.marikoEmcVddqVolt);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoCpuUV, kip.marikoCpuUV);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoGpuUV, kip.marikoGpuUV);
|
||||
this->config->SetConfigValue(KipConfigValue_eristaCpuUV, kip.eristaCpuUV);
|
||||
this->config->SetConfigValue(KipConfigValue_eristaGpuUV, kip.eristaGpuUV);
|
||||
this->config->SetConfigValue(KipConfigValue_commonGpuVoltOffset, kip.commonGpuVoltOffset);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoEmcDvbShift, kip.marikoEmcDvbShift);
|
||||
this->config->SetConfigValue(KipConfigValue_t1_tRCD, kip.t1_tRCD);
|
||||
this->config->SetConfigValue(KipConfigValue_t2_tRP, kip.t2_tRP);
|
||||
this->config->SetConfigValue(KipConfigValue_t3_tRAS, kip.t3_tRAS);
|
||||
this->config->SetConfigValue(KipConfigValue_t4_tRRD, kip.t4_tRRD);
|
||||
this->config->SetConfigValue(KipConfigValue_t5_tRFC, kip.t5_tRFC);
|
||||
this->config->SetConfigValue(KipConfigValue_t6_tRTW, kip.t6_tRTW);
|
||||
this->config->SetConfigValue(KipConfigValue_t7_tWTR, kip.t7_tWTR);
|
||||
this->config->SetConfigValue(KipConfigValue_t8_tREFI, kip.t8_tREFI);
|
||||
const char* kip = "sdmc:/atmosphere/kips/hoc.kip";
|
||||
CustomizeTable table;
|
||||
|
||||
this->config->SetConfigValue(KipConfigValue_mem_burst_read_latency, kip.mem_burst_read_latency);
|
||||
this->config->SetConfigValue(KipConfigValue_mem_burst_write_latency, kip.mem_burst_write_latency);
|
||||
// Read the KIP file ONCE
|
||||
if (!cust_read_and_cache(kip, &table)) {
|
||||
FileUtils::LogLine("[clock_manager] Failed to read KIP file for GetKipData");
|
||||
return;
|
||||
}
|
||||
|
||||
this->config->SetConfigValue(KipConfigValue_marikoCpuHighVmin, kip.marikoCpuHighVmin);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoCpuLowVmin, kip.marikoCpuLowVmin);
|
||||
// Build a config value list to set all at once
|
||||
SysClkConfigValueList configValues;
|
||||
memset(&configValues, 0, sizeof(configValues));
|
||||
|
||||
this->config->SetConfigValue(KipConfigValue_eristaGpuVmin, kip.eristaGpuVmin);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoGpuVmin, kip.marikoGpuVmin);
|
||||
this->config->SetConfigValue(KipConfigValue_marikoGpuVmax, kip.marikoGpuVmax);
|
||||
// Read all fields from KIP file
|
||||
configValues.values[KipConfigValue_custRev] = cust_get_cust_rev(&table);
|
||||
configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
|
||||
configValues.values[KipConfigValue_hpMode] = cust_get_hp_mode(&table);
|
||||
|
||||
this->config->SetConfigValue(KipConfigValue_marikoGpuFullUnlock, kip.marikoGpuFullUnlock);
|
||||
configValues.values[KipConfigValue_commonEmcMemVolt] = cust_get_common_emc_volt(&table);
|
||||
configValues.values[KipConfigValue_eristaEmcMaxClock] = cust_get_erista_emc_max(&table);
|
||||
configValues.values[KipConfigValue_marikoEmcMaxClock] = cust_get_mariko_emc_max(&table);
|
||||
configValues.values[KipConfigValue_marikoEmcVddqVolt] = cust_get_mariko_emc_vddq(&table);
|
||||
configValues.values[KipConfigValue_emcDvbShift] = cust_get_emc_dvb_shift(&table);
|
||||
|
||||
// Mariko GPU voltages
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_76800, kip.g_volt_76800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_153600, kip.g_volt_153600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_230400, kip.g_volt_230400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_307200, kip.g_volt_307200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_384000, kip.g_volt_384000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_460800, kip.g_volt_460800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_537600, kip.g_volt_537600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_614400, kip.g_volt_614400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_691200, kip.g_volt_691200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_768000, kip.g_volt_768000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_844800, kip.g_volt_844800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_921600, kip.g_volt_921600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_998400, kip.g_volt_998400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1075200, kip.g_volt_1075200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1152000, kip.g_volt_1152000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1228800, kip.g_volt_1228800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1267200, kip.g_volt_1267200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1305600, kip.g_volt_1305600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1344000, kip.g_volt_1344000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1382400, kip.g_volt_1382400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1420800, kip.g_volt_1420800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1459200, kip.g_volt_1459200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1497600, kip.g_volt_1497600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_1536000, kip.g_volt_1536000);
|
||||
configValues.values[KipConfigValue_t1_tRCD] = cust_get_tRCD(&table);
|
||||
configValues.values[KipConfigValue_t2_tRP] = cust_get_tRP(&table);
|
||||
configValues.values[KipConfigValue_t3_tRAS] = cust_get_tRAS(&table);
|
||||
configValues.values[KipConfigValue_t4_tRRD] = cust_get_tRRD(&table);
|
||||
configValues.values[KipConfigValue_t5_tRFC] = cust_get_tRFC(&table);
|
||||
configValues.values[KipConfigValue_t6_tRTW] = cust_get_tRTW(&table);
|
||||
configValues.values[KipConfigValue_t7_tWTR] = cust_get_tWTR(&table);
|
||||
configValues.values[KipConfigValue_t8_tREFI] = cust_get_tREFI(&table);
|
||||
configValues.values[KipConfigValue_mem_burst_read_latency] = cust_get_burst_read_lat(&table);
|
||||
configValues.values[KipConfigValue_mem_burst_write_latency] = cust_get_burst_write_lat(&table);
|
||||
|
||||
// Erista GPU voltages
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_76800, kip.g_volt_e_76800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_115200, kip.g_volt_e_115200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_153600, kip.g_volt_e_153600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_192000, kip.g_volt_e_192000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_230400, kip.g_volt_e_230400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_268800, kip.g_volt_e_268800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_307200, kip.g_volt_e_307200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_345600, kip.g_volt_e_345600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_384000, kip.g_volt_e_384000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_422400, kip.g_volt_e_422400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_460800, kip.g_volt_e_460800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_499200, kip.g_volt_e_499200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_537600, kip.g_volt_e_537600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_576000, kip.g_volt_e_576000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_614400, kip.g_volt_e_614400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_652800, kip.g_volt_e_652800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_691200, kip.g_volt_e_691200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_729600, kip.g_volt_e_729600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_768000, kip.g_volt_e_768000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_806400, kip.g_volt_e_806400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_844800, kip.g_volt_e_844800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_883200, kip.g_volt_e_883200);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_921600, kip.g_volt_e_921600);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_960000, kip.g_volt_e_960000);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_998400, kip.g_volt_e_998400);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_1036800, kip.g_volt_e_1036800);
|
||||
this->config->SetConfigValue(KipConfigValue_g_volt_e_1075200, kip.g_volt_e_1075200);
|
||||
configValues.values[KipConfigValue_eristaCpuUV] = cust_get_erista_cpu_uv(&table);
|
||||
configValues.values[KipConfigValue_eristaCpuMaxVolt] = cust_get_erista_cpu_max_volt(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuUVLow] = cust_get_mariko_cpu_uv_low(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuUVHigh] = cust_get_mariko_cpu_uv_high(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuLowVmin] = cust_get_mariko_cpu_low_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuHighVmin] = cust_get_mariko_cpu_high_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuMaxVolt] = cust_get_mariko_cpu_max_volt(&table);
|
||||
configValues.values[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table);
|
||||
|
||||
configValues.values[KipConfigValue_eristaGpuUV] = cust_get_erista_gpu_uv(&table);
|
||||
configValues.values[KipConfigValue_eristaGpuVmin] = cust_get_erista_gpu_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoGpuUV] = cust_get_mariko_gpu_uv(&table);
|
||||
configValues.values[KipConfigValue_marikoGpuVmin] = cust_get_mariko_gpu_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table);
|
||||
configValues.values[KipConfigValue_commonGpuVoltOffset] = cust_get_common_gpu_offset(&table);
|
||||
configValues.values[KipConfigValue_gpuSpeedo] = cust_get_gpu_speedo(&table);
|
||||
configValues.values[KipConfigValue_marikoGpuFullUnlock] = cust_get_mariko_gpu_unlock(&table);
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
configValues.values[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
configValues.values[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
|
||||
}
|
||||
|
||||
if (sizeof(SysClkConfigValueList) <= sizeof(configValues)) {
|
||||
if (this->config->SetConfigValues(&configValues, false)) {
|
||||
FileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config");
|
||||
} else {
|
||||
FileUtils::LogLine("[clock_manager] Warning: Failed to set config values from KIP");
|
||||
}
|
||||
} else {
|
||||
FileUtils::LogLine("[clock_manager] Error: Config value list buffer size mismatch");
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "board.h"
|
||||
#include <nxExt/cpp/lockable_mutex.h>
|
||||
#include "integrations.h"
|
||||
#include "kip_handler.h"
|
||||
|
||||
class ReverseNXSync;
|
||||
|
||||
|
||||
@@ -405,22 +405,6 @@ std::uint64_t Config::GetConfigValue(SysClkConfigValue kval)
|
||||
return this->configValues[kval];
|
||||
}
|
||||
|
||||
void Config::SetConfigValue(SysClkConfigValue kval, std::uint64_t value)
|
||||
{
|
||||
ASSERT_ENUM_VALID(SysClkConfigValue, kval);
|
||||
|
||||
std::scoped_lock lock{this->configMutex};
|
||||
|
||||
if(sysclkValidConfigValue(kval, value))
|
||||
{
|
||||
this->configValues[kval] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->configValues[kval] = sysclkDefaultConfigValue(kval);
|
||||
}
|
||||
}
|
||||
|
||||
const char* Config::GetConfigValueName(SysClkConfigValue kval, bool pretty)
|
||||
{
|
||||
ASSERT_ENUM_VALID(SysClkConfigValue, kval);
|
||||
@@ -444,7 +428,6 @@ bool Config::SetConfigValues(SysClkConfigValueList* configValues, bool immediate
|
||||
{
|
||||
std::scoped_lock lock{this->configMutex};
|
||||
|
||||
// Use dynamic allocation instead of fixed stack buffers
|
||||
std::vector<const char*> iniKeys;
|
||||
std::vector<std::string> iniValues;
|
||||
|
||||
@@ -496,5 +479,53 @@ bool Config::SetConfigValues(SysClkConfigValueList* configValues, bool immediate
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Config::ResetConfigValue(SysClkConfigValue kval)
|
||||
{
|
||||
// Check enum validity BEFORE acquiring lock
|
||||
if (!SYSCLK_ENUM_VALID(SysClkConfigValue, kval)) {
|
||||
FileUtils::LogLine("[cfg] Invalid SysClkConfigValue: %u", kval);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::scoped_lock lock{this->configMutex};
|
||||
|
||||
std::uint64_t defaultValue = sysclkDefaultConfigValue(kval);
|
||||
|
||||
// Build key-value pair for INI file (empty value to remove)
|
||||
std::vector<const char*> iniKeys;
|
||||
std::vector<std::string> iniValues;
|
||||
|
||||
iniKeys.reserve(2); // key + NULL terminator
|
||||
iniValues.reserve(1);
|
||||
|
||||
const char* keyStr = sysclkFormatConfigValue(kval, false);
|
||||
|
||||
iniKeys.push_back(keyStr);
|
||||
iniValues.push_back(""); // Empty string to remove the key
|
||||
|
||||
// Null terminate keys
|
||||
iniKeys.push_back(NULL);
|
||||
|
||||
// Build value pointers array
|
||||
std::vector<const char*> valuePointers;
|
||||
valuePointers.reserve(iniValues.size() + 1);
|
||||
for (const auto& val : iniValues) {
|
||||
valuePointers.push_back(val.c_str());
|
||||
}
|
||||
valuePointers.push_back(NULL);
|
||||
|
||||
// Write to INI file
|
||||
if (!ini_putsection(CONFIG_VAL_SECTION, iniKeys.data(), valuePointers.data(), this->path.c_str())) {
|
||||
FileUtils::LogLine("[cfg] Failed to reset config value %u in INI", kval);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply default value in memory
|
||||
this->configValues[kval] = defaultValue;
|
||||
FileUtils::LogLine("[cfg] Reset config value %u to default: %llu", kval, defaultValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -62,10 +62,10 @@ class Config
|
||||
std::uint32_t GetOverrideHz(SysClkModule module);
|
||||
|
||||
std::uint64_t GetConfigValue(SysClkConfigValue val);
|
||||
void SetConfigValue(SysClkConfigValue val, std::uint64_t value);
|
||||
const char* GetConfigValueName(SysClkConfigValue val, bool pretty);
|
||||
void GetConfigValues(SysClkConfigValueList* out_configValues);
|
||||
bool SetConfigValues(SysClkConfigValueList* configValues, bool immediate);
|
||||
bool ResetConfigValue(SysClkConfigValue kval);
|
||||
protected:
|
||||
void Load();
|
||||
void Close();
|
||||
|
||||
@@ -205,7 +205,9 @@ Result IpcService::ServiceHandlerFunc(void* arg, const IpcServerRequest* r, u8*
|
||||
}
|
||||
break;
|
||||
case HocClkIpcCmd_SetKipData:
|
||||
return ipcSrv->SetKipData();
|
||||
if (r->data.size >= 0) {
|
||||
return ipcSrv->SetKipData();
|
||||
}
|
||||
}
|
||||
|
||||
return SYSCLK_ERROR(Generic);
|
||||
@@ -359,18 +361,17 @@ Result IpcService::GetFreqList(SysClkIpc_GetFreqList_Args* args, std::uint32_t*
|
||||
}
|
||||
|
||||
Result IpcService::SetReverseNXRTMode(ReverseNXMode mode) {
|
||||
ClockManager::GetInstance()->SetRNXRTMode(mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result IpcService::SetKipData() {
|
||||
ClockManager::GetInstance()->SetKipData();
|
||||
this->clockMgr->SetKipData();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result IpcService::GetKipData() {
|
||||
ClockManager::GetInstance()->GetKipData();
|
||||
this->clockMgr->GetKipData();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
398
Source/sys-clk/sysmodule/src/kip.h
Normal file
398
Source/sys-clk/sysmodule/src/kip.h
Normal file
@@ -0,0 +1,398 @@
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct {
|
||||
u8 cust[4];
|
||||
u32 custRev;
|
||||
u32 mtcConf;
|
||||
u32 hpMode;
|
||||
u32 commonEmcMemVolt;
|
||||
u32 eristaEmcMaxClock;
|
||||
u32 marikoEmcMaxClock;
|
||||
u32 marikoEmcVddqVolt;
|
||||
u32 emcDvbShift;
|
||||
u32 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_read_latency;
|
||||
u32 mem_burst_write_latency;
|
||||
u32 eristaCpuUV;
|
||||
u32 eristaCpuMaxVolt;
|
||||
u32 marikoCpuUVLow;
|
||||
u32 marikoCpuUVHigh;
|
||||
u32 tableConf;
|
||||
u32 marikoCpuLowVmin;
|
||||
u32 marikoCpuHighVmin;
|
||||
u32 marikoCpuMaxVolt;
|
||||
u32 eristaCpuBoostClock;
|
||||
u32 marikoCpuBoostClock;
|
||||
u32 eristaGpuUV;
|
||||
u32 eristaGpuVmin;
|
||||
u32 marikoGpuUV;
|
||||
u32 marikoGpuVmin;
|
||||
u32 marikoGpuVmax;
|
||||
u32 commonGpuVoltOffset;
|
||||
u32 gpuSpeedo;
|
||||
u32 marikoGpuFullUnlock;
|
||||
u32 eristaGpuVoltArray[27];
|
||||
u32 marikoGpuVoltArray[24];
|
||||
} CustomizeTable;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define CUST_MAGIC "CUST"
|
||||
#define CUST_MAGIC_LEN 4
|
||||
|
||||
typedef struct {
|
||||
FILE* file;
|
||||
long offset;
|
||||
CustomizeTable cached_table;
|
||||
bool has_cache;
|
||||
} CustHandle;
|
||||
|
||||
static inline bool cust_find_offset(FILE* f, long* out_offset) {
|
||||
u8 buf[512];
|
||||
long pos = 0;
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
while (1) {
|
||||
size_t r = fread(buf, 1, sizeof(buf), f);
|
||||
if (r < CUST_MAGIC_LEN) break;
|
||||
|
||||
for (size_t i = 0; i <= r - CUST_MAGIC_LEN; i++) {
|
||||
if (memcmp(&buf[i], CUST_MAGIC, CUST_MAGIC_LEN) == 0) {
|
||||
*out_offset = pos + (long)i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
pos += (long)(r - (CUST_MAGIC_LEN - 1));
|
||||
fseek(f, pos, SEEK_SET);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool cust_read_table(const char* path, CustomizeTable* out) {
|
||||
FILE* f = fopen(path, "rb");
|
||||
if (!f) return false;
|
||||
|
||||
long off;
|
||||
if (!cust_find_offset(f, &off)) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
|
||||
if (off + (long)sizeof(CustomizeTable) > size) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(f, off, SEEK_SET);
|
||||
bool ok = fread(out, 1, sizeof(CustomizeTable), f) == sizeof(CustomizeTable);
|
||||
fclose(f);
|
||||
|
||||
return ok && memcmp(out->cust, CUST_MAGIC, 4) == 0;
|
||||
}
|
||||
|
||||
static inline bool cust_write_table(const char* path, const CustomizeTable* in) {
|
||||
FILE* f = fopen(path, "r+b");
|
||||
if (!f) return false;
|
||||
|
||||
long off;
|
||||
if (!cust_find_offset(f, &off)) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
|
||||
if (off + (long)sizeof(CustomizeTable) > size) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(f, off, SEEK_SET);
|
||||
bool ok = fwrite(in, 1, sizeof(CustomizeTable), f) == sizeof(CustomizeTable);
|
||||
fflush(f);
|
||||
fclose(f);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
static inline bool cust_read_and_cache(const char* path, CustomizeTable* out) {
|
||||
return cust_read_table(path, out);
|
||||
}
|
||||
|
||||
#define CUST_WRITE_FIELD_BATCH(table, field, val) \
|
||||
do { \
|
||||
(table)->field = (val); \
|
||||
} while (0)
|
||||
|
||||
#define CUST_WRITE_FIELD(path, field, val) \
|
||||
do { \
|
||||
CustomizeTable t; \
|
||||
if (!cust_read_table(path, &t)) return false; \
|
||||
t.field = (val); \
|
||||
return cust_write_table(path, &t); \
|
||||
} while (0)
|
||||
|
||||
static inline bool cust_set_cust_rev(const char* p, u32 v) { CUST_WRITE_FIELD(p, custRev, v); }
|
||||
static inline bool cust_set_mtc_conf(const char* p, u32 v) { CUST_WRITE_FIELD(p, mtcConf, v); }
|
||||
static inline bool cust_set_hp_mode(const char* p, u32 v) { CUST_WRITE_FIELD(p, hpMode, v); }
|
||||
|
||||
static inline bool cust_set_common_emc_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, commonEmcMemVolt, v); }
|
||||
static inline bool cust_set_erista_emc_max(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaEmcMaxClock, v); }
|
||||
static inline bool cust_set_mariko_emc_max(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoEmcMaxClock, v); }
|
||||
static inline bool cust_set_mariko_emc_vddq(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoEmcVddqVolt, v); }
|
||||
static inline bool cust_set_emc_dvb_shift(const char* p, u32 v) { CUST_WRITE_FIELD(p, emcDvbShift, v); }
|
||||
|
||||
static inline bool cust_set_tRCD(const char* p, u32 v) { CUST_WRITE_FIELD(p, t1_tRCD, v); }
|
||||
static inline bool cust_set_tRP(const char* p, u32 v) { CUST_WRITE_FIELD(p, t2_tRP, v); }
|
||||
static inline bool cust_set_tRAS(const char* p, u32 v) { CUST_WRITE_FIELD(p, t3_tRAS, v); }
|
||||
static inline bool cust_set_tRRD(const char* p, u32 v) { CUST_WRITE_FIELD(p, t4_tRRD, v); }
|
||||
static inline bool cust_set_tRFC(const char* p, u32 v) { CUST_WRITE_FIELD(p, t5_tRFC, v); }
|
||||
static inline bool cust_set_tRTW(const char* p, u32 v) { CUST_WRITE_FIELD(p, t6_tRTW, v); }
|
||||
static inline bool cust_set_tWTR(const char* p, u32 v) { CUST_WRITE_FIELD(p, t7_tWTR, v); }
|
||||
static inline bool cust_set_tREFI(const char* p, u32 v) { CUST_WRITE_FIELD(p, t8_tREFI, v); }
|
||||
static inline bool cust_set_burst_read_lat(const char* p, u32 v) { CUST_WRITE_FIELD(p, mem_burst_read_latency, v); }
|
||||
static inline bool cust_set_burst_write_lat(const char* p, u32 v) { CUST_WRITE_FIELD(p, mem_burst_write_latency, v); }
|
||||
|
||||
static inline bool cust_set_erista_cpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuUV, v); }
|
||||
static inline bool cust_set_erista_cpu_max_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuMaxVolt, v); }
|
||||
static inline bool cust_set_mariko_cpu_uv_low(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuUVLow, v); }
|
||||
static inline bool cust_set_mariko_cpu_uv_high(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuUVHigh, v); }
|
||||
static inline bool cust_set_mariko_cpu_low_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuLowVmin, v); }
|
||||
static inline bool cust_set_mariko_cpu_high_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuHighVmin, v); }
|
||||
static inline bool cust_set_mariko_cpu_max_volt(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuMaxVolt, v); }
|
||||
static inline bool cust_set_erista_cpu_boost(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaCpuBoostClock, v); }
|
||||
static inline bool cust_set_mariko_cpu_boost(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoCpuBoostClock, v); }
|
||||
|
||||
static inline bool cust_set_erista_gpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaGpuUV, v); }
|
||||
static inline bool cust_set_erista_gpu_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, eristaGpuVmin, v); }
|
||||
static inline bool cust_set_mariko_gpu_uv(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuUV, v); }
|
||||
static inline bool cust_set_mariko_gpu_vmin(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuVmin, v); }
|
||||
static inline bool cust_set_mariko_gpu_vmax(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuVmax, v); }
|
||||
static inline bool cust_set_common_gpu_offset(const char* p, u32 v) { CUST_WRITE_FIELD(p, commonGpuVoltOffset, v); }
|
||||
static inline bool cust_set_gpu_speedo(const char* p, u32 v) { CUST_WRITE_FIELD(p, gpuSpeedo, v); }
|
||||
static inline bool cust_set_mariko_gpu_unlock(const char* p, u32 v) { CUST_WRITE_FIELD(p, marikoGpuFullUnlock, v); }
|
||||
|
||||
/* GPU VOLT ARRAY HELPERS */
|
||||
static inline bool cust_set_erista_gpu_volt(const char* p, int idx, u32 v) {
|
||||
if (idx < 0 || idx >= 27) return false;
|
||||
CustomizeTable t;
|
||||
if (!cust_read_table(p, &t)) return false;
|
||||
t.eristaGpuVoltArray[idx] = v;
|
||||
return cust_write_table(p, &t);
|
||||
}
|
||||
|
||||
static inline bool cust_set_mariko_gpu_volt(const char* p, int idx, u32 v) {
|
||||
if (idx < 0 || idx >= 24) return false;
|
||||
CustomizeTable t;
|
||||
if (!cust_read_table(p, &t)) return false;
|
||||
t.marikoGpuVoltArray[idx] = v;
|
||||
return cust_write_table(p, &t);
|
||||
}
|
||||
|
||||
static inline u32 cust_get_field(const CustomizeTable* t, u32 offset) {
|
||||
if (!t) return 0;
|
||||
return *(u32*)((u8*)t + offset);
|
||||
}
|
||||
|
||||
#define CUST_GET_FIELD(table, field) ((table) ? (table)->field : 0)
|
||||
|
||||
static inline u32 cust_get_cust_rev(const CustomizeTable* t) { return CUST_GET_FIELD(t, custRev); }
|
||||
static inline u32 cust_get_mtc_conf(const CustomizeTable* t) { return CUST_GET_FIELD(t, mtcConf); }
|
||||
static inline u32 cust_get_hp_mode(const CustomizeTable* t) { return CUST_GET_FIELD(t, hpMode); }
|
||||
|
||||
static inline u32 cust_get_common_emc_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, commonEmcMemVolt); }
|
||||
static inline u32 cust_get_erista_emc_max(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaEmcMaxClock); }
|
||||
static inline u32 cust_get_mariko_emc_max(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoEmcMaxClock); }
|
||||
static inline u32 cust_get_mariko_emc_vddq(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoEmcVddqVolt); }
|
||||
static inline u32 cust_get_emc_dvb_shift(const CustomizeTable* t) { return CUST_GET_FIELD(t, emcDvbShift); }
|
||||
|
||||
static inline u32 cust_get_tRCD(const CustomizeTable* t) { return CUST_GET_FIELD(t, t1_tRCD); }
|
||||
static inline u32 cust_get_tRP(const CustomizeTable* t) { return CUST_GET_FIELD(t, t2_tRP); }
|
||||
static inline u32 cust_get_tRAS(const CustomizeTable* t) { return CUST_GET_FIELD(t, t3_tRAS); }
|
||||
static inline u32 cust_get_tRRD(const CustomizeTable* t) { return CUST_GET_FIELD(t, t4_tRRD); }
|
||||
static inline u32 cust_get_tRFC(const CustomizeTable* t) { return CUST_GET_FIELD(t, t5_tRFC); }
|
||||
static inline u32 cust_get_tRTW(const CustomizeTable* t) { return CUST_GET_FIELD(t, t6_tRTW); }
|
||||
static inline u32 cust_get_tWTR(const CustomizeTable* t) { return CUST_GET_FIELD(t, t7_tWTR); }
|
||||
static inline u32 cust_get_tREFI(const CustomizeTable* t) { return CUST_GET_FIELD(t, t8_tREFI); }
|
||||
static inline u32 cust_get_burst_read_lat(const CustomizeTable* t) { return CUST_GET_FIELD(t, mem_burst_read_latency); }
|
||||
static inline u32 cust_get_burst_write_lat(const CustomizeTable* t) { return CUST_GET_FIELD(t, mem_burst_write_latency); }
|
||||
|
||||
static inline u32 cust_get_erista_cpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuUV); }
|
||||
static inline u32 cust_get_erista_cpu_max_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuMaxVolt); }
|
||||
static inline u32 cust_get_mariko_cpu_uv_low(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuUVLow); }
|
||||
static inline u32 cust_get_mariko_cpu_uv_high(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuUVHigh); }
|
||||
static inline u32 cust_get_mariko_cpu_low_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuLowVmin); }
|
||||
static inline u32 cust_get_mariko_cpu_high_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuHighVmin); }
|
||||
static inline u32 cust_get_mariko_cpu_max_volt(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuMaxVolt); }
|
||||
static inline u32 cust_get_erista_cpu_boost(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaCpuBoostClock); }
|
||||
static inline u32 cust_get_mariko_cpu_boost(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoCpuBoostClock); }
|
||||
|
||||
static inline u32 cust_get_erista_gpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaGpuUV); }
|
||||
static inline u32 cust_get_erista_gpu_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, eristaGpuVmin); }
|
||||
static inline u32 cust_get_mariko_gpu_uv(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuUV); }
|
||||
static inline u32 cust_get_mariko_gpu_vmin(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuVmin); }
|
||||
static inline u32 cust_get_mariko_gpu_vmax(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuVmax); }
|
||||
static inline u32 cust_get_common_gpu_offset(const CustomizeTable* t) { return CUST_GET_FIELD(t, commonGpuVoltOffset); }
|
||||
static inline u32 cust_get_gpu_speedo(const CustomizeTable* t) { return CUST_GET_FIELD(t, gpuSpeedo); }
|
||||
static inline u32 cust_get_mariko_gpu_unlock(const CustomizeTable* t) { return CUST_GET_FIELD(t, marikoGpuFullUnlock); }
|
||||
|
||||
static inline u32 cust_get_erista_gpu_volt(const CustomizeTable* t, int idx) {
|
||||
if (!t || idx < 0 || idx >= 27) return 0;
|
||||
return t->eristaGpuVoltArray[idx];
|
||||
}
|
||||
|
||||
static inline u32 cust_get_mariko_gpu_volt(const CustomizeTable* t, int idx) {
|
||||
if (!t || idx < 0 || idx >= 24) return 0;
|
||||
return t->marikoGpuVoltArray[idx];
|
||||
}
|
||||
|
||||
#define DECL_ERISTA_GPU_VOLT_HELPER(freq, idx) \
|
||||
static inline bool cust_set_erista_gpu_volt_##freq( \
|
||||
const char* p, u32 v) { \
|
||||
return cust_set_erista_gpu_volt(p, idx, v); \
|
||||
}
|
||||
|
||||
#define DECL_MARIKO_GPU_VOLT_HELPER(freq, idx) \
|
||||
static inline bool cust_set_mariko_gpu_volt_##freq( \
|
||||
const char* p, u32 v) { \
|
||||
return cust_set_mariko_gpu_volt(p, idx, v); \
|
||||
}
|
||||
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(76800, 0)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(115200, 1)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(153600, 2)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(192000, 3)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(230400, 4)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(268800, 5)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(307200, 6)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(345600, 7)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(384000, 8)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(422400, 9)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(460800, 10)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(499200, 11)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(537600, 12)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(576000, 13)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(614400, 14)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(652800, 15)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(691200, 16)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(729600, 17)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(768000, 18)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(806400, 19)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(844800, 20)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(883200, 21)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(921600, 22)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(960000, 23)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(998400, 24)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(1036800, 25)
|
||||
DECL_ERISTA_GPU_VOLT_HELPER(1075200, 26)
|
||||
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(76800, 0)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(153600, 1)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(230400, 2)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(307200, 3)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(384000, 4)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(460800, 5)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(537600, 6)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(614400, 7)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(691200, 8)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(768000, 9)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(844800, 10)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(921600, 11)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(998400, 12)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1075200, 13)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1152000, 14)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1228800, 15)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1267200, 16)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1305600, 17)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1344000, 18)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1382400, 19)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1420800, 20)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1459200, 21)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1497600, 22)
|
||||
DECL_MARIKO_GPU_VOLT_HELPER(1536000, 23)
|
||||
|
||||
|
||||
#define DECL_ERISTA_GPU_VOLT_GET(freq, idx) \
|
||||
static inline u32 cust_get_erista_gpu_volt_##freq##_val(const char* p) { \
|
||||
CustomizeTable t; \
|
||||
if (!cust_read_table(p, &t)) return 0; \
|
||||
return cust_get_erista_gpu_volt(&t, idx); \
|
||||
}
|
||||
#define DECL_MARIKO_GPU_VOLT_GET(freq, idx) \
|
||||
static inline u32 cust_get_mariko_gpu_volt_##freq##_val(const char* p) { \
|
||||
CustomizeTable t; \
|
||||
if (!cust_read_table(p, &t)) return 0; \
|
||||
return cust_get_mariko_gpu_volt(&t, idx); \
|
||||
}
|
||||
|
||||
DECL_ERISTA_GPU_VOLT_GET(76800, 0)
|
||||
DECL_ERISTA_GPU_VOLT_GET(115200, 1)
|
||||
DECL_ERISTA_GPU_VOLT_GET(153600, 2)
|
||||
DECL_ERISTA_GPU_VOLT_GET(192000, 3)
|
||||
DECL_ERISTA_GPU_VOLT_GET(230400, 4)
|
||||
DECL_ERISTA_GPU_VOLT_GET(268800, 5)
|
||||
DECL_ERISTA_GPU_VOLT_GET(307200, 6)
|
||||
DECL_ERISTA_GPU_VOLT_GET(345600, 7)
|
||||
DECL_ERISTA_GPU_VOLT_GET(384000, 8)
|
||||
DECL_ERISTA_GPU_VOLT_GET(422400, 9)
|
||||
DECL_ERISTA_GPU_VOLT_GET(460800, 10)
|
||||
DECL_ERISTA_GPU_VOLT_GET(499200, 11)
|
||||
DECL_ERISTA_GPU_VOLT_GET(537600, 12)
|
||||
DECL_ERISTA_GPU_VOLT_GET(576000, 13)
|
||||
DECL_ERISTA_GPU_VOLT_GET(614400, 14)
|
||||
DECL_ERISTA_GPU_VOLT_GET(652800, 15)
|
||||
DECL_ERISTA_GPU_VOLT_GET(691200, 16)
|
||||
DECL_ERISTA_GPU_VOLT_GET(729600, 17)
|
||||
DECL_ERISTA_GPU_VOLT_GET(768000, 18)
|
||||
DECL_ERISTA_GPU_VOLT_GET(806400, 19)
|
||||
DECL_ERISTA_GPU_VOLT_GET(844800, 20)
|
||||
DECL_ERISTA_GPU_VOLT_GET(883200, 21)
|
||||
DECL_ERISTA_GPU_VOLT_GET(921600, 22)
|
||||
DECL_ERISTA_GPU_VOLT_GET(960000, 23)
|
||||
DECL_ERISTA_GPU_VOLT_GET(998400, 24)
|
||||
DECL_ERISTA_GPU_VOLT_GET(1036800, 25)
|
||||
DECL_ERISTA_GPU_VOLT_GET(1075200, 26)
|
||||
|
||||
DECL_MARIKO_GPU_VOLT_GET(76800, 0)
|
||||
DECL_MARIKO_GPU_VOLT_GET(153600, 1)
|
||||
DECL_MARIKO_GPU_VOLT_GET(230400, 2)
|
||||
DECL_MARIKO_GPU_VOLT_GET(307200, 3)
|
||||
DECL_MARIKO_GPU_VOLT_GET(384000, 4)
|
||||
DECL_MARIKO_GPU_VOLT_GET(460800, 5)
|
||||
DECL_MARIKO_GPU_VOLT_GET(537600, 6)
|
||||
DECL_MARIKO_GPU_VOLT_GET(614400, 7)
|
||||
DECL_MARIKO_GPU_VOLT_GET(691200, 8)
|
||||
DECL_MARIKO_GPU_VOLT_GET(768000, 9)
|
||||
DECL_MARIKO_GPU_VOLT_GET(844800, 10)
|
||||
DECL_MARIKO_GPU_VOLT_GET(921600, 11)
|
||||
DECL_MARIKO_GPU_VOLT_GET(998400, 12)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1075200, 13)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1152000, 14)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1228800, 15)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1267200, 16)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1305600, 17)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1344000, 18)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1382400, 19)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1420800, 20)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1459200, 21)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1497600, 22)
|
||||
DECL_MARIKO_GPU_VOLT_GET(1536000, 23)
|
||||
@@ -1,182 +0,0 @@
|
||||
#ifndef KIP_H
|
||||
#define KIP_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define KIP_MAGIC "CUST"
|
||||
#define KIP_MAGIC_LEN 4
|
||||
#define KIP_MAX_STRUCT 4096
|
||||
|
||||
typedef struct {
|
||||
uint32_t custRev;
|
||||
uint32_t mtcConf;
|
||||
uint32_t hpMode;
|
||||
uint32_t commonCpuBoostClock;
|
||||
uint32_t commonEmcMemVolt;
|
||||
uint32_t eristaCpuMaxVolt;
|
||||
uint32_t eristaEmcMaxClock;
|
||||
uint32_t marikoCpuMaxVolt;
|
||||
uint32_t marikoEmcMaxClock;
|
||||
uint32_t marikoEmcVddqVolt;
|
||||
uint32_t marikoCpuUV;
|
||||
uint32_t marikoGpuUV;
|
||||
uint32_t eristaCpuUV;
|
||||
uint32_t eristaGpuUV;
|
||||
uint32_t commonGpuVoltOffset;
|
||||
uint32_t marikoEmcDvbShift;
|
||||
|
||||
uint32_t t1_tRCD;
|
||||
uint32_t t2_tRP;
|
||||
uint32_t t3_tRAS;
|
||||
uint32_t t4_tRRD;
|
||||
uint32_t t5_tRFC;
|
||||
uint32_t t6_tRTW;
|
||||
uint32_t t7_tWTR;
|
||||
uint32_t t8_tREFI;
|
||||
uint32_t mem_burst_read_latency;
|
||||
uint32_t mem_burst_write_latency;
|
||||
uint32_t marikoCpuHighVmin;
|
||||
uint32_t marikoCpuLowVmin;
|
||||
uint32_t eristaGpuVmin;
|
||||
uint32_t marikoGpuVmin;
|
||||
uint32_t marikoGpuVmax;
|
||||
|
||||
uint32_t marikoGpuFullUnlock;
|
||||
|
||||
uint32_t g_volt_76800;
|
||||
uint32_t g_volt_153600;
|
||||
uint32_t g_volt_230400;
|
||||
uint32_t g_volt_307200;
|
||||
uint32_t g_volt_384000;
|
||||
uint32_t g_volt_460800;
|
||||
uint32_t g_volt_537600;
|
||||
uint32_t g_volt_614400;
|
||||
uint32_t g_volt_691200;
|
||||
uint32_t g_volt_768000;
|
||||
uint32_t g_volt_844800;
|
||||
uint32_t g_volt_921600;
|
||||
uint32_t g_volt_998400;
|
||||
uint32_t g_volt_1075200;
|
||||
uint32_t g_volt_1152000;
|
||||
uint32_t g_volt_1228800;
|
||||
uint32_t g_volt_1267200;
|
||||
uint32_t g_volt_1305600;
|
||||
uint32_t g_volt_1344000;
|
||||
uint32_t g_volt_1382400;
|
||||
uint32_t g_volt_1420800;
|
||||
uint32_t g_volt_1459200;
|
||||
uint32_t g_volt_1497600;
|
||||
uint32_t g_volt_1536000;
|
||||
|
||||
uint32_t g_volt_e_76800;
|
||||
uint32_t g_volt_e_115200;
|
||||
uint32_t g_volt_e_153600;
|
||||
uint32_t g_volt_e_192000;
|
||||
uint32_t g_volt_e_230400;
|
||||
uint32_t g_volt_e_268800;
|
||||
uint32_t g_volt_e_307200;
|
||||
uint32_t g_volt_e_345600;
|
||||
uint32_t g_volt_e_384000;
|
||||
uint32_t g_volt_e_422400;
|
||||
uint32_t g_volt_e_460800;
|
||||
uint32_t g_volt_e_499200;
|
||||
uint32_t g_volt_e_537600;
|
||||
uint32_t g_volt_e_576000;
|
||||
uint32_t g_volt_e_614400;
|
||||
uint32_t g_volt_e_652800;
|
||||
uint32_t g_volt_e_691200;
|
||||
uint32_t g_volt_e_729600;
|
||||
uint32_t g_volt_e_768000;
|
||||
uint32_t g_volt_e_806400;
|
||||
uint32_t g_volt_e_844800;
|
||||
uint32_t g_volt_e_883200;
|
||||
uint32_t g_volt_e_921600;
|
||||
uint32_t g_volt_e_960000;
|
||||
uint32_t g_volt_e_998400;
|
||||
uint32_t g_volt_e_1036800;
|
||||
uint32_t g_volt_e_1075200;
|
||||
} kip_data_t;
|
||||
|
||||
|
||||
|
||||
static long kip_find_magic(FILE *f)
|
||||
{
|
||||
unsigned char buf[4096 + KIP_MAGIC_LEN];
|
||||
size_t r;
|
||||
long offset = 0;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
while ((r = fread(buf + KIP_MAGIC_LEN, 1, 4096, f)) > 0)
|
||||
{
|
||||
for (size_t i = 0; i < r; i++)
|
||||
{
|
||||
if (memcmp(buf + i, KIP_MAGIC, KIP_MAGIC_LEN) == 0)
|
||||
{
|
||||
return offset + i;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(buf, buf + 4096, KIP_MAGIC_LEN);
|
||||
offset += r;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int kip_read(const char *path, void *out_struct, size_t struct_size)
|
||||
{
|
||||
if (struct_size > KIP_MAX_STRUCT)
|
||||
return -3;
|
||||
|
||||
FILE *f = fopen(path, "rb");
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
long magic_pos = kip_find_magic(f);
|
||||
if (magic_pos < 0) {
|
||||
fclose(f);
|
||||
return -2; /* magic not found */
|
||||
}
|
||||
|
||||
long data_pos = magic_pos + KIP_MAGIC_LEN;
|
||||
fseek(f, data_pos, SEEK_SET);
|
||||
|
||||
size_t r = fread(out_struct, 1, struct_size, f);
|
||||
fclose(f);
|
||||
|
||||
return (r == struct_size) ? 0 : -4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int kip_write(const char *path, const void *in_struct, size_t struct_size)
|
||||
{
|
||||
if (struct_size > KIP_MAX_STRUCT)
|
||||
return -3;
|
||||
|
||||
FILE *f = fopen(path, "r+b");
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
long magic_pos = kip_find_magic(f);
|
||||
if (magic_pos < 0) {
|
||||
fclose(f);
|
||||
return -2;
|
||||
}
|
||||
|
||||
long data_pos = magic_pos + KIP_MAGIC_LEN;
|
||||
fseek(f, data_pos, SEEK_SET);
|
||||
|
||||
size_t w = fwrite(in_struct, 1, struct_size, f);
|
||||
fclose(f);
|
||||
|
||||
return (w == struct_size) ? 0 : -4;
|
||||
}
|
||||
|
||||
#endif /* KIP_H */
|
||||
63
dist/README.md
vendored
63
dist/README.md
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="assets/logo.png" alt="logo" width="160"/>
|
||||
<img src="assets/logo.png" alt="logo" width="350"/>
|
||||
|
||||
---
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
## ⚠️ Disclaimer
|
||||
|
||||
> **THIS TOOL CAN BE DANGEROUS IF MISUSED. PROCEED WITH CAUTION.**
|
||||
> Due to the design of Horizon OS, **overclocking RAM can cause NAND DAMAGE.**
|
||||
> Ensure you have a **full NAND backup** before proceeding.
|
||||
> Due to the design of Horizon OS, **overclocking RAM can cause NAND OR SD CORRUPTION.**
|
||||
> Ensure you have a **full NAND, PROINFO, EMUMMC and SD backup** before proceeding.
|
||||
|
||||
---
|
||||
|
||||
@@ -31,21 +31,21 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Features
|
||||
## Features
|
||||
|
||||
* **CPU:** Up to `2397MHz` (Mariko) / `2091MHz` (Erista)
|
||||
* **GPU:** Up to `1305MHz` (Mariko) / `998MHz` (Erista)
|
||||
* **RAM:** Up to `3200MHz` (Mariko) / `2360MHz` (Erista)
|
||||
* **CPU:** Up to 1963MHz (Mariko) / 1785MHz (Erista)
|
||||
* **GPU:** Up to 1075MHz (Mariko) / 998MHz (Erista)
|
||||
* **RAM:** Up to 1866MHz (Mariko) / 1600MHz (Erista)
|
||||
* Over/undervolting support
|
||||
* Built-in configurator
|
||||
* Compatible with most homebrew
|
||||
|
||||
> *Higher (potentially dangerous) frequencies are unlockable.*
|
||||
> *Exact maximum values vary per console.*
|
||||
> *Higher (potentially dangerous) frequencies are unlockable via configuration.*
|
||||
> *The exact maximum overclock possible varies per console, although most consoles should be able to do this safely.*
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Installation
|
||||
## Installation
|
||||
|
||||
1. Ensure you have the latest versions of
|
||||
|
||||
@@ -55,7 +55,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
3. If using **Hekate**, edit `hekate_ipl.ini` to include:
|
||||
|
||||
```
|
||||
kip1=atmosphere/kips/*
|
||||
kip1=atmosphere/kips/hoc.kip
|
||||
```
|
||||
|
||||
*(No changes needed if using fusee.)*
|
||||
@@ -64,7 +64,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Configuration
|
||||
## Configuration
|
||||
|
||||
1. Download the latest **Configurator** on your computer.
|
||||
2. Run the executable.
|
||||
@@ -74,40 +74,19 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
---
|
||||
|
||||
## 🧱 Building from Source
|
||||
## Building from Source
|
||||
|
||||
1. Set up a development environment for compiling **Atmosphere**.
|
||||
2. Clone Atmosphere:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Atmosphere-NX/Atmosphere.git
|
||||
```
|
||||
3. Move the cloned folder into `build/`.
|
||||
4. Insert your `Source/stratosphere` folder into `build/`.
|
||||
5. Run: (On Windows you need to use "make -j %NUMBER_OF_PROCESSORS%")
|
||||
|
||||
```bash
|
||||
./build.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
To build the Configurator:
|
||||
|
||||
```bash
|
||||
cd Source/Configurator
|
||||
build.bat
|
||||
# or
|
||||
python -m PyInstaller --onefile --add-data "assets;assets" --icon=assets/icon.ico --noconsole src/main.py
|
||||
```
|
||||
Refer to COMPILATION.md
|
||||
|
||||
---
|
||||
|
||||
## 💎 Credits
|
||||
## Credits
|
||||
|
||||
* **Lightos** & **Dominatorul** – RAM timings
|
||||
* **KazushiMe** & **meha** – Switch-OC-Suite
|
||||
* **Lightos** – RAM timings
|
||||
* **ScriesM** - Atmosphere CFW
|
||||
* **KazushiMe** – Switch OC Suite
|
||||
* **B3711** - UV Tables
|
||||
* **sys-clk team** – sys-clk
|
||||
* **b0rd2death** – Ultrahand sys-clk fork
|
||||
* **Lightos** & **Sammybigio2011** – Early testing
|
||||
|
||||
* **MasaGratoR and ZachyCatGames** - General help
|
||||
* **Lightos, Dom, Samybigio, Dom, Arcdelta, Miki, Algie, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TRRR and Xenshen** - Testing
|
||||
|
||||
BIN
dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp
vendored
BIN
dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp
vendored
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name" : "Horizon OC",
|
||||
"name" : "hoc-clk",
|
||||
"tid" : "00FF0000636C6BFF",
|
||||
"requires_reboot": false
|
||||
}
|
||||
Reference in New Issue
Block a user