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

@@ -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); }