mirror of
https://github.com/joel16/SwitchIdent.git
synced 2024-11-23 03:39:40 +00:00
Get rid of kernel version and make minor accuracy changes
This commit is contained in:
parent
dba7cd6818
commit
ba75f262fd
@ -4,16 +4,6 @@
|
||||
#include "kernel.h"
|
||||
#include "setsys.h"
|
||||
|
||||
static u64 SwitchIdent_GetPackage1MaxverConstant(void) {
|
||||
Result ret = 0;
|
||||
u64 version = 0x0;
|
||||
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_Version, &version)))
|
||||
printf("splGetConfig(SplConfigItem_Version) failed: 0x%x.\n\n", ret);
|
||||
|
||||
return (version + 1); // (Package1 maxver constant - 1) + 1
|
||||
}
|
||||
|
||||
char *SwitchIdent_GetDramDesc(void) {
|
||||
Result ret = 0;
|
||||
u64 id = 0;
|
||||
@ -29,14 +19,17 @@ char *SwitchIdent_GetDramDesc(void) {
|
||||
"MarikoIowax1x2Samsung4gb",
|
||||
"MarikoIowaSamsung4gb",
|
||||
"MarikoIowaSamsung8gb",
|
||||
"Unknown",
|
||||
"MarikoIowaHynix4gb",
|
||||
"Unknown",
|
||||
"MarikoHoagSamsung4gb",
|
||||
"MarikoHoagSamsung8gb"
|
||||
"MarikoHoagSamsung8gb",
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_DramId, &id)))
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_DramId, &id))) {
|
||||
printf("splGetConfig(SplConfigItem_DramId) failed: 0x%x.\n\n", ret);
|
||||
return dram_desc[14];
|
||||
}
|
||||
|
||||
return dram_desc[id];
|
||||
}
|
||||
@ -56,23 +49,6 @@ char *SwitchIdent_GetFirmwareVersion(void) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *SwitchIdent_GetKernelVersion(void) {
|
||||
char *versions[] = {
|
||||
"Unknown0",
|
||||
"Unknown1",
|
||||
"5.0.0",
|
||||
"6.1.0",
|
||||
"7.4.0",
|
||||
"7.4.0",
|
||||
"X.X.X",
|
||||
"9.3.0",
|
||||
"Unknown2",
|
||||
"Unknown3"
|
||||
};
|
||||
|
||||
return versions[SwitchIdent_GetPackage1MaxverConstant()];
|
||||
}
|
||||
|
||||
char *SwitchIdent_GetHardwareType(void) {
|
||||
Result ret = 0;
|
||||
u64 hardware_type = 4;
|
||||
@ -80,30 +56,32 @@ char *SwitchIdent_GetHardwareType(void) {
|
||||
char *hardware_300[] = {
|
||||
"Icosa",
|
||||
"Copper",
|
||||
"Unknown",
|
||||
"Unknown",
|
||||
"Hoag",
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
char *hardware_400[] = {
|
||||
"Icosa",
|
||||
"Copper",
|
||||
"Unknown",
|
||||
"Hoag",
|
||||
"Mariko",
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_HardwareType, &hardware_type)))
|
||||
printf("splGetConfig(SplConfigItem_HardwareType) failed: 0x%x.\n\n", ret);
|
||||
|
||||
if (SwitchIdent_GetPackage1MaxverConstant() < 0x6)
|
||||
return hardware_300[hardware_type];
|
||||
|
||||
else {
|
||||
if (kernelAbove400())
|
||||
return hardware_400[hardware_type];
|
||||
else
|
||||
return hardware_300[hardware_type];
|
||||
}
|
||||
|
||||
return hardware_400[4];
|
||||
}
|
||||
|
||||
// [4.0.0+] Kiosk mode (0 = retail; 1 = kiosk)
|
||||
static bool SwitchIdent_IsKiosk(void) {
|
||||
bool SwitchIdent_IsKiosk(void) {
|
||||
u64 isKiosk = 0;
|
||||
Result ret = 0;
|
||||
|
||||
@ -118,7 +96,7 @@ static bool SwitchIdent_IsKiosk(void) {
|
||||
|
||||
char *SwitchIdent_GetUnit(void) {
|
||||
Result ret = 0;
|
||||
u64 isRetail = 2;
|
||||
u64 isRetail = 0;
|
||||
|
||||
char *unit[] = {
|
||||
"Debug",
|
||||
@ -126,12 +104,9 @@ char *SwitchIdent_GetUnit(void) {
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_IsRetail, &isRetail)))
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_IsRetail, &isRetail))) {
|
||||
printf("splGetConfig(SplConfigItem_IsRetail) failed: 0x%x.\n\n", ret);
|
||||
|
||||
if (SwitchIdent_GetPackage1MaxverConstant() >= 0x6) {// 4.00+
|
||||
if (SwitchIdent_IsKiosk())
|
||||
return "Kiosk";
|
||||
return unit[2];
|
||||
}
|
||||
|
||||
return unit[isRetail];
|
||||
@ -140,14 +115,14 @@ char *SwitchIdent_GetUnit(void) {
|
||||
bool SwitchIdent_IsSafeMode(void) {
|
||||
Result ret = 0;
|
||||
u64 safemode = 0;
|
||||
bool out = false;
|
||||
|
||||
if (R_FAILED(ret = splGetConfig(SplConfigItem_IsRecoveryBoot, &safemode)))
|
||||
printf("splGetConfig(SplConfigItem_IsRecoveryBoot) failed: 0x%x.\n\n", ret);
|
||||
|
||||
out = safemode; // 1 = true, 0 = false
|
||||
if (safemode)
|
||||
return true;
|
||||
|
||||
return out;
|
||||
return false;
|
||||
}
|
||||
|
||||
u64 SwitchIdent_GetDeviceID(void) {
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
char *SwitchIdent_GetDramDesc(void);
|
||||
char *SwitchIdent_GetFirmwareVersion(void);
|
||||
char *SwitchIdent_GetKernelVersion(void);
|
||||
char *SwitchIdent_GetHardwareType(void);
|
||||
char *SwitchIdent_GetUnit(void);
|
||||
bool SwitchIdent_IsSafeMode(void);
|
||||
|
@ -30,13 +30,12 @@ char *SwitchIdent_GetRegion(void) {
|
||||
|
||||
SetRegion regionCode = 0;
|
||||
|
||||
if (R_SUCCEEDED(ret = setGetRegionCode(®ionCode))) {
|
||||
if (regionCode < 4)
|
||||
return regions[regionCode];
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = setGetRegionCode(®ionCode))) {
|
||||
printf("setGetRegionCode() failed: 0x%x.\n\n", ret);
|
||||
return regions[4];
|
||||
}
|
||||
|
||||
return regions[regionCode];
|
||||
}
|
||||
|
||||
u32 SwitchIdent_GetCPUClock(void) {
|
||||
|
@ -91,7 +91,6 @@ int main(int argc, char **argv) {
|
||||
Kernel/Hardware info:
|
||||
*/
|
||||
printf("\x1b[31;1m*\x1b[0m Firmware version: \x1b[31;1m%s\n", SwitchIdent_GetFirmwareVersion());
|
||||
printf("\x1b[31;1m*\x1b[0m Kernel version: \x1b[31;1m%s\n", SwitchIdent_GetKernelVersion());
|
||||
printf("\x1b[31;1m*\x1b[0m Hardware: \x1b[31;1m%s\x1b[0m (\x1b[31;1m%s\x1b[0m) \x1b[0m\n", SwitchIdent_GetHardwareType(), SwitchIdent_GetUnit());
|
||||
printf("\x1b[31;1m*\x1b[0m Serial number: \x1b[31;1m%s\n", SwitchIdent_GetSerialNumber());
|
||||
printf("\x1b[31;1m*\x1b[0m Device ID: \x1b[31;1m%llu\n", SwitchIdent_GetDeviceID());
|
||||
@ -108,7 +107,7 @@ int main(int argc, char **argv) {
|
||||
char hostname[128];
|
||||
Result ret = gethostname(hostname, sizeof(hostname));
|
||||
// 21
|
||||
printf("\x1b[22;0H");
|
||||
printf("\x1b[21;0H");
|
||||
printf("\x1b[36;1m*\x1b[0m IP: \x1b[36;1m%s\n", R_SUCCEEDED(ret)? hostname : NULL);
|
||||
printf("\x1b[36;1m*\x1b[0m Wireless LAN: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled");
|
||||
printf("\x1b[36;1m*\x1b[0m Bluetooth: \x1b[36;1m%s\n", SwitchIdent_GetFlag(SetSysFlag_BluetoothEnable)? "Enabled" : "Disabled");
|
||||
@ -131,7 +130,7 @@ int main(int argc, char **argv) {
|
||||
Utils_GetSizeString(nand_s_free_str, SwitchIdent_GetFreeStorage(FsStorageId_NandSystem));
|
||||
Utils_GetSizeString(nand_s_used_str, SwitchIdent_GetUsedStorage(FsStorageId_NandSystem));
|
||||
|
||||
printf("\x1b[32;0H");
|
||||
printf("\x1b[31;0H");
|
||||
printf("\x1b[35;1m*\x1b[0m Total SD Capacity: \x1b[35;1m%s\n", sd_total_str);
|
||||
printf("\x1b[35;1m*\x1b[0m Free SD Capacity: \x1b[35;1m%s\n", sd_free_str);
|
||||
printf("\x1b[35;1m*\x1b[0m Used storage: \x1b[35;1m%s\n", sd_used_str);
|
||||
@ -150,7 +149,7 @@ int main(int argc, char **argv) {
|
||||
/*
|
||||
System info (continued):
|
||||
*/
|
||||
printf("\x1b[11;0H");
|
||||
printf("\x1b[10;0H");
|
||||
printf("\x1b[33;1m*\x1b[0m CPU clock: \x1b[33;1m%lu\x1b[0m MHz \n", SwitchIdent_GetCPUClock());
|
||||
printf("\x1b[33;1m*\x1b[0m GPU clock: \x1b[33;1m%lu\x1b[0m MHz \n", SwitchIdent_GetGPUClock());
|
||||
printf("\x1b[33;1m*\x1b[0m EMC clock: \x1b[33;1m%lu\x1b[0m MHz \n", SwitchIdent_GetGPUClock());
|
||||
@ -159,14 +158,14 @@ int main(int argc, char **argv) {
|
||||
/*
|
||||
Battery info:
|
||||
*/
|
||||
printf("\x1b[16;0H");
|
||||
printf("\x1b[15;0H");
|
||||
printf("\x1b[94;1m*\x1b[0m Battery percentage: \x1b[94;1m%lu %%\x1b[0m (\x1b[94;1m%s\x1b[0m) \x1b[0m \n", SwitchIdent_GetBatteryPercent(), SwitchIdent_IsCharging()? "charging" : "not charging");
|
||||
printf("\x1b[94;1m*\x1b[0m Battery voltage state: \x1b[94;1m%s \n", SwitchIdent_GetVoltageState(&psm_service));
|
||||
printf("\x1b[94;1m*\x1b[0m Battery charger type: \x1b[94;1m%s \n", SwitchIdent_GetChargerType());
|
||||
printf("\x1b[94;1m*\x1b[0m Battery charging enabled: \x1b[94;1m%s \n", SwitchIdent_IsChargingEnabled(&psm_service)? "Yes" : "No");
|
||||
printf("\x1b[94;1m*\x1b[0m Battery ample power supplied: \x1b[94;1m%s \n\n", SwitchIdent_IsEnoughPowerSupplied(&psm_service)? "Yes" : "No");
|
||||
|
||||
printf("\x1b[28;0H");
|
||||
printf("\x1b[27;0H");
|
||||
printf("\x1b[36;1m*\x1b[0m State: \x1b[36;1m%s \n", SwitchIdent_GetOperationMode());
|
||||
printf("\x1b[36;1m*\x1b[0m SD card status: \x1b[36;1m%s \n", isSDInserted? "Inserted" : "Not inserted");
|
||||
printf("\x1b[36;1m*\x1b[0m Game card status: \x1b[36;1m%s \n\n", isGameCardInserted? "Inserted" : "Not inserted");
|
||||
|
@ -33,12 +33,11 @@ static void Menu_DrawItem(int x, int y, char *item_title, const char *text, ...)
|
||||
|
||||
static void Menu_Kernel(void) {
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 50, "Firmware version:", SwitchIdent_GetFirmwareVersion());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "Kernel version:", SwitchIdent_GetKernelVersion());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 150, "Hardware:", SwitchIdent_GetHardwareType());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "Unit:", SwitchIdent_GetUnit());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 250, "Serial:", SwitchIdent_GetSerialNumber());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 300, "DRAM ID:", SwitchIdent_GetDramDesc());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 350, "Device ID:", "%llu", SwitchIdent_GetDeviceID());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "Hardware:", SwitchIdent_GetHardwareType());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 150, "Unit:", SwitchIdent_GetUnit());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "Serial:", SwitchIdent_GetSerialNumber());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 250, "DRAM ID:", SwitchIdent_GetDramDesc());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 300, "Device ID:", "%llu", SwitchIdent_GetDeviceID());
|
||||
}
|
||||
|
||||
static void Menu_System(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user