Skip to content

Commit ed9b8fc

Browse files
committed
sys_report: dont write to uart on retail units
1 parent 49b62a0 commit ed9b8fc

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎libogc/sys_report.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,23 @@ static ssize_t __uart_write(const char *buffer,size_t len)
5353
if(EXI_Deselect(EXI_CHANNEL_0)==0) ret |= 0x08;
5454
if(EXI_Unlock(EXI_CHANNEL_0)==0) ret |= 0x10;
5555

56-
return len;
56+
return ret;
5757
}
5858

5959
#define __outsz 256
6060

6161
static ssize_t __uart_stdio_write(struct _reent *r, void *fd, const char *ptr, size_t len)
6262
{
63+
// on retail consoles, there is no UART and the address shared with rtc so... no.
64+
// Dolphin reports as devkit, so it keeps working there
65+
#ifdef __gamecube__
66+
if (((*(vu32 *)0xCC006024) & 0xFF) == 0xFF)
67+
return len;
68+
#elif defined(__wii__)
69+
if (((*(vu32 *)0xCD006024) & 0xFF) != 0x01)
70+
return len;
71+
#endif
72+
6373
// translate \n and \r\n to \r for Dolphin handling
6474
char *p = (char*)ptr;
6575
char *buf = (char*)ptr;

0 commit comments

Comments
 (0)