mirror of
https://github.com/zeldaret/ss
synced 2026-05-23 15:01:38 -04:00
Most of eggAssert
This commit is contained in:
@@ -420,6 +420,7 @@ egg/prim/eggAssert.cpp:
|
||||
.text start:0x8049BF90 end:0x8049C5BC
|
||||
.data start:0x8056EC88 end:0x8056ED00
|
||||
.sbss start:0x805767F8 end:0x80576808
|
||||
.bss start:0x80674C60 end:0x80674D68
|
||||
|
||||
egg/gfx/eggCamera.cpp:
|
||||
.text start:0x8049C5C0 end:0x8049CAC8
|
||||
|
||||
+13
-13
@@ -17227,7 +17227,7 @@ fn_802DEF80 = .text:0x802DEF80; // type:function size:0x8
|
||||
fn_802DEF90 = .text:0x802DEF90; // type:function size:0x4C
|
||||
fn_802DEFE0 = .text:0x802DEFE0; // type:function size:0x80
|
||||
OSReport = .text:0x802DF060; // type:function size:0x80 scope:weak
|
||||
vprintf = .text:0x802DF0E0; // type:function size:0x4 scope:global
|
||||
OSVReport = .text:0x802DF0E0; // type:function size:0x4 scope:global
|
||||
fn_802DF0F0 = .text:0x802DF0F0; // type:function size:0x10
|
||||
fn_802DF100 = .text:0x802DF100; // type:function size:0xA0
|
||||
fn_802DF1A0 = .text:0x802DF1A0; // type:function size:0x48
|
||||
@@ -22143,7 +22143,7 @@ fn_803B3490 = .text:0x803B3490; // type:function size:0x8
|
||||
fn_803B34A0 = .text:0x803B34A0; // type:function size:0x198
|
||||
fn_803B3640 = .text:0x803B3640; // type:function size:0x80C
|
||||
VISetPreRetraceCallback = .text:0x803B3E50; // type:function size:0x44
|
||||
fn_803B3EA0 = .text:0x803B3EA0; // type:function size:0x44
|
||||
VISetPostRetraceCallback = .text:0x803B3EA0; // type:function size:0x44
|
||||
fn_803B3EF0 = .text:0x803B3EF0; // type:function size:0x118
|
||||
fn_803B4010 = .text:0x803B4010; // type:function size:0x200
|
||||
VIInit = .text:0x803B4210; // type:function size:0x548
|
||||
@@ -24182,7 +24182,7 @@ XStrToU32___Q24nw4r2dbFPCUc = .text:0x80436D20; // type:function size:0xCC
|
||||
CopySymbol___Q24nw4r2dbFPCUcPUcUlUc = .text:0x80436DF0; // type:function size:0x2DC
|
||||
QuerySymbolToMapFile___Q24nw4r2dbFPUcPC12OSModuleInfoUlPUcUl = .text:0x804370D0; // type:function size:0xD8
|
||||
QuerySymbolToSingleMapFile___Q24nw4r2dbFPQ34nw4r2db7MapFileUlPUcUl = .text:0x804371B0; // type:function size:0xF8
|
||||
MapFile_QuerySymbol__Q24nw4r2dbFUlPUcUl = .text:0x804372B0; // type:function size:0x104
|
||||
MapFile_QuerySymbol__Q24nw4r2dbFPvPcUi = .text:0x804372B0; // type:function size:0x104
|
||||
Assertion_SetConsole__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x804373C0; // type:function size:0x10
|
||||
FExp__Q34nw4r4math6detailFf = .text:0x804373D0; // type:function size:0xAC
|
||||
FLog__Q34nw4r4math6detailFf = .text:0x80437480; // type:function size:0xA4
|
||||
@@ -26394,15 +26394,15 @@ normalise__Q23EGG8Vector3fFv = .text:0x8049BCC0; // type:function size:0x84
|
||||
setLength__Q23EGG8Vector3fFRCQ23EGG8Vector3ff = .text:0x8049BD50; // type:function size:0xB8
|
||||
setLength__Q23EGG8Vector3fFf = .text:0x8049BE10; // type:function size:0xA0
|
||||
__sinit_\eggVector_cpp = .text:0x8049BEB0; // type:function size:0xE0 scope:local
|
||||
egg_assert_waittime = .text:0x8049BF90; // type:function size:0x78
|
||||
egg_assert_vreport = .text:0x8049C010; // type:function size:0x4
|
||||
egg_assert_report = .text:0x8049C020; // type:function size:0x80
|
||||
egg_assert_get_file_name = .text:0x8049C0A0; // type:function size:0x54
|
||||
egg_assert_querySymbol = .text:0x8049C100; // type:function size:0x44
|
||||
egg_assert_isOutsideMEM1 = .text:0x8049C150; // type:function size:0x2C
|
||||
egg_assert_set_callback = .text:0x8049C180; // type:function size:0x10
|
||||
egg_assert_halt = .text:0x8049C190; // type:function size:0x398
|
||||
egg_assert_assert = .text:0x8049C530; // type:function size:0x8C
|
||||
wait__Q23EGG6AssertFUi = .text:0x8049BF90; // type:function size:0x78
|
||||
system_vreport__Q23EGG6AssertFPCcP16__va_list_struct = .text:0x8049C010; // type:function size:0x4
|
||||
system_report__Q23EGG6AssertFPCce = .text:0x8049C020; // type:function size:0x80
|
||||
getPeriodPos__Q23EGG6AssertFPCc = .text:0x8049C0A0; // type:function size:0x54
|
||||
getMapSymbol__Q23EGG6AssertFPv = .text:0x8049C100; // type:function size:0x44
|
||||
isOutsideMEM1__Q23EGG6AssertFUi = .text:0x8049C150; // type:function size:0x2C
|
||||
setAssertCallback__Q23EGG6AssertFPFv_v = .text:0x8049C180; // type:function size:0x10
|
||||
system_halt__Q23EGG6AssertFPCcUiPCcP16__va_list_struct = .text:0x8049C190; // type:function size:0x398
|
||||
assert__Q23EGG6AssertFPCcUiPCce = .text:0x8049C530; // type:function size:0x8C
|
||||
FUN_8049c5c0 = .text:0x8049C5C0; // type:function size:0x10
|
||||
FUN_8049c5d0 = .text:0x8049C5D0; // type:function size:0x50
|
||||
FUN_8049c620 = .text:0x8049C620; // type:function size:0x44
|
||||
@@ -40910,7 +40910,7 @@ zero__Q23EGG8Vector3s = .sbss:0x805767D8; // type:object size:0x6 data:2byte
|
||||
ex__Q23EGG8Vector3s = .sbss:0x805767E0; // type:object size:0x6 data:2byte
|
||||
ey__Q23EGG8Vector3s = .sbss:0x805767E8; // type:object size:0x6 data:2byte
|
||||
ez__Q23EGG8Vector3s = .sbss:0x805767F0; // type:object size:0x6 data:2byte
|
||||
lbl_805767F8 = .sbss:0x805767F8; // type:object size:0x4 data:4byte
|
||||
sAssertCallback__Q23EGG6Assert = .sbss:0x805767F8; // type:object size:0x4 data:4byte
|
||||
lbl_805767FC = .sbss:0x805767FC; // type:object size:0x4 data:4byte
|
||||
lbl_80576800 = .sbss:0x80576800; // type:object size:0x4 data:4byte
|
||||
lbl_80576804 = .sbss:0x80576804; // type:object size:0x1 data:byte
|
||||
|
||||
@@ -36,5 +36,6 @@ void *__va_arg(_va_list_struct *, int);
|
||||
#define __va_end(list) ((void)0)
|
||||
|
||||
#define __va_copy(a, b) (*(a) = *(b))
|
||||
#define va_copy __va_copy
|
||||
|
||||
#endif /* __VA_ARG_H */
|
||||
|
||||
@@ -8,14 +8,17 @@ namespace EGG {
|
||||
// TODO: Fixup funtions
|
||||
namespace Assert {
|
||||
|
||||
typedef void (*AssertCallback)();
|
||||
|
||||
/* 8049bf90 */ void wait(u32 time);
|
||||
/* 8049c010 */ void system_print();
|
||||
/* 8049c010 */ void system_report();
|
||||
/* 8049c0a0 */ s32 getPeriodPos(char *);
|
||||
/* 8049c010 */ void system_vreport(const char *str, va_list list);
|
||||
/* 8049c010 */ void system_report(const char *str, ...);
|
||||
/* 8049c0a0 */ s32 getPeriodPos(const char *);
|
||||
/* 8049c100 */ char *getMapSymbol();
|
||||
/* 8049c150 */ bool isOutsideMEM1(u32 addr);
|
||||
/* 8049c190 */ void system_halt();
|
||||
/* 8049c530 */ void assert();
|
||||
/* 8049c180 */ AssertCallback setAssertCallback(AssertCallback cb);
|
||||
/* 8049c190 */ void system_halt(const char *file, u32 line, const char *msg, va_list list);
|
||||
/* 8049c530 */ void assert(const char *file, u32 line, const char *msg, ...);
|
||||
|
||||
} // namespace Assert
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ extern OSErrorHandler __OSErrorTable[OS_ERR_MAX];
|
||||
extern u32 __OSFpscrEnableBits;
|
||||
|
||||
DECL_WEAK void OSReport(const char *msg, ...);
|
||||
DECL_WEAK void OSVReport(const char *msg, va_list args);
|
||||
DECL_WEAK void OSPanic(const char *file, int line, const char *msg, ...);
|
||||
|
||||
OSErrorHandler OSSetErrorHandler(u16 error, OSErrorHandler handler);
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
#include <Runtime.PPCEABI.H/__va_arg.h>
|
||||
#include <egg/core/eggSystem.h>
|
||||
#include <egg/core/eggXfbManager.h>
|
||||
#include <egg/prim/eggAssert.h>
|
||||
#include <nw4r/db/db_directPrint.h>
|
||||
#include <rvl/OS.h>
|
||||
#include <rvl/VI.h>
|
||||
#include <MSL_C/string.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace db {
|
||||
// TODO
|
||||
extern s32 MapFile_QuerySymbol(void *arg, char *buf, u32 buf_size);
|
||||
} // namespace db
|
||||
} // namespace nw4r
|
||||
|
||||
namespace EGG {
|
||||
|
||||
namespace Assert {
|
||||
|
||||
AssertCallback sAssertCallback;
|
||||
AssertCallback sAssertCallback2;
|
||||
u32 sPtrOverride;
|
||||
bool sInstantHalt;
|
||||
bool sAssertOccurred;
|
||||
|
||||
/* 8049bf90 */ void wait(u32 time) {
|
||||
u32 tick = OSGetTick();
|
||||
u32 tick2;
|
||||
do {
|
||||
tick2 = OSGetTick();
|
||||
} while ((tick2 - tick) / (OS_BUS_CLOCK_SPEED / 4 / 1000) < time);
|
||||
}
|
||||
|
||||
// extern "C" void OSVReport(const char *str, va_list list);
|
||||
|
||||
/* 8049c010 */ void system_vreport(const char *str, va_list list) {
|
||||
OSVReport(str, list);
|
||||
}
|
||||
/* 8049c010 */ void system_report(const char *str, ...) {
|
||||
va_list l;
|
||||
va_start(l, str);
|
||||
system_vreport(str, l);
|
||||
va_end(l);
|
||||
}
|
||||
/* 8049c0a0 */ s32 getPeriodPos(const char *str) {
|
||||
char *b = strchr(str, '.');
|
||||
s32 len;
|
||||
if (b == nullptr) {
|
||||
len = strlen(str);
|
||||
} else {
|
||||
len = b - str;
|
||||
}
|
||||
|
||||
if (len > 0xff) {
|
||||
return 0xff;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/* 80674c60 */ char buf[260];
|
||||
|
||||
/* 8049c100 */ const char *getMapSymbol(void *arg) {
|
||||
u32 success = nw4r::db::MapFile_QuerySymbol(arg, buf, sizeof(buf));
|
||||
return success ? buf : nullptr;
|
||||
}
|
||||
|
||||
/* 8049c150 */ bool isOutsideMEM1(u32 addr) {
|
||||
// TODO
|
||||
if (0x80000000 <= addr) {
|
||||
if (addr <= 0x83000000 - 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 8049c180 */ AssertCallback setAssertCallback(AssertCallback cb) {
|
||||
AssertCallback old = sAssertCallback;
|
||||
sAssertCallback = cb;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* 8049c190 */ void system_halt(const char *file, u32 line, const char *msg, va_list list) {
|
||||
if (sAssertOccurred) {
|
||||
#line 152
|
||||
OSError("Recursive assertioned");
|
||||
}
|
||||
|
||||
sAssertOccurred = true;
|
||||
if (sAssertCallback != nullptr) {
|
||||
sAssertCallback();
|
||||
}
|
||||
VISetPreRetraceCallback(nullptr);
|
||||
VISetPostRetraceCallback(nullptr);
|
||||
system_report("\n---------- HALT -------------\n");
|
||||
s32 pos = getPeriodPos(file);
|
||||
system_report("%.*s(%d):", pos, file, line);
|
||||
va_list args;
|
||||
va_copy(args, list);
|
||||
system_vreport(msg, args);
|
||||
system_report("\n");
|
||||
u32 *stackp = (u32 *)OSGetStackPointer();
|
||||
if (sPtrOverride != 0) {
|
||||
stackp = (u32*)((u32*)sPtrOverride)[1];
|
||||
}
|
||||
u32 *stack = stackp;
|
||||
|
||||
s32 num = 0;
|
||||
for (s32 num = 0; num < 0x1e; num++) {
|
||||
if (isOutsideMEM1((u32)stack)) {
|
||||
break;
|
||||
}
|
||||
const char *sym = getMapSymbol((void *)stack[1]);
|
||||
if (sym != nullptr) {
|
||||
system_report("%d: %s", num, sym);
|
||||
} else {
|
||||
system_report("%d: %p", num, stack[1]);
|
||||
}
|
||||
stack = (u32*)stack[0];
|
||||
if (isOutsideMEM1((u32)stack)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sInstantHalt == 0) {
|
||||
VISetBlack(false);
|
||||
VIFlush();
|
||||
nw4r::db::DirectPrint_Init();
|
||||
nw4r::db::detail::DirectPrint_SetupFB(0);
|
||||
Xfb *fb = BaseSystem::mConfigData->getXfbMgr()->mToShowXfb;
|
||||
if (fb == nullptr) {
|
||||
fb = BaseSystem::mConfigData->getXfbMgr()->mNextXfb;
|
||||
}
|
||||
|
||||
if (fb == nullptr) {
|
||||
#line 239
|
||||
OSError("Program Halt");
|
||||
}
|
||||
|
||||
// TODO this isn't optimized out?
|
||||
void *buf = (void *)0x43300000;
|
||||
nw4r::db::DirectPrint_EraseXfb(0, 0, fb->mWidth, fb->mHeight);
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
OSDisableInterrupts();
|
||||
OSDisableScheduler();
|
||||
OSEnableInterrupts();
|
||||
while (true) {
|
||||
nw4r::db::DirectPrint_EraseXfb(0, 0, fb->mWidth, fb->mHeight);
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
nw4r::db::DirectPrint_Printf(2, 2, "%.*s:%d", pos, file, line);
|
||||
va_list args;
|
||||
va_copy(args, list);
|
||||
nw4r::db::DirectPrint_printfsub(2, 0xe, msg, args);
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
|
||||
// TODO instshuffle
|
||||
s32 line = 0x1a;
|
||||
u32 *stack = stackp;
|
||||
|
||||
for (s32 counter = 0; counter < 0x10; counter++) {
|
||||
if (isOutsideMEM1((u32)stack)) {
|
||||
break;
|
||||
}
|
||||
const char *sym = getMapSymbol((void*)stack[1]);
|
||||
if (sym != nullptr) {
|
||||
nw4r::db::DirectPrint_Printf(2, line, "%d:%s\n", counter, sym);
|
||||
} else {
|
||||
nw4r::db::DirectPrint_Printf(2, line, "LR Save[%d]:%p\n", counter, (void*)stack[1]);
|
||||
}
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
stack = (u32*)*stack;
|
||||
if (isOutsideMEM1((u32)stack)) {
|
||||
break;
|
||||
}
|
||||
line += 0xc;
|
||||
}
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
wait(4000);
|
||||
if (sAssertCallback2 == nullptr) {
|
||||
goto end;
|
||||
}
|
||||
nw4r::db::DirectPrint_EraseXfb(0, 0, fb->mWidth, fb->mHeight);
|
||||
(sAssertCallback2)();
|
||||
nw4r::db::DirectPrint_StoreCache();
|
||||
wait(4000);
|
||||
}
|
||||
}
|
||||
end:
|
||||
#line 315
|
||||
OSError("Program Halt");
|
||||
return;
|
||||
}
|
||||
/* 8049c530 */ void assert(const char *file, u32 line, const char *msg, ...) {
|
||||
va_list l;
|
||||
va_start(l, msg);
|
||||
system_halt(file, line, msg, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
||||
} // namespace Assert
|
||||
|
||||
} // namespace EGG
|
||||
Reference in New Issue
Block a user