diff --git a/Source/sys-clk/common/include/sysclk/clock_manager.h b/Source/sys-clk/common/include/sysclk/clock_manager.h index bbbf4c2d..eec46155 100644 --- a/Source/sys-clk/common/include/sysclk/clock_manager.h +++ b/Source/sys-clk/common/include/sysclk/clock_manager.h @@ -32,7 +32,6 @@ typedef struct { - uint8_t enabled; uint64_t applicationId; SysClkProfile profile; uint32_t freqs[SysClkModule_EnumMax]; diff --git a/Source/sys-clk/overlay/src/main.cpp b/Source/sys-clk/overlay/src/main.cpp index 8e65ec4c..29e150e7 100644 --- a/Source/sys-clk/overlay/src/main.cpp +++ b/Source/sys-clk/overlay/src/main.cpp @@ -27,9 +27,6 @@ #define TESLA_INIT_IMPL #include -#ifdef IS_MINIMAL -#warning "Minimal compilation" -#endif #include "ui/gui/fatal_gui.h" #include "ui/gui/main_gui.h" #include "rgltr_services.h" // for extern Service g_rgltrSrv, etc. diff --git a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp index ccc08a61..43ea72ee 100644 --- a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp @@ -24,8 +24,8 @@ #include #include #include -#if IS_MINIMAL == 0 -#pragma message("Compiling with full features") +#if IS_MINIMAL == 1 +#pragma message("Compiling with minimal features") #endif class RamSubmenuGui; class RamTimingsSubmenuGui; diff --git a/Source/sys-clk/sysmodule/src/clock_manager.cpp b/Source/sys-clk/sysmodule/src/clock_manager.cpp index 34308c03..18925452 100644 --- a/Source/sys-clk/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk/sysmodule/src/clock_manager.cpp @@ -76,7 +76,6 @@ ClockManager::ClockManager() this->context = new SysClkContext; this->context->applicationId = 0; this->context->profile = SysClkProfile_Handheld; - this->context->enabled = false; for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { this->context->freqs[module] = 0; @@ -133,7 +132,7 @@ void ClockManager::FixCpuBug() { maxHz = this->GetMaxAllowedHz(SysClkModule_CPU, this->context->profile); nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz); - if (nearestHz != this->context->freqs[SysClkModule_CPU] && this->context->enabled) { + if (nearestHz != this->context->freqs[SysClkModule_CPU]) { Board::SetHz(SysClkModule_CPU, nearestHz); this->context->freqs[SysClkModule_CPU] = nearestHz; @@ -487,7 +486,6 @@ void ClockManager::Tick() lastGovernorState = newGovernorState; hasChanged = true; - this->context->enabled = this->GetConfig()->Enabled(); Board::ResetToStock(); } isGovernorEnabled = newGovernorState; @@ -498,8 +496,12 @@ void ClockManager::Tick() Board::SetHz(HorizonOCModule_Display, targetHz); else Board::ResetToStockDisplay(); + } + if(targetHz && this->context->realFreqs[HorizonOCModule_Display] != targetHz && module == HorizonOCModule_Display) + this->context->realFreqs[HorizonOCModule_Display] = targetHz; + // Skip GPU if governor handles it if(module > SysClkModule_MEM) { continue; @@ -517,7 +519,7 @@ void ClockManager::Tick() maxHz = this->GetMaxAllowedHz((SysClkModule)module, this->context->profile); nearestHz = this->GetNearestHz((SysClkModule)module, targetHz, maxHz); - if (nearestHz != this->context->freqs[module] && this->context->enabled) { + if (nearestHz != this->context->freqs[module]) { FileUtils::LogLine( "[mgr] %s clock set : %u.%u MHz (target = %u.%u MHz)", Board::GetModuleName((SysClkModule)module, true), @@ -550,14 +552,6 @@ bool ClockManager::RefreshContext() { bool hasChanged = false; - bool enabled = this->GetConfig()->Enabled(); - if (enabled != this->context->enabled) - { - this->context->enabled = enabled; - FileUtils::LogLine("[mgr] " TARGET " status: %s", enabled ? "enabled" : "disabled"); - hasChanged = true; - } - std::uint64_t applicationId = ProcessManagement::GetCurrentApplicationId(); if (applicationId != this->context->applicationId) { @@ -684,6 +678,18 @@ bool ClockManager::RefreshContext() else this->context->maxDisplayFreq = 60; + u32 targetHz = this->context->overrideFreqs[HorizonOCModule_Display]; + if (!targetHz) + { + targetHz = this->config->GetAutoClockHz(this->context->applicationId, HorizonOCModule_Display, this->context->profile, true); + if(!targetHz) + targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Display, this->context->profile, true); + } + + if(targetHz && this->context->realFreqs[HorizonOCModule_Display] != targetHz) + this->context->realFreqs[HorizonOCModule_Display] = targetHz; // clean up display real freqs, should probably be moved to the real freqs loop? + + return hasChanged; }