diff --git a/common/system.c b/common/system.c index 366de93..7506703 100644 --- a/common/system.c +++ b/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) { diff --git a/common/system.h b/common/system.h index 0d8c0f9..72be0fe 100644 --- a/common/system.h +++ b/common/system.h @@ -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); diff --git a/console/source/main.c b/console/source/main.c index cdeaf61..b57dd23 100644 --- a/console/source/main.c +++ b/console/source/main.c @@ -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"); diff --git a/gui/source/menus.c b/gui/source/menus.c index dcdf49a..78fc00a 100644 --- a/gui/source/menus.c +++ b/gui/source/menus.c @@ -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) {