You've already forked smb-decomp
mirror of
https://github.com/encounter/smb-decomp.git
synced 2026-03-30 11:38:28 -07:00
a0214ede7c
* initial work on gcc support * fix more gcc issues * fix ball.c crash when compiled with gcc * fixed white monkey face glitch * no need to support R_PPC_REL32 relocs after all * stop generating .eh_frame and .gnu.attributes sections * fix more instances of undefined behavior
57 lines
1003 B
C
57 lines
1003 B
C
#include <dolphin.h>
|
|
|
|
static struct
|
|
{
|
|
u8 filler0[4];
|
|
u32 unk4;
|
|
} *__DBInterface;
|
|
|
|
static int DBVerbose;
|
|
|
|
static void __DBExceptionDestination();
|
|
|
|
void DBInit(void)
|
|
{
|
|
__DBInterface = (void *)0x80000040;
|
|
*(u32 *)0x80000048 = (u32)__DBExceptionDestination - 0x80000000;
|
|
DBVerbose = 1;
|
|
return;
|
|
}
|
|
|
|
void __DBExceptionDestinationAux(void)
|
|
{
|
|
u8 dummy[8];
|
|
OSContext *ctx = (void *)(0x80000000 + *(u32 *)0xC0); // WTF??
|
|
OSReport("DBExceptionDestination\n");
|
|
OSDumpContext(ctx);
|
|
PPCHalt();
|
|
}
|
|
|
|
#ifdef __MWERKS__
|
|
static asm void __DBExceptionDestination(void)
|
|
{
|
|
nofralloc
|
|
mfmsr r3
|
|
ori r3, r3, 0x30
|
|
mtmsr r3
|
|
b __DBExceptionDestinationAux
|
|
}
|
|
#else
|
|
static void __DBExceptionDestination(void)
|
|
{
|
|
asm(
|
|
"mfmsr %r3\n"
|
|
"ori %r3, %r3, 0x30\n"
|
|
"mtmsr %r3\n"
|
|
"b __DBExceptionDestinationAux\n"
|
|
);
|
|
}
|
|
#endif
|
|
|
|
int __DBIsExceptionMarked(u8 a)
|
|
{
|
|
return __DBInterface->unk4 & (1 << a);
|
|
}
|
|
|
|
void DBPrintf(char *str, ...) {}
|