match JFramework

This commit is contained in:
SwareJonge
2025-06-16 22:11:30 +02:00
parent 5b865cb165
commit b791f26f44
16 changed files with 1262 additions and 14 deletions
+48
View File
@@ -2,6 +2,54 @@
#define _JSYSTEM_JUT_JUTDBPRINT_H
#ifdef __cplusplus
#include "JSystem/JUtility/TColor.h"
#include "JSystem/JUtility/JUTFont.h"
#include "JSystem/JKernel/JKRHeap.h"
struct JUTDbPrintList
{
JUTDbPrintList *mNext; // _00
s16 mX; // _04
s16 mY; // _06
s16 mDuration; // _08
s16 mLen; // _0A
u8 mStr; // _0C
};
struct JUTDbPrint
{
JUTDbPrint(JUTFont *, JKRHeap *); // unused/inlined
~JUTDbPrint(); // unused/inlined
JUTFont *changeFont(JUTFont *);
void flush();
void flush(int, int, int, int);
void drawString(int, int, int, const u8 *);
// Unused/inlined:
void enter(int, int, int, const char *, int);
void print(int, int, const char *, ...);
void print(int, int, int, const char *, ...);
void reset();
void setVisible(bool visible) { mVisible = visible; }
JUTFont *getFont() const { return mFont; }
JUTDbPrintList *getList() const { return mList; }
static JUTDbPrint *start(JUTFont *, JKRHeap *);
static JUTDbPrint *getManager() { return sDebugPrint; }
static JUTDbPrint *sDebugPrint;
JUTDbPrintList *mList; // _00
JUTFont *mFont; // _04
JUtility::TColor mColor; // _08
bool mVisible; // _0C
JKRHeap *mHeap; // _10
};
extern "C" {
#endif
+1 -1
View File
@@ -40,7 +40,7 @@ private:
void *mFramebuffer; // _00
u16 mFbWidth; // _04
u16 mFbHeight; // _06
u16 mStride; // _08, aligned width?
u16 mStride; // _08
size_t mFbSize; // _0C
u8 _10[0x4]; // _10 - unknown
u16 *mFrameMemory; // _14
+149
View File
@@ -0,0 +1,149 @@
#ifndef _JSYSTEM_JUT_JUTEXCEPTION_H
#define _JSYSTEM_JUT_JUTEXCEPTION_H
#include <dolphin/os.h>
#include "JSystem/JKernel/JKRThread.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "JSystem/JUtility/JUTXfb.h"
#include "types.h"
struct JUTConsole;
struct JUTDirectPrint;
typedef void (*JUTErrorHandler)(s32 error, OSContext *context, u32 dsisr, u32 dar);
enum ExPrintFlags
{
EXPRINTFLAG_GPR = 0x1,
EXPRINTFLAG_GPRMap = 0x2,
EXPRINTFLAG_SRR0Map = 0x4,
EXPRINTFLAG_Float = 0x8,
EXPRINTFLAG_Stack = 0x10,
EXPRINTFLAG_All = 0x1F,
};
/**
* @size{0xA4}
*/
struct JUTException : public JKRThread
{
enum EInfoPage
{
INFOPAGE_GPR = 1,
INFOPAGE_Float = 2,
INFOPAGE_Stack = 3,
INFOPAGE_GPRMap = 4,
INFOPAGE_SRR0Map = 5,
};
// size: 0x14
struct JUTExMapFile
{
inline JUTExMapFile(const char *fileName)
: mLink(this)
{
mFileName = (char *)fileName;
}
char *mFileName; // _00
JSULink<JUTExMapFile> mLink; // _04
};
/** @fabricated */
struct ExCallbackObject
{
JUTErrorHandler mErrorHandler; // _00
s32 mError; // _04
OSContext *mContext; // _08
u32 _0C; // _0C
u32 _10; // _10
};
JUTException(JUTDirectPrint *); // unused/inlined
virtual ~JUTException(){}; // _08 (weak)
virtual void *run(); // _0C
void showFloat(OSContext *);
void showStack(OSContext *);
void showMainInfo(u16, OSContext *, u32, u32);
bool showMapInfo_subroutine(u32, bool);
void showGPRMap(OSContext *);
void printDebugInfo(JUTException::EInfoPage, u16, OSContext *, u32, u32);
bool readPad(u32 *, u32 *);
void printContext(u16, OSContext *, u32, u32);
void createFB();
static void waitTime(long);
static JUTErrorHandler setPreUserCallback(JUTErrorHandler);
static void appendMapFile(const char *);
static bool queryMapAddress(char *, u32, long, u32 *, u32 *, char *, u32, bool, bool);
static bool queryMapAddress_single(char *, u32, long, u32 *, u32 *, char *, u32, bool, bool);
static JUTException *create(JUTDirectPrint *);
static void createConsole(void *buffer, u32 bufferSize);
static void panic_f(const char *file, int line, const char *msg, ...);
static void errorHandler(u16, OSContext *, u32, u32);
static void setFPException(u32);
static bool searchPartialModule(u32, u32 *, u32 *, u32 *, u32 *);
// unused/inlined:
static void panic_f_va(const char *, int, const char *, va_list);
static JUTErrorHandler setPostUserCallback(JUTErrorHandler);
// Inline
static void panic(const char *file, int line, const char *msg) {
panic_f(file, line, "%s", msg);
}
void showFloatSub(int, f32);
void showGPR(OSContext *);
void showSRR0Map(OSContext *);
bool isEnablePad() const;
u32 getFpscr();
void setFpscr(u32);
void enableFpuException();
void disableFpuException();
JUTExternalFB *getFrameMemory() const { return mFrameMemory; }
void setTraceSuppress(u32 supress) { mTraceSuppress = supress; }
void setGamePad(JUTGamePad *gamePad)
{
mGamePad = gamePad;
mPadPort = JUTGamePad::Port_Invalid;
}
static JUTException *getManager() { return sErrorManager; }
static JUTConsole *getConsole() { return sConsole; }
static JUTConsole *sConsole;
static void *sConsoleBuffer;
static size_t sConsoleBufferSize;
static JUTException *sErrorManager;
static OSMessageQueue sMessageQueue;
static void *sMessageBuffer[1];
static JUTErrorHandler sPreUserCallback;
static JUTErrorHandler sPostUserCallback;
static u32 msr;
static u32 fpscr;
static const char *sCpuExpName[32];
static JSUList<JUTExMapFile> sMapFileList;
// _00 = VTBL
// _00-_7C = JKRThread
JUTExternalFB *mFrameMemory; // _7C
JUTDirectPrint *mDirectPrint; // _80
JUTGamePad *mGamePad; // _84
JUTGamePad::EPadPort mPadPort; // _88
int mPrintWaitTime0; // _8C
int mPrintWaitTime1; // _90
u32 mTraceSuppress; // _94
u32 _98; // _98
u32 mPrintFlags; // _9C, see ExPrintFlags enum
u32 mStackPointer; // _A0
};
#endif
+49
View File
@@ -0,0 +1,49 @@
#ifndef _JUTFADER_H
#define _JUTFADER_H
#include "JSystem/JGeometry.h"
#include "JSystem/JUtility/TColor.h"
#include "JSystem/JUtility/JUTVideo.h"
#include "types.h"
struct JUTFader
{
enum EStatus
{
Status_Out = 0,
Status_In = 1,
Status_FadingIn = 2,
Status_FadingOut = 3
};
JUTFader(int, int, int, int, JUtility::TColor);
virtual ~JUTFader() {} // _08 (weak)
virtual bool startFadeIn(int duration); // _0C
virtual bool startFadeOut(int duration); // _10
virtual void draw(); // _14
void control();
// unused/inlined:
void start(int);
void setStatus(EStatus, int);
void setResetState(bool reset) { mResetting = reset; }
EStatus getStatus() const { return mStatus; }
void setColor(JUtility::TColor color) { mColor.set(color.r, color.g, color.b, mColor.a); }
// _00 VTBL
EStatus mStatus; // _04 - current status
u16 mTicksTarget; // _08 - ticks (calls to control()) to run a fade in/out for
u16 mTicksRun; // _0A - ticks the current fade has run
bool mResetting; // _0C - probably exclusive to mkdd, holds true when starting the fadeout for reset, sets back to false when fading in
u8 _0D[3]; // padding
JUtility::TColor mColor; // _10 - color of fade
JGeometry::TBox2f mViewBox; // _14 - ortho box to render within
int mEStatus; // _24 - ???
EStatus _28; // _28 - ???
};
#endif
+43
View File
@@ -0,0 +1,43 @@
#ifndef _JSYSTEM_JUT_JUTGRAPHFIFO_H
#define _JSYSTEM_JUT_JUTGRAPHFIFO_H
#include "types.h"
#include <dolphin/gx.h>
struct JUTGraphFifo
{
JUTGraphFifo(u32);
virtual ~JUTGraphFifo(); // _08
void becomeCurrent();
void setBreakPt();
void getGpStatus()
{
GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2], (GXBool*)&mGpStatus[3],
(GXBool*)&mGpStatus[4]);
}
bool isGPActive()
{
getGpStatus();
return mGpStatus[2] == false;
}
void save() { GXSaveCPUFifo(this->mFifo); }
static JUTGraphFifo *sCurrentFifo;
static GXBool mGpStatus[5];
static bool sInitiated;
// _00 = VTBL
GXFifoObj* mFifo; // _04
void* mBase; // _08
u32 mSize; // _0C
u8 _10[0xC]; // _10
};
inline void JUTCreateFifo(u32 bufSize) { new JUTGraphFifo(bufSize); }
#endif
+8 -11
View File
@@ -8,46 +8,43 @@
#include "dolphin/vi.h"
#ifdef __cplusplus
/**
* @size{0x58}
*/
typedef u8 (*Pattern)[2];
struct JUTVideo
{
JUTVideo(const _GXRenderModeObj *);
JUTVideo(const GXRenderModeObj*);
virtual ~JUTVideo(); // _08
static JUTVideo *createManager(const _GXRenderModeObj *);
static JUTVideo *createManager(const GXRenderModeObj*);
static void destroyManager();
static void preRetraceProc(unsigned long);
static void postRetraceProc(unsigned long);
static void drawDoneCallback();
u16 getEfbHeight() const { return mRenderModeObj->efbHeight; }
u16 getFbWidth() const { return mRenderModeObj->fbWidth; }
u32 getEfbHeight() const { return mRenderModeObj->efbHeight; }
u32 getXfbHeight() const { return mRenderModeObj->xfbHeight; }
u32 getFbWidth() const { return (u16)mRenderModeObj->fbWidth; } // cast required for callDirectDraw
void getBounds(u16& width, u16& height) const {
width = getFbWidth();
height = getEfbHeight();
}
_GXRenderModeObj *getRenderMode() const { return mRenderModeObj; }
u16 getXfbHeight() const { return mRenderModeObj->xfbHeight; }
GXRenderModeObj *getRenderMode() const { return mRenderModeObj; }
u32 isAntiAliasing() const { return mRenderModeObj->aa; }
Pattern getSamplePattern() const { return mRenderModeObj->sample_pattern; }
u8 *getVFilter() const { return mRenderModeObj->vfilter; }
OSMessageQueue *getMessageQueue() { return &mMessageQueue; };
static void drawDoneStart();
static void dummyNoDrawWait();
void setRenderMode(const _GXRenderModeObj *);
void setRenderMode(const GXRenderModeObj*);
void waitRetraceIfNeed(); // blr, global
VIRetraceCallback setPostRetraceCallback(VIRetraceCallback);
// Unused/inlined:
void getDrawWait();
VIRetraceCallback setPreRetraceCallback(VIRetraceCallback);
void getPixelAspect(const _GXRenderModeObj *);
void getPixelAspect(const GXRenderModeObj*);
void getPixelAspect() const;
// Static inline gets
+84
View File
@@ -0,0 +1,84 @@
#ifndef _JSYSTEM_JUT_JUTXFB_H
#define _JSYSTEM_JUT_JUTXFB_H
#include <dolphin/gx.h>
#include <JSystem/JKernel/JKRHeap.h>
#include "types.h"
struct JUTExternalFB
{
JUTExternalFB(GXRenderModeObj *, GXGamma, void *, u32);
GXRenderModeObj *mRenderModeObj; // _00
u32 mSize; // _04
u8 _08[4]; // _08
u16 _0C; // _0C
u16 mGamma; // _0E, treat as GXGamma
bool _10; // _10
};
class JUTXfb
{
public:
enum EXfbNumber
{
Unset = 0,
SingleBuffer = 1,
DoubleBuffer = 2,
TripleBuffer = 3
};
void clearIndex();
void common_init(int);
JUTXfb(const GXRenderModeObj*, JKRHeap*, JUTXfb::EXfbNumber);
~JUTXfb();
void delXfb(int);
static JUTXfb *createManager(const GXRenderModeObj* rmode, JKRHeap*, JUTXfb::EXfbNumber);
static void destroyManager();
void initiate(u16, u16, JKRHeap*, JUTXfb::EXfbNumber);
u32 accumeXfbSize();
int getBufferNum() const { return mBufferNum; }
int getDrawnXfbIndex() const { return mDrawnXfbIndex; }
s16 getDrawingXfbIndex() const { return mDrawingXfbIndex; }
s16 getDisplayingXfbIndex() const { return mDisplayingXfbIndex; }
int getSDrawingFlag() const { return mSDrawingFlag; }
void *getXfb(int index) const {
return mBuffer[index];
}
void *getDrawnXfb() const {
return (mDrawnXfbIndex >= 0) ? mBuffer[mDrawnXfbIndex] : nullptr;
}
void *getDrawingXfb() const {
return (mDrawingXfbIndex >= 0) ? mBuffer[mDrawingXfbIndex] : nullptr;
}
void *getDisplayingXfb() const {
return (mDisplayingXfbIndex >= 0) ? mBuffer[mDisplayingXfbIndex] : nullptr;
}
void setBufferNum(int num) { mBufferNum = num; }
void setDisplayingXfbIndex(s16 index) { mDisplayingXfbIndex = index; }
void setSDrawingFlag(s32 flag) { mSDrawingFlag = flag; }
void setDrawnXfbIndex(s16 index) { mDrawnXfbIndex = index; }
void setDrawingXfbIndex(s16 index) { mDrawingXfbIndex = index; }
static JUTXfb *getManager() { return sManager; }
private:
static JUTXfb *sManager;
private:
void *mBuffer[3]; // 00
bool mXfbAllocated[3]; // 0c
int mBufferNum; // 10
s16 mDrawingXfbIndex; // 14
s16 mDrawnXfbIndex; // 16
s16 mDisplayingXfbIndex; // 18
s32 mSDrawingFlag; // 1a
};
#endif