mirror of
https://github.com/SwareJonge/mkdd.git
synced 2024-11-28 07:40:41 +00:00
Fixed most regswaps
This commit is contained in:
parent
91d80f35b3
commit
e7fbbaf984
@ -14,12 +14,12 @@ JSystem/JFramework/JFWSystem.cpp:
|
||||
.sdata2: [0x80417398, 0x804173b8]
|
||||
|
||||
#JSystem/JFramework/JFWDisplay.cpp:
|
||||
#.text: [0x80015b80, 0x8001726c]
|
||||
##.ctors: [0x803160a8, 0x803160ac]
|
||||
#.text: [0x80015b80, 0x8001726c] # 0x0x80017308
|
||||
#.ctors: [0x803160a8, 0x803160ac]
|
||||
#.rodata: [0x80360fd8, 0x803610f0]
|
||||
#.data: [0x803880c0, 0x80388160]
|
||||
##.bss: [0x803ae380, 0x803ae3b0] # common on yay....
|
||||
##.bss: [0x803ef5c0, 0x803ef5cc] # probably won't work
|
||||
#.bss: [0x803ae380, 0x803ae3b0] # common on yay....
|
||||
#.bss: [0x803ef5c0, 0x803ef5cc] # probably won't work
|
||||
#.sbss: [0x80415718, 0x80415740]
|
||||
#.sdata2: [0x804173b8, 0x804173e0]
|
||||
|
||||
|
@ -71,6 +71,7 @@ global:
|
||||
|
||||
0x80388140: __vt__10JFWDisplay
|
||||
0x803880c0: e_mtx
|
||||
0x803ae38c: clear_z_tobj
|
||||
0x803ef5c0: sList__8JFWAlarm
|
||||
0x80415718: sManager__10JFWDisplay
|
||||
|
||||
@ -699,6 +700,10 @@ global:
|
||||
0x800f31d8: __init_cpp
|
||||
0x800f322c: _ExitProcess
|
||||
|
||||
# global_destructor_chain.c
|
||||
0x80105a68: __destroy_global_chain
|
||||
0x80105ab0: __register_global_object
|
||||
|
||||
# NMWException.cp
|
||||
0x80105af8: __destroy_new_array
|
||||
0x80105b74: __destroy_arr
|
||||
|
@ -13,11 +13,9 @@
|
||||
|
||||
typedef void (*JFWDisplayUnkFunc)(void);
|
||||
|
||||
static void JFWDrawDoneAlarm();
|
||||
static void JFWThreadAlarmHandler(OSAlarm *, OSContext *);
|
||||
static void JFWGXAbortAlarmHandler(OSAlarm *, OSContext *);
|
||||
static void waitForTick(u32, u16);
|
||||
static void diagnoseGpHang();
|
||||
struct zTXStruct {
|
||||
GXTexObj texObj[2];
|
||||
} __attribute__((aligned(32))); // workaround i guess
|
||||
|
||||
class JFWAlarm : public OSAlarm { // everything here seems to be auto inlined or unused
|
||||
public:
|
||||
@ -31,7 +29,7 @@ public:
|
||||
OSThread *getThread() const { return mThread; }
|
||||
void setThread(OSThread *thread) { mThread = thread; }
|
||||
|
||||
static JSUList<JFWAlarm> sList;
|
||||
static JSUList<JFWAlarm> sList;//
|
||||
|
||||
public:
|
||||
/* 0x28 */ OSThread *mThread;
|
||||
@ -80,7 +78,7 @@ public:
|
||||
// void addToDoubleXfb(void *, bool);
|
||||
// void addToDoubleXfb(JKRHeap *);
|
||||
// void clearAllXfb();
|
||||
// void frameToTick(float);
|
||||
s32 frameToTick(float);
|
||||
// static void setForOSResetSystem();
|
||||
|
||||
// Virtual functions
|
||||
@ -91,11 +89,11 @@ public:
|
||||
|
||||
static JFWDisplay *getManager() { return sManager; }
|
||||
|
||||
int getEfbHeight() const {
|
||||
u32 getEfbHeight() const {
|
||||
return JUTVideo::getManager()->getEfbHeight();
|
||||
}
|
||||
|
||||
int getEfbWidth() const {
|
||||
u32 getEfbWidth() const {
|
||||
return JUTVideo::getManager()->getFbWidth();
|
||||
}
|
||||
|
||||
@ -106,16 +104,6 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
void waitDraw() {
|
||||
waitForTick(mTickRate, mFrameRate);
|
||||
JUTVideo::getManager()->waitRetraceIfNeed();
|
||||
|
||||
u32 tick = OSGetTick();
|
||||
_30 = tick - _2C; // duration of frame in ticks?
|
||||
_2C = tick;
|
||||
_34 = _2C - JUTVideo::getVideoLastTick();
|
||||
}
|
||||
|
||||
int startFadeIn(int param_0) {
|
||||
if (mFader != nullptr) {
|
||||
return mFader->startFadeIn(param_0);
|
||||
@ -153,4 +141,12 @@ private:
|
||||
/* 0x4A */ u8 _4a;
|
||||
};
|
||||
|
||||
extern GXTexObj clear_z_tobj;
|
||||
|
||||
static void JFWDrawDoneAlarm();
|
||||
static void JFWThreadAlarmHandler(OSAlarm *, OSContext *);
|
||||
static void JFWGXAbortAlarmHandler(OSAlarm *, OSContext *);
|
||||
static void waitForTick(u32, u16);
|
||||
static void diagnoseGpHang();
|
||||
|
||||
#endif
|
@ -49,6 +49,9 @@ class JSULink; // friend class? i'm C++ noob
|
||||
template<class T>
|
||||
class JSUList : public JSUPtrList {
|
||||
public:
|
||||
JSUList(bool thing) : JSUPtrList(thing) {
|
||||
|
||||
}
|
||||
JSUList() : JSUPtrList() {
|
||||
|
||||
}
|
||||
@ -56,10 +59,6 @@ public:
|
||||
bool remove(JSULink<T> *link) { // is this even correct?
|
||||
return JSUPtrList::remove(link);
|
||||
}
|
||||
|
||||
JSUList(bool thing) : JSUPtrList(thing) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
@ -10,7 +10,7 @@
|
||||
* @size{0x58}
|
||||
*/
|
||||
|
||||
//typedef u8 (*Pattern)[2];
|
||||
typedef u8 (*Pattern)[2];
|
||||
|
||||
struct JUTVideo
|
||||
{
|
||||
@ -26,20 +26,20 @@ struct JUTVideo
|
||||
|
||||
u16 getEfbHeight() const { return m_renderModeObj->efbHeight; }
|
||||
u16 getFbWidth() const { return m_renderModeObj->fbWidth; }
|
||||
void getBounds(u16& width, u16& height) const {
|
||||
width = (u16)getFbWidth();
|
||||
height = (u16)getEfbHeight();
|
||||
void getBounds(u16& width, u16& height) const {
|
||||
width = getFbWidth();
|
||||
height = getEfbHeight();
|
||||
}
|
||||
const _GXRenderModeObj *getRenderMode() { return m_renderModeObj; }
|
||||
_GXRenderModeObj *getRenderMode() const { return m_renderModeObj; }
|
||||
u16 getXfbHeight() const { return m_renderModeObj->xfbHeight; }
|
||||
u32 isAntiAliasing() const { return m_renderModeObj->aa; }
|
||||
//u8 * getSamplePattern() const { return &m_renderModeObj->sample_pattern; }
|
||||
//u8 *getVFilter() const { return m_renderModeObj->vfilter; }
|
||||
Pattern getSamplePattern() const { return m_renderModeObj->sample_pattern; }
|
||||
u8 *getVFilter() const { return m_renderModeObj->vfilter; }
|
||||
OSMessageQueue *getMessageQueue() { return &m_messageQueue; };
|
||||
static void drawDoneStart();
|
||||
static void dummyNoDrawWait();
|
||||
void setRenderMode(const _GXRenderModeObj *);
|
||||
void waitRetraceIfNeed(){};
|
||||
void waitRetraceIfNeed(); // blr, global
|
||||
VIRetraceCallback setPostRetraceCallback(VIRetraceCallback);
|
||||
|
||||
// Unused/inlined:
|
||||
@ -54,7 +54,7 @@ struct JUTVideo
|
||||
static OSTick getVideoLastTick() { return sVideoLastTick; }
|
||||
|
||||
// _00 VTBL
|
||||
const _GXRenderModeObj *m_renderModeObj; // _04
|
||||
_GXRenderModeObj *m_renderModeObj; // _04
|
||||
u32 _08; // _08
|
||||
u32 m_retraceCount; // _0C
|
||||
int _10; // _10
|
||||
|
@ -26,29 +26,20 @@ public:
|
||||
|
||||
s32 getBufferNum() const { return mBufferNum; }
|
||||
s16 getDrawnXfbIndex() const { return mDrawnXfbIndex; }
|
||||
s16 getDrawingXfbIndex() const { return mDrawingXfbIndex; }
|
||||
s16 getDisplayingXfbIndex() const { return mDisplayingXfbIndex; }
|
||||
int getDrawingXfbIndex() const { return mDrawingXfbIndex; }
|
||||
int getDisplayingXfbIndex() const { return mDisplayingXfbIndex; }
|
||||
s32 getSDrawingFlag() const { return mSDrawingFlag; }
|
||||
|
||||
void *getDrawnXfb() const
|
||||
{
|
||||
if (mDrawnXfbIndex >= 0)
|
||||
return mBuffer[mDrawnXfbIndex];
|
||||
return nullptr;
|
||||
void *getDrawnXfb() const {
|
||||
return (mDrawnXfbIndex >= 0) ? mBuffer[mDrawnXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void *getDrawingXfb() const
|
||||
{
|
||||
if (mDrawingXfbIndex >= 0)
|
||||
return mBuffer[mDrawingXfbIndex];
|
||||
return nullptr;
|
||||
void *getDrawingXfb() const {
|
||||
return (mDrawingXfbIndex >= 0) ? mBuffer[mDrawingXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void *getDisplayingXfb() const
|
||||
{
|
||||
if (mDisplayingXfbIndex >= 0)
|
||||
return mBuffer[mDisplayingXfbIndex];
|
||||
return nullptr;
|
||||
void *getDisplayingXfb() const {
|
||||
return (mDisplayingXfbIndex >= 0) ? mBuffer[mDisplayingXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void setDisplayingXfbIndex(s16 index) { mDisplayingXfbIndex = index; }
|
||||
|
@ -24,6 +24,7 @@ u32 __OSBusClock : (0x800000F8);
|
||||
#define OSTicksToMicroseconds(ticks) (((ticks) * 8) / (OS_TIMER_CLOCK / 125000))
|
||||
#define OSTicksToNanoseconds(ticks) (((ticks) * 8000) / (OS_TIMER_CLOCK / 125000))
|
||||
|
||||
#define OSMillisecondsToTicks(msec) ((msec) * (OS_TIMER_CLOCK / 1000))
|
||||
#define OSMicrosecondsToTicks(usec) (((usec) * (OS_TIMER_CLOCK / 125000)) / 8)
|
||||
#define OSNanosecondsToTicks(nsec) (((nsec) * (OS_TIMER_CLOCK / 125000)) / 8000)
|
||||
#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0))
|
||||
|
@ -902,21 +902,9 @@ typedef enum _GXTlutSize {
|
||||
void GXDrawDone(void);
|
||||
void GXPixModeSync(void);
|
||||
|
||||
typedef struct GXTexObj
|
||||
typedef struct _GXTexObj
|
||||
{
|
||||
u32 _00;
|
||||
u32 _04;
|
||||
u32 _08;
|
||||
u32 _0c;
|
||||
u8 _10;
|
||||
u8 _11;
|
||||
u8 _12;
|
||||
u8 _13;
|
||||
u32 format_14;
|
||||
u32 tlut_name_18;
|
||||
u16 _1c;
|
||||
s8 _1e;
|
||||
s8 mipmap_1f;
|
||||
u32 dummy[8];
|
||||
} GXTexObj;
|
||||
|
||||
typedef struct
|
||||
|
@ -18,7 +18,7 @@ extern JSUList<JFWAlarm> JFWAlarm::sList;
|
||||
JFWDisplay *JFWDisplay::sManager;
|
||||
static GXTexObj clear_z_tobj;
|
||||
|
||||
static Mtx44 e_mtx = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}};
|
||||
static Mtx44 e_mtx = {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}}; // Fake match, e_mtx has a size of 0x30
|
||||
static GXTexObj clear_z_TX[2] = {{0xFF00FF, 0xFF00FF, 0xFF00FF, 0xFF00FF, 0, 0xFF, 0, 0xFF, 0xFF00FF, 0xFF00FF, 0xFF, 0, -1},
|
||||
{0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF, -1, -1}};
|
||||
|
||||
@ -75,6 +75,7 @@ JFWDisplay *JFWDisplay::createManager(const _GXRenderModeObj *renderModeObj, JKR
|
||||
}
|
||||
|
||||
void JFWDisplay::destroyManager() {
|
||||
JUT_CONFIRM_MESSAGE(533, sManager); // fabricated
|
||||
delete sManager;
|
||||
sManager = nullptr;
|
||||
}
|
||||
@ -98,8 +99,8 @@ void JFWDisplay::prepareCopyDisp() {
|
||||
GXSetDispCopyYScale(y_scaleF);
|
||||
VIFlush();
|
||||
GXSetCopyFilter((GXBool)JUTVideo::getManager()->isAntiAliasing(),
|
||||
JUTVideo::getManager()->getRenderMode()->sample_pattern, GX_ENABLE,
|
||||
JUTVideo::getManager()->getRenderMode()->vfilter);
|
||||
JUTVideo::getManager()->getSamplePattern(), GX_ENABLE,
|
||||
JUTVideo::getManager()->getVFilter());
|
||||
GXSetCopyClamp((GXFBClamp)mClamp);
|
||||
GXSetDispCopyGamma((GXGamma)mGamma);
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
@ -242,7 +243,7 @@ static void MyFree(void *p1) {
|
||||
JKRHeap::getSystemHeap()->free(p1);
|
||||
}
|
||||
|
||||
void JFWDisplay::beginRender() { // jus trecompile
|
||||
void JFWDisplay::beginRender() {
|
||||
JUTProcBar::getManager()->wholeLoopEnd();
|
||||
JUTProcBar::getManager()->wholeLoopStart(0xff, 0x81, 0x1e);
|
||||
if (_40) {
|
||||
@ -267,16 +268,17 @@ void JFWDisplay::beginRender() { // jus trecompile
|
||||
|
||||
if(_40) {
|
||||
JUTProcBar::getManager()->gpStart(0xff, 0x81, 0x1e);
|
||||
switch (JUTXfb::getManager()->getBufferNum()) {
|
||||
JUTXfb * xfbMgr = JUTXfb::getManager();
|
||||
switch (xfbMgr->getBufferNum()) {
|
||||
case 1:
|
||||
if (JUTXfb::getManager()->getSDrawingFlag() != 2) {
|
||||
JUTXfb::getManager()->setSDrawingFlag(1);
|
||||
if (xfbMgr->getSDrawingFlag() != 2) {
|
||||
xfbMgr->setSDrawingFlag(1);
|
||||
clearEfb(mClearColor);
|
||||
}
|
||||
else {
|
||||
JUTXfb::getManager()->setSDrawingFlag(1);
|
||||
xfbMgr->setSDrawingFlag(1);
|
||||
}
|
||||
JUTXfb::getManager()->setDrawingXfbIndex(_48);
|
||||
xfbMgr->setDrawingXfbIndex(_48);
|
||||
break;
|
||||
case 2:
|
||||
exchangeXfb_double();
|
||||
@ -289,8 +291,8 @@ void JFWDisplay::beginRender() { // jus trecompile
|
||||
}
|
||||
}
|
||||
|
||||
_3C++;
|
||||
_40 = _3C >= _38;
|
||||
|
||||
_40 = _3C++ >= _38; // Regswaps here
|
||||
|
||||
if (_40) {
|
||||
_3C = 0;
|
||||
@ -422,17 +424,17 @@ void JFWDisplay::clearEfb(GXColor color) {
|
||||
clearEfb(0, 0, width, height, color);
|
||||
}
|
||||
|
||||
void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GXColor color)
|
||||
{
|
||||
u16 height;
|
||||
u16 width;
|
||||
|
||||
void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3,
|
||||
GXColor color) {
|
||||
Mtx44 mtx;
|
||||
|
||||
JUTVideo::getManager()->getBounds(width, height);
|
||||
|
||||
MTXOrtho(mtx, 0.0f, (u32)height, 0.0f, (u32)width, 0.0f, 1.0f);
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
u16 height = JUTVideo::getManager()->getEfbHeight();
|
||||
|
||||
C_MTXOrtho(mtx, 0.0f, height, 0.0f, width, 0.0f, 1.0f);
|
||||
GXSetProjection(mtx, GX_ORTHOGRAPHIC);
|
||||
GXSetViewport(0.0f, 0.0f, (u32)width, (u32)height, 0.0f, 1.0f);
|
||||
GXSetViewport(0.0f, 0.0f, width, height, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, width, height);
|
||||
|
||||
GXLoadPosMtxImm(e_mtx, GX_PNMTX0);
|
||||
@ -443,10 +445,8 @@ void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GX
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBX8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0);
|
||||
GXSetNumChans(0);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_DISABLE, 125);
|
||||
GXLoadTexObj(&clear_z_tobj, GX_TEXMAP0);
|
||||
@ -507,6 +507,11 @@ void JFWDisplay::calcCombinationRatio() {
|
||||
}
|
||||
}
|
||||
|
||||
s32 JFWDisplay::frameToTick(float mTemporarySingle) { // fabricated
|
||||
JUT_CONFIRM_MESSAGE(999, mTemporarySingle);
|
||||
return OSMillisecondsToTicks(mFrameRate);
|
||||
}
|
||||
|
||||
static void JFWDrawDoneAlarm() {
|
||||
JFWAlarm alarm;
|
||||
s32 status = OSDisableInterrupts();
|
||||
@ -527,6 +532,7 @@ static void JFWGXAbortAlarmHandler(OSAlarm *param_0, OSContext *param_1) {
|
||||
GXSetDrawDone();
|
||||
}
|
||||
|
||||
// TODO
|
||||
static void diagnoseGpHang() {
|
||||
u32 sp28;
|
||||
u32 sp24;
|
||||
|
Loading…
Reference in New Issue
Block a user