JUTException (#154)

* JUTException inherit JKRThread

* OK __ct__12JUTExceptionFP14JUTDirectPrint

* OK create__12JUTExceptionFP14JUTDirectPrint

* OK setFPException__12JUTExceptionFUl

* OK showFloatSub__12JUTExceptionFif

* OK showFloat__12JUTExceptionFP9OSContext

* OK searchPartialModule__12JUTExceptionFUlPUlPUlPUlPUl

* OK search_name_part__FPUcPUci

* OK showStack__12JUTExceptionFP9OSContext

* OK showMainInfo__12JUTExceptionFUsP9OSContextUlUl

* OK showGPR__12JUTExceptionFP9OSContext

* OK __sinit_JUTException_cpp

* OK showMapInfo_subroutine__12JUTExceptionFUlb

* OK showGPRMap__12JUTExceptionFP9OSContext

* OK showSRR0Map__12JUTExceptionFP9OSContext

* OK printDebugInfo__12JUTExceptionFQ212JUTException9EInfoPageUsP9OSContextUlUl

* OK isEnablePad__12JUTExceptionCFv

* OK readPad__12JUTExceptionFPUlPUl

* NONMATCHING printContext__12JUTExceptionFUsP9OSContextUlUl

* OK printContext__12JUTExceptionFUsP9OSContextUlUl

* OK __dt__12JUTExceptionFv

* OK waitTime__12JUTExceptionFl

* OK createFB__12JUTExceptionFv

* OK setPreUserCallback__12JUTExceptionFPFUsP9OSContextUlUl_v

* OK __ct__13JUTExternalFBFP16_GXRenderModeObj8_GXGammaPvUl

* OK createConsole__12JUTExceptionFPvUl

* NONMATCHING queryMapAddress_single__12JUTExceptionFPcUllPUlPUlPcUlbb

* OK queryMapAddress__12JUTExceptionFPcUllPUlPUlPcUlbb

* OK appendMapFile__12JUTExceptionFPCc

* clean up

* OK panic_f__12JUTExceptionFPCciPCce

* OK panic_f_va__12JUTExceptionFPCciPCcP16__va_list_struct

* OK errorHandler__12JUTExceptionFUsP9OSContextUlUl

* format

* format

* fixed requested changes

* merged with master and removed *.s files

Co-authored-by: Julgodis <>
This commit is contained in:
Jonathan Wase
2021-11-09 23:09:38 +01:00
committed by GitHub
parent 5020395dfd
commit 901b222eb8
59 changed files with 1201 additions and 3141 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ public:
bool operator==(JSULink<T> const* other) const { return this->mLink == other; }
bool operator!=(JSULink<T> const* other) const { return this->mLink != other; }
bool operator==(JSUListIterator<T> const& other) const { return this->mLink == other.mLink; }
bool operator!=(JSUListIterator<T> const& other) const { return this->mLink != other.other; }
bool operator!=(JSUListIterator<T> const& other) const { return this->mLink != other.mLink; }
JSUListIterator<T> operator++(int) {
JSUListIterator<T> prev = *this;
+18 -9
View File
@@ -14,8 +14,8 @@ public:
UNK_TYPE2 = 2,
};
/* 802E73E4 */ void create(unsigned int, void*, u32);
/* 802E7354 */ void create(unsigned int, unsigned int, JKRHeap*);
/* 802E73E4 */ static JUTConsole* create(unsigned int, void*, u32);
/* 802E7354 */ static JUTConsole* create(unsigned int, unsigned int, JKRHeap*);
/* 802E746C */ JUTConsole(unsigned int, unsigned int, bool);
/* 802E75CC */ static size_t getObjectSizeFromBufferSize(unsigned int, unsigned int);
/* 802E75DC */ static size_t getLineFromObjectSize(u32, unsigned int);
@@ -31,26 +31,31 @@ public:
/* 802E755C */ virtual ~JUTConsole();
void setOutput(u32 output) { mOutput = output; }
u32 getOutput() const { return mOutput; }
void setPosition(int x, int y) {
mPositionX = x;
mPositionY = y;
}
void setFontSize(f32 x, f32 y) {
mFontSizeX = x;
mFontSizeY = y;
}
void setHeight(u32 height) {
mHeight = height;
if (mHeight > field_0x24) {
mHeight = field_0x24;
}
}
u32 getOutput() const { return mOutput; }
int getPositionY() const { return mPositionY; }
int getPositionX() const { return mPositionX; }
u32 getHeight() const { return mHeight; }
bool isVisible() const { return mVisible; }
void setVisible(bool visible) { mVisible = visible; }
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0 + 1]; }
int diffIndex(int param_0, int param_1) const {
int diff = param_1 - param_0;
if (diff >= 0) {
@@ -59,6 +64,10 @@ public:
return diff += field_0x24;
}
void scrollToLastLine() { scroll(field_0x24); }
void scrollToFirstLine() { scroll(-field_0x24); }
private:
/* 0x18 */ JGadget::TLinkListNode mListNode;
private:
@@ -22,6 +22,8 @@ public:
/* 802E4240 */ static JUTDirectPrint* start();
bool isActive() const { return field_0x00 != 0; }
static JUTDirectPrint* getManager() { return sDirectPrint; }
private:
+94 -51
View File
@@ -2,85 +2,128 @@
#define JUTEXCEPTION_H
#include "JSystem/JKernel/JKRThread.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/types.h"
#include "global.h"
struct _GXRenderModeObj;
struct _GXGamma {};
struct JUTExternalFB {
/* 802E40CC */ JUTExternalFB(_GXRenderModeObj*, _GXGamma, void*, u32);
};
struct JUTDirectPrint {
/* 802E456C */ void changeFrameBuffer(void*, u16, u16);
};
class JUTException /* : public JKRThread */ {
class JUTExternalFB {
public:
struct EInfoPage {};
/* 802E40CC */ JUTExternalFB(_GXRenderModeObj*, GXGamma, void*, u32);
private:
/* 0x00 */ _GXRenderModeObj* mRenderMode;
/* 0x04 */ u32 mSize;
/* 0x08 */ u32 field_0x08;
/* 0x0C */ u16 field_0x0C;
/* 0x0E */ u16 mGamma;
/* 0x10 */ bool field_0x10;
/* 0x11 */ u8 field_[3];
};
STATIC_ASSERT(sizeof(JUTExternalFB) == 0x14);
#define JUT_PRINT_GPR 1
#define JUT_PRINT_GPR_MAP 2
#define JUT_PRINT_SRR0_MAP 4
#define JUT_PRINT_FLOAT 8
#define JUT_PRINT_STACK 16
class JUTException : public JKRThread {
public:
enum EInfoPage {
EINFO_PAGE_GPR = 1,
EINFO_PAGE_FLOAT = 2,
EINFO_PAGE_STACK = 3,
EINFO_PAGE_GPR_MAP = 4,
EINFO_PAGE_SSR0_MAP = 5,
};
class JUTExMapFile {
public:
JUTExMapFile(char* path) : mLink(this) { mPath = path; }
public:
/* 0x00 */ char* mPath;
/* 0x04 */ JSULink<JUTExMapFile> mLink;
/* 0x14 */
};
// TODO: return types are probably wrong
/* 802E1D5C */ JUTException(JUTDirectPrint*);
/* 802E1E40 */ void create(JUTDirectPrint*);
/* 802E1FCC */ void errorHandler(u16, OSContext*, u32, u32);
/* 802E20C0 */ void panic_f_va(char const*, int, char const*, va_list);
/* 802E21FC */ static void panic_f(char const*, int, char const*, ...);
/* 802E227C */ void setFPException(u32);
/* 802E40EC */ virtual ~JUTException();
/* 802E22C4 */ void showFloatSub(int, f32);
/* 802E2454 */ void showFloat(OSContext*);
/* 802E2578 */ void searchPartialModule(u32, u32*, u32*, u32*, u32*);
/* 802E26B0 */ void showStack(OSContext*);
/* 802E27B0 */ void showMainInfo(u16, OSContext*, u32, u32);
/* 802E2A84 */ void showGPR(OSContext*);
/* 802E2B44 */ void showMapInfo_subroutine(u32, bool);
/* 802E2B44 */ bool showMapInfo_subroutine(u32, bool);
/* 802E2CA0 */ void showGPRMap(OSContext*);
/* 802E2DAC */ void showSRR0Map(OSContext*);
/* 802E2E70 */ void printDebugInfo(JUTException::EInfoPage, u16, OSContext*, u32, u32);
/* 802E2F18 */ void isEnablePad() const;
/* 802E2E70 */ void printDebugInfo(JUTException::EInfoPage, OSError, OSContext*, u32, u32);
/* 802E2F18 */ bool isEnablePad() const;
/* 802E2F54 */ bool readPad(u32*, u32*);
/* 802E34C0 */ void printContext(u16, OSContext*, u32, u32);
/* 802E3980 */ static void waitTime(s32);
/* 802E3A08 */ void createFB();
/* 802E3AEC */ void setPreUserCallback(void (*)(u16, OSContext*, u32, u32));
/* 802E3AFC */ void setPostUserCallback(void (*)(u16, OSContext*, u32, u32));
/* 802E3B0C */ void appendMapFile(char const*);
/* 802E3BA0 */ void queryMapAddress(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
/* 802E3C90 */ void queryMapAddress_single(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
/* 802E3FEC */ void createConsole(void*, u32);
/* 802E40EC */ virtual ~JUTException();
/* 802E1EA8 */ virtual void run();
/* 802E1EA8 */ /* vt[03] */ virtual void* run();
/* 802E1E40 */ static JUTException* create(JUTDirectPrint*);
/* 802E1FCC */ static void errorHandler(OSError, OSContext*, u32, u32);
/* 802E20C0 */ static void panic_f_va(char const*, int, char const*, va_list);
/* 802E21FC */ static void panic_f(char const*, int, char const*, ...);
/* 802E227C */ static void setFPException(u32);
/* 802E2578 */ static bool searchPartialModule(u32, u32*, u32*, u32*, u32*);
/* 802E3AEC */ static OSErrorHandler setPreUserCallback(OSErrorHandler);
/* 802E3AFC */ static OSErrorHandler setPostUserCallback(OSErrorHandler);
/* 802E3B0C */ static void appendMapFile(char const*);
/* 802E3BA0 */ static bool queryMapAddress(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
/* 802E3C90 */ static bool queryMapAddress_single(char*, u32, s32, u32*, u32*, char*, u32, bool,
bool);
/* 802E3FEC */ static void createConsole(void*, u32);
/* 802E3980 */ static void waitTime(s32);
static JUTException* getManager() { return sErrorManager; }
void setTraceSuppress(u32 param_0) { mTraceSuppress = param_0; }
static u8 sMessageQueue[32];
static void* sCpuExpName[17];
static u8 sMapFileList[12 + 4 /* padding */];
JUTExternalFB* getFrameMemory() const { return mFrameMemory; }
void setTraceSuppress(u32 param_0) { mTraceSuppress = param_0; }
void setGamePad(JUTGamePad* gamePad) {
mGamePad = gamePad;
mGamePadPort = JUTGamePad::Port_Unknown;
}
private:
static OSMessageQueue sMessageQueue;
static const char* sCpuExpName[17];
static JSUList<JUTException::JUTExMapFile> sMapFileList;
static u8 sMessageBuffer[4 + 4 /* padding */];
static JUTException* sErrorManager;
static u8 sPreUserCallback[4];
static u8 sPostUserCallback[4];
static u8 sConsoleBuffer[4];
static u8 sConsoleBufferSize[4];
static u8 sConsole[4];
static u8 msr[4];
static u8 fpscr[4];
static OSErrorHandler sPreUserCallback;
static OSErrorHandler sPostUserCallback;
static void* sConsoleBuffer;
static u32 sConsoleBufferSize;
static JUTConsole* sConsole;
static u32 msr;
static u32 fpscr;
/* 0x00 */ JKRThread field_0x0; // should be inherited
/* 0x80 */ JUTDirectPrint* field_0x80;
/* 0x84 */ JUTGamePad* field_0x84;
/* 0x88 */ s32 field_0x88;
/* 0x8C */ s32 field_0x8c;
/* 0x90 */ s32 field_0x90;
private:
/* 0x7C */ JUTExternalFB* mFrameMemory;
/* 0x80 */ JUTDirectPrint* mDirectPrint;
/* 0x84 */ JUTGamePad* mGamePad;
/* 0x88 */ JUTGamePad::EPadPort mGamePadPort;
/* 0x8C */ s32 mPrintWaitTime0;
/* 0x90 */ s32 mPrintWaitTime1;
/* 0x94 */ u32 mTraceSuppress;
/* 0x98 */ u32 field_0x98;
/* 0x9C */ u32 field_0x9c;
/* 0xA0 */ u32 field_0xa0;
/* 0x9C */ u32 mPrintFlags;
/* 0xA0 */ u32 mStackPointer;
};
STATIC_ASSERT(sizeof(JUTException) == 0xA4);
#endif /* JUTEXCEPTION_H */
+8 -1
View File
@@ -47,7 +47,14 @@ public:
enum EStickMode {};
enum EWhichStick {};
enum EPadPort { Port_1, Port_2, Port_3, Port_4 };
enum EPadPort {
Port_Unknown = -1, // used by JUTException
Port_1,
Port_2,
Port_3,
Port_4,
};
JUTGamePad(JUTGamePad::EPadPort port);
virtual ~JUTGamePad();