sysclk: fix display rate bug on lite

This commit is contained in:
souldbminersmwc
2026-01-03 21:10:18 -05:00
parent fca0c3ae15
commit c892b08097
10 changed files with 74 additions and 39 deletions

View File

@@ -446,8 +446,8 @@ volatile CustomizeTable C = {
{ 998400, { }, { 1065665,-16075, -497,-179, 3213, 9 } },
{ 1075200, { }, { 1132576,-16093, -648, 0, 1077, 40 } },
{ 1152000, { }, { 1180029,-14534, -830, 0, 1469, 110 } },
{ 1228800, { }, { 1248293,-16383, -859, 0, 3722, 313 } },
{ 1267200, { }, { 1286399,-17475, -867, 0, 3681, 559 } },
// { 1228800, { }, { 1248293,-16383, -859, 0, 3722, 313 } },
// { 1267200, { }, { 1286399,-17475, -867, 0, 3681, 559 } },
},
.marikoGpuDvfsTableSLT = {
@@ -467,7 +467,7 @@ volatile CustomizeTable C = {
{ 1075200, { }, { 1132576, -16093, -648, 0, 1077, 40 } },
{ 1152000, { }, { 1180029, -14534, -830, 0, 1469, 110 } },
{ 1228800, { }, { 1238293, -16383, -859, 0, 3722, 313 } },
{ 1267200, { }, { 1276399, -17475, -867, 0, 3681, 559 } },
// { 1267200, { }, { 1276399, -17475, -867, 0, 3681, 559 } },
},
.marikoGpuDvfsTableHiOPT = {

View File

@@ -1,4 +1,3 @@
// display_refresh_rate.h
#ifndef DISPLAY_REFRESH_RATE_H
#define DISPLAY_REFRESH_RATE_H
@@ -109,9 +108,6 @@ typedef struct {
bool displaySyncDockedOutOfFocus60;
} DisplayRefreshConfig;
// Callback types for hardware access (compatible with libnx Result types)
// Public API functions
bool DisplayRefresh_Initialize(const DisplayRefreshConfig* config);
bool DisplayRefresh_SetRate(uint32_t new_refreshRate);
bool DisplayRefresh_GetRate(uint32_t* out_refreshRate, bool internal);

View File

@@ -1,4 +1,3 @@
// display_refresh_rate.c
#include "display_refresh_rate.h"
#include <string.h>
#include <math.h>
@@ -111,7 +110,6 @@ static void _changeOledElvssSettings(const uint32_t* offsets, const uint32_t* va
svcSleepThread(20000000);
}
// Public API Implementation
bool DisplayRefresh_Initialize(const DisplayRefreshConfig* config) {
if (!config) return false;
@@ -571,7 +569,7 @@ bool DisplayRefresh_SetRate(uint32_t new_refreshRate) {
uint32_t fd = 0;
if (g_config.isLite && g_config.isPossiblySpoofedRetro) {
g_config.isRetroSUPER = false; // Would check flag file here in original
g_config.isRetroSUPER = false; // Would check flag file here in original, but i dont care lol
}
if (g_config.isRetroSUPER && !g_config.isDocked) {

View File

@@ -271,10 +271,12 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
this->addModuleListItem(profile, SysClkModule_CPU);
this->addModuleListItem(profile, SysClkModule_GPU);
this->addModuleListItem(profile, SysClkModule_MEM);
if(profile != SysClkProfile_Docked)
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
else
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 120, 5, " Hz", 1, 0);
if(!IsHoag()) {
if(profile != SysClkProfile_Docked)
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
else
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 120, 5, " Hz", 1, 0);
}
this->addModuleListItemToggle(profile, HorizonOCModule_Governor);
}

View File

@@ -39,7 +39,9 @@ BaseMenuGui::BaseMenuGui() : tempColors{ tsl::Color(0), tsl::Color(0), tsl::Colo
// Pre-cache hardware model during initialization
IsAula();
IsMariko();
IsHoag();
// Initialize display strings
memset(displayStrings, 0, sizeof(displayStrings));

View File

@@ -41,17 +41,39 @@ class BaseMenuGui : public BaseGui
SysClkConfigValueList* configList;
bool g_hardwareModelCached = false;
bool g_isMariko = false;
bool IsMariko() {
bool g_isAula = false;
bool g_isHoag = false;
SetSysProductModel HWmodel;
bool IsAula() {
if (!g_hardwareModelCached) {
SetSysProductModel model = SetSysProductModel_Invalid;
setsysGetProductModel(&model);
g_isMariko = (model == SetSysProductModel_Iowa ||
model == SetSysProductModel_Hoag ||
model == SetSysProductModel_Calcio ||
model == SetSysProductModel_Aula);
SetSysProductModel HWmodel = SetSysProductModel_Invalid;
setsysGetProductModel(&HWmodel);
g_hardwareModelCached = true;
}
g_isAula = (HWmodel == SetSysProductModel_Aula);
return g_isAula;
}
bool IsHoag() {
if (!g_hardwareModelCached) {
SetSysProductModel HWmodel = SetSysProductModel_Invalid;
setsysGetProductModel(&HWmodel);
g_hardwareModelCached = true;
}
g_isHoag = (HWmodel == SetSysProductModel_Hoag);
return g_isHoag;
}
bool IsMariko() {
if (!g_hardwareModelCached) {
SetSysProductModel HWmodel = SetSysProductModel_Invalid;
setsysGetProductModel(&HWmodel);
g_hardwareModelCached = true;
}
g_isMariko = (HWmodel == SetSysProductModel_Iowa ||
HWmodel == SetSysProductModel_Hoag ||
HWmodel == SetSysProductModel_Calcio ||
HWmodel == SetSysProductModel_Aula);
return g_isMariko;
}

View File

@@ -255,7 +255,8 @@ void GlobalOverrideGui::listUI()
this->addModuleListItem(SysClkModule_CPU);
this->addModuleListItem(SysClkModule_GPU);
this->addModuleListItem(SysClkModule_MEM);
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
if(!IsHoag())
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, 72, 1, " Hz", 1, 0);
this->addModuleToggleItem(HorizonOCModule_Governor);
}

View File

@@ -24,6 +24,7 @@
* --------------------------------------------------------------------------
*/
// Note: Hoag crashes on display refresh rate init while in sleep mode
#include <nxExt.h>
#include "board.h"
@@ -254,16 +255,17 @@ void Board::Initialize()
if (hosversionAtLeast(6,0,0) && R_SUCCEEDED(pwmInitialize())) {
pwmCheck = pwmOpenSession2(&g_ICon, 0x3D000001);
}
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
u64 clkVirtAddr, dsiVirtAddr, outsize;
rc = svcQueryMemoryMapping(&clkVirtAddr, &outsize, 0x60006000, 0x1000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (clk)");
rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (dsi)");
u64 clkVirtAddr, dsiVirtAddr, outsize;
rc = svcQueryMemoryMapping(&clkVirtAddr, &outsize, 0x60006000, 0x1000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (clk)");
rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (dsi)");
DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr};
DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr};
DisplayRefresh_Initialize(&cfg);
DisplayRefresh_Initialize(&cfg);
}
FetchHardwareInfos();
}
@@ -366,6 +368,8 @@ void Board::Exit()
rgltrExit();
batteryInfoExit();
pmdmntExit();
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
DisplayRefresh_Shutdown();
}
SysClkProfile Board::GetProfile()
@@ -400,7 +404,7 @@ void Board::SetHz(SysClkModule module, std::uint32_t hz)
{
Result rc = 0;
if(module == HorizonOCModule_Display) {
if(module == HorizonOCModule_Display && Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
DisplayRefresh_SetRate(hz);
return;
}
@@ -430,7 +434,10 @@ std::uint32_t Board::GetHz(SysClkModule module)
std::uint32_t hz = 0;
if(module == HorizonOCModule_Display) {
DisplayRefresh_GetRate(&hz, false);
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
DisplayRefresh_GetRate(&hz, false);
else
hz = 60;
return hz;
}
@@ -467,7 +474,10 @@ std::uint32_t Board::GetRealHz(SysClkModule module)
case SysClkModule_MEM:
return t210ClkMemFreq();
case HorizonOCModule_Display:
DisplayRefresh_GetRate(&hz, false);
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
DisplayRefresh_GetRate(&hz, false);
else
hz = 60;
return hz;
default:
ASSERT_ENUM_VALID(SysClkModule, module);
@@ -662,11 +672,15 @@ void Board::ResetToStockGpu()
}
void Board::ResetToStockDisplay() {
DisplayRefresh_SetRate(60);
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
DisplayRefresh_SetRate(60);
}
u8 Board::GetHighestDockedDisplayRate() {
return DisplayRefresh_GetDockedHighestAllowed();
if(Board::GetConsoleType() != HorizonOCConsoleType_Lite)
return DisplayRefresh_GetDockedHighestAllowed();
else
return 60;
}
std::uint32_t Board::GetTemperatureMilli(SysClkThermalSensor sensor)

View File

@@ -484,7 +484,7 @@ void ClockManager::Tick()
isGovernorEnabled = newGovernorState;
}
if(module == HorizonOCModule_Display && this->config->GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate)) {
if(module == HorizonOCModule_Display && this->config->GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate) && Board::GetConsoleType() != HorizonOCConsoleType_Lite) {
if(targetHz)
Board::SetHz(HorizonOCModule_Display, targetHz);
else
@@ -670,7 +670,7 @@ bool ClockManager::RefreshContext()
FileUtils::WriteContextToCsv(this->context);
}
if(this->context->profile == SysClkProfile_Docked)
if(this->context->profile == SysClkProfile_Docked && !Board::GetConsoleType() == HorizonOCConsoleType_Lite)
this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
else
this->context->maxDisplayFreq = 60;

2
dist/README.md vendored
View File

@@ -57,7 +57,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
```
kip1=atmosphere/kips/hoc.kip
secmon=secmon_patch_ams_x_xx_x.bin
secmon=exosphere.bin
```
*(No changes needed if using fusee.)*