add kip version detection + version mismatch warning

This commit is contained in:
Lightos1
2026-05-08 20:44:28 +02:00
parent d443e069fd
commit 848a788c5f
4 changed files with 47 additions and 22 deletions

View File

@@ -78,9 +78,11 @@ typedef struct {
// FPS / Resolution
u8 fps;
u16 resolutionHeight;
u8 custRev;
u16 kipVersion;
// Reserved for future use
u8 reserved[0x368];
u8 reserved[0x363];
} HocClkContext;
typedef struct

View File

@@ -22,6 +22,8 @@
#include "cat.h"
#include "ult_ext.h"
// tsl::elm::ListItem* custRevItem = NULL;
tsl::elm::ListItem* kipVersionItem = NULL;
tsl::elm::ListItem* SpeedoItem = NULL;
tsl::elm::ListItem* IddqItem = NULL;
tsl::elm::ListItem* DramModule = NULL;
@@ -61,7 +63,7 @@ void AboutGui::listUI()
ramVoltItem =
new tsl::elm::ListItem("RAM Voltage:");
if(IsMariko()) {
this->listElement->addItem(ramVoltItem);
}
@@ -98,11 +100,11 @@ void AboutGui::listUI()
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")
@@ -133,6 +135,12 @@ void AboutGui::listUI()
new tsl::elm::CategoryHeader("Software Info")
);
// custRevItem = new tsl::elm::ListItem("CUST revision:");
// this->listElement->addItem(custRevItem);
kipVersionItem = new tsl::elm::ListItem("Kip version:");
this->listElement->addItem(kipVersionItem);
if(!IsHoag()) {
sysdockStatusItem =
new tsl::elm::ListItem("sys-dock status:");
@@ -210,7 +218,7 @@ void AboutGui::listUI()
);
this->listElement->addItem(
new tsl::elm::ListItem("Delta")
new tsl::elm::ListItem("arcdelta")
);
this->listElement->addItem(
@@ -255,7 +263,7 @@ void AboutGui::listUI()
);
this->listElement->addItem(
new tsl::elm::ListItem("ScriesM - Atmosphere CFW")
new tsl::elm::ListItem("SciresM - Atmosphere CFW")
);
this->listElement->addItem(
@@ -263,7 +271,7 @@ void AboutGui::listUI()
);
this->listElement->addItem(
new tsl::elm::ListItem("hanai3bi - Switch OC Suite & EOS")
new tsl::elm::ListItem("hanai3Bi - Switch OC Suite & EOS")
);
this->listElement->addItem(
@@ -347,7 +355,7 @@ void AboutGui::update()
void AboutGui::refresh()
{
BaseMenuGui::refresh();
if (!this->context)
return;
// Format strings once per refresh
@@ -357,11 +365,15 @@ void AboutGui::refresh()
SpeedoItem->setValue(strings[0]);
IddqItem->setValue(strings[1]);
DramModule->setValue(formatRamModule());
// custRevItem->setValue(std::to_string(this->context->custRev));
kipVersionItem->setValue(std::to_string((this->context->kipVersion / 100) % 10) + "." + std::to_string((this->context->kipVersion / 10) % 10) + "." + std::to_string( this->context->kipVersion % 10));
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");
@@ -384,7 +396,7 @@ void AboutGui::refresh()
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]);
@@ -401,19 +413,19 @@ void AboutGui::refresh()
ramBWItemMax->setValue(strings[9]);
switch(context->temps[HocClkThermalSensor_BQ24193]) {
case BQ24193Temp_Normal:
strcpy(strings[10], "Normal");
case BQ24193Temp_Normal:
strcpy(strings[10], "Normal");
break;
case BQ24193Temp_Warm:
strcpy(strings[10], "Warm");
case BQ24193Temp_Warm:
strcpy(strings[10], "Warm");
break;
case BQ24193Temp_Hot:
strcpy(strings[10], "Hot");
case BQ24193Temp_Hot:
strcpy(strings[10], "Hot");
break;
case BQ24193Temp_Overheat:
strcpy(strings[10], "Overheat");
case BQ24193Temp_Overheat:
strcpy(strings[10], "Overheat");
break;
default:
default:
strcpy(strings[10], "Unknown");
}

View File

@@ -18,8 +18,11 @@
#include "kip.hpp"
#include "board/board.hpp"
#include "file_utils.hpp"
#include "clock_manager.hpp"
#define CUST_REV 2
#define KIP_VERSION 220
namespace kip {
bool kipAvailable = false;
@@ -58,7 +61,6 @@ namespace kip {
// return;
// }
CUST_WRITE_FIELD_BATCH(&table, custRev, config::GetConfigValue(KipConfigValue_custRev));
// CUST_WRITE_FIELD_BATCH(&table, mtcConf, config::GetConfigValue(KipConfigValue_mtcConf));
CUST_WRITE_FIELD_BATCH(&table, hpMode, config::GetConfigValue(KipConfigValue_hpMode));
@@ -200,6 +202,14 @@ namespace kip {
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
// configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
clockManager::gContext.custRev = cust_get_cust_rev(&table);
u16 kipVersion = cust_get_kip_version(&table);
if (kipVersion != KIP_VERSION) {
notification::writeNotification("Horizon OC\nKip version mismatch detected!");
}
clockManager::gContext.kipVersion = kipVersion;
configValues.values[KipConfigValue_hpMode] = cust_get_hp_mode(&table);
configValues.values[KipConfigValue_commonEmcMemVolt] = cust_get_common_emc_volt(&table);

View File

@@ -34,7 +34,7 @@ namespace kip {
typedef struct {
u8 cust[4];
u32 custRev;
u32 hocVersion;
u32 kipVersion;
u32 hpMode;
u32 commonEmcMemVolt;
u32 eristaEmcMaxClock;
@@ -206,7 +206,7 @@ namespace kip {
return cust_write_table(path, &t); \
} while (0)
static inline bool cust_set_cust_rev(const char* p, u32 v) { CUST_WRITE_FIELD(p, custRev, v); }
// static inline bool cust_set_cust_rev(const char* p, u32 v) { CUST_WRITE_FIELD(p, custRev, v); }
// static inline bool cust_set_mtc_conf(const char* p, u32 v) { CUST_WRITE_FIELD(p, mtcConf, v); }
static inline bool cust_set_hp_mode(const char* p, u32 v) { CUST_WRITE_FIELD(p, hpMode, v); }
@@ -295,6 +295,7 @@ namespace kip {
#define CUST_GET_FIELD(table, field) ((table) ? (table)->field : 0)
static inline u32 cust_get_cust_rev(const CustomizeTable* t) { return CUST_GET_FIELD(t, custRev); }
static inline u32 cust_get_kip_version(const CustomizeTable* t) { return CUST_GET_FIELD(t, kipVersion); }
// static inline u32 cust_get_mtc_conf(const CustomizeTable* t) { return CUST_GET_FIELD(t, mtcConf); }
static inline u32 cust_get_hp_mode(const CustomizeTable* t) { return CUST_GET_FIELD(t, hpMode); }