m_Do cleanup, d_resource, drawlist stuff (#145)

* d_resource / some d_stage

* setup dDlst_list_c / d_select_icon OK

* JUTXfb / some JUTVideo + various

* some J2D classes / JUTVideo/Fader attempts

* bunch of m_Do cleanup + matches / f_ap_game OK

* mDoLib_clipper::setup OK

* most of d_meter_HIO OK

* pane_class / kantera_icon_meter
This commit is contained in:
TakaRikka
2021-09-24 08:11:10 -07:00
committed by GitHub
parent 6dcfdaf8a3
commit 7374f5f2f7
261 changed files with 6757 additions and 10882 deletions
+67
View File
@@ -1,6 +1,73 @@
#ifndef JUTCONSOLE_H
#define JUTCONSOLE_H
#include "JSystem/JGadget/linklist.h"
#include "JSystem/JKernel/JKRDisposer.h"
#include "JSystem/JUtility.h"
#include "JSystem/JUtility/JUTFont.h"
#include "dolphin/types.h"
class JUTConsole : public JKRDisposer {
public:
enum EConsoleType {};
/* 802E73E4 */ void create(unsigned int, void*, u32);
/* 802E7354 */ void create(unsigned int, unsigned int, JKRHeap*);
/* 802E746C */ JUTConsole(unsigned int, unsigned int, bool);
/* 802E75CC */ void getObjectSizeFromBufferSize(unsigned int, unsigned int);
/* 802E75DC */ void getLineFromObjectSize(u32, unsigned int);
/* 802E75EC */ void clear();
/* 802E7648 */ void doDraw(JUTConsole::EConsoleType) const;
/* 802E7BB8 */ void print_f(char const*, ...);
/* 802E7C38 */ void print(char const*);
/* 802E7F7C */ void dumpToTerminal(unsigned int);
/* 802E80A8 */ void scroll(int);
/* 802E8184 */ void getUsedLine() const;
/* 802E81A8 */ int getLineOffset() const;
/* 802E755C */ virtual ~JUTConsole();
void setOutput(u32 output) { mOutput = output; }
u32 getOutput() const { return mOutput; }
void setPosition(int x, int y) {
mPositionX = x;
mPositionY = y;
}
int getPositionY() const { return mPositionY; }
int getPositionX() const { return mPositionX; }
bool isVisible() const { return mVisible; }
void setVisible(bool visible) { mVisible = visible; }
private:
/* 0x18 */ JGadget::TLinkListNode mListNode;
/* 0x20 */ u32 field_0x20;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ u32 field_0x28;
/* 0x2C */ bool field_0x2c;
/* 0x30 */ int field_0x30;
/* 0x34 */ int field_0x34;
/* 0x38 */ int field_0x38;
/* 0x3C */ int field_0x3c;
/* 0x40 */ int mPositionX;
/* 0x44 */ int mPositionY;
/* 0x48 */ u32 mHeight;
/* 0x4C */ JUTFont* mFont;
/* 0x50 */ f32 mFontSizeX;
/* 0x54 */ f32 mFontSizeY;
/* 0x58 */ int mOutput;
/* 0x5C */ JUtility::TColor field_0x5c;
/* 0x60 */ JUtility::TColor field_0x60;
/* 0x64 */ int field_0x64;
/* 0x68 */ bool mVisible;
/* 0x69 */ bool field_0x69;
/* 0x6A */ bool field_0x6a;
/* 0x6B */ bool field_0x6b;
}; // Size: 0x6C
#endif /* JUTCONSOLE_H */
+24
View File
@@ -1,6 +1,30 @@
#ifndef JUTDBPRINT_H
#define JUTDBPRINT_H
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTFont.h"
#include "dolphin/types.h"
class JUTDbPrint {
public:
/* 802E0148 */ JUTDbPrint(JUTFont*, JKRHeap*);
/* 802E0190 */ void start(JUTFont*, JKRHeap*);
/* 802E0204 */ void changeFont(JUTFont*);
/* 802E021C */ void enter(int, int, int, char const*, int);
/* 802E02DC */ void flush(int, int, int, int);
/* 802E02A4 */ void flush();
/* 802E0440 */ void drawString(int, int, int, u8 const*);
static JUTDbPrint* getManager() { return sDebugPrint; }
void setVisible(bool visible) { mVisible = visible; }
static JUTDbPrint* sDebugPrint;
private:
/* 0x00 */ JUTDbPrint* mNext;
/* 0x04 */ JUTFont* mFont;
/* 0x08 */ JUtility::TColor mColor;
/* 0x0C */ bool mVisible;
};
#endif /* JUTDBPRINT_H */
+24 -6
View File
@@ -1,6 +1,8 @@
#ifndef JUTEXCEPTION_H
#define JUTEXCEPTION_H
#include "JSystem/JKernel/JKRThread.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "dolphin/gx/GX.h"
#include "dolphin/os/OS.h"
#include "dolphin/types.h"
@@ -16,13 +18,13 @@ struct JUTDirectPrint {
/* 802E456C */ void changeFrameBuffer(void*, u16, u16);
};
struct JUTException {
class JUTException /* : public JKRThread */ {
public:
struct EInfoPage {};
// TODO: return types are probably wrong
/* 802E1D5C */ JUTException(JUTDirectPrint*);
/* 802E1E40 */ void create(JUTDirectPrint*);
/* 802E1EA8 */ void run();
/* 802E1FCC */ void errorHandler(u16, OSContext*, u32, u32);
/* 802E20C0 */ void panic_f_va(char const*, int, char const*, __va_list_struct*);
/* 802E21FC */ static void panic_f(char const*, int, char const*, ...);
@@ -38,9 +40,9 @@ struct JUTException {
/* 802E2DAC */ void showSRR0Map(OSContext*);
/* 802E2E70 */ void printDebugInfo(JUTException::EInfoPage, u16, OSContext*, u32, u32);
/* 802E2F18 */ void isEnablePad() const;
/* 802E2F54 */ void readPad(u32*, u32*);
/* 802E2F54 */ bool readPad(u32*, u32*);
/* 802E34C0 */ void printContext(u16, OSContext*, u32, u32);
/* 802E3980 */ void waitTime(s32);
/* 802E3980 */ static void waitTime(s32);
/* 802E3A08 */ void createFB();
/* 802E3AEC */ void setPreUserCallback(void (*)(u16, OSContext*, u32, u32));
/* 802E3AFC */ void setPostUserCallback(void (*)(u16, OSContext*, u32, u32));
@@ -48,13 +50,18 @@ struct JUTException {
/* 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 */ ~JUTException();
/* 802E40EC */ virtual ~JUTException();
/* 802E1EA8 */ virtual void run();
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 */];
static u8 sMessageBuffer[4 + 4 /* padding */];
static u8 sErrorManager[4];
static JUTException* sErrorManager;
static u8 sPreUserCallback[4];
static u8 sPostUserCallback[4];
static u8 sConsoleBuffer[4];
@@ -62,6 +69,17 @@ struct JUTException {
static u8 sConsole[4];
static u8 msr[4];
static u8 fpscr[4];
/* 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;
/* 0x94 */ u32 mTraceSuppress;
/* 0x98 */ u32 field_0x98;
/* 0x9C */ u32 field_0x9c;
/* 0xA0 */ u32 field_0xa0;
};
#endif /* JUTEXCEPTION_H */
+27
View File
@@ -1,6 +1,33 @@
#ifndef JUTFADER_H
#define JUTFADER_H
#include "JSystem/JGeometry.h"
#include "JSystem/JUtility.h"
#include "dolphin/types.h"
class JUTFader {
public:
enum EStatus {
UNKSTATUS_M1 = -1,
};
/* 802E5530 */ JUTFader(int, int, int, int, JUtility::TColor);
/* 802E55DC */ void control();
/* 802E57D0 */ void setStatus(JUTFader::EStatus, int);
/* 802E5840 */ virtual ~JUTFader();
/* 802E576C */ virtual bool startFadeIn(int);
/* 802E579C */ virtual bool startFadeOut(int);
/* 802E56DC */ virtual void draw();
private:
/* 0x04 */ s32 mStatus;
/* 0x08 */ u16 field_0x8;
/* 0x0A */ u16 field_0xa;
/* 0x0C */ JUtility::TColor mColor;
/* 0x10 */ JGeometry::TBox2<f32> mBox;
/* 0x20 */ EStatus mEStatus;
/* 0x24 */ u32 field_0x24;
};
#endif /* JUTFADER_H */
+107 -55
View File
@@ -26,6 +26,9 @@ enum {
};
}
extern bool struct_80451500;
extern bool struct_80451501; // sResetOccured
struct JUTGamePad : public JKRDisposer {
public:
// TODO: fix types
@@ -44,49 +47,98 @@ public:
enum EStickMode {};
enum EWhichStick {};
// typedef u32 EPadPort;
enum EPadPort { Port_1 = 0, Port_2 = 0, Port_3 = 0, Port_4 = 0 };
enum EPadPort { Port_1, Port_2, Port_3, Port_4 };
JUTGamePad(JUTGamePad::EPadPort port);
virtual ~JUTGamePad();
void initList();
static s32 init();
void clear();
void read();
static void read();
void assign();
void checkResetCallback(OSTime unk); // todo: weird arg
void update();
void stopPatternedRumble() { this->rumble.stopPatternedRumble(this->pad_port); }
void stopPatternedRumble() { mRumble.stopPatternedRumble(mPortNum); }
static void checkResetSwitch();
static void clearForReset();
static JUTGamePad* getGamePad(int pad_index);
static bool recalibrate(/*PADMask*/ u32 pad_mask);
static void setAnalogMode(u32 mode) {
sAnalogMode = mode;
PADSetAnalogMode(mode);
}
static void clearResetOccurred() { struct_80451501 = false; }
static void setResetCallback(callbackFn callback, void* param_0) {
C3ButtonReset::sCallback = callback;
C3ButtonReset::sCallbackArg = param_0;
}
u32 getButton() const { return mButton.mButton; }
u32 getTrigger() const { return mButton.mTrigger; }
f32 getMainStickX() const { return mMainStick.mPosX; }
f32 getMainStickY() const { return mMainStick.mPosY; }
f32 getMainStickValue() const { return mMainStick.mValue; }
s16 getMainStickAngle() const { return mMainStick.mAngle; }
f32 getSubStickX() const { return mSubStick.mPosX; }
f32 getSubStickY() const { return mSubStick.mPosY; }
f32 getSubStickValue() const { return mSubStick.mValue; }
s16 getSubStickAngle() const { return mSubStick.mAngle; }
u8 getAnalogA() const { return mButton.mAnalogA; }
u8 getAnalogB() const { return mButton.mAnalogB; }
u8 getAnalogL() const { return mButton.mAnalogL; }
u8 getAnalogR() const { return mButton.mAnalogR; }
s8 getErrorStatus() const { return mErrorStatus; }
u32 testTrigger(u32 button) const { return mButton.mTrigger & button; }
bool isPushing3ButtonReset() const {
bool isPushingReset = false;
if (mPortNum != -1 && mButtonReset.mReset != false) {
isPushingReset = true;
}
return isPushingReset;
}
struct CButton {
CButton();
CButton(); // inline
void clear();
u32 update(PADStatus const*, u32 unk);
void setRepeat(u32 unk0, u32 unk1, u32 unk2);
u32 mButtonFlags;
u32 mPressedButtonFlags;
u32 mReleasedButtonFlags;
u8 mAnalogARaw;
u8 mAnalogBRaw;
u8 mTriggerLeftRaw;
u8 mTriggerRightRaw;
f32 mTriggerLeft;
f32 mTriggerRight;
u32 field_0x18; // padding?
u32 field_0x1c;
u32 field_0x20;
u32 field_0x24;
u32 field_0x28;
u32 field_0x2c;
};
/* 0x00 */ u32 mButton;
/* 0x04 */ u32 mTrigger; // Pressed Buttons
/* 0x08 */ u32 mRelease; // Released Buttons
/* 0x0C */ u8 mAnalogA;
/* 0x0D */ u8 mAnalogB;
/* 0x0E */ u8 mAnalogL;
/* 0x0F */ u8 mAnalogR;
/* 0x10 */ f32 mAnalogLf;
/* 0x14 */ f32 mAnalogRf;
/* 0x18 */ u32 mRepeat;
/* 0x1C */ u32 field_0x1c;
/* 0x20 */ u32 field_0x20;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ u32 field_0x28;
/* 0x2C */ u32 field_0x2c;
}; // Size: 0x30
struct C3ButtonReset {
// TODO: fix types
@@ -96,26 +148,28 @@ public:
static void* sCallbackArg;
static OSTime sThreshold;
static s32 sResetOccurredPort;
};
/* 0x0 */ bool mReset;
}; // Size: 0x4
struct CStick {
static f32 sPressPoint;
static f32 sReleasePoint;
CStick();
CStick(); // inline
void clear();
void clear(JUTGamePad* pad);
u32 update(s8 unk0, s8 unk1, JUTGamePad::EStickMode mode, JUTGamePad::EWhichStick stick,
u32 unk2);
u32 getButton(u32 unk);
float mPosX;
float mPosY;
float mValue;
s16 mAngle;
s8 field_0xe;
s8 field_0xf;
};
/* 0x0 */ f32 mPosX;
/* 0x4 */ f32 mPosY;
/* 0x8 */ f32 mValue;
/* 0xC */ s16 mAngle;
/* 0xE */ s8 field_0xe;
/* 0xF */ s8 field_0xf;
}; // Size: 0x10
struct CRumble {
static PADMask sChannelMask[4];
@@ -137,30 +191,28 @@ public:
void startPatternedRumble(void* unk0, ERumble rumble, u32 unk1);
void stopPatternedRumble(s16 pad_port);
void stopPatternedRumbleAtThePeriod();
static void setEnabled(/*PADMask*/ u32 pad_mask);
static void setEnabled(u32 pad_mask);
u32 field_0x0;
u32 field_0x4;
u8* field_0x8;
u32 field_0xc;
u8* field_0x10;
};
/* 0x00 */ u32 field_0x0;
/* 0x04 */ u32 field_0x4;
/* 0x08 */ u8* field_0x8;
/* 0x0C */ u32 field_0xc;
/* 0x10 */ u8* field_0x10;
}; // Size: 0x14
CButton buttons;
CStick control_stick;
CStick c_stick;
CRumble rumble;
s16 pad_port;
s8 error_value;
u8 pad0;
JSUPtrLink ptr_link;
u8 unk0[8];
u8 field_0x98;
u8 unk1[3];
u8 reset_flag;
u8 pad1[3];
OSTime reset_time;
u8 field_0xa8;
/* 0x18 */ CButton mButton;
/* 0x48 */ CStick mMainStick;
/* 0x58 */ CStick mSubStick;
/* 0x68 */ CRumble mRumble;
/* 0x7C */ s16 mPortNum;
/* 0x7E */ s8 mErrorStatus;
/* 0x80 */ JSULink<JUTGamePad> mLink;
/* 0x90 */ u32 mPadRecord;
/* 0x94 */ u32 mPadReplay;
/* 0x98 */ C3ButtonReset mButtonReset;
/* 0x9C */ u8 field_0x9c[4];
/* 0xA0 */ OSTime mResetTime;
/* 0xA8 */ u8 field_0xa8;
friend class CRumble;
};
+2 -2
View File
@@ -23,8 +23,8 @@ struct ResTIMG { /* Acts as the header to image data. Usually texture data immed
u8 maxAnisotropy;
u8 minFilter;
u8 magFilter;
u8 minLOD;
u8 maxLOD;
s8 minLOD;
s8 maxLOD;
u8 mipmapCount;
u8 unknown;
s16 LODBias;
+28 -29
View File
@@ -6,40 +6,16 @@
#include "dolphin/types.h"
#include "dolphin/vi/vi.h"
// TODO: placeholder
struct _GXRenderModeObj {};
struct JUTVideo {
static JUTVideo* sManager;
// TODO: figure out type
static u8 sVideoLastTick[4];
static u8 sVideoInterval[4];
class JUTVideo {
public:
typedef void (*CallbackFn)(void);
JUTVideo(_GXRenderModeObj const*);
virtual ~JUTVideo();
typedef void (*CallbackFn)(void);
// struct JUTVideo_vtable * vtable;
GXRenderModeObj* render_object;
u32 field_0x8;
u32 retrace_count;
u32 field_0x10;
u32 field_0x14;
u32 field_0x18;
VIRetraceCallback pre_retrace_callback;
VIRetraceCallback post_retrace_callback;
CallbackFn unknown_callback_1;
CallbackFn unknown_callback_2;
bool set_black;
u8 padding[3];
s32 set_black_frame_counter;
OSMessage message;
OSMessageQueue message_queue;
// TODO: return types not confirmed
/* 802E4C54 */ void createManager(_GXRenderModeObj const*);
/* 802E4CAC */ void destroyManager();
/* 802E4C54 */ static JUTVideo* createManager(_GXRenderModeObj const*);
/* 802E4CAC */ static void destroyManager();
/* 802E4E50 */ void preRetraceProc(u32);
/* 802E5088 */ void drawDoneStart();
/* 802E50B0 */ void dummyNoDrawWait();
@@ -47,6 +23,29 @@ struct JUTVideo {
/* 802E5144 */ void postRetraceProc(u32);
/* 802E5198 */ void setRenderMode(_GXRenderModeObj const*);
/* 802E5210 */ void waitRetraceIfNeed();
static JUTVideo* getManager() { return sManager; }
_GXRenderModeObj* getRenderMode() const { return mRenderObj; }
static JUTVideo* sManager;
static u32 sVideoLastTick;
static u32 sVideoInterval;
private:
/* 0x04 */ _GXRenderModeObj* mRenderObj;
/* 0x08 */ u32 field_0x8;
/* 0x0C */ u32 mRetraceCount;
/* 0x10 */ u32 field_0x10;
/* 0x14 */ u32 field_0x14;
/* 0x18 */ u32 field_0x18;
/* 0x1C */ VIRetraceCallback mPreRetraceCallback;
/* 0x20 */ VIRetraceCallback mPostRetraceCallback;
/* 0x24 */ CallbackFn unknown_callback_1;
/* 0x28 */ CallbackFn unknown_callback_2;
/* 0x2C */ bool mSetBlack;
/* 0x30 */ s32 mSetBlackFrameCount;
/* 0x34 */ OSMessage mMessage;
/* 0x38 */ OSMessageQueue mMessageQueue;
};
#endif /* JUTVIDEO_H */
+32
View File
@@ -1,6 +1,38 @@
#ifndef JUTXFB_H
#define JUTXFB_H
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTVideo.h"
#include "dolphin/types.h"
class JUTXfb {
public:
enum EXfbNumber { // TODO: placeholder
UNK_0 = 0,
UNK_1 = 1,
UNK_2 = 2,
UNK_3 = 3,
};
/* 802E5214 */ void clearIndex();
/* 802E5228 */ void common_init(int);
/* 802E5260 */ JUTXfb(_GXRenderModeObj const*, JKRHeap*, JUTXfb::EXfbNumber);
/* 802E5308 */ ~JUTXfb();
/* 802E5378 */ void delXfb(int);
/* 802E53B8 */ static JUTXfb* createManager(JKRHeap*, JUTXfb::EXfbNumber);
/* 802E5424 */ static void destroyManager();
/* 802E5454 */ void initiate(u16, u16, JKRHeap*, JUTXfb::EXfbNumber);
static JUTXfb* sManager;
private:
/* 0x00 */ void* mBuffer[3];
/* 0x0C */ bool mXfbAllocated[3];
/* 0x10 */ s32 mBufferNum;
/* 0x14 */ s16 mDrawingXfbIndex;
/* 0x16 */ s16 mDrawnXfbIndex;
/* 0x18 */ s16 mDisplayingXfbIndex;
/* 0x1C */ s32 mSDrawingFlag;
};
#endif /* JUTXFB_H */