hoc-monitor: fully fix hoc monitor
This commit is contained in:
@@ -18,13 +18,14 @@
|
||||
#include "rgltr_services.h" // for extern Service g_rgltrSrv, etc.
|
||||
|
||||
|
||||
#include "../../sys-clk/common/include/sysclk/client/ipc.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sysclk/client/ipc.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
@@ -221,10 +222,11 @@ uint64_t lastFrameNumber = 0;
|
||||
uint32_t realCPU_Hz = 0;
|
||||
uint32_t realGPU_Hz = 0;
|
||||
uint32_t realRAM_Hz = 0;
|
||||
uint32_t ramLoad[SysClkPartLoad_EnumMax];
|
||||
uint32_t PartLoad[SysClkPartLoad_EnumMax];
|
||||
uint32_t realCPU_mV = 0;
|
||||
uint32_t realGPU_mV = 0;
|
||||
uint32_t realRAM_mV = 0;
|
||||
uint32_t realVDD2_mV = 0;
|
||||
uint32_t realVDDQ_mV = 0;
|
||||
uint32_t realSOC_mV = 0;
|
||||
uint8_t refreshRate = 0;
|
||||
|
||||
@@ -515,9 +517,11 @@ std::string getVersionString() {
|
||||
|
||||
|
||||
bool usingEOS() {
|
||||
return true;
|
||||
const std::string versionString = getVersionString();
|
||||
return versionString.find("eos") != std::string::npos;
|
||||
}
|
||||
|
||||
|
||||
// === ULTRA-FAST VOLTAGE READING ===
|
||||
static constexpr PowerDomainId domains[] = {
|
||||
PcvPowerDomainId_Max77621_Cpu, // [0] CPU
|
||||
@@ -574,12 +578,13 @@ void Misc(void*) {
|
||||
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU];
|
||||
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU];
|
||||
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM];
|
||||
ramLoad[SysClkPartLoad_EMC] = sysclkCTX.PartLoad[SysClkPartLoad_EMC];
|
||||
ramLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.PartLoad[SysClkPartLoad_EMCCpu];
|
||||
PartLoad[SysClkPartLoad_EMC] = sysclkCTX.PartLoad[SysClkPartLoad_EMC];
|
||||
PartLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.PartLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
realVDD2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realVDDQ_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
}
|
||||
}
|
||||
@@ -697,19 +702,18 @@ void Misc3(void*) {
|
||||
|
||||
// Get sys-clk data
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
ramLoad[SysClkPartLoad_EMC] = sysclkCTX.PartLoad[SysClkPartLoad_EMC];
|
||||
ramLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.PartLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
// Get voltages from sys-clk if using EOS
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
PartLoad[SysClkPartLoad_EMC] = sysclkCTX.PartLoad[SysClkPartLoad_EMC];
|
||||
PartLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.PartLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
realVDD2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realVDDQ_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
}
|
||||
}
|
||||
|
||||
// Temperatures
|
||||
if (R_SUCCEEDED(i2cCheck)) {
|
||||
Tmp451GetSocTemp(&SOC_temperatureF);
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
#include "../../sys-clk/common/include/sysclk.h"
|
||||
|
||||
//static tsl::elm::HeaderOverlayFrame* rootFrame = nullptr;
|
||||
static bool skipMain = false;
|
||||
static std::string lastSelectedItem;
|
||||
@@ -53,7 +51,7 @@ static std::string lastSelectedItem;
|
||||
// });
|
||||
// list->addItem(comFPSCounter);
|
||||
//
|
||||
// tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor", "Modes");
|
||||
// tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", "Modes");
|
||||
// rootFrame->setContent(list);
|
||||
//
|
||||
// return rootFrame;
|
||||
@@ -378,7 +376,7 @@ public:
|
||||
|
||||
|
||||
//list->disableCaching();
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor", APP_VERSION);
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION);
|
||||
rootFrame->setContent(list);
|
||||
|
||||
return rootFrame;
|
||||
@@ -988,7 +986,7 @@ inline void setupMode(const std::string& modeType = "") {
|
||||
// This function gets called on startup to create a new Overlay object
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
// load heap settings outside of loop (only Status Monitor directive)
|
||||
// load heap settings outside of loop (only Horizon OC Monitor directive)
|
||||
ult::currentHeapSize = ult::getCurrentHeapSize();
|
||||
ult::expandedMemory = ult::currentHeapSize >= ult::OverlayHeapSize::Size_8MB;
|
||||
ult::limitedMemory = ult::currentHeapSize == ult::OverlayHeapSize::Size_4MB;
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
});
|
||||
|
||||
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor", APP_VERSION, true);
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION, true);
|
||||
rootFrame->setContent(Status);
|
||||
|
||||
return rootFrame;
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
list->jumpToItem("", ult::CHECKMARK_SYMBOL, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Alpha");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Alpha");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
// Jump to currently selected item
|
||||
list->jumpToItem("", ult::CHECKMARK_SYMBOL, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "DTC Format");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "DTC Format");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -424,11 +424,11 @@ public:
|
||||
list->addItem(socVoltage);
|
||||
|
||||
if (isMiniMode) {
|
||||
auto* ramLoadCPUGPU = new tsl::elm::ToggleListItem("RAM Load CPU/GPU", getCurrentShowRAMLoadCPUGPU());
|
||||
ramLoadCPUGPU->setStateChangedListener([this, section](bool state) {
|
||||
auto* PartLoadCPUGPU = new tsl::elm::ToggleListItem("RAM Load CPU/GPU", getCurrentShowRAMLoadCPUGPU());
|
||||
PartLoadCPUGPU->setStateChangedListener([this, section](bool state) {
|
||||
ult::setIniFileValue(configIniPath, section, "show_RAM_load_CPU_GPU", state ? "true" : "false");
|
||||
});
|
||||
list->addItem(ramLoadCPUGPU);
|
||||
list->addItem(PartLoadCPUGPU);
|
||||
}
|
||||
|
||||
if (isMiniMode || isMicroMode) {
|
||||
@@ -494,7 +494,7 @@ public:
|
||||
jumpItemExactMatch = false;
|
||||
}
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ public:
|
||||
|
||||
list->jumpToItem("", ult::CHECKMARK_SYMBOL, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -808,7 +808,7 @@ public:
|
||||
|
||||
list->jumpToItem("", ult::CHECKMARK_SYMBOL, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -896,7 +896,7 @@ public:
|
||||
|
||||
list->jumpToItem("", ult::CHECKMARK_SYMBOL, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Font Sizes");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Font Sizes");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -969,7 +969,7 @@ public:
|
||||
});
|
||||
list->addItem(dockedItem);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
list->jumpToItem(jumpItemName, jumpItemValue, jumpItemExactMatch);
|
||||
{
|
||||
@@ -1181,7 +1181,7 @@ public:
|
||||
}
|
||||
list->jumpToItem("", _jumpItemValue, false);
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Colors");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Colors");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -1587,7 +1587,7 @@ public:
|
||||
}
|
||||
|
||||
//list->disableCaching();
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -1780,7 +1780,7 @@ public:
|
||||
jumpItemExactMatch = false;
|
||||
}
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", "Configuration");
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", "Configuration");
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
@@ -2022,7 +2022,7 @@ public:
|
||||
jumpItemExactMatch = false;
|
||||
}
|
||||
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Status Monitor", modeName);
|
||||
tsl::elm::OverlayFrame* rootFrame = new tsl::elm::OverlayFrame("Horizon OC Monitor", modeName);
|
||||
rootFrame->setContent(list);
|
||||
return rootFrame;
|
||||
}
|
||||
|
||||
@@ -496,8 +496,8 @@ public:
|
||||
snprintf(CPU_Load_c, sizeof(CPU_Load_c), "%.1f%%", cpu_usageM);
|
||||
snprintf(GPU_Load_c, sizeof(GPU_Load_c), "%d.%d%%", GPU_Load_u / 10, GPU_Load_u % 10);
|
||||
snprintf(RAM_Load_c, sizeof(RAM_Load_c), "%hu.%hhu%%",
|
||||
ramLoad[SysClkPartLoad_EMC] / 10,
|
||||
ramLoad[SysClkPartLoad_EMC] % 10);
|
||||
PartLoad[SysClkPartLoad_EMC] / 10,
|
||||
PartLoad[SysClkPartLoad_EMC] % 10);
|
||||
|
||||
mutexUnlock(&mutex_Misc);
|
||||
|
||||
|
||||
@@ -234,10 +234,10 @@ public:
|
||||
renderer->drawString(DeltaRAM_c, false, COMMON_MARGIN + deltaOffset, height_offset, 15, (settings.textColor));
|
||||
}
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
static std::vector<std::string> ramLoadColoredChars = {"CPU", "GPU"};
|
||||
static std::vector<std::string> PartLoadColoredChars = {"CPU", "GPU"};
|
||||
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
|
||||
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
|
||||
renderer->drawStringWithColoredSections(RAM_load_c, false, ramLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
|
||||
renderer->drawStringWithColoredSections(RAM_load_c, false, PartLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
|
||||
}
|
||||
}
|
||||
if (R_SUCCEEDED(Hinted)) {
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
renderer->drawString(" to Exit", false, baseX + pressWidth + keyComboWidth, baseY, fontSize, (tsl::bottomTextColor));
|
||||
});
|
||||
|
||||
auto rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor", APP_VERSION);
|
||||
auto rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION);
|
||||
rootFrame->setContent(Status);
|
||||
|
||||
return rootFrame;
|
||||
@@ -446,11 +446,11 @@ public:
|
||||
);
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
const int RAM_GPU_Load = ramLoad[SysClkPartLoad_EMC] - ramLoad[SysClkPartLoad_EMCCpu];
|
||||
const int RAM_GPU_Load = PartLoad[SysClkPartLoad_EMC] - PartLoad[SysClkPartLoad_EMCCpu];
|
||||
snprintf(RAM_load_c, sizeof RAM_load_c,
|
||||
"%u.%u%% CPU %u.%u%% GPU %u.%u%%",
|
||||
ramLoad[SysClkPartLoad_EMC] / 10, ramLoad[SysClkPartLoad_EMC] % 10,
|
||||
ramLoad[SysClkPartLoad_EMCCpu] / 10, ramLoad[SysClkPartLoad_EMCCpu] % 10,
|
||||
PartLoad[SysClkPartLoad_EMC] / 10, PartLoad[SysClkPartLoad_EMC] % 10,
|
||||
PartLoad[SysClkPartLoad_EMCCpu] / 10, PartLoad[SysClkPartLoad_EMCCpu] % 10,
|
||||
RAM_GPU_Load / 10, RAM_GPU_Load % 10);
|
||||
}
|
||||
///Thermal
|
||||
|
||||
@@ -821,13 +821,13 @@ public:
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
// Use sys-clk's RAM load if available
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%hu%%",
|
||||
ramLoad[SysClkPartLoad_EMC] / 10);
|
||||
PartLoad[SysClkPartLoad_EMC] / 10);
|
||||
} else {
|
||||
// Calculate percentage manually when sys-clk isn't available
|
||||
const uint64_t RAM_Total_all = RAM_Total_application_u + RAM_Total_applet_u + RAM_Total_system_u + RAM_Total_systemunsafe_u;
|
||||
const uint64_t RAM_Used_all = RAM_Used_application_u + RAM_Used_applet_u + RAM_Used_system_u + RAM_Used_systemunsafe_u;
|
||||
const unsigned ramLoadPercent = (RAM_Total_all > 0) ? (unsigned)((RAM_Used_all * 100) / RAM_Total_all) : 0;
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%u%%", ramLoadPercent);
|
||||
const unsigned PartLoadPercent = (RAM_Total_all > 0) ? (unsigned)((RAM_Used_all * 100) / RAM_Total_all) : 0;
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%u%%", PartLoadPercent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,8 +857,8 @@ public:
|
||||
if (settings.realVolts && (settings.showVDD2 || settings.showVDDQ)) {
|
||||
/* realRAM_mV packs VDD2 | VDDQ in 10-µV units *
|
||||
* → split, convert to mV */
|
||||
const float mv_vdd2 = (realRAM_mV / 10000) / 10.0f; // VDD2
|
||||
const uint32_t mv_vddq = (realRAM_mV % 10000) / 10; // VDDQ
|
||||
const float mv_vdd2 = realVDD2_mV / 1000; // VDD2
|
||||
const uint32_t mv_vddq = realVDDQ_mV / 1000; // VDDQ
|
||||
|
||||
// Build voltage string based on settings
|
||||
RAM_volt_c[0] = '\0'; // Start with empty string
|
||||
|
||||
@@ -991,35 +991,35 @@ public:
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
} else {
|
||||
unsigned ramLoadInt;
|
||||
unsigned PartLoadInt;
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
ramLoadInt = ramLoad[SysClkPartLoad_EMC] / 10;
|
||||
PartLoadInt = PartLoad[SysClkPartLoad_EMC] / 10;
|
||||
|
||||
if (settings.showRAMLoadCPUGPU) {
|
||||
unsigned ramCpuLoadInt = ramLoad[SysClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = ramLoad[SysClkPartLoad_EMC] - ramLoad[SysClkPartLoad_EMCCpu];
|
||||
unsigned ramCpuLoadInt = PartLoad[SysClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = PartLoad[SysClkPartLoad_EMC] - PartLoad[SysClkPartLoad_EMCCpu];
|
||||
unsigned ramGpuLoadInt = RAM_GPU_Load / 10;
|
||||
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
ramLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
ramLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
} else {
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", ramLoadInt,
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", ramLoadInt,
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
}
|
||||
@@ -1028,24 +1028,24 @@ public:
|
||||
RAM_Total_system_u + RAM_Total_systemunsafe_u;
|
||||
const uint64_t RAM_Used_all = RAM_Used_application_u + RAM_Used_applet_u +
|
||||
RAM_Used_system_u + RAM_Used_systemunsafe_u;
|
||||
ramLoadInt = (RAM_Total_all > 0) ? (unsigned)((RAM_Used_all * 100) / RAM_Total_all) : 0;
|
||||
PartLoadInt = (RAM_Total_all > 0) ? (unsigned)((RAM_Used_all * 100) / RAM_Total_all) : 0;
|
||||
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", ramLoadInt,
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", ramLoadInt,
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.realVolts) {
|
||||
const float mv_vdd2_f = realRAM_mV / 100000.0f;
|
||||
const uint32_t mv_vdd2_i = realRAM_mV / 100000;
|
||||
const uint32_t mv_vddq = (realRAM_mV % 10000) / 10;
|
||||
const float mv_vdd2_f = realVDD2_mV / 100000.0f;
|
||||
const uint32_t mv_vdd2_i = realVDD2_mV / 1000;
|
||||
const uint32_t mv_vddq = realVDDQ_mV / 1000;
|
||||
|
||||
if (isMariko) {
|
||||
if (settings.showVDDQ && settings.showVDD2) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
});
|
||||
|
||||
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor", APP_VERSION, true);
|
||||
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION, true);
|
||||
rootFrame->setContent(Status);
|
||||
|
||||
return rootFrame;
|
||||
|
||||
128
Source/Horizon-OC-Monitor/source/sysclk_ipc.c
Normal file
128
Source/Horizon-OC-Monitor/source/sysclk_ipc.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* --------------------------------------------------------------------------
|
||||
* "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
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <switch.h>
|
||||
#include <string.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
static Service g_sysclkSrv;
|
||||
static atomic_size_t g_refCnt;
|
||||
|
||||
bool sysclkIpcRunning()
|
||||
{
|
||||
Handle handle;
|
||||
const bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
|
||||
if (!running)
|
||||
{
|
||||
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME));
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
Result sysclkIpcInitialize(void)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
g_refCnt++;
|
||||
|
||||
if (serviceIsActive(&g_sysclkSrv))
|
||||
return 0;
|
||||
|
||||
rc = smGetService(&g_sysclkSrv, SYSCLK_IPC_SERVICE_NAME);
|
||||
|
||||
if (R_FAILED(rc)) sysclkIpcExit();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void sysclkIpcExit(void)
|
||||
{
|
||||
if (--g_refCnt == 0)
|
||||
{
|
||||
serviceClose(&g_sysclkSrv);
|
||||
}
|
||||
}
|
||||
|
||||
Result sysclkIpcGetAPIVersion(u32* out_ver)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetApiVersion, *out_ver);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetVersionString(char* out, size_t len)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetVersionString,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = {{out, len}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetCurrentContext(SysClkContext* out_context)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetCurrentContext, *out_context);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetEnabled(bool enabled)
|
||||
{
|
||||
u8 enabledRaw = (u8)enabled;
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetEnabled, enabledRaw);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
|
||||
{
|
||||
SysClkIpc_SetOverride_Args args = {
|
||||
.module = module,
|
||||
.hz = hz
|
||||
};
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetOverride, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid, *out_profiles);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
{
|
||||
SysClkIpc_SetProfiles_Args args;
|
||||
args.tid = tid;
|
||||
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues, *out_configValues);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues, *configValues);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
{
|
||||
SysClkIpc_GetFreqList_Args args = {
|
||||
.module = module,
|
||||
.maxCount = maxCount
|
||||
};
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{list, maxCount * sizeof(u32)}},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user