Skip to content

Commit 3221b66

Browse files
committed
[ppctty] quit if console is not deckard
1 parent 3c3b469 commit 3221b66

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

iop/debug/ppctty/src/main.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
#include <excepman.h>
55
#include "tty.h"
66

7-
IRX_ID("ppctty", 1, 0);
7+
IRX_ID(MODNAME, 1, 0);
8+
9+
#define IS_DECKARD() \
10+
({ \
11+
u16 iop_revision; \
12+
asm("mfc0 %0, $15\n" \
13+
: "=r"(iop_revision):); \
14+
iop_revision == 0x30; \
15+
})
816

917
volatile uint8_t *PPC_UART_TX = (volatile uint8_t *) 0x1F80380C;
1018

@@ -19,7 +27,12 @@ int _start(int argc, char *argv[])
1927
{
2028
(void)argc;
2129
(void)argv;
22-
30+
if (!IS_DECKARD())
31+
{
32+
printf(MODNAME ": THIS PS2 IS NOT DECKARD\n");
33+
return MODULE_NO_RESIDENT_END;
34+
}
35+
2336
if(tty_init() != 0)
2437
{
2538
printf("Failed initializing PPC TTY system!\n");

iop/debug/ppctty/src/tty.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ IOP->PPC TTY
1313
#include <intrman.h>
1414
#include <ioman.h>
1515
#include <thsemap.h>
16+
#include "tty.h"
1617

1718
#ifdef DEBUG
18-
#define DPRINTF(fmt, x...) printf("ppctty: "fmt, ##x)
19+
#define DPRINTF(fmt, x...) printf(MODNAME ": " fmt, ##x)
1920
#else
2021
#define DPRINTF(x...)
2122
#endif

iop/debug/ppctty/src/tty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "tamtypes.h"
55
#include <stdint.h>
6-
6+
#define MODNAME "ppctty"
77
// Prototypes
88
int tty_init(void);
99

0 commit comments

Comments
 (0)