Files
Horizon-OC/Source/hoc-clk/overlay/src/ui/gui/about_gui.cpp
souldbminersmwc 037f011c9b hocclk: peak emc bw and mem display unit option
also correct bw reading to keep it accurate
2026-04-11 20:56:35 -04:00

386 lines
10 KiB
C++

/*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "about_gui.h"
#include "../format.h"
#include <tesla.hpp>
#include <string>
#include "cat.h"
#include "ult_ext.h"
tsl::elm::ListItem* SpeedoItem = NULL;
tsl::elm::ListItem* IddqItem = NULL;
tsl::elm::ListItem* DramModule = NULL;
tsl::elm::ListItem* sysdockStatusItem = NULL;
tsl::elm::ListItem* saltyNXStatusItem = NULL;
tsl::elm::ListItem* RETROStatusItem = NULL;
tsl::elm::ListItem* waferCordsItem = NULL;
tsl::elm::ListItem* ramVoltItem = NULL;
tsl::elm::ListItem* eristaPLLXItem = NULL;
tsl::elm::ListItem* dispVoltItem = NULL;
tsl::elm::ListItem* ramBWItemAll = NULL;
tsl::elm::ListItem* ramBWItemCpu = NULL;
tsl::elm::ListItem* ramBWItemGpu = NULL;
tsl::elm::ListItem* ramBWItemMax = NULL;
ImageElement* CatImage = NULL;
HideableCategoryHeader* CatHeader = NULL;
HideableCustomDrawer* CatSpacer = NULL;
int lightosClickCount = 0;
AboutGui::AboutGui()
{
memset(strings, 0, sizeof(strings));
}
AboutGui::~AboutGui()
{
}
void AboutGui::listUI()
{
this->listElement->addItem(
new tsl::elm::CategoryHeader("Voltages and Temps")
);
ramVoltItem =
new tsl::elm::ListItem("RAM Voltage:");
if(IsMariko()) {
this->listElement->addItem(ramVoltItem);
}
dispVoltItem =
new tsl::elm::ListItem("Display Voltage:");
this->listElement->addItem(dispVoltItem);
eristaPLLXItem =
new tsl::elm::ListItem("PLLX Temp:");
if(IsErista()) {
this->listElement->addItem(eristaPLLXItem);
}
this->listElement->addItem(
new tsl::elm::CategoryHeader("RAM Bandwidth")
);
ramBWItemMax =
new tsl::elm::ListItem("RAM BW (Peak):");
this->listElement->addItem(ramBWItemMax);
ramBWItemAll =
new tsl::elm::ListItem("RAM BW (All):");
this->listElement->addItem(ramBWItemAll);
ramBWItemCpu =
new tsl::elm::ListItem("RAM BW (CPU):");
this->listElement->addItem(ramBWItemCpu);
ramBWItemGpu =
new tsl::elm::ListItem("RAM BW (GPU):");
this->listElement->addItem(ramBWItemGpu);
this->listElement->addItem(
new tsl::elm::CategoryHeader("HW Info")
);
SpeedoItem =
new tsl::elm::ListItem("Speedo:");
this->listElement->addItem(SpeedoItem);
IddqItem =
new tsl::elm::ListItem("IDDQ:");
this->listElement->addItem(IddqItem);
DramModule =
new tsl::elm::ListItem("Module: ");
this->listElement->addItem(DramModule);
waferCordsItem =
new tsl::elm::ListItem("Wafer Position:");
this->listElement->addItem(waferCordsItem);
if(IsHoag()) {
RETROStatusItem =
new tsl::elm::ListItem("RR Display status:");
this->listElement->addItem(RETROStatusItem);
}
this->listElement->addItem(
new tsl::elm::CategoryHeader("Software Info")
);
if(!IsHoag()) {
sysdockStatusItem =
new tsl::elm::ListItem("sys-dock status:");
this->listElement->addItem(sysdockStatusItem);
}
saltyNXStatusItem =
new tsl::elm::ListItem("SaltyNX status:");
this->listElement->addItem(saltyNXStatusItem);
this->listElement->addItem(
new tsl::elm::CategoryHeader("Credits")
);
this->listElement->addItem(
new tsl::elm::CategoryHeader("Developers")
);
this->listElement->addItem(
new tsl::elm::ListItem("Souldbminer")
);
// Create special clickable item for Lightos
auto lightosItem = new tsl::elm::ListItem("Lightos_");
lightosItem->setClickListener([this](u64 keys) -> bool {
if (keys & HidNpadButton_A) {
lightosClickCount++;
if (lightosClickCount >= 10) {
if (CatImage != NULL) CatImage->setVisible(true);
if (CatHeader != NULL) CatHeader->setVisible(true);
if (CatSpacer != NULL) CatSpacer->setVisible(true);
}
return true;
}
return false;
});
this->listElement->addItem(lightosItem);
// ---- Contributors ----
this->listElement->addItem(
new tsl::elm::CategoryHeader("Contributors")
);
this->listElement->addItem(
new tsl::elm::ListItem("Dom")
);
this->listElement->addItem(
new tsl::elm::ListItem("Blaise25")
);
// ---- Testers ----
this->listElement->addItem(
new tsl::elm::CategoryHeader("Testers")
);
this->listElement->addItem(
new tsl::elm::ListItem("Dom")
);
this->listElement->addItem(
new tsl::elm::ListItem("Samybigio2011")
);
this->listElement->addItem(
new tsl::elm::ListItem("Delta")
);
this->listElement->addItem(
new tsl::elm::ListItem("Miki1305")
);
this->listElement->addItem(
new tsl::elm::ListItem("Happy")
);
this->listElement->addItem(
new tsl::elm::ListItem("Flopsider")
);
this->listElement->addItem(
new tsl::elm::ListItem("Winnerboi77")
);
this->listElement->addItem(
new tsl::elm::ListItem("Blaise25")
);
this->listElement->addItem(
new tsl::elm::ListItem("WE1ZARD")
);
this->listElement->addItem(
new tsl::elm::ListItem("Alvise")
);
this->listElement->addItem(
new tsl::elm::ListItem("TDRR")
);
this->listElement->addItem(
new tsl::elm::ListItem("agjeococh")
);
this->listElement->addItem(
new tsl::elm::ListItem("Xenshen")
);
this->listElement->addItem(
new tsl::elm::ListItem("Frost")
);
// ---- Special Thanks ----
this->listElement->addItem(
new tsl::elm::CategoryHeader("Special Thanks")
);
this->listElement->addItem(
new tsl::elm::ListItem("ScriesM - Atmosphere CFW")
);
this->listElement->addItem(
new tsl::elm::ListItem("KazushiMe - Switch OC Suite")
);
this->listElement->addItem(
new tsl::elm::ListItem("hanai3bi - Switch OC Suite & EOS")
);
this->listElement->addItem(
new tsl::elm::ListItem("NaGaa95 - L4T-OC-Kernel")
);
this->listElement->addItem(
new tsl::elm::ListItem("B3711 - EOS")
);
this->listElement->addItem(
new tsl::elm::ListItem("RetroNX - sys-clk")
);
this->listElement->addItem(
new tsl::elm::ListItem("b0rd2death - Ultrahand")
);
this->listElement->addItem(
new tsl::elm::ListItem("MasaGratoR - Status Monitor")
);
// Create cat elements but hide them initially
CatHeader = new HideableCategoryHeader("Cat");
CatHeader->setVisible(false);
this->listElement->addItem(CatHeader);
CatImage = new ImageElement(CAT_DATA, CAT_WIDTH, CAT_HEIGHT);
CatImage->setVisible(false);
this->listElement->addItem(CatImage);
CatSpacer = new HideableCustomDrawer(75);
CatSpacer->setVisible(false);
this->listElement->addItem(CatSpacer);
}
std::string AboutGui::formatRamModule() {
switch (this->context->dramID) {
case 0: return "HB-MGCH 4GB";
case 4: return "HM-MGCH 6GB";
case 7: return "HM-MGXX 8GB";
case 1: return "NLE 4GB";
case 2: return "WT:C 4GB";
case 3:
case 5 ... 6: return "NEE 4GB";
case 8:
case 12: return "AM-MGCJ 4GB";
case 9:
case 13: return "AM-MGCJ 8GB";
case 10:
case 14: return "NME 4GB";
case 11:
case 15: return "WT:E 4GB";
case 17:
case 19:
case 24: return "AA-MGCL 4GB";
case 18:
case 23:
case 28: return "AA-MGCL 8GB";
case 20 ... 22: return "AB-MGCL 4GB";
case 25 ... 27: return "WT:F 4GB";
case 29 ... 31: return "x267 4GB";
case 32 ... 34: return "WT:B 4GB";
default: return "Unknown";
}
}
void AboutGui::update()
{
BaseMenuGui::update();
}
void AboutGui::refresh()
{
BaseMenuGui::refresh();
if (!this->context)
return;
// Format strings once per refresh
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HocClkSpeedo_CPU], this->context->speedos[HocClkSpeedo_GPU], this->context->speedos[HocClkSpeedo_SOC]);
// This is how hekate does it
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HocClkSpeedo_CPU], this->context->iddq[HocClkSpeedo_GPU], this->context->iddq[HocClkSpeedo_SOC]);
SpeedoItem->setValue(strings[0]);
IddqItem->setValue(strings[1]);
DramModule->setValue(formatRamModule());
if(!IsHoag())
sysdockStatusItem->setValue(this->context->isSysDockInstalled ? "Installed" : "Not Installed");
saltyNXStatusItem->setValue(this->context->isSaltyNXInstalled ? "Installed" : "Not Installed");
if(IsHoag())
RETROStatusItem->setValue(this->context->isUsingRetroSuper ? "Installed" : "Not Installed");
sprintf(strings[2], "X: %u Y: %u", this->context->waferX, this->context->waferY);
waferCordsItem->setValue(strings[2]);
if(IsErista()) {
u32 millis = context->temps[HocClkThermalSensor_PLLX];
sprintf(strings[3], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
eristaPLLXItem->setValue(strings[3]);
}
sprintf(strings[4], "%u.%u / %u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U, context->voltages[HocClkVoltage_EMCVDDQ] / 1000);
ramVoltItem->setValue(strings[4]);
sprintf(strings[5], "%u.%u mV", context->voltages[HocClkVoltage_Display] / 1000U, (context->voltages[HocClkVoltage_Display] % 1000U) / 100U);
dispVoltItem->setValue(strings[5]);
sprintf(strings[6], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWAll]);
ramBWItemAll->setValue(strings[6]);
sprintf(strings[7], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWCpu]);
ramBWItemCpu->setValue(strings[7]);
sprintf(strings[8], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWGpu]);
ramBWItemGpu->setValue(strings[8]);
sprintf(strings[9], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWPeak]);
ramBWItemMax->setValue(strings[9]);
}