2014-07-25 20:42:07 +02:00
|
|
|
#ifndef __SYS_H__
|
|
|
|
#define __SYS_H__
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
#include <ogc\lwp_watchdog.h>
|
2014-07-25 20:42:07 +02:00
|
|
|
#include "tools.h"
|
2014-06-19 19:47:13 +02:00
|
|
|
|
|
|
|
#define AHB_ACCESS (*(vu32*)0xcd800064 == 0xFFFFFFFF)
|
2014-02-10 16:00:50 +01:00
|
|
|
#define MEM_REG_BASE 0xd8b4000
|
|
|
|
#define MEM_PROT (MEM_REG_BASE + 0x20a)
|
2015-02-07 08:33:33 +01:00
|
|
|
#define HOLLYWOOD_VERSION (*(vu32*)0x80003138)
|
2014-02-10 16:00:50 +01:00
|
|
|
#define LOADER_STUB (vu32*)0x80001800
|
2015-03-13 09:16:55 +01:00
|
|
|
#define IOS_START (*((vu32*)0x80003130))
|
|
|
|
#define IOS_END (*((vu32*)0x80003134))
|
|
|
|
//#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE)
|
|
|
|
#define IS_WII_U ((*(vu16*)(0xCd8005A2)) == 0xCAFE)
|
2014-02-20 17:22:19 +01:00
|
|
|
#define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0])))
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-10-21 18:41:01 +02:00
|
|
|
// Turn upper and lower into a full title ID
|
|
|
|
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
|
|
|
|
// Get upper or lower half of a title ID
|
|
|
|
#define TITLE_UPPER(x) ((u32)((x) >> 32))
|
|
|
|
// Turn upper and lower into a full title ID
|
|
|
|
#define TITLE_LOWER(x) ((u32)(x))
|
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
enum {
|
|
|
|
APP_TITLE = 0,
|
|
|
|
APP_IOS,
|
|
|
|
BLANK_LINE,
|
|
|
|
TEXT_REGION,
|
|
|
|
SYSMENU,
|
|
|
|
PRIILOADER,
|
|
|
|
DVD,
|
|
|
|
HBC,
|
|
|
|
HBF,
|
|
|
|
HOLLYWOOD,
|
|
|
|
CONSOLE_ID,
|
2014-02-13 10:16:23 +01:00
|
|
|
CONSOLE_TYPE,
|
2013-10-12 20:38:34 +02:00
|
|
|
COUNTRY,
|
|
|
|
BOOT2_VERSION,
|
|
|
|
NR_OF_TITLES,
|
|
|
|
NR_OF_IOS,
|
|
|
|
BLANK,
|
|
|
|
LAST
|
|
|
|
};
|
|
|
|
|
2015-01-28 18:14:15 +01:00
|
|
|
enum {
|
|
|
|
CONSOLE_WII = 0,
|
|
|
|
CONSOLE_WII_U
|
|
|
|
};
|
|
|
|
|
2014-02-13 10:16:23 +01:00
|
|
|
enum {
|
|
|
|
HBC_NONE = 0,
|
|
|
|
HBC_HAXX,
|
|
|
|
HBC_JODI,
|
|
|
|
HBC_1_0_7,
|
|
|
|
HBC_LULZ
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
HBF_NONE = 0,
|
|
|
|
HBF_HBF0,
|
|
|
|
HBF_THBF
|
|
|
|
};
|
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
enum {
|
|
|
|
TID_CBOOT2 = 252, // cBoot252
|
|
|
|
TID_NANDEMU,
|
|
|
|
TID_BOOTMII,
|
|
|
|
TID_BC = 256,
|
|
|
|
TID_MIOS,
|
|
|
|
TID_NAND = 512,
|
|
|
|
TID_WFS
|
|
|
|
};
|
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
typedef struct {
|
|
|
|
s32 revision;
|
|
|
|
bool isStub;
|
|
|
|
bool infoFakeSignature;
|
|
|
|
bool infoESIdentify;
|
|
|
|
bool infoFlashAccess;
|
|
|
|
bool infoNANDAccess;
|
|
|
|
bool infoBoot2Access;
|
|
|
|
bool infoUSB2;
|
|
|
|
bool infoVersionPatch;
|
2014-08-22 19:55:55 +02:00
|
|
|
bool infovIOS;
|
2013-10-12 20:38:34 +02:00
|
|
|
s32 baseIOS;
|
|
|
|
s32 mloadVersion;
|
2014-02-20 17:22:19 +01:00
|
|
|
char info[64];
|
2013-10-12 20:38:34 +02:00
|
|
|
u8 infoContent;
|
|
|
|
u32 titleID;
|
|
|
|
u8 num_contents;
|
2014-07-25 20:42:07 +02:00
|
|
|
u32 titleSize;
|
2015-03-13 09:16:55 +01:00
|
|
|
} IOS_t;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bool hasInfo;
|
|
|
|
u32 realRevision;
|
|
|
|
char info[0x10];
|
2015-03-13 09:16:55 +01:00
|
|
|
} sysMenu_t;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
typedef struct _U8Header
|
|
|
|
{
|
|
|
|
u32 fcc;
|
|
|
|
u32 rootNodeOffset;
|
|
|
|
u32 headerSize;
|
|
|
|
u32 dataOffset;
|
|
|
|
u8 zeroes[16];
|
|
|
|
} __attribute__((packed)) U8Header;
|
|
|
|
|
|
|
|
typedef struct _U8Entry
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 fileType :8;
|
|
|
|
u32 nameOffset :24;
|
|
|
|
};
|
|
|
|
u32 fileOffset;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
u32 fileLength;
|
|
|
|
u32 numEntries;
|
|
|
|
};
|
|
|
|
} __attribute__( ( packed ) ) U8Entry;
|
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
extern const char *Regions[];
|
|
|
|
extern u8 sysMenuInfoContent;
|
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Prototypes
|
2014-07-25 20:42:07 +02:00
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
char GetSysMenuRegion(u32 sysVersion);
|
2013-10-12 20:38:34 +02:00
|
|
|
bool GetCertificates(void);
|
|
|
|
u32 GetSysMenuVersion(void);
|
|
|
|
float GetSysMenuNintendoVersion(u32 sysVersion);
|
|
|
|
u32 GetBoot2Version(void);
|
|
|
|
u32 GetDeviceID(void);
|
2015-02-07 08:33:33 +01:00
|
|
|
bool CheckIOSType(void);
|
2013-10-12 20:38:34 +02:00
|
|
|
bool CheckFakeSignature(void);
|
|
|
|
bool CheckESIdentify(void);
|
|
|
|
bool CheckFlashAccess(void);
|
|
|
|
bool CheckNANDAccess(void);
|
|
|
|
bool CheckBoot2Access(void);
|
|
|
|
bool CheckMload(void);
|
2014-02-13 10:16:23 +01:00
|
|
|
bool CheckUSB2(u32 titleID);
|
|
|
|
bool IsKnownStub(u32 noIOS, s32 noRevision);
|
2013-10-12 20:38:34 +02:00
|
|
|
s32 GetTMD(u64 TicketID, signed_blob **Output, u32 *Length);
|
|
|
|
s32 read_file_from_nand(char *filepath, u8 **buffer, u32 *filesize);
|
2013-10-21 18:41:01 +02:00
|
|
|
int checkSysLoader(void);
|
2013-10-12 20:38:34 +02:00
|
|
|
void transmitSyscheck(char ReportBuffer[200][100], int *lines);
|
|
|
|
s32 brute_tmd(tmd *p_tmd);
|
|
|
|
s32 get_miosinfo(char *str);
|
2014-07-06 20:53:35 +02:00
|
|
|
int get_title_ios(u64 title);
|
2015-03-13 09:16:55 +01:00
|
|
|
bool getInfoFromContent(IOS_t *ios);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|