Merge upstream changes from GUI

This commit is contained in:
Joel16 2017-09-17 01:16:14 -05:00
parent 99fc2e4c58
commit d3f8b192f3
4 changed files with 87 additions and 17 deletions

View File

@ -3,6 +3,29 @@
#include <3ds.h>
enum
{
KERNEL_VERSIONREVISION = 0x1FF80001,
KERNEL_VERSIONMINOR = 0x1FF80002,
KERNEL_VERSIONMAJOR = 0x1FF80003,
UPDATEFLAG = 0x1FF80004,
NSTID = 0x1FF80008,
SYSCOREVER = 0x1FF80010,
ENVINFO = 0x1FF80014,
UNITINFO = 0x1FF80014,
PREV_FIRM = 0x1FF80016,
KERNEL_CTRSDKVERSION = 0x1FF80018,
APPMEMTYPE = 0x1FF80030,
APPMEMALLOC = 0x1FF80040,
SYSMEMALLOC = 0x1FF80044,
BASEMEMALLOC = 0x1FF80048,
FIRM_VERSIONREVISION = 0x1FF80061,
FIRM_VERSIONMINOR = 0x1FF80062,
FIRM_VERSIONMAJOR = 0x1FF80063,
FIRM_SYSCOREVER = 0x1FF80064,
FIRM_CTRSDKVERSION = 0x1FF80068,
};
char * getVersion(int version);
char * getSdmcCid(void);
char * getNandCid(void);

View File

@ -3,11 +3,30 @@
#include <3ds.h>
enum
{
DATETIME = 0x1FF81000,
RUNNING_HW = 0x1FF81004,
MCU_HW_INFO = 0x1FF81005,
DATETIME_0 = 0x1FF81020,
DATETIME_1 = 0x1FF81040,
WIFI_MACADDR = 0x1FF81060,
WIFI_LINKLEVEL = 0x1FF81066,
_3D_SLIDERSTATE = 0x1FF81080,
_3D_LEDSTATE = 0x1FF81084,
BATTERY_LEDSTATE = 0x1FF81085,
MENUTID = 0x1FF810A0,
ACTIVEMENUTID = 0x1FF810A8,
HEADSET_CONNECTED = 0x1FF810C0
};
const char * getModel(void);
const char * getRegion(void);
const char getFirmRegion(void);
const char * getLang(void);
char * getMacAddress(void);
char * getRunningHW(void);
char * isDebugUnit(void);
char * getScreenType(void);
u64 getLocalFriendCodeSeed(void);
u8 * getSerialNumber(void);

View File

@ -26,9 +26,8 @@ char * getVersion(int version)
memset(nver, 0, sizeof(OS_VersionBin));
memset(cver, 0, sizeof(OS_VersionBin));
ret = osGetSystemVersionData(nver, cver);
if (ret)
if (R_FAILED(ret = osGetSystemVersionData(nver, cver)))
snprintf(str_sysver, 100, "0x%08liX", ret);
else
snprintf(str_sysver, 100, "%d.%d.%d-%d%c",

View File

@ -117,7 +117,7 @@ const char * getLang(void)
char * getMacAddress(void)
{
u8 * macByte = (u8 *)0x1FF81060;
u8 * macByte = (u8 *)WIFI_MACADDR;
static char macAddress[18];
snprintf(macAddress, 18, "%02X:%02X:%02X:%02X:%02X:%02X", *macByte, *(macByte + 1), *(macByte + 2), *(macByte + 3), *(macByte + 4), *(macByte + 5));
@ -125,10 +125,39 @@ char * getMacAddress(void)
return macAddress;
}
char * getRunningHW(void)
{
u8 * data = (u8 *)RUNNING_HW;
static char runningHW[0x9];
switch (*data)
{
case 1:
snprintf(runningHW, 0x7, "Retail");
break;
case 2:
snprintf(runningHW, 0x9, "Devboard");
break;
case 3:
snprintf(runningHW, 0x9, "Debugger");
break;
case 4:
snprintf(runningHW, 0x8, "Capture");
break;
}
return runningHW;
}
char * isDebugUnit(void)
{
return *(char *)0x1FF80015 ? "(Debug Unit)" : "";
}
char * getScreenType(void)
{
static char uScreenType[20];
static char dScreenType[20];
static char upperScreen[20];
static char lowerScreen[20];
static char screenType[32];
@ -144,31 +173,31 @@ char * getScreenType(void)
switch ((screens >> 4) & 0xF)
{
case 1: // 0x01 = JDI => IPS
sprintf(uScreenType, "Upper: IPS");
case 0x01: // 0x01 = JDI => IPS
sprintf(upperScreen, "Upper: IPS");
break;
case 0xC: // 0x0C = SHARP => TN
sprintf(uScreenType, "Upper: TN");
case 0x0C: // 0x0C = SHARP => TN
sprintf(upperScreen, "Upper: TN");
break;
default:
sprintf(uScreenType, "Upper: Unknown");
sprintf(upperScreen, "Upper: Unknown");
break;
}
switch (screens & 0xF)
{
case 1: // 0x01 = JDI => IPS
sprintf(dScreenType, " | Lower: IPS");
case 0x01: // 0x01 = JDI => IPS
sprintf(lowerScreen, " | Lower: IPS");
break;
case 0xC: // 0x0C = SHARP => TN
sprintf(dScreenType, " | Lower: TN");
case 0x0C: // 0x0C = SHARP => TN
sprintf(lowerScreen, " | Lower: TN");
break;
default:
sprintf(dScreenType, " | Lower: Unknown");
sprintf(lowerScreen, " | Lower: Unknown");
break;
}
strcpy(screenType, uScreenType);
strcat(screenType, dScreenType);
strcpy(screenType, upperScreen);
strcat(screenType, lowerScreen);
}
else
sprintf(screenType, "Upper: TN | Lower: TN");