mirror of
https://github.com/joel16/SwitchIdent.git
synced 2024-11-23 03:39:40 +00:00
Properly display CPU & GPU clocks and also EMC clock
This commit is contained in:
parent
919f7d0f32
commit
1534eaef0c
106
common/system.c
106
common/system.c
@ -39,104 +39,34 @@ char *SwitchIdent_GetRegion(void) {
|
||||
return regions[4];
|
||||
}
|
||||
|
||||
static u32 SwitchIdent_GetPerformanceConfig(void) {
|
||||
Result ret = 0;
|
||||
u32 performanceConfig = 0;
|
||||
|
||||
if (R_FAILED(ret = apmGetPerformanceConfiguration(appletGetOperationMode(), &performanceConfig)))
|
||||
printf("apmGetPerformanceConfiguration() failed: 0x%x.\n\n", ret);
|
||||
|
||||
return performanceConfig;
|
||||
}
|
||||
|
||||
u32 SwitchIdent_GetCPUClock(void) {
|
||||
Result ret = 0;
|
||||
u32 out = 0;
|
||||
|
||||
switch (SwitchIdent_GetPerformanceConfig()) {
|
||||
case 0x00010000:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00010001:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00010002:
|
||||
out = 1224;
|
||||
break;
|
||||
case 0x00020000:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00020001:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00020002:
|
||||
out = 1224;
|
||||
break;
|
||||
case 0x00020003:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00020004:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00020005:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x00020006:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x92220007:
|
||||
out = 1020;
|
||||
break;
|
||||
case 0x92220008:
|
||||
out = 1020;
|
||||
break;
|
||||
}
|
||||
if (R_FAILED(ret = pcvGetClockRate(PcvModule_Cpu, &out)))
|
||||
printf("pcvGetClockRate(PcvModule_Cpu) failed: 0x%x.\n\n", ret);
|
||||
|
||||
return out;
|
||||
return out/1000000;
|
||||
}
|
||||
|
||||
u32 SwitchIdent_GetGPUClock(void) {
|
||||
Result ret = 0;
|
||||
u32 out = 0;
|
||||
|
||||
switch (SwitchIdent_GetPerformanceConfig()) {
|
||||
case 0x00010000:
|
||||
out = 384;
|
||||
break;
|
||||
case 0x00010001:
|
||||
out = 768;
|
||||
break;
|
||||
case 0x00010002:
|
||||
out = 691.2;
|
||||
break;
|
||||
case 0x00020000:
|
||||
out = 230.4;
|
||||
break;
|
||||
case 0x00020001:
|
||||
out = 307.2;
|
||||
break;
|
||||
case 0x00020002:
|
||||
out = 230.4;
|
||||
break;
|
||||
case 0x00020003:
|
||||
out = 307;
|
||||
break;
|
||||
case 0x00020004:
|
||||
out = 384;
|
||||
break;
|
||||
case 0x00020005:
|
||||
out = 307.2;
|
||||
break;
|
||||
case 0x00020006:
|
||||
out = 384;
|
||||
break;
|
||||
case 0x92220007:
|
||||
out = 460.8;
|
||||
break;
|
||||
case 0x92220008:
|
||||
out = 460.8;
|
||||
break;
|
||||
}
|
||||
if (R_FAILED(ret = pcvGetClockRate(PcvModule_Gpu, &out)))
|
||||
printf("pcvGetClockRate(PcvModule_Gpu) failed: 0x%x.\n\n", ret);
|
||||
|
||||
return out/1000000;
|
||||
}
|
||||
|
||||
return out;
|
||||
u32 SwitchIdent_GetEMCClock(void) {
|
||||
Result ret = 0;
|
||||
u32 out = 0;
|
||||
|
||||
if (R_FAILED(ret = pcvGetClockRate(PcvModule_Emc, &out)))
|
||||
printf("pcvGetClockRate(PcvModule_Emc) failed: 0x%x.\n\n", ret);
|
||||
|
||||
return out/1000000;
|
||||
}
|
||||
|
||||
char *SwitchIdent_GetBluetoothBdAddress(Service *srv) {
|
||||
|
@ -5,6 +5,7 @@ char *SwitchIdent_GetLanguage(void);
|
||||
char *SwitchIdent_GetRegion(void);
|
||||
u32 SwitchIdent_GetCPUClock(void);
|
||||
u32 SwitchIdent_GetGPUClock(void);
|
||||
u32 SwitchIdent_GetEMCClock(void);
|
||||
char *SwitchIdent_GetBluetoothBdAddress(Service *srv);
|
||||
char *SwitchIdent_GetWirelessLanMacAddress(Service *srv);
|
||||
|
||||
|
@ -108,7 +108,7 @@ int main(int argc, char **argv) {
|
||||
char hostname[128];
|
||||
Result ret = gethostname(hostname, sizeof(hostname));
|
||||
// 21
|
||||
printf("\x1b[20;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 +131,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[30;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);
|
||||
@ -153,12 +153,13 @@ int main(int argc, char **argv) {
|
||||
printf("\x1b[11;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());
|
||||
printf("\x1b[33;1m*\x1b[0m Wireless LAN: \x1b[33;1m%s\x1b[0m (RSSI: \x1b[33;1m%d\x1b[0m) (Quality: \x1b[33;1m%lu\x1b[0m) \n\n", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled", SwitchIdent_GetWlanRSSI(&wlaninf_service), SwitchIdent_GetWlanQuality(SwitchIdent_GetWlanRSSI(&wlaninf_service)));
|
||||
|
||||
/*
|
||||
Battery info:
|
||||
*/
|
||||
printf("\x1b[15;0H");
|
||||
printf("\x1b[16;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");
|
||||
// Voltage state needs more clarification
|
||||
//printf("\x1b[94;1m*\x1b[0m Battery voltage state: \x1b[94;1m%s \n", SwitchIdent_GetVoltageState(&psm_service));
|
||||
@ -166,7 +167,7 @@ int main(int argc, char **argv) {
|
||||
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[26;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");
|
||||
|
@ -45,9 +45,10 @@ static void Menu_System(void) {
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 50, "Region:", SwitchIdent_GetRegion());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 100, "CPU clock:", "%lu MHz", SwitchIdent_GetCPUClock());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 150, "GPU clock:", "%lu MHz", SwitchIdent_GetGPUClock());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "Wireless LAN:", "%s (RSSI: %d) (Quality: %lu)", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled", SwitchIdent_GetWlanRSSI(&wlaninf_service), SwitchIdent_GetWlanQuality(SwitchIdent_GetWlanRSSI(&wlaninf_service)));
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 250, "Bluetooth:", "%s", SwitchIdent_GetFlag(SetSysFlag_BluetoothEnable)? "Enabled" : "Disabled");
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 300, "NFC:", SwitchIdent_GetFlag(SetSysFlag_NfcEnable)? "Enabled" : "Disabled");
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 200, "EMC clock:", "%lu MHz", SwitchIdent_GetEMCClock());
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 250, "Wireless LAN:", "%s (RSSI: %d) (Quality: %lu)", SwitchIdent_GetFlag(SetSysFlag_WirelessLanEnable)? "Enabled" : "Disabled", SwitchIdent_GetWlanRSSI(&wlaninf_service), SwitchIdent_GetWlanQuality(SwitchIdent_GetWlanRSSI(&wlaninf_service)));
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 300, "Bluetooth:", "%s", SwitchIdent_GetFlag(SetSysFlag_BluetoothEnable)? "Enabled" : "Disabled");
|
||||
Menu_DrawItem(450, 250 + ((MENU_Y_DIST - item_height) / 2) + 350, "NFC:", SwitchIdent_GetFlag(SetSysFlag_NfcEnable)? "Enabled" : "Disabled");
|
||||
}
|
||||
|
||||
static void Menu_Power(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user