diff --git a/Source/sys-clk/overlay/src/ui/gui/info_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/info_gui.cpp
index 1f51f322..74ddbe0e 100644
--- a/Source/sys-clk/overlay/src/ui/gui/info_gui.cpp
+++ b/Source/sys-clk/overlay/src/ui/gui/info_gui.cpp
@@ -13,63 +13,57 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
#include "info_gui.h"
#include "../format.h"
#include
#include
+tsl::elm::ListItem* cpuSpeedoItem;
+tsl::elm::ListItem* gpuSpeedoItem;
+tsl::elm::ListItem* socSpeedoItem;
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;
- }
-
+ // Initialize display strings
+ memset(speedoStrings, 0, sizeof(speedoStrings));
}
InfoGui::~InfoGui()
{
-
}
-
void InfoGui::listUI()
{
- tsl::elm::ListItem* cpuSpeedoItem =
+ 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 =
+
+ 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]));
+
+ socSpeedoItem =
+ new tsl::elm::ListItem("SOC Speedo");
this->listElement->addItem(socSpeedoItem);
}
void InfoGui::update()
{
BaseMenuGui::update();
-
}
void InfoGui::refresh()
{
BaseMenuGui::refresh();
- static int frameCounter = 0;
+ if (!this->context)
+ return;
- if (this->context && ++frameCounter >= 60) {
- frameCounter = 0;
-
- }
+ // Format speedo strings once per refresh
+ sprintf(speedoStrings[0], "%u", this->context->speedos[HorizonOCSpeedo_CPU]);
+ sprintf(speedoStrings[1], "%u", this->context->speedos[HorizonOCSpeedo_GPU]);
+ sprintf(speedoStrings[2], "%u", this->context->speedos[HorizonOCSpeedo_SOC]);
+ cpuSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_CPU]); // this is SO hacky but it works i guess
+ gpuSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_GPU]);
+ socSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_SOC]);
+
}
\ No newline at end of file
diff --git a/Source/sys-clk/overlay/src/ui/gui/info_gui.h b/Source/sys-clk/overlay/src/ui/gui/info_gui.h
index 0f223b07..10c869b1 100644
--- a/Source/sys-clk/overlay/src/ui/gui/info_gui.h
+++ b/Source/sys-clk/overlay/src/ui/gui/info_gui.h
@@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
#pragma once
#include "../../ipc.h"
#include "base_menu_gui.h"
@@ -26,7 +25,8 @@
class InfoGui : public BaseMenuGui
{
protected:
- SysClkContext* Currentcontext;
+ char speedoStrings[3][16]; // Pre-formatted speedo strings
+
public:
InfoGui();
~InfoGui();
@@ -34,5 +34,4 @@ public:
void listUI() override;
void update() override;
void refresh() override;
-
};
\ No newline at end of file
diff --git a/Source/sys-clk/overlay/src/ui/gui/main_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/main_gui.cpp
index 81a5d788..2df62d9a 100644
--- a/Source/sys-clk/overlay/src/ui/gui/main_gui.cpp
+++ b/Source/sys-clk/overlay/src/ui/gui/main_gui.cpp
@@ -74,7 +74,7 @@ void MainGui::listUI()
tsl::elm::ListItem* globalOverrideItem = new tsl::elm::ListItem("Temporary Overrides");
globalOverrideItem->setClickListener([this](u64 keys) {
- if((keys & HidNpadButton_A) == HidNpadButton_A)
+ if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
{
tsl::changeTo();
return true;
@@ -100,7 +100,7 @@ void MainGui::listUI()
tsl::elm::ListItem* infoItem = new tsl::elm::ListItem("Information");
infoItem->setClickListener([this](u64 keys) {
- if((keys & HidNpadButton_A) == HidNpadButton_A)
+ if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
{
tsl::changeTo();
return true;
diff --git a/Source/sys-clk/overlay/src/ui/gui/main_gui.h b/Source/sys-clk/overlay/src/ui/gui/main_gui.h
index ab2c2196..77b98a2e 100644
--- a/Source/sys-clk/overlay/src/ui/gui/main_gui.h
+++ b/Source/sys-clk/overlay/src/ui/gui/main_gui.h
@@ -32,7 +32,6 @@
class MainGui : public BaseMenuGui
{
protected:
- SysClkContext* context;
tsl::elm::ToggleListItem* enabledToggle;
public: