sysclk: add display unsafe freq option

This commit is contained in:
souldbminersmwc
2026-01-21 18:15:28 -05:00
parent 7325905476
commit 4a06176897
6 changed files with 45 additions and 11 deletions

View File

@@ -269,15 +269,20 @@ void AppProfileGui::addModuleListItemValue(
void AppProfileGui::addProfileUI(SysClkProfile profile)
{
Result rc = sysclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
return;
}
this->listElement->addItem(new tsl::elm::CategoryHeader(sysclkFormatProfile(profile, true) + std::string(" ") + ult::DIVIDER_SYMBOL + "  Reset"));
this->addModuleListItem(profile, SysClkModule_CPU);
this->addModuleListItem(profile, SysClkModule_GPU);
this->addModuleListItem(profile, SysClkModule_MEM);
#if IS_MINIMAL == 0
ValueThresholds lcdThresholds(60, 65);
if(!IsHoag()) {
if(!IsHoag() && configList.values[HorizonOCConfigValue_OverwriteRefreshRate]) {
if(profile != SysClkProfile_Docked)
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0, lcdThresholds);
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
else
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 120, 5, " Hz", 1, 0);
}

View File

@@ -195,6 +195,12 @@ void BaseMenuGui::refresh()
FatalGui::openWithResultCode("sysclkIpcGetCurrentContext", rc);
return;
}
rc = sysclkIpcGetConfigValues(&configList);
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
return;
}
// dockedHighestAllowedRefreshRate = this->context->maxDisplayFreq;
// === FORMAT ALL DISPLAY STRINGS (once per second) ===

View File

@@ -38,7 +38,7 @@ class BaseMenuGui : public BaseGui
// u8 dockedHighestAllowedRefreshRate = 60;
SysClkContext* context;
std::uint64_t lastContextUpdate;
SysClkConfigValueList* configList;
SysClkConfigValueList configList;
bool g_hardwareModelCached = false;
bool g_isMariko = false;
bool g_isAula = false;

View File

@@ -269,6 +269,12 @@ void GlobalOverrideGui::addModuleToggleItem(SysClkModule module)
void GlobalOverrideGui::listUI()
{
Result rc = sysclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
return;
}
this->listElement->addItem(new tsl::elm::CategoryHeader(
"Temporary Overrides " + ult::DIVIDER_SYMBOL + " Reset"));
this->addModuleListItem(SysClkModule_CPU);
@@ -276,8 +282,8 @@ void GlobalOverrideGui::listUI()
this->addModuleListItem(SysClkModule_MEM);
#if IS_MINIMAL == 0
ValueThresholds lcdThresholds(60, 65);
if(!IsHoag())
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0, lcdThresholds);
if(!IsHoag() && configList.values[HorizonOCConfigValue_OverwriteRefreshRate])
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
#endif
this->addModuleToggleItem(HorizonOCModule_Governor);
}

View File

@@ -406,6 +406,15 @@ void MiscGui::listUI()
false
);
addConfigToggle(HorizonOCConfigValue_OverwriteRefreshRate, nullptr);
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
renderer->drawString("\uE150 Enabling unsafe display", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
renderer->drawString("refresh rates may cause stress", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
renderer->drawString("or damage to your display! ", false, x + 20, y + 70, 18, tsl::style::color::ColorText);
renderer->drawString("Proceed at your own risk!", false, x + 20, y + 90, 18, tsl::style::color::ColorText);
});
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 110);
this->listElement->addItem(warningText);
addConfigToggle(HorizonOCConfigValue_EnableUnsafeDisplayFreqs, nullptr);
} else {
std::vector<NamedValue> chargerCurrents = {
NamedValue("Disabled", 0),
@@ -675,7 +684,7 @@ protected:
renderer->drawString("\uE150 This feature is EXPERIMENTAL", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
renderer->drawString("and should only be used for testing!", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
});
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 150);
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 70);
this->listElement->addItem(warningText);
#endif
}
@@ -817,7 +826,10 @@ protected:
);
std::vector<NamedValue> maxClkOptions = {
// NamedValue("1963MHz", 1963000),
NamedValue("1963MHz", 1963000),
NamedValue("2091MHz", 2091000),
NamedValue("2193MHz", 2193000),
NamedValue("2295MHz", 2295000),
NamedValue("2397MHz", 2397000),
NamedValue("2499MHz", 2499000),
NamedValue("2601MHz", 2601000),
@@ -1139,10 +1151,10 @@ protected:
renderer->drawString("\uE150 Setting GPU Clocks past", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
renderer->drawString("1075MHz without UV, 1152MHz on SLT", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
renderer->drawString("or 1228MHz on HiOPT can cause ", false, x + 20, y + 70, 18, tsl::style::color::ColorText);
renderer->drawString("permanent damage to your Switch!", false, x + 20, y + 900, 18, tsl::style::color::ColorText);
renderer->drawString("permanent damage to your Switch!", false, x + 20, y + 90, 18, tsl::style::color::ColorText);
renderer->drawString("Proceed at your own risk!", false, x + 20, y + 110, 18, tsl::style::color::ColorText);
});
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 150);
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 130);
this->listElement->addItem(warningText);
addConfigButton(KipConfigValue_g_volt_76800, "76.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
@@ -1178,7 +1190,7 @@ protected:
renderer->drawString("permanent damage to your Switch!", false, x + 20, y + 90, 18, tsl::style::color::ColorText);
renderer->drawString("Proceed at your own risk!", false, x + 20, y + 110, 18, tsl::style::color::ColorText);
});
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 150);
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 130);
this->listElement->addItem(warningText);
addConfigButton(KipConfigValue_g_volt_e_76800, "76.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);