summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorErin Moon <erin@hecke.rs>2020-12-29 17:01:48 -0600
committerGitHub <noreply@github.com>2020-12-29 18:01:48 -0500
commitcba64289a4440824e8ddad549dca562df2489edf (patch)
treead320e3687437a428d0d94873588744c0f218f46 /include
parent6a16bef70ea98b2b8ed553ddd37439bdb6513b04 (diff)
JUTXfb: decompile (#38)
* m_Do_Reset: split and (some) decomp decompiles: - my_OSCancelAlarmAll() - destroyVideo() * mDoRst::reset(): decompile, plus some supporting code * split DVD* functions to dvd.h * mDoRst::resetCallBack(): decompile * JUTXfb: split * JUTXfb: decompile (except for almost-matching ctor) Elaborates JUTVideo and some related stuff. Decompiles the following functions: - JUTXfb::initiate() - JUTXfb::createManager() - JUTXfb::common_init() - JUTXfb::destroyManager() - JUTXfb::~JUTXfb() - JUTXfb::JUTXfb(): *almost* matching up to regalloc * clang-format and extern label modifications Co-authored-by: Pheenoh <pheenoh@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/JUtility/JUTVideo/JUTVideo.h33
-rw-r--r--include/JSystem/JUtility/JUTXfb/JUTXfb.h13
-rw-r--r--include/JSystem/JUtility/JUTXfb/asm/func_802E5260.s44
-rw-r--r--include/functions.h8
-rw-r--r--include/gx/GX.h27
-rw-r--r--include/m_Do/m_Do_Reset/m_Do_Reset.h1
-rw-r--r--include/variables.h2
-rw-r--r--include/vi/VI.h8
8 files changed, 135 insertions, 1 deletions
diff --git a/include/JSystem/JUtility/JUTVideo/JUTVideo.h b/include/JSystem/JUtility/JUTVideo/JUTVideo.h
new file mode 100644
index 0000000000..8c47e79dad
--- /dev/null
+++ b/include/JSystem/JUtility/JUTVideo/JUTVideo.h
@@ -0,0 +1,33 @@
+#ifndef __JUTILITY_JUTVIDEO_JUTVIDEO_H__
+#define __JUTILITY_JUTVIDEO_JUTVIDEO_H__
+
+#include "gx/GX.h"
+#include "os/OS.h"
+#include "vi/VI.h"
+
+struct JUTVideo {
+ 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;
+};
+
+extern JUTVideo* lbl_80451538;
+
+#endif
diff --git a/include/JSystem/JUtility/JUTXfb/JUTXfb.h b/include/JSystem/JUtility/JUTXfb/JUTXfb.h
index 0eaa499a78..fbfdb7156f 100644
--- a/include/JSystem/JUtility/JUTXfb/JUTXfb.h
+++ b/include/JSystem/JUtility/JUTXfb/JUTXfb.h
@@ -1,11 +1,22 @@
#ifndef __JUTILITY_JUTXFB_JUTXFB_H__
#define __JUTILITY_JUTXFB_JUTXFB_H__
+#include "JSystem/JKernel/JKRHeap/JKRHeap.h"
#include "dolphin/types.h"
+#include "gx/GX.h"
class JUTXfb {
public:
+ typedef s32 EXfbNumber;
+ JUTXfb(GXRenderModeObj* obj, JKRHeap* heap, EXfbNumber xfb_number);
+ ~JUTXfb();
+
void clearIndex();
+ void common_init(s32 xfb_number);
+ void delXfb(s32 index);
+ static JUTXfb* createManager(JKRHeap* heap, EXfbNumber xfb_number);
+ static void destroyManager();
+ void initiate(u16 width, u16 height, JKRHeap* heap, JUTXfb::EXfbNumber xfb_number);
private:
void* xfb_buffer[3];
@@ -19,4 +30,6 @@ private:
s32 field_0x1c;
};
+extern JUTXfb* lbl_80451550;
+
#endif \ No newline at end of file
diff --git a/include/JSystem/JUtility/JUTXfb/asm/func_802E5260.s b/include/JSystem/JUtility/JUTXfb/asm/func_802E5260.s
new file mode 100644
index 0000000000..e27f6b9346
--- /dev/null
+++ b/include/JSystem/JUtility/JUTXfb/asm/func_802E5260.s
@@ -0,0 +1,44 @@
+/* 802E5260 002E21A0 94 21 FF E0 */ stwu r1, -0x20(r1)
+/* 802E5264 002E21A4 7C 08 02 A6 */ mflr r0
+/* 802E5268 002E21A8 90 01 00 24 */ stw r0, 0x24(r1)
+/* 802E526C 002E21AC 39 61 00 20 */ addi r11, r1, 0x20
+/* 802E5270 002E21B0 48 07 CF 65 */ bl _savegpr_27
+/* 802E5274 002E21B4 7C 7B 1B 78 */ mr r27, r3
+/* 802E5278 002E21B8 7C 9E 23 78 */ mr r30, r4
+/* 802E527C 002E21BC 7C BC 2B 78 */ mr r28, r5
+/* 802E5280 002E21C0 7C DD 33 78 */ mr r29, r6
+/* 802E5284 002E21C4 7F A4 EB 78 */ mr r4, r29
+/* 802E5288 002E21C8 4B FF FF A1 */ bl common_init__6JUTXfbFl
+/* 802E528C 002E21CC 28 1E 00 00 */ cmplwi r30, 0
+/* 802E5290 002E21D0 41 82 00 20 */ beq lbl_802E52B0
+/* 802E5294 002E21D4 7F 63 DB 78 */ mr r3, r27
+/* 802E5298 002E21D8 A0 9E 00 04 */ lhz r4, 4(r30)
+/* 802E529C 002E21DC A0 BE 00 08 */ lhz r5, 8(r30)
+/* 802E52A0 002E21E0 7F 86 E3 78 */ mr r6, r28
+/* 802E52A4 002E21E4 7F A7 EB 78 */ mr r7, r29
+/* 802E52A8 002E21E8 48 00 01 AD */ bl initiate__6JUTXfbFUsUsP7JKRHeapl
+/* 802E52AC 002E21EC 48 00 00 40 */ b lbl_802E52EC
+lbl_802E52B0:
+/* 802E52B0 002E21F0 80 6D 8F B8 */ lwz r3, lbl_80451538-_SDA_BASE_(r13)
+/* 802E52B4 002E21F4 80 83 00 04 */ lwz r4, 4(r3)
+/* 802E52B8 002E21F8 A3 E4 00 04 */ lhz r31, 4(r4)
+/* 802E52BC 002E21FC A0 64 00 06 */ lhz r3, 6(r4)
+/* 802E52C0 002E2200 7C 7E 1B 78 */ mr r30, r3
+/* 802E52C4 002E2204 A0 84 00 08 */ lhz r4, 8(r4)
+/* 802E52C8 002E2208 48 07 7A A5 */ bl GXGetYScaleFactor
+/* 802E52CC 002E220C 7F C3 F3 78 */ mr r3, r30
+/* 802E52D0 002E2210 48 07 7A 0D */ bl GXGetNumXfbLines
+/* 802E52D4 002E2214 7C 65 1B 78 */ mr r5, r3
+/* 802E52D8 002E2218 7F 63 DB 78 */ mr r3, r27
+/* 802E52DC 002E221C 7F E4 FB 78 */ mr r4, r31
+/* 802E52E0 002E2220 7F 86 E3 78 */ mr r6, r28
+/* 802E52E4 002E2224 7F A7 EB 78 */ mr r7, r29
+/* 802E52E8 002E2228 48 00 01 6D */ bl initiate__6JUTXfbFUsUsP7JKRHeapl
+lbl_802E52EC:
+/* 802E52EC 002E222C 7F 63 DB 78 */ mr r3, r27
+/* 802E52F0 002E2230 39 61 00 20 */ addi r11, r1, 0x20
+/* 802E52F4 002E2234 48 07 CF 2D */ bl _restgpr_27
+/* 802E52F8 002E2238 80 01 00 24 */ lwz r0, 0x24(r1)
+/* 802E52FC 002E223C 7C 08 03 A6 */ mtlr r0
+/* 802E5300 002E2240 38 21 00 20 */ addi r1, r1, 0x20
+/* 802E5304 002E2244 4E 80 00 20 */ blr \ No newline at end of file
diff --git a/include/functions.h b/include/functions.h
index 9b26f6ba7c..f9302f54d2 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -261,6 +261,8 @@ void __RAS_OSDisableInterrupts_begin(void);
u8 dComIfGs_getBottleMax(void);
void mDoDvdErr_ThdCleanup(void);
+void initiate__6JUTXfbFUsUsP7JKRHeapl(void);
+void common_init__6JUTXfbFl(void);
}
class mDoCPd_c;
@@ -379,6 +381,12 @@ void VIFlush(void);
}
extern "C" {
+void VIWaitForRetrace(void);
+void VISetBlack(s32);
+void VIFlush(void);
+}
+
+extern "C" {
void JUTReport__FiiPCce(int, int, const char*, ...);
void JUTReportConsole(const char*);
}
diff --git a/include/gx/GX.h b/include/gx/GX.h
new file mode 100644
index 0000000000..d7c5f80ca8
--- /dev/null
+++ b/include/gx/GX.h
@@ -0,0 +1,27 @@
+#ifndef __GX_H__
+#define __GX_H__
+
+#include "dolphin/types.h"
+
+struct GXRenderModeObj {
+ s32 vi_tv_mode;
+ u16 fb_width;
+ u16 efb_height;
+ u16 xfb_height;
+ u16 vi_x_origin;
+ u16 vi_y_origin;
+ u16 vi_width;
+ u16 vi_height;
+ s32 xfb_mode;
+ u8 field_rendering;
+ u8 antialiasing;
+ u8 sample_pattern[12][2];
+ u8 vfilter[7];
+};
+
+extern "C" {
+f32 GXGetYScaleFactor(u16 efb_height, u16 xfb_height);
+u16 GXGetNumXfbLines(u32 efb_height, f32 y_scale);
+}
+
+#endif \ No newline at end of file
diff --git a/include/m_Do/m_Do_Reset/m_Do_Reset.h b/include/m_Do/m_Do_Reset/m_Do_Reset.h
index 6603198b50..b778624850 100644
--- a/include/m_Do/m_Do_Reset/m_Do_Reset.h
+++ b/include/m_Do/m_Do_Reset/m_Do_Reset.h
@@ -1,6 +1,7 @@
#ifndef __M_DO_RESET_H__
#define __M_DO_RESET_H__
+#include "JSystem/JUtility/JUTXfb/JUTXfb.h"
#include "dolphin/types.h"
extern "C" {
diff --git a/include/variables.h b/include/variables.h
index 3a30de2643..32b7b5e29c 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -396,7 +396,7 @@ extern u32 lbl_80450DE4;
// m_Do_Reset
// func_80015614
#include "JSystem/JUtility/JUTXfb/JUTXfb.h"
-extern JUTXfb* lbl_80451550;
+// extern JUTXfb* lbl_80451550;
extern u8 lbl_80450BB8;
extern char lbl_80374198[16];
// func_8001574C
diff --git a/include/vi/VI.h b/include/vi/VI.h
new file mode 100644
index 0000000000..e284e538ae
--- /dev/null
+++ b/include/vi/VI.h
@@ -0,0 +1,8 @@
+#ifndef __VI_H__
+#define __VI_H__
+
+#include "dolphin/types.h"
+
+typedef void (*VIRetraceCallback)(u32);
+
+#endif \ No newline at end of file