re-add sys-clk manager, default to mtc auto adj (others are useless), new gpu table for erista units, custom sys-clk updates
This commit is contained in:
souldbminersmwc
2025-09-18 22:20:44 -04:00
parent f3eae72b47
commit 342f9dd116
203 changed files with 55075 additions and 189 deletions

View File

@@ -14,17 +14,14 @@
#include "logo_rgba_bin.h"
#define LOGO_WIDTH 110
#define LOGO_HEIGHT 39
#define LOGO_X 18
#define LOGO_Y 21
#define LOGO_LABEL_X (LOGO_X + LOGO_WIDTH + 6)
#define LOGO_LABEL_Y 50
#define LOGO_LABEL_FONT_SIZE 28
#define VERSION_X (LOGO_LABEL_X + 110+8)
#define VERSION_Y LOGO_LABEL_Y-4
#define LOGO_X 20
#define LOGO_Y 45
#define LOGO_LABEL_FONT_SIZE 35
#define VERSION_X (LOGO_X + 250)
#define VERSION_Y LOGO_Y-40
#define VERSION_FONT_SIZE 15
std::string getVersionString() {
@@ -38,9 +35,9 @@ std::string getVersionString() {
void BaseGui::preDraw(tsl::gfx::Renderer* renderer)
{
renderer->drawBitmap(LOGO_X, LOGO_Y, LOGO_WIDTH, LOGO_HEIGHT, logo_rgba_bin);
renderer->drawString("overlay", false, LOGO_LABEL_X, LOGO_LABEL_Y, LOGO_LABEL_FONT_SIZE, renderer->a(TEXT_COLOR));
renderer->drawString(TARGET_VERSION, false, VERSION_X, VERSION_Y, VERSION_FONT_SIZE, tsl::bannerVersionTextColor);
// renderer->drawBitmap(LOGO_X, LOGO_Y, LOGO_WIDTH, LOGO_HEIGHT, logo_rgba_bin);
renderer->drawString("sys-clk-ocs2 overlay", false, LOGO_X, LOGO_Y, LOGO_LABEL_FONT_SIZE, renderer->a(TEXT_COLOR));
// renderer->drawString(TARGET_VERSION, false, VERSION_X, VERSION_Y, VERSION_FONT_SIZE, tsl::bannerVersionTextColor);
}
tsl::elm::Element* BaseGui::createUI()

View File

@@ -41,7 +41,7 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
// All constants pre-calculated and cached
static constexpr const char* const labels[10] = {
"App ID", "Profile", "CPU", "GPU", "MEM", "SOC", "PCB", "Skin", "Now", "Avg"
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg"
};
static constexpr u32 dataPositions[6] = {63-3+3, 200-1, 344-1-3, 200-1, 342-1, 321-1};
@@ -57,7 +57,7 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
}
static u32 positions[10] = {24-1, 310-labelWidths[1], 24-1, 192-labelWidths[3], 332-labelWidths[4], 24-1, 192 - labelWidths[6], 332-labelWidths[7], 192 - labelWidths[8], 332-labelWidths[9]};
static u32 maxProfileValueWidth = renderer->getTextDimensions("Official Charger", false, SMALL_TEXT_SIZE).first; // longest word
static u32 maxProfileValueWidth = renderer->getTextDimensions("PD Charger", false, SMALL_TEXT_SIZE).first; // longest word
u32 y = 91;
@@ -243,9 +243,9 @@ void BaseMenuGui::refresh()
sprintf(displayStrings[7], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
// Voltages
sprintf(displayStrings[8], "%u mV", cpuVoltageUv / 1000U);
sprintf(displayStrings[9], "%u mV", gpuVoltageUv / 1000U);
sprintf(displayStrings[8], "%.1f mV", cpuVoltageUv / 1000.0);
sprintf(displayStrings[9], "%.1f mV", gpuVoltageUv / 1000.0);
// Memory voltage (handle VDD case)
if (emcVoltageUv && vddVoltageUv) {
//sprintf(displayStrings[10], "%u%u mV", vddVoltageUv / 1000U, emcVoltageUv / 1000U);

View File

@@ -23,7 +23,7 @@ void FatalGui::openWithResultCode(std::string tag, Result rc)
info.append(rcStr, snprintf(rcStr, sizeof(rcStr), "\n\n[0x%x] %04d-%04d", rc, R_MODULE(rc), R_DESCRIPTION(rc)));
tsl::changeTo<FatalGui>(
"Could not connect to sys-clk.\n\n"
"Could not connect to sys-clk-ocs2 sysmodule.\n\n"
"\n"
"Please make sure everything is\n\n"
"correctly installed and enabled.",

View File

@@ -8,60 +8,124 @@
* --------------------------------------------------------------------------
*/
#include "freq_choice_gui.h"
#include "freq_choice_gui.h"
#include "../format.h"
#include "fatal_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)
{
this->selectedHz = selectedHz;
this->hzList = hzList;
this->hzCount = hzCount;
this->module = module; // Add this
this->listener = listener;
}
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()
{
// 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 (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 = 1153;
danger_cpu = 2398;
danger_gpu = 1306;
}
else
{
unsafe_cpu = 1786;
unsafe_gpu = 922;
danger_cpu = 2092;
danger_gpu = 999;
}
FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t* hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener)
{
this->selectedHz = selectedHz;
this->hzList = hzList;
this->hzCount = hzCount;
this->module = module; // Add this
this->listener = listener;
}
tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool selected)
{
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(formatListFreqHz(hz), "", true);
listItem->setValue(selected ? "\uE14B" : "");
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()
{
// Add CategoryHeader based on module
std::string moduleName = sysclkFormatModule(this->module, true);
this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName));
this->listElement->addItem(this->createFreqListItem(0, this->selectedHz == 0));
std::uint32_t hz;
for(std::uint32_t i = 0; i < this->hzCount; i++) {
hz = this->hzList[i];
// Skip 204 MHz exactly
if(moduleName == "Memory" && hz == 204000000) {
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));
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));
continue;
}
} else if (moduleName == "mem") {
this->listElement->addItem(this->createFreqListItem(hz, mhz == this->selectedHz / 1000000, 0));
continue;
}
// if(moduleName == "GPU") {
// if(BaseGui::isMariko() && is)
// continue;
// }
this->listElement->addItem(this->createFreqListItem(hz, (hz / 1000000) == (this->selectedHz / 1000000)));
}
this->listElement->jumpToItem("", "");
}
}
}
this->listElement->jumpToItem("", "");
}

View File

@@ -26,7 +26,7 @@ class FreqChoiceGui : public BaseMenuGui
std::uint32_t hzCount;
SysClkModule module; // Added
FreqChoiceListener listener;
tsl::elm::ListItem* createFreqListItem(std::uint32_t hz, bool selected);
tsl::elm::ListItem* createFreqListItem(std::uint32_t hz, bool selected, int safety);
public:
FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t* hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener);

View File

@@ -28,7 +28,7 @@ void MainGui::listUI()
this->lastContextUpdate = armGetSystemTick();
this->context->enabled = state;
});
this->listElement->addItem(this->enabledToggle);
// this->listElement->addItem(this->enabledToggle);
tsl::elm::ListItem* appProfileItem = new tsl::elm::ListItem("Edit App Profile");
appProfileItem->setClickListener([this](u64 keys) {

View File

@@ -179,8 +179,6 @@ int MiscGui::getConfigIntValue(const std::string& iniKey, int defaultValue)
return defaultValue;
}
SysClkIpcToggleUncappedClocks(SysClkModule_CPU, g_freq_table_hz[SysClkModule_CPU][result])
void MiscGui::setConfigValue(const std::string& iniKey, bool value)
{
if(iniKey == "uncapped_clocks") {