hoc-sys: change stuff

This commit is contained in:
souldbminersmwc
2025-11-09 16:07:13 -05:00
parent a76c2b33b6
commit e72f9d8e60
14 changed files with 406 additions and 397 deletions

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
@@ -23,13 +27,20 @@
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
#include "base_gui.h"
#include "../elements/base_frame.h"
#include "logo_rgba_bin.h"
#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
@@ -45,12 +56,9 @@ std::string getVersionString() {
void BaseGui::preDraw(tsl::gfx::Renderer* renderer)
{
// Draw "Horizon OC " in default color
renderer->drawString("Horizon OC ", false, LOGO_X, LOGO_Y, LOGO_LABEL_FONT_SIZE, renderer->a(TEXT_COLOR));
// Draw "Gaea" in green
tsl::Color greenColor(40, 204, 40, 255); // Light green
renderer->drawString("Gaea", false, LOGO_X + 225, LOGO_Y, LOGO_LABEL_FONT_SIZE, greenColor);
// renderer->drawBitmap(LOGO_X, LOGO_Y, LOGO_WIDTH, LOGO_HEIGHT, logo_rgba_bin);
renderer->drawString("Horizon OC 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

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,14 +1,7 @@
/*
* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
@@ -23,15 +16,26 @@
*
* 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 "base_menu_gui.h"
#include "fatal_gui.h"
/* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
// Cache hardware model to avoid repeated syscalls
BaseMenuGui::BaseMenuGui()
{
#include "base_menu_gui.h"
#include "fatal_gui.h"
// Cache hardware model to avoid repeated syscalls
BaseMenuGui::BaseMenuGui() : tempColors{tsl::Color(0), tsl::Color(0), tsl::Color(0)}
{
tsl::initializeThemeVars();
this->context = nullptr;
this->lastContextUpdate = 0;
@@ -45,20 +49,20 @@
// Initialize display strings
memset(displayStrings, 0, sizeof(displayStrings));
}
}
BaseMenuGui::~BaseMenuGui() {
BaseMenuGui::~BaseMenuGui() {
delete this->context; // delete handles nullptr automatically
}
}
// Fast preDraw - just renders pre-computed strings
void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
// Fast preDraw - just renders pre-computed strings
void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
BaseGui::preDraw(renderer);
if(!this->context) [[unlikely]] return;
// All constants pre-calculated and cached
static constexpr const char* const labels[] = {
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg", "CPU", "GPU", "PLL", "PMIC", "BAT"
static constexpr const char* const labels[10] = {
"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};
@@ -79,7 +83,7 @@
u32 y = 91;
// === TOP SECTION ===
// renderer->drawRoundedRect(14, 70-1, 420, 30+2, 10.0f, renderer->aWithOpacity(tsl::tableBGColor));
renderer->drawRoundedRect(14, 70-1, 420, 30+2, 10.0f, renderer->aWithOpacity(tsl::tableBGColor));
// App ID - use pre-formatted string
renderer->drawString(labels[0], false, positions[0], y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
@@ -89,10 +93,10 @@
renderer->drawString(labels[1], false, 423 - maxProfileValueWidth - labelWidths[1] - 9, y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
renderer->drawString(displayStrings[1], false, 423 - maxProfileValueWidth, y, SMALL_TEXT_SIZE, tsl::infoTextColor);
y = y + 38; // Direct assignment instead of += 38
y = 129; // Direct assignment instead of += 38
// === MAIN DATA SECTION ===
// renderer->drawRoundedRect(14, 106, 420, 116, 10.0f, renderer->aWithOpacity(tsl::tableBGColor));
renderer->drawRoundedRect(14, 106, 420, 116, 10.0f, renderer->aWithOpacity(tsl::tableBGColor));
// === FREQUENCY SECTION ===
// Labels first (better cache locality)
@@ -105,14 +109,14 @@
renderer->drawString(displayStrings[3], false, dataPositions[1], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // GPU
renderer->drawString(displayStrings[4], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // MEM
y = y + 20; // Direct assignment (129 + 20)
y = 149; // Direct assignment (129 + 20)
// === REAL FREQUENCIES ===
renderer->drawString(displayStrings[5], false, positions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // CPU real
renderer->drawString(displayStrings[6], false, positions[3], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // GPU real
renderer->drawString(displayStrings[7], false, positions[4], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // MEM real
renderer->drawString(displayStrings[5], false, dataPositions[0], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // CPU real
renderer->drawString(displayStrings[6], false, dataPositions[1], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // GPU real
renderer->drawString(displayStrings[7], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // MEM real
y = y + 20; // Direct assignment (149 + 20)
y = 169; // Direct assignment (149 + 20)
// === VOLTAGES ===
renderer->drawString(displayStrings[8], false, dataPositions[0], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // CPU voltage
@@ -127,14 +131,7 @@
renderer->drawString(displayStrings[10], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor);
}
// y = y + 20; // Direct assignment (169 + 22)
// renderer->drawString(displayStrings[17], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[3]); // CPU
// renderer->drawString(displayStrings[18], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[4]); // GPU
// renderer->drawString(displayStrings[19], false, dataPositions[2], y, SMALL_TEXT_SIZE, tempColors[5]); // PLL
y = y + 22; // Direct assignment (149 + 20)
y = 191; // Direct assignment (169 + 22)
// === TEMPERATURE SECTION ===
// Labels
@@ -147,7 +144,7 @@
renderer->drawString(displayStrings[12], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[1]); // PCB
renderer->drawString(displayStrings[13], false, dataPositions[2], y, SMALL_TEXT_SIZE, tempColors[2]); // Skin
y = y + 20; // Direct assignment (191 + 20)
y = 211; // Direct assignment (191 + 20)
// === SOC VOLTAGE & POWER ===
// SOC voltage (if available)
@@ -161,21 +158,11 @@
renderer->drawString(displayStrings[15], false, dataPositions[3], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Power now
renderer->drawString(displayStrings[16], false, dataPositions[4], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Power avg
}
y = y + 20; // Direct assignment (191 + 20)
renderer->drawString(displayStrings[20], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[4]); // BAT
renderer->drawString(displayStrings[21], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[5]); // PMIC
y = y + 20; // Direct assignment (191 + 20)
}
// Optimized refresh - now does all the string formatting once per second
void BaseMenuGui::refresh()
{
// Optimized refresh - now does all the string formatting once per second
void BaseMenuGui::refresh()
{
const u64 ticks = armGetSystemTick();
// Use cached comparison - 1 billion nanoseconds
if (armTicksToNs(ticks - this->lastContextUpdate) <= 1000000000UL) [[likely]] {
@@ -195,8 +182,8 @@
PcvPowerDomainId_Max77621_Cpu, // [0] CPU
PcvPowerDomainId_Max77621_Gpu, // [1] GPU
PcvPowerDomainId_Max77812_Dram, // [2] EMC/DRAM - Mariko only
PcvPowerDomainId_Max77620_Sd0, // [3] SOC
PcvPowerDomainId_Max77620_Sd1 // [4] VDD2
PcvPowerDomainId_Max77620_Sd0, // [3] SOC - EOS only
PcvPowerDomainId_Max77620_Sd1 // [4] VDD2 - EOS only
};
// Voltage array for direct indexing
@@ -258,7 +245,6 @@
// Current frequencies
u32 hz = context->freqs[0]; // CPU
sprintf(displayStrings[2], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
hz = context->freqs[1]; // GPU
@@ -293,35 +279,19 @@
sprintf(displayStrings[10], "%u mV", emcVoltageUv / 1000U);
}
u32 millis = context->temps[SysClkThermalSensor_SOC]; // SOC
// Temperatures and pre-compute colors
u32 millis = context->temps[0]; // SOC
sprintf(displayStrings[11], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
tempColors[0] = tsl::GradientColor(millis * 0.001f);
millis = context->temps[SysClkThermalSensor_PCB]; // PCB
millis = context->temps[1]; // PCB
sprintf(displayStrings[12], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
tempColors[1] = tsl::GradientColor(millis * 0.001f);
millis = context->temps[SysClkThermalSensor_Skin]; // Skin
millis = context->temps[2]; // Skin
sprintf(displayStrings[13], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
tempColors[2] = tsl::GradientColor(millis * 0.001f);
millis = context->temps[HocClkThermalSensor_Battery]; //
sprintf(displayStrings[20], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
tempColors[3] = tsl::GradientColor(millis * 0.001f);
millis = context->temps[HocClkThermalSensor_PMIC]; //
sprintf(displayStrings[21], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
tempColors[4] = tsl::GradientColor(millis * 0.001f);
// millis = context->temps[HocClkThermalSensor_GPU]; // Skin
// sprintf(displayStrings[18], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
// tempColors[4] = tsl::GradientColor(millis * 0.001f);
// millis = context->temps[HocClkThermalSensor_PLL]; // Skin
// sprintf(displayStrings[19], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
// tempColors[5] = tsl::GradientColor(millis * 0.001f);
// SOC voltage (if available)
if (socVoltageUv) {
sprintf(displayStrings[14], "%u mV", socVoltageUv / 1000U);
@@ -330,15 +300,13 @@
// Power
sprintf(displayStrings[15], "%d mW", context->power[0]); // Now
sprintf(displayStrings[16], "%d mW", context->power[1]); // Avg
}
}
tsl::elm::Element* BaseMenuGui::baseUI()
{
tsl::elm::Element* BaseMenuGui::baseUI()
{
auto* list = new tsl::elm::List();
this->listElement = list;
this->listUI();
return list;
}
}

View File

@@ -1,14 +1,7 @@
/*
* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
@@ -23,17 +16,27 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../rgltr_services.h"
#include "../../ipc.h"
#include "base_gui.h"
/* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
class BaseMenuGui : public BaseGui
{
#pragma once
#include "../../rgltr_services.h"
#include "../../ipc.h"
#include "base_gui.h"
class BaseMenuGui : public BaseGui
{
protected:
SysClkContext* context;
std::uint64_t lastContextUpdate;
@@ -44,10 +47,8 @@
std::uint32_t vddVoltageUv;//add vdd2 voltage
public:
uint64_t systemtickfrequency = 19200000;
bool g_hardwareModelCached = false;
bool g_isMariko = false;
bool g_isAula = false;
bool IsMariko() {
if (!g_hardwareModelCached) {
@@ -62,15 +63,6 @@
return g_isMariko;
}
bool IsAula() {
if (!g_hardwareModelCached) {
SetSysProductModel model = SetSysProductModel_Invalid;
setsysGetProductModel(&model);
g_isMariko = (model == SetSysProductModel_Aula);
}
return g_isAula;
}
bool IsErista() {
return !IsMariko();
}
@@ -83,9 +75,6 @@
virtual void listUI() = 0;
private:
char displayStrings[32][32]; // Pre-formatted display strings
tsl::Color tempColors[6] = {
tsl::Color(0), tsl::Color(0), tsl::Color(0),
tsl::Color(0), tsl::Color(0), tsl::Color(0)
};
};
char displayStrings[17][32]; // Pre-formatted display strings
tsl::Color tempColors[3]; // Pre-computed temperature colors
};

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it

View File

@@ -1,4 +1,8 @@
/*
* Copyright (C) Switch-OC-Suite
*
* Copyright (c) 2023 hanai3Bi
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it