diff --git a/ldscript.lcf b/ldscript.lcf index 95fe8e566..687e7c38c 100644 --- a/ldscript.lcf +++ b/ldscript.lcf @@ -22,17 +22,10 @@ extabindex_ ALIGN(0x20):{} .sbss2 ALIGN(0x20):{} .stack ALIGN(0x100):{} } > text -_stack_addr = (_f_sbss2 + SIZEOF(.sbss2) + 65536 + 0x7) & ~0x7; +_stack_addr = (_f_sbss2 + SIZEOF(.sbss2) + 0x10000 + 0x7) & ~0x7; _stack_end = _f_sbss2 + SIZEOF(.sbss2); _db_stack_addr = (_stack_addr + 0x2000); _db_stack_end = _stack_addr; __ArenaLo = (_db_stack_addr + 0x1f) & ~0x1f; __ArenaHi = 0x81700000 ; } - -/* #pragma force_active on is NOT working for this symbol for some reason. So the linker - * gets to have a crowbar in its face to stop this symbol from being stripped. Don't you - * just love Metrowerks bugs? */ -FORCEACTIVE { - HSD_Debug_804C28D0 -} diff --git a/src/sysdolphin/baselib/debug.c b/src/sysdolphin/baselib/debug.c index f9f55e7d9..439e26562 100644 --- a/src/sysdolphin/baselib/debug.c +++ b/src/sysdolphin/baselib/debug.c @@ -1,6 +1,9 @@ +#include "debug.h" + +#include "synth.h" + #include #include -#include struct UnkStruct80400430 { char filler0[0x52]; @@ -9,43 +12,15 @@ struct UnkStruct80400430 { int (*unk84)(s32, s32, s32*, s32); }; -extern void (*HSD_Synth_804D7710)(s32, s32); -extern void (*HSD_Synth_804D7714)(OSContext*, ...); -extern int (*HSD_Synth_804D7718)(s32, s32, s32*, s32); - extern struct UnkStruct80400430 __files; -OSContext HSD_Debug_804C2608; +struct DebugContext { + OSContext context; + u8 unk[0x10]; +} HSD_Debug_804C2608; #ifdef MUST_MATCH -/* - * Unused symbol probably used by the myStrippedFunction below, but since it - * got stripped there's no telling what it was for. - * - * Regarding the pragma, normally this works, but in this case the Metrowerks - * toolchain is out for fuckin' blood or something. See the FORCEACTIVE section - * we had to add in the LCF just to get the compiler to stop removing this. - */ -#pragma push -#pragma force_active on -extern char HSD_Debug_804C28D0[0x10]; -#pragma pop -#endif - -char HSD_Debug_804C28D0[0x10]; // unk space. what is this? - -static char HSD_Debug_804D6010[1] = ""; - -#ifdef MUST_MATCH -// required stripped asm function to get the peephole off behavior in early -// CW versions to occur. -static void asm myStrippedFunction() -{ // clang-format off - nop - nop - nop - nop -} // clang-format on +#pragma peephole off #endif int HSD_Debug_8038815C(s32 arg0, s32 arg1, s32* arg2, s32 arg3) @@ -69,15 +44,15 @@ void HSD_Debug_803881E4(void) void __assert(char* str, u32 arg1, char* arg2) { OSReport("assertion \"%s\" failed", arg2); - HSD_Panic(str, arg1, HSD_Debug_804D6010); + HSD_Panic(str, arg1, ""); } void HSD_Panic(char* arg0, u32 line, char* arg2) { if (HSD_Synth_804D7714 != NULL) { - OSSaveContext(&HSD_Debug_804C2608); + OSSaveContext(&HSD_Debug_804C2608.context); OSReport("%s in %s on line %d.\n", arg2, arg0, line); - HSD_Synth_804D7714(&HSD_Debug_804C2608); + HSD_Synth_804D7714(&HSD_Debug_804C2608.context); } OSPanic(arg0, line, arg2); } diff --git a/src/sysdolphin/baselib/synth.h b/src/sysdolphin/baselib/synth.h index 21c406c6f..e7c6e58d9 100644 --- a/src/sysdolphin/baselib/synth.h +++ b/src/sysdolphin/baselib/synth.h @@ -1,4 +1,10 @@ #ifndef SYSDOLPHIN_BASELIB_SYNTH_H #define SYSDOLPHIN_BASELIB_SYNTH_H +#include + +extern void (*HSD_Synth_804D7710)(s32, s32); +extern void (*HSD_Synth_804D7714)(OSContext*, ...); +extern int (*HSD_Synth_804D7718)(s32, s32, s32*, s32); + #endif