Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eggException with two minor problems #53

Merged
merged 3 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,8 @@ egg/audio/eggAudioSystem.cpp:

egg/util/eggException.cpp:
.text start:0x804B7550 end:0x804B7B48
.data start:0x8056F420 end:0x8056F438
.sbss start:0x80576900 end:0x80576920

Runtime.PPCEABI.H/global_destructor_chain.c:
.text start:0x804C65C0 end:0x804C6620
Expand Down
34 changes: 17 additions & 17 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26863,14 +26863,14 @@ fn_804B7370 = .text:0x804B7370; // type:function size:0x60
fn_804B73D0 = .text:0x804B73D0; // type:function size:0x78
fn_804B7450 = .text:0x804B7450; // type:function size:0xF4
ExceptionWaitTime__Q23EGG9ExceptionFUl = .text:0x804B7550; // type:function size:0x78
EGG__Exception__ExceptionCallback = .text:0x804B75D0; // type:function size:0x58
ExceptionCallback__Q23EGG9ExceptionFPQ44nw4r2db6detail11ConsoleHeadPv = .text:0x804B75D0; // type:function size:0x58
ExceptionCallback___Q23EGG9ExceptionFPQ44nw4r2db6detail11ConsoleHeadPv = .text:0x804B7630; // type:function size:0x214
create__Q23EGG9ExceptionFUsUsUsPQ23EGG4Heapi = .text:0x804B7850; // type:function size:0x98
EGG__Exception__setCallbackArgs = .text:0x804B78F0; // type:function size:0x54
EGG__Exception__setPreExceptionCallback = .text:0x804B7950; // type:function size:0x8
EGG__Exception__SetUserCallback = .text:0x804B7960; // type:function size:0x8
EGG__Exception__setDisplayInfo = .text:0x804B7970; // type:function size:0x8
EGG__Exception__getConsoleHandle = .text:0x804B7980; // type:function size:0x8
SetCallbackArgs__Q23EGG9ExceptionFPv = .text:0x804B78F0; // type:function size:0x54
SetPreExceptionCallback__Q23EGG9ExceptionFPFv_v = .text:0x804B7950; // type:function size:0x8
SetUserCallback__Q23EGG9ExceptionFPFPQ23EGG10CoreStatus_v = .text:0x804B7960; // type:function size:0x8
SetCallbackMode__Q23EGG9ExceptionFb = .text:0x804B7970; // type:function size:0x8
GetConsoleHandle__Q23EGG9ExceptionFv = .text:0x804B7980; // type:function size:0x8
__dt__Q23EGG9ExceptionFv = .text:0x804B7990; // type:function size:0xA4
__ct__Q23EGG9ExceptionFUsUsUsPQ23EGG4Heapi = .text:0x804B7A40; // type:function size:0x108
fn_804B7B50 = .text:0x804B7B50; // type:function size:0x64
Expand Down Expand Up @@ -37220,8 +37220,8 @@ lbl_8056F320 = .data:0x8056F320; // type:object size:0xA8
lbl_8056F3C8 = .data:0x8056F3C8; // type:object size:0x10
lbl_8056F3D8 = .data:0x8056F3D8; // type:object size:0x30
lbl_8056F408 = .data:0x8056F408; // type:object size:0x18
lbl_8056F420 = .data:0x8056F420; // type:object size:0xC data:string
EGG__Exception__vtable = .data:0x8056F42C; // type:object size:0xC
lbl_8056F420 = .data:0x8056F420; // type:object size:0xC scope:local data:string
__vt__Q23EGG9Exception = .data:0x8056F42C; // type:object size:0xC
lbl_8056F438 = .data:0x8056F438; // type:object size:0x14
lbl_8056F44C = .data:0x8056F44C; // type:object size:0x14
lbl_8056F460 = .data:0x8056F460; // type:object size:0x10
Expand Down Expand Up @@ -41031,15 +41031,15 @@ AudioHeap_ptr = .sbss:0x805768EC; // type:object size:0x4 data:4byte
lbl_805768F0 = .sbss:0x805768F0; // type:object size:0x4 data:4byte
lbl_805768F4 = .sbss:0x805768F4; // type:object size:0x4 data:4byte
lbl_805768F8 = .sbss:0x805768F8; // type:object size:0x8 data:4byte
EGG__Exception__sException = .sbss:0x80576900; // type:object size:0x4 data:4byte
EGG__Exception__sConsoleHandle = .sbss:0x80576904; // type:object size:0x4 data:4byte
EGG__Exception__sMapFileWorks = .sbss:0x80576908; // type:object size:0x4 data:4byte
EGG__Exception__sMapFileNumMax = .sbss:0x8057690C; // type:object size:0x4 data:4byte
EGG__Exception__sCurrentMapFileNum = .sbss:0x80576910; // type:object size:0x4 data:4byte
EGG__Exception__sPreException = .sbss:0x80576914; // type:object size:0x4 data:4byte
EGG__Exception__sUserCallbackFunc = .sbss:0x80576918; // type:object size:0x4 data:4byte
EGG__Exception__sEnableUserCallback = .sbss:0x8057691C; // type:object size:0x1 data:byte
EGG__Exception__sDisplayInfo = .sbss:0x8057691E; // type:object size:0x2 data:2byte
sException__Q23EGG9Exception = .sbss:0x80576900; // type:object size:0x4 data:4byte
sConsoleHandle__Q23EGG9Exception = .sbss:0x80576904; // type:object size:0x4 data:4byte
sMapFileWorks__Q23EGG9Exception = .sbss:0x80576908; // type:object size:0x4 data:4byte
sMapFileNumMax__Q23EGG9Exception = .sbss:0x8057690C; // type:object size:0x4 data:4byte
sCurrentMapFileNum__Q23EGG9Exception = .sbss:0x80576910; // type:object size:0x4 data:4byte
sPreException__Q23EGG9Exception = .sbss:0x80576914; // type:object size:0x4 data:4byte
sUserCallbackFunc__Q23EGG9Exception = .sbss:0x80576918; // type:object size:0x4 data:4byte
sUserCallbackMode__Q23EGG9Exception = .sbss:0x8057691C; // type:object size:0x1 data:byte
sExceptionDisplayInfo__Q23EGG9Exception = .sbss:0x8057691E; // type:object size:0x2 data:2byte
lbl_80576920 = .sbss:0x80576920; // type:object size:0x8 data:float
lbl_80576928 = .sbss:0x80576928; // type:object size:0x8 data:4byte
__global_destructor_chain = .sbss:0x80576930; // type:object size:0x4 scope:global data:4byte
Expand Down
9 changes: 9 additions & 0 deletions include/egg/core/eggVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <common.h>

extern "C" GXRenderModeObj lbl_8055FC64;

namespace EGG {

class Video {
Expand All @@ -28,6 +30,13 @@ class Video {
static u32 getTickPerVRetrace();
static const GXRenderModeObj *getStandardRenderModeObj(const RenderModeObjSet *);

GXRenderModeObj* getCurrentOrFallbackRenderModeObj() const {
if (pRenderMode == nullptr) {
return &lbl_8055FC64;
}
return pRenderMode;
}

public:
void setBlack(bool b) {
VISetBlack(!mFlag.onBit(0));
Expand Down
41 changes: 40 additions & 1 deletion include/egg/util/eggException.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
#ifndef EGG_EXCEPTION_H
#define EGG_EXCEPTION_H

namespace EGG {} // namespace EGG
#include <common.h>
#include <nw4r/db/db_console.h>

namespace EGG {

class Heap;
class CoreStatus;

class Exception {
public:
Exception(u16, u16, u16, EGG::Heap *, int);
virtual ~Exception();

static void ExceptionWaitTime(u32 time);
static bool ExceptionCallback(nw4r::db::ConsoleHandle handle, void *);
static bool ExceptionCallback_(nw4r::db::ConsoleHandle handle, void *);
static Exception *create(u16, u16, u16, Heap *, int);

static Exception *sException;

volatile static nw4r::db::ConsoleHandle sConsoleHandle;
static void *sMapFileWorks;
static u32 sMapFileNumMax;
static u32 sCurrentMapFileNum;
static volatile bool sUserCallbackMode;

// inofficial

static void (*sPreException)();
static void (*sUserCallbackFunc)(CoreStatus *status);
static s16 sExceptionDisplayInfo;

static void SetUserCallback(void (*cb)(CoreStatus *status));
static void SetPreExceptionCallback(void (*cb)());
static void SetCallbackMode(bool);
static void SetCallbackArgs(void *);
nw4r::db::ConsoleHandle GetConsoleHandle();
};

} // namespace EGG

#endif
40 changes: 36 additions & 4 deletions include/nw4r/db/db_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct ConsoleHead {
u16 printTop;
u16 printXPos;
u16 ringTop;
u32 ringTopLineCnt;
s32 ringTopLineCnt;
s32 viewTopLine;
s16 viewPosX;
s16 viewPosY;
Expand All @@ -38,15 +38,47 @@ enum ConsoleOutputType {
CONSOLE_OUTPUT_ALL = CONSOLE_OUTPUT_DISPLAY | CONSOLE_OUTPUT_TERMINAL,
};

inline s16 Console_GetPositionX(ConsoleHandle console) {
return console->viewPosX;
}

inline s16 Console_GetPositionY(ConsoleHandle console) {
return console->viewPosY;
}

inline bool Console_SetVisible(ConsoleHandle handle, bool bVisible) {
bool old = handle->isVisible;
handle->isVisible = bVisible;
return old;
}

inline void Console_SetPosition(ConsoleHandle handle, s32 x, s32 y) {
handle->viewPosX = x;
handle->viewPosY = y;
}

inline s32 Console_GetViewBaseLine(ConsoleHandle console) {
return console->viewTopLine;
}

inline s32 Console_SetViewBaseLine(ConsoleHandle console, s32 line) {
s32 old = console->viewTopLine;
console->viewTopLine = line;
return old;
}

inline s32 Console_GetBufferHeadLine(ConsoleHandle console) {
return console->ringTopLineCnt;
}

ConsoleHandle Console_Create(void *arg, u16, u16, u16, u16, u16);
ConsoleHandle Console_Destroy(ConsoleHandle console);
void Console_DrawDirect(ConsoleHandle console);
void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, const char* format, va_list vlist);
void Console_Printf(ConsoleHandle console, const char* format, ...);
void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, const char *format, va_list vlist);
void Console_Printf(ConsoleHandle console, const char *format, ...);
s32 Console_GetTotalLines(ConsoleHandle console);

} // namespace db
} // namespace nw4r


#endif
1 change: 1 addition & 0 deletions include/nw4r/db/db_exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void Exception_Init();
ConsoleHandle Exception_SetConsole(ConsoleHandle, const _GXRenderModeObj *);
ConsoleHandle Exception_GetConsole();
void Exception_SetUserCallback(bool (*)(ConsoleHandle, void *), void *);
u16 Exception_SetDisplayInfo(u16 newInfo);

} // namespace db
} // namespace nw4r
Expand Down
1 change: 1 addition & 0 deletions include/rvl/KPAD/KPAD.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef void (*KPADConnectCallback)(s32, s32);
// TODO: Create Proper Headers
void KPADInitEx(void * /* UNKTYPE */, u32);

s32 KPADRead(s32 chan, UNKTYPE *status, s32);
s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *);

void KPADSetConnectCallback(u32, KPADConnectCallback);
Expand Down
Loading