diff --git a/gc/ogc/system.h b/gc/ogc/system.h index 16d7441..3b5a116 100644 --- a/gc/ogc/system.h +++ b/gc/ogc/system.h @@ -98,6 +98,38 @@ distribution. *@} */ +#define SYS_CONSOLE_MASK 0xf0000000 +#define SYS_CONSOLE_RETAIL 0x00000000 +#define SYS_CONSOLE_DEVELOPMENT 0x10000000 +#define SYS_CONSOLE_TDEV 0x20000000 + +#if defined(HW_DOL) +#define SYS_CONSOLE_RETAIL_HW1 0x00000001 +#define SYS_CONSOLE_RETAIL_HW2 0x00000002 +#define SYS_CONSOLE_RETAIL_HW3 0x00000003 +#define SYS_CONSOLE_DEVELOPMENT_HW1 0x10000004 +#define SYS_CONSOLE_DEVELOPMENT_HW2 0x10000005 +#define SYS_CONSOLE_DEVELOPMENT_HW3 0x10000006 +#define SYS_CONSOLE_TDEV_HW1 0x20000004 +#define SYS_CONSOLE_TDEV_HW2 0x20000005 +#define SYS_CONSOLE_TDEV_HW3 0x20000006 +#elif defined(HW_RVL) +#define SYS_CONSOLE_RETAIL_ES1_0 0x00000010 +#define SYS_CONSOLE_RETAIL_ES1_1 0x00000011 +#define SYS_CONSOLE_RETAIL_ES1_2 0x00000012 +#define SYS_CONSOLE_RETAIL_ES2_0 0x00000020 +#define SYS_CONSOLE_RETAIL_ES2_1 0x00000021 +#define SYS_CONSOLE_RETAIL_ES3_0 0x00000030 +#define SYS_CONSOLE_RETAIL_ES3_1 0x00000031 +#define SYS_CONSOLE_NDEV_ES1_0 0x10000010 +#define SYS_CONSOLE_NDEV_ES1_1 0x10000011 +#define SYS_CONSOLE_NDEV_ES1_2 0x10000012 +#define SYS_CONSOLE_NDEV_ES2_0 0x10000020 +#define SYS_CONSOLE_NDEV_ES2_1 0x10000021 +#define SYS_CONSOLE_NDEV_ES3_0 0x10000030 +#define SYS_CONSOLE_NDEV_ES3_1 0x10000031 +#endif + #define SYS_LANG_ENGLISH 0 #define SYS_LANG_GERMAN 1 #define SYS_LANG_FRENCH 2 @@ -350,6 +382,7 @@ void SYS_SetWirelessID(u32 chan,u16 id); u16 SYS_GetGBSMode(void); void SYS_SetGBSMode(u16 mode); +u32 SYS_GetConsoleType(void); u32 SYS_GetFontEncoding(void); u32 SYS_InitFont(sys_fontheader *font_data); void SYS_GetFontTexture(s32 c,void **image,s32 *xpos,s32 *ypos,s32 *width); diff --git a/libogc/exi.c b/libogc/exi.c index 217d00d..876ef6e 100644 --- a/libogc/exi.c +++ b/libogc/exi.c @@ -34,6 +34,7 @@ distribution. #include "asm.h" #include "irq.h" #include "processor.h" +#include "system.h" #include "cache.h" #include "exi.h" #include "lwp.h" @@ -1091,10 +1092,13 @@ void __SYS_EnableBarnacle(s32 chn,u32 dev) s32 InitializeUART(void) { if(exi_uart_barnacle_enabled==0xa5ff005a) return 0; + if((SYS_GetConsoleType()&SYS_CONSOLE_MASK)!=SYS_CONSOLE_DEVELOPMENT) { + exi_uart_enabled = 0; + return 2; + } exi_uart_chan = EXI_CHANNEL_0; exi_uart_dev = EXI_DEVICE_1; - exi_uart_enabled = 0xa5ff005a; return 0; } diff --git a/libogc/system.c b/libogc/system.c index a463813..026328e 100644 --- a/libogc/system.c +++ b/libogc/system.c @@ -2025,7 +2025,22 @@ void SYS_SetGBSMode(u16 mode) __SYS_UnlockSramEx(write); } -#if defined(HW_RVL) +#if defined(HW_DOL) +u32 SYS_GetConsoleType(void) +{ + u32 type; + type = *((u32*)0x8000002c); + return type; +} +#elif defined(HW_RVL) +u32 SYS_GetConsoleType(void) +{ + u32 type; + type = SYS_CONSOLE_RETAIL_ES1_0; + type += *((u32*)0x80003138); + return type; +} + u32 SYS_GetHollywoodRevision(void) { u32 rev;