sysclk: add speedo information

This commit is contained in:
souldbminersmwc
2025-12-25 18:00:31 -05:00
parent 42864af8d8
commit 329feea148
5 changed files with 129 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ include ${TOPDIR}/lib/libultrahand/ultrahand.mk
# version control constants
#---------------------------------------------------------------------------------
#TARGET_VERSION := $(shell git describe --dirty --always --tags)
APP_VERSION := 1.0.0
APP_VERSION := 0.22
TARGET_VERSION := $(APP_VERSION)
#---------------------------------------------------------------------------------

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) Souldbminer 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 "info_gui.h"
#include "../format.h"
#include <tesla.hpp>
#include <string>
InfoGui::InfoGui()
{
if (!this->Currentcontext) [[unlikely]] {
this->Currentcontext = new SysClkContext;
}
Result rc = sysclkIpcGetCurrentContext(this->Currentcontext);
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetCurrentContext", rc);
return;
}
}
InfoGui::~InfoGui()
{
}
void InfoGui::listUI()
{
tsl::elm::ListItem* cpuSpeedoItem =
new tsl::elm::ListItem("CPU Speedo");
cpuSpeedoItem->setValue(std::to_string(this->Currentcontext->speedos[HorizonOCSpeedo_CPU]));
this->listElement->addItem(cpuSpeedoItem);
tsl::elm::ListItem* gpuSpeedoItem =
new tsl::elm::ListItem("GPU Speedo");
gpuSpeedoItem->setValue(std::to_string(this->Currentcontext->speedos[HorizonOCSpeedo_GPU]));
this->listElement->addItem(gpuSpeedoItem);
tsl::elm::ListItem* socSpeedoItem =
new tsl::elm::ListItem("GPU Speedo");
socSpeedoItem->setValue(std::to_string(this->Currentcontext->speedos[HorizonOCSpeedo_SOC]));
this->listElement->addItem(socSpeedoItem);
}
void InfoGui::update()
{
BaseMenuGui::update();
}
void InfoGui::refresh()
{
BaseMenuGui::refresh();
static int frameCounter = 0;
if (this->context && ++frameCounter >= 60) {
frameCounter = 0;
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) Souldbminer 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/>.
*/
#pragma once
#include "../../ipc.h"
#include "base_menu_gui.h"
#include "freq_choice_gui.h"
#include "value_choice_gui.h"
#include "fatal_gui.h"
#include <map>
#include <vector>
class InfoGui : public BaseMenuGui
{
protected:
SysClkContext* Currentcontext;
public:
InfoGui();
~InfoGui();
void listUI() override;
void update() override;
void refresh() override;
};

View File

@@ -31,7 +31,7 @@
#include "app_profile_gui.h"
#include "global_override_gui.h"
#include "misc_gui.h"
#include "info_gui.h"
void MainGui::listUI()
{
// this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false);
@@ -97,7 +97,19 @@ void MainGui::listUI()
return false;
});
this->listElement->addItem(miscItem);
}
tsl::elm::ListItem* infoItem = new tsl::elm::ListItem("Information");
infoItem->setClickListener([this](u64 keys) {
if((keys & HidNpadButton_A) == HidNpadButton_A)
{
tsl::changeTo<InfoGui>();
return true;
}
return false;
});
this->listElement->addItem(infoItem);
}
void MainGui::refresh()
{

View File

@@ -32,6 +32,7 @@
class MainGui : public BaseMenuGui
{
protected:
SysClkContext* context;
tsl::elm::ToggleListItem* enabledToggle;
public: