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)
 
char * is_debug_print (char *arg0, const char *str, size_t count)
 
void is_debug_init (void)
 
void printf (const char *fmt,...)
 
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 {
68 strncpy(crashScreenAssertMessage, message, sizeof(crashScreenAssertMessage));
70}
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 46 of file is_debug.c.

46 {
47 u32 data;
48 s32 pos;
49 s32 start;
50 s32 end;
51
52 osEPiReadIo(nuPiCartHandle, (u32) &gISVDbgPrnAdrs->magic, &data);
53 if (data != ASCII_TO_U32('I', 'S', '6', '4')) {
54 return (char*) 1;
55 }
56 osEPiReadIo(nuPiCartHandle, (u32) &gISVDbgPrnAdrs->get, &data);
57 pos = data;
58 osEPiReadIo(nuPiCartHandle, (u32) &gISVDbgPrnAdrs->put, &data);
59 start = data;
60 end = start + count;
61 if (end >= 0xffe0) {
62 end -= 0xffe0;
63 if (pos < end || start < pos) {
64 return (char*) 1;
65 }
66 } else {
67 if (start < pos && pos < end) {
68 return (char*) 1;
69 }
70 }
71 while (count) {
72 u8 c = *str;
73
74 if (c != 0) {
75 u32 addr = (u32) &gISVDbgPrnAdrs->data + (start & 0xffffffc);
76 s32 shift = ((3 - (start & 3)) * 8);
77
78 osEPiReadIo(nuPiCartHandle, addr, &data);
79 osEPiWriteIo(nuPiCartHandle, addr, (data & ~(0xff << shift)) | ((u8)*str << shift));
80
81 start++;
82 if (start >= 0xffe0) {
83 start -= 0xffe0;
84 }
85 }
86 count--;
87 str++;
88 }
89 osEPiWriteIo(nuPiCartHandle, (u32)&gISVDbgPrnAdrs->put, start);
90 return (char*) 1;
91}
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:179

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

◆ is_debug_init()

void is_debug_init ( void )

Definition at line 19 of file is_debug.c.

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

Referenced by boot_main().

◆ printf()

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

Definition at line 25 of file is_debug.c.

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

◆ osSyncPrintf()

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

Definition at line 32 of file is_debug.c.

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

Referenced by __bt_analyze_func(), address2symbol(), debug_backtrace(), and load_texture_by_name().

◆ rmonPrintf()

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

Definition at line 39 of file is_debug.c.

39 {
40 va_list args;
41 va_start(args, fmt);
42
43 _Printf(is_debug_print, NULL, fmt, args);
44}

◆ is_debug_panic()

void is_debug_panic ( const char * message)

Definition at line 93 of file is_debug.c.

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