Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
is_debug.c File Reference

Go to the source code of this file.

Data Structures

struct  ISVDbg
 

Macros

#define gISVDbgPrnAdrs   ((ISVDbg*) 0xb3ff0000)
 

Functions

void crash_screen_set_assert_info (const char *message)
 
charis_debug_print (char *arg0, const char *str, size_t count)
 
void is_debug_init (void)
 
int printf (const char *restrict fmt,...)
 
int __printf_chk (int flag, const char *restrict fmt,...)
 
int puts (const char *s)
 
void osSyncPrintf (const char *fmt,...)
 
void rmonPrintf (const char *fmt,...)
 
void is_debug_panic (const char *message)
 

Data Structure Documentation

◆ ISVDbg

struct ISVDbg
Data Fields
u32 magic
u32 get
char unk_08[0x14-0x08]
u32 put
char unk_18[0x20-0x18]
char data[0x10000-0x20]

Macro Definition Documentation

◆ gISVDbgPrnAdrs

#define gISVDbgPrnAdrs   ((ISVDbg*) 0xb3ff0000)

Definition at line 15 of file is_debug.c.

Referenced by is_debug_init(), and is_debug_print().

Function Documentation

◆ crash_screen_set_assert_info()

void crash_screen_set_assert_info ( const char * message)

Definition at line 67 of file crash_screen.c.

67 {
70}
BSS s32 PopupMenu_SelectedIndex
char crashScreenAssertMessage[0x100]

Referenced by is_debug_panic().

◆ is_debug_print()

char * is_debug_print ( char * arg0,
const char * str,
size_t count )

Definition at line 59 of file is_debug.c.

59 {
60 u32 data;
61 s32 pos;
62 s32 start;
63 s32 end;
64
66 if (data != ASCII_TO_U32('I', 'S', '6', '4')) {
67 return (char*) 1;
68 }
70 pos = data;
72 start = data;
73 end = start + count;
74 if (end >= 0xffe0) {
75 end -= 0xffe0;
76 if (pos < end || start < pos) {
77 return (char*) 1;
78 }
79 } else {
80 if (start < pos && pos < end) {
81 return (char*) 1;
82 }
83 }
84 while (count) {
85 u8 c = *str;
86
87 if (c != 0) {
88 u32 addr = (u32) &gISVDbgPrnAdrs->data + (start & 0xffffffc);
89 s32 shift = ((3 - (start & 3)) * 8);
90
91 osEPiReadIo(nuPiCartHandle, addr, &data);
92 osEPiWriteIo(nuPiCartHandle, addr, (data & ~(0xff << shift)) | ((u8)*str << shift));
93
94 start++;
95 if (start >= 0xffe0) {
96 start -= 0xffe0;
97 }
98 }
99 count--;
100 str++;
101 }
103 return (char*) 1;
104}
Vec3s pos
Definition demo_api.c:17
#define gISVDbgPrnAdrs
Definition is_debug.c:15
#define ASCII_TO_U32(a, b, c, d)
Definition macros.h:183

Referenced by __printf_chk(), osSyncPrintf(), printf(), and rmonPrintf().

◆ is_debug_init()

void is_debug_init ( void )

Definition at line 19 of file is_debug.c.

19 {
22 osEPiWriteIo(nuPiCartHandle, (u32) &gISVDbgPrnAdrs->magic, ASCII_TO_U32('I', 'S', '6', '4'));
23}

Referenced by boot_main().

◆ printf()

int printf ( const char *restrict fmt,
... )

Definition at line 25 of file is_debug.c.

25 {
26 va_list args;
27 va_start(args, fmt);
28
29 return _Printf(is_debug_print, NULL, fmt, args);
30}
int _Printf(outfun prout, char *arg, const char *fmt, va_list args)
char * is_debug_print(char *arg0, const char *str, size_t count)
Definition is_debug.c:59

Referenced by load_texture_by_name(), and puts().

◆ __printf_chk()

int __printf_chk ( int flag,
const char *restrict fmt,
... )

Definition at line 32 of file is_debug.c.

32 {
33 va_list args;
34 va_start(args, fmt);
35 (void)flag;
36
37 return _Printf(is_debug_print, NULL, fmt, args);
38}

◆ puts()

int puts ( const char * s)

Definition at line 40 of file is_debug.c.

40 {
41 printf("%s\n", s);
42 return 0;
43}
int printf(const char *restrict fmt,...)
Definition is_debug.c:25

◆ osSyncPrintf()

void osSyncPrintf ( const char * fmt,
... )

Definition at line 45 of file is_debug.c.

45 {
46 va_list args;
47 va_start(args, fmt);
48
49 _Printf(is_debug_print, NULL, fmt, args);
50}

◆ rmonPrintf()

void rmonPrintf ( const char * fmt,
... )

Definition at line 52 of file is_debug.c.

52 {
53 va_list args;
54 va_start(args, fmt);
55
56 _Printf(is_debug_print, NULL, fmt, args);
57}

◆ is_debug_panic()

void is_debug_panic ( const char * message)

Definition at line 106 of file is_debug.c.

106 {
108 *(volatile u32*)0 = 0; // Crash so we can see the crash screen
110}
void crash_screen_set_assert_info(const char *message)