kernel: Get cradle FW version (stubbed for now)

This commit is contained in:
joel16 2023-06-18 17:47:44 -04:00
parent 57c75634e6
commit 5785623568
3 changed files with 24 additions and 0 deletions

View File

@ -29,6 +29,13 @@ typedef struct {
u8 device_identifier[0xC];
} HIDFirmwareVersion;
typedef struct {
u32 major;
u32 minor;
u32 micro;
u32 rev;
} DockFirmwareVersion;
namespace SwitchIdent {
// Kernel
const char *GetDramDesc(void);
@ -39,6 +46,7 @@ namespace SwitchIdent {
bool IsSafeMode(void);
u64 GetDeviceID(void);
SetSysSerialNumber GetSerialNumber(void);
DockFirmwareVersion GetDockFirmware(void);
// Misc
const char *GetOperationMode(void);

View File

@ -150,4 +150,15 @@ namespace SwitchIdent {
return serial;
}
DockFirmwareVersion GetDockFirmware(void) {
Result ret = 0;
DockFirmwareVersion version;
if (R_FAILED(ret = appletGetCradleFwVersion(&version.major, &version.minor, &version.micro, &version.rev))) {
std::printf("appletGetCradleFwVersion() failed: 0x%x.\n\n", ret);
}
return version;
}
}

View File

@ -55,6 +55,7 @@ namespace Menus {
void KernelInfo(void) {
SetSysFirmwareVersion ver = SwitchIdent::GetFirmwareVersion();
//DockFirmwareVersion dock_ver = SwitchIdent::GetDockFirmware();
Menus::DrawItemf(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 60, "Firmware version:",
"%u.%u.%u-%u%u", ver.major, ver.minor, ver.micro, ver.revision_major, ver.revision_minor);
Menus::DrawItem(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 120, "Hardware:", SwitchIdent::GetHardwareType());
@ -62,6 +63,10 @@ namespace Menus {
Menus::DrawItem(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 240, "Serial:", SwitchIdent::GetSerialNumber().number);
Menus::DrawItem(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 300, "DRAM ID:", SwitchIdent::GetDramDesc());
Menus::DrawItemf(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 360, "Device ID:", "%llu", SwitchIdent::GetDeviceID());
// if (hosversionAtLeast(2, 0, 0) && appletGetOperationMode() == AppletOperationMode_Console) {
// Menus::DrawItemf(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 420, "Dock firmware:", "%d.%d.%d.%d", dock_ver.major, dock_ver.minor, dock_ver.micro, dock_ver.rev);
// }
}
void SystemInfo(void) {