sysclk: reformat kip editor and add fan speed to info

This commit is contained in:
souldbminersmwc
2025-12-18 20:02:12 -05:00
parent 2ad8767ffc
commit 25430dab20
10 changed files with 278 additions and 807 deletions

View File

@@ -43,6 +43,9 @@ typedef struct
uint32_t PartLoad[SysClkPartLoad_EnumMax];
uint32_t voltages[HocClkVoltage_EnumMax];
uint32_t perfConfId;
u8 fps;
u8 lcdFreq;
u8 fanLevel;
} SysClkContext;
typedef struct
@@ -54,7 +57,5 @@ typedef struct
} SysClkTitleProfileList;
#define SYSCLK_FREQ_LIST_MAX 32
#define SYSCLK_GPU_BOOST_HZ 76800000
#define SYSCLK_CPU_BOOST_HZ 1785000000
#define GLOBAL_PROFILE_ID 0xA111111111111111

View File

@@ -189,14 +189,14 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
return pretty ? "Overwrite Boost Mode" : "ow_boost";
case HocClkConfigValue_EristaMaxCpuClock:
return pretty ? "Erista Max CPU Clock" : "cpu_max_e";
return pretty ? "Max CPU Clock" : "cpu_max_e";
case HocClkConfigValue_EristaMaxGpuClock:
return pretty ? "Erista Max GPU Clock" : "gpu_max_e";
return pretty ? "Max GPU Clock" : "gpu_max_e";
case HocClkConfigValue_EristaMaxMemClock:
return pretty ? "Erista Max MEM Clock" : "mem_max_e";
case HocClkConfigValue_MarikoMaxCpuClock:
return pretty ? "Mariko Max CPU Clock" : "cpu_max_m";
return pretty ? "CPU Max Display Clock" : "cpu_max_m";
case HocClkConfigValue_MarikoMaxGpuClock:
return pretty ? "Mariko Max GPU Clock" : "gpu_max_m";
case HocClkConfigValue_MarikoMaxMemClock:

View File

@@ -126,16 +126,14 @@ static s32 drawDynamicUltraText(
tsl::Color color(r, g, b, 15);
// ---------------------------------------------
// Vertical Water Wobble
// Static Position (no vertical wobble)
// ---------------------------------------------
s32 wobbleY = y + sin(phase) * 3;
std::string ls(1, letter);
if (useNotificationMethod)
currentX += renderer->drawNotificationString(ls, false, currentX, wobbleY, fontSize, color).first;
currentX += renderer->drawNotificationString(ls, false, currentX, y, fontSize, color).first;
else
currentX += renderer->drawString(ls, false, currentX, wobbleY, fontSize, color).first;
currentX += renderer->drawString(ls, false, currentX, y, fontSize, color).first;
}
return currentX;
@@ -172,4 +170,4 @@ tsl::elm::Element* BaseGui::createUI()
void BaseGui::update()
{
this->refresh();
}
}

View File

@@ -55,8 +55,8 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
if(!this->context) [[unlikely]] return;
// All constants pre-calculated and cached
static constexpr const char* const labels[10] = {
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg"
static constexpr const char* const labels[11] = {
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg", "Fan"
};
static constexpr u32 dataPositions[6] = {63-3+3, 200-1, 344-1-3, 200-1, 342-1, 321-1};
@@ -144,6 +144,13 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
renderer->drawString(displayStrings[15], false, dataPositions[3], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Power now
renderer->drawString(displayStrings[16], false, dataPositions[4], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Power avg
y+=20;
renderer->drawString(labels[10], false, positions[5], y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
renderer->drawString(displayStrings[19], false, dataPositions[0], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Power now
}
// Optimized refresh - now does all the string formatting once per second
@@ -233,6 +240,7 @@ void BaseMenuGui::refresh()
sprintf(displayStrings[17], "%u%%", context->PartLoad[HocClkPartLoad_GPU] / 10);
sprintf(displayStrings[18], "%u%%", context->PartLoad[SysClkPartLoad_EMC] / 10);
sprintf(displayStrings[19], "%hhu%%", context->fanLevel);
}

View File

@@ -124,9 +124,9 @@ void FreqChoiceGui::listUI()
this->configList->values[HocClkConfigValue_MarikoMaxCpuClock] < mhz)
continue;
if (moduleName == "gpu" &&
this->configList->values[HocClkConfigValue_MarikoMaxGpuClock] < mhz)
continue;
// if (moduleName == "gpu" &&
// this->configList->values[HocClkConfigValue_MarikoMaxGpuClock] < mhz)
// continue;
// if (moduleName == "mem" &&
// this->configList->values[HocClkConfigValue_MarikoMaxMemClock] < mhz)

View File

@@ -34,17 +34,17 @@
void MainGui::listUI()
{
this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false);
enabledToggle->setStateChangedListener([this](bool state) {
Result rc = sysclkIpcSetEnabled(state);
if(R_FAILED(rc))
{
FatalGui::openWithResultCode("sysclkIpcSetEnabled", rc);
}
// this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false);
// enabledToggle->setStateChangedListener([this](bool state) {
// Result rc = sysclkIpcSetEnabled(state);
// if(R_FAILED(rc))
// {
// FatalGui::openWithResultCode("sysclkIpcSetEnabled", rc);
// }
this->lastContextUpdate = armGetSystemTick();
this->context->enabled = state;
});
// this->lastContextUpdate = armGetSystemTick();
// this->context->enabled = state;
// });
// this->listElement->addItem(this->enabledToggle);
tsl::elm::ListItem* appProfileItem = new tsl::elm::ListItem("Edit App Profile");
@@ -59,7 +59,6 @@ void MainGui::listUI()
});
this->listElement->addItem(appProfileItem);
this->listElement->addItem(new tsl::elm::CategoryHeader("Advanced"));
tsl::elm::ListItem* globalProfileItem = new tsl::elm::ListItem("Edit Global Profile");
globalProfileItem->setClickListener([this](u64 keys) {

File diff suppressed because it is too large Load Diff

View File

@@ -49,6 +49,11 @@ Thread cpuCore0Thread;
Thread cpuCore1Thread;
Thread cpuCore2Thread;
Thread cpuCore3Thread;
Thread MISCThread;
FanController fanController;
Result fanCheck = 1;
u8 fanSpeed = 0;
uint32_t GPU_Load_u = 0, fd = 0;
@@ -169,6 +174,14 @@ void gpuLoadThread(void*) {
} while(true);
}
void miscThread(void*) {
float temp;
for(;;) {
fanControllerGetRotationSpeedLevel(&fanController, &temp);
fanSpeed = (u8)temp;
}
}
void Board::Initialize()
{
@@ -205,6 +218,15 @@ void Board::Initialize()
if (R_SUCCEEDED(nvInitialize())) nvCheck = nvOpen(&fd, "/dev/nvhost-ctrl-gpu");
rc = rgltrInitialize();
ASSERT_RESULT_OK(rc, "rgltrInitialize");
if (R_SUCCEEDED(fanInitialize())) {
if (hosversionAtLeast(7,0,0)) fanCheck = fanOpenController(&fanController, 0x3D000001);
else fanCheck = fanOpenController(&fanController, 1);
}
threadCreate(&gpuLThread, gpuLoadThread, NULL, NULL, 0x1000, 0x3F, -2);
threadStart(&gpuLThread);
@@ -220,8 +242,8 @@ void Board::Initialize()
threadCreate(&cpuCore3Thread, CheckCore3, NULL, NULL, 0x1000, 0x10, 3);
threadStart(&cpuCore3Thread);
rc = rgltrInitialize();
ASSERT_RESULT_OK(rc, "rgltrInitialize");
threadCreate(&MISCThread, miscThread, NULL, NULL, 0x1000, 0x3F, -2);
threadStart(&MISCThread);
FetchHardwareInfos();
@@ -254,6 +276,8 @@ void Board::Exit()
threadClose(&cpuCore1Thread);
threadClose(&cpuCore2Thread);
threadClose(&cpuCore3Thread);
threadClose(&MISCThread);
rgltrExit();
}
@@ -729,3 +753,7 @@ std::uint32_t Board::GetVoltage(HocClkVoltage voltage)
return out > 0 ? out : 0;
}
u8 Board::GetFanRotationLevel() {
return fanSpeed;
}

View File

@@ -55,6 +55,7 @@ class Board
static SysClkSocType GetSocType();
static HorizonOCConsoleType GetConsoleType();
static std::uint32_t GetVoltage(HocClkVoltage voltage);
static u8 GetFanRotationLevel();
protected:
static void FetchHardwareInfos();

View File

@@ -81,7 +81,7 @@ ClockManager::ClockManager()
this->rnxSync = new ReverseNXSync;
if(this->config->GetConfigValue(HocClkConfigValue_KipEditing))
this->GetKipData();
this->GetKipData();
}
ClockManager::~ClockManager()
@@ -512,6 +512,8 @@ bool ClockManager::RefreshContext()
FileUtils::WriteContextToCsv(this->context);
}
this->context->fanLevel = Board::GetFanRotationLevel();
return hasChanged;
}
@@ -632,7 +634,7 @@ void ClockManager::GetKipData() {
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_marikoCpuMaxClock] = cust_get_marikoCpuMaxClock(&table) / 1000;
configValues.values[KipConfigValue_marikoGpuFullUnlock] = cust_get_marikoCpuMaxClock(&table) / 1000;
configValues.values[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table) / 1000;
configValues.values[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table) / 1000;