summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2024-10-06 22:36:36 +0200
committerGitHub <noreply@github.com>2024-10-06 16:36:36 -0400
commit558db54bf44b7fe885705a6d5b513000b8d75cf6 (patch)
tree99e8cdf6ae106ad24f9c3d3cf8ccf25fcfeb1c74 /include
parentf8e61c7de8b2b8d2b2174f33457b1357175e2c0d (diff)
eggException with two minor problems (#53)
* eggException with two minor problems * Fix * One minor problem --------- Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/egg/core/eggVideo.h9
-rw-r--r--include/egg/util/eggException.h41
-rw-r--r--include/nw4r/db/db_console.h40
-rw-r--r--include/nw4r/db/db_exception.h1
-rw-r--r--include/rvl/KPAD/KPAD.h1
5 files changed, 87 insertions, 5 deletions
diff --git a/include/egg/core/eggVideo.h b/include/egg/core/eggVideo.h
index 00ebf89c..37633ee9 100644
--- a/include/egg/core/eggVideo.h
+++ b/include/egg/core/eggVideo.h
@@ -7,6 +7,8 @@
#include <common.h>
+extern "C" GXRenderModeObj lbl_8055FC64;
+
namespace EGG {
class Video {
@@ -28,6 +30,13 @@ public:
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));
diff --git a/include/egg/util/eggException.h b/include/egg/util/eggException.h
index c2e21809..3252f35c 100644
--- a/include/egg/util/eggException.h
+++ b/include/egg/util/eggException.h
@@ -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
diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h
index 01921110..b2d724c6 100644
--- a/include/nw4r/db/db_console.h
+++ b/include/nw4r/db/db_console.h
@@ -17,7 +17,7 @@ typedef struct ConsoleHead {
u16 printTop;
u16 printXPos;
u16 ringTop;
- u32 ringTopLineCnt;
+ s32 ringTopLineCnt;
s32 viewTopLine;
s16 viewPosX;
s16 viewPosY;
@@ -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
diff --git a/include/nw4r/db/db_exception.h b/include/nw4r/db/db_exception.h
index 34bc646d..9e14e803 100644
--- a/include/nw4r/db/db_exception.h
+++ b/include/nw4r/db/db_exception.h
@@ -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
diff --git a/include/rvl/KPAD/KPAD.h b/include/rvl/KPAD/KPAD.h
index 6eac5f21..87f47832 100644
--- a/include/rvl/KPAD/KPAD.h
+++ b/include/rvl/KPAD/KPAD.h
@@ -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);