summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2021-05-10 08:54:07 -0700
committerGitHub <noreply@github.com>2021-05-10 11:54:07 -0400
commit462d71cbef02ef119fc2aa480b98cfeedde46441 (patch)
tree923ed9f6f939c3e4b64dba0070e1539d05910089 /include
parent9799fadfe84344fa3ea78835365570d832a476c7 (diff)
Makefile fixes / JUTNameTab (#129)
* Makefile: Fix issues with iconv causing it to break under devkitPro / msys The version of iconv included in devkitPro does not have a -o option, so replace it with normal shell redirection. Also, SHIFT-JIS does not have a mapping for ~, so output the Windows CP932 variant instead, which does. See: https://en.wikipedia.org/wiki/Tilde#Unicode_and_Shift_JIS_encoding_of_wave_dash https://en.wikipedia.org/wiki/Code_page_932_(Microsoft_Windows)#Single-byte_character_differences * Update diff configuration -Bbinary doesn't seem to work with my copy of bjdump (it says it can't decode unknown architecture) Cheese things by using expected/ instead of having the user place things manually. * JUTNameTab * J3DPacket / J3DDrawBuffer * format Co-authored-by: lepelog <lepelog@users.noreply.github.com>
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/J3DGraphBase/J3DDrawBuffer.h45
-rw-r--r--include/JSystem/J3DGraphBase/J3DPacket.h108
-rw-r--r--include/JSystem/J3DGraphBase/J3DSys.h6
-rw-r--r--include/JSystem/JUtility/JUTNameTab.h30
-rw-r--r--include/dolphin/gx/GX.h1
-rw-r--r--include/dolphin/gx/GXDisplayList.h6
6 files changed, 196 insertions, 0 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
index 5f62d772f8..f24f798b08 100644
--- a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
+++ b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
@@ -1,6 +1,51 @@
#ifndef J3DDRAWBUFFER_H
#define J3DDRAWBUFFER_H
+#include "JSystem/J3DGraphBase/J3DSys.h"
+#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
+class J3DDrawBuffer;
+class J3DPacket;
+class J3DDrawPacket;
+class J3DMatPacket;
+class J3DShapePacket;
+
+typedef void (*J3DDrawBuffer_DrawFunc)(const J3DDrawBuffer* this_);
+
+class J3DDrawBuffer {
+public:
+ ~J3DDrawBuffer();
+ void initialize();
+ J3DError allocBuffer(u32);
+ void frameInit();
+ void entryMatSort(J3DMatPacket*);
+ void entryMatAnmSort(J3DMatPacket*);
+ void entryZSort(J3DMatPacket*);
+ void entryModelSort(J3DMatPacket*);
+ void entryInvalidSort(J3DMatPacket*);
+ bool entryNonSort(J3DMatPacket*);
+ bool entryImm(J3DPacket* pPacket, u16 index);
+ void draw() const;
+ void drawHead() const;
+ void drawTail() const;
+
+ inline void calcZRatio();
+
+public:
+ J3DPacket** mpBuf;
+ u32 mBufSize;
+ u32 mDrawType;
+ u32 mSortType;
+ float mZNear;
+ float mZFar;
+ float mZRatio;
+ Mtx* mpZMtx;
+ J3DPacket* mpCallBackPacket;
+
+ static u8 sortFuncTable[72];
+ static u8 drawFuncTable[24];
+ static u8 entryNum[4 + 4 /* padding */];
+};
+
#endif /* J3DDRAWBUFFER_H */
diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h
index 4c0f4064b4..09e3a7c739 100644
--- a/include/JSystem/J3DGraphBase/J3DPacket.h
+++ b/include/JSystem/J3DGraphBase/J3DPacket.h
@@ -1,6 +1,114 @@
#ifndef J3DPACKET_H
#define J3DPACKET_H
+#include "JSystem/J3DGraphBase/J3DSys.h"
+#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
+class J3DMatPacket;
+
+class J3DDrawBuffer;
+class J3DMaterial;
+class J3DMaterialAnm;
+class J3DModel;
+class J3DMtxBuffer;
+class J3DShape;
+class J3DTexMtx;
+class J3DTexture;
+
+class J3DDisplayListObj {
+public:
+ J3DError newDisplayList(u32);
+ J3DError newSingleDisplayList(u32);
+ J3DError single_To_Double();
+ void setSingleDisplayList(void*, u32);
+ void swapBuffer();
+ void callDL() const;
+ void beginDL();
+ void endDL();
+ void beginPatch();
+ void endPatch();
+
+ static u8 sGDLObj[16];
+ static u8 sInterruptFlag[4 + 4 /* padding */];
+
+ void* mpData[2];
+ u32 mSize;
+ u32 mCapacity;
+};
+
+class J3DPacket {
+public:
+ void addChildPacket(J3DPacket* pChild);
+
+ inline void clear() {
+ mpNextSibling = NULL;
+ mpFirstChild = NULL;
+ }
+
+ virtual bool entry(J3DDrawBuffer* pDrawBuffer);
+ virtual void draw();
+ virtual ~J3DPacket();
+
+public:
+ J3DPacket* mpNextSibling;
+ J3DPacket* mpFirstChild;
+};
+
+class J3DDrawPacket : public J3DPacket {
+public:
+ J3DDrawPacket();
+ ~J3DDrawPacket();
+ J3DError newDisplayList(u32);
+ J3DError newSingleDisplayList(u32);
+ virtual void draw();
+
+public:
+ void* mpUserData;
+ int mFlags;
+ char mPad0[0x0C]; // unk
+ J3DDisplayListObj* mpDisplayListObj;
+ J3DTexMtx* mpTexMtx;
+};
+
+class J3DShapePacket : public J3DDrawPacket {
+public:
+ J3DShapePacket();
+ void calcDifferedBufferSize(u32);
+ void newDifferedDisplayList(u32);
+ void prepareDraw() const;
+ void drawFast();
+
+ virtual ~J3DShapePacket();
+ virtual void draw();
+
+public:
+ J3DShape* mpShape;
+ J3DMtxBuffer* mpMtxBuffer;
+ Mtx* mpViewMtx;
+ u32 mDiffFlag;
+ J3DModel* mpModel;
+};
+
+class J3DMatPacket : public J3DDrawPacket {
+public:
+ J3DMatPacket();
+ void addShapePacket(J3DShapePacket*);
+ void beginDiff();
+ void endDiff();
+ void isSame(J3DMatPacket*) const;
+
+ virtual ~J3DMatPacket();
+ virtual bool entry(J3DDrawBuffer* pDrawBuffer);
+ virtual void draw();
+
+public:
+ J3DShapePacket* mpShapePacket;
+ J3DShapePacket* mpFirstShapePacket;
+ J3DMaterial* mpMaterial;
+ s32 mSortFlags;
+ J3DTexture* mpTexture;
+ J3DMaterialAnm* mpMaterialAnm;
+};
+
#endif /* J3DPACKET_H */
diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h
index 5802253819..73cef8bde9 100644
--- a/include/JSystem/J3DGraphBase/J3DSys.h
+++ b/include/JSystem/J3DGraphBase/J3DSys.h
@@ -3,4 +3,10 @@
#include "dolphin/types.h"
+// Perhaps move to a new J3DEnum.h?
+enum J3DError {
+ kJ3DError_Success = 0,
+ kJ3DError_Alloc = 4,
+};
+
#endif /* J3DSYS_H */
diff --git a/include/JSystem/JUtility/JUTNameTab.h b/include/JSystem/JUtility/JUTNameTab.h
index 008473520a..ff0e7860e8 100644
--- a/include/JSystem/JUtility/JUTNameTab.h
+++ b/include/JSystem/JUtility/JUTNameTab.h
@@ -3,4 +3,34 @@
#include "dolphin/types.h"
+struct ResNTAB {
+ u16 mEntryNum;
+ u16 mPad0;
+ struct Entry {
+ u16 mKeyCode;
+ u16 mOffs;
+ } mEntries[1];
+
+ inline const char* getName(u32 index) const {
+ return ((const char*)mEntries) + mEntries[index].mOffs - 4;
+ }
+};
+
+class JUTNameTab {
+public:
+ JUTNameTab();
+ JUTNameTab(const ResNTAB* pNameTable);
+ virtual ~JUTNameTab() {}
+
+ void setResource(const ResNTAB* pNameTable);
+ s32 getIndex(char const*) const;
+ const char* getName(u16 index) const;
+ u16 calcKeyCode(char const* pName) const;
+
+private:
+ const ResNTAB* mpNameTable;
+ const char* mpStrData;
+ u16 mNameNum;
+};
+
#endif /* JUTNAMETAB_H */
diff --git a/include/dolphin/gx/GX.h b/include/dolphin/gx/GX.h
index c07a96f247..ad2d4d99ed 100644
--- a/include/dolphin/gx/GX.h
+++ b/include/dolphin/gx/GX.h
@@ -1,6 +1,7 @@
#ifndef GX_H_
#define GX_H_
+#include "dolphin/gx/GXDisplayList.h"
#include "dolphin/gx/GXTexture.h"
#include "dolphin/types.h"
diff --git a/include/dolphin/gx/GXDisplayList.h b/include/dolphin/gx/GXDisplayList.h
index db5429fa95..abc3a045a2 100644
--- a/include/dolphin/gx/GXDisplayList.h
+++ b/include/dolphin/gx/GXDisplayList.h
@@ -3,4 +3,10 @@
#include "dolphin/types.h"
+extern "C" {
+void GXBeginDisplayList(void* pDL, u32 capacity);
+void GXEndDisplayList(void);
+void GXCallDisplayList(const void* pDL, u32 size);
+};
+
#endif /* GXDISPLAYLIST_H */