almost all of dolphin matched (#2036)

* TRK full match

* remove trk asm

* ar done

* cleanup some dolphin headers

* more dolphin cleanup

* cleanup / GD fully matched

* almost all of GX fully matched

* GX / Mtx full matched

* most of OS done

* pad done

* most of VI

* remove asm

* forgot couple vec funcs

* couple JUtility matches
This commit is contained in:
TakaRikka
2024-01-19 16:22:19 -08:00
committed by GitHub
parent f97fc769df
commit 981cfe7283
461 changed files with 11574 additions and 22635 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
#include "JSystem/JGeometry.h"
#include "JSystem/JUtility/TColor.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
class J2DGrafContext {
+1 -1
View File
@@ -4,7 +4,7 @@
#include "JSystem/JGeometry.h"
#include "JSystem/JSupport/JSUList.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
class J2DAnmBase;
class J2DAnmColor;
+1 -1
View File
@@ -3,7 +3,7 @@
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
struct J2DTextureSRTInfo {
/* 0x00 */ f32 field_0x0;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
#include "JSystem/J3DGraphBase/J3DPacket.h"
#include "JSystem/J3DGraphBase/J3DVertex.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
enum J3DMdlFlag {
+11 -11
View File
@@ -2,7 +2,7 @@
#define J3DGD_H
#include "dolphin/gd/GDBase.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
inline void J3DGDWrite_u8(u8 param) {
__GDWrite(param);
@@ -31,8 +31,8 @@ inline void J3DGDWriteBPCmd(u32 cmd) {
}
inline void J3DFifoLoadBPCmd(u32 cmd) {
GFX_FIFO(u8) = 0x61;
GFX_FIFO(u32) = cmd;
GXWGFifo.u8 = 0x61;
GXWGFifo.u32 = cmd;
}
inline void J3DGDWriteXFCmd(u16 addr, u32 cmd) {
@@ -49,17 +49,17 @@ inline void J3DGDWriteXFCmdHdr(u16 addr, u8 len) {
}
inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
GFX_FIFO(u8) = 0x10;
GFX_FIFO(u16) = len - 1;
GFX_FIFO(u16) = addr;
GXWGFifo.u8 = 0x10;
GXWGFifo.u16 = len - 1;
GXWGFifo.u16 = addr;
}
inline void J3DGXCmd1f32ptr(f32* value) {
GFX_FIFO(u32) = *(u32*)value;
GXWGFifo.u32 = *(u32*)value;
}
inline void J3DGXCmd1f32(f32 value) {
GFX_FIFO(u32) = *(u32*)&value;
GXWGFifo.u32 = *(u32*)&value;
}
inline void J3DGDWriteCPCmd(u8 reg, u32 value) {
@@ -104,9 +104,9 @@ void J3DFifoLoadNrmMtxToTexMtx3x3(f32 (*)[3], u32);
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
GFX_FIFO(u8) = cmd;
GFX_FIFO(u16) = indx;
GFX_FIFO(u16) = addr;
GXWGFifo.u8 = cmd;
GXWGFifo.u16 = indx;
GXWGFifo.u16 = addr;
}
inline void J3DGDSetNumChans(u8 numChans) {
+9 -9
View File
@@ -3,7 +3,7 @@
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
class J3DCurrentMtxInfo {
@@ -13,15 +13,15 @@ public:
};
static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
GFX_FIFO(u8) = GX_CMD_LOAD_CP_REG;
GFX_FIFO(u8) = cmd;
GFX_FIFO(u32) = param;
GXWGFifo.u8 = GX_CMD_LOAD_CP_REG;
GXWGFifo.u8 = cmd;
GXWGFifo.u32 = param;
}
static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
GFX_FIFO(u8) = GX_CMD_LOAD_XF_REG;
GFX_FIFO(u16) = (len - 1);
GFX_FIFO(u16) = cmd;
GXWGFifo.u8 = GX_CMD_LOAD_XF_REG;
GXWGFifo.u16 = (len - 1);
GXWGFifo.u16 = cmd;
}
class J3DCurrentMtx : public J3DCurrentMtxInfo {
@@ -44,8 +44,8 @@ public:
J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A
J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B
J3DFifoWriteXFCmd(0x1018, 2);
GFX_FIFO(u32) = getMtxIdxRegA();
GFX_FIFO(u32) = getMtxIdxRegB();
GXWGFifo.u32 = getMtxIdxRegA();
GXWGFifo.u32 = getMtxIdxRegB();
}
void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4,
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef J3DSHAPEMTX_H
#define J3DSHAPEMTX_H
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
class J3DTexMtx;
class J3DTexGenBlock;
+1 -1
View File
@@ -2,7 +2,7 @@
#define J3DSTRUCT_H
#include "dolphin/gx/GXStruct.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "dolphin/mtx/mtx44.h"
#include "dolphin/mtx/vec.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef J3DSYS_H
#define J3DSYS_H
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/types.h"
// Perhaps move to a new J3DEnum.h?
+1 -1
View File
@@ -3,7 +3,7 @@
#include "JSystem/J3DGraphBase/J3DStruct.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
class J3DTexture {
+1 -1
View File
@@ -2,7 +2,7 @@
#define J3DTRANSFORM_H
#include "JSystem/JGeometry.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
struct J3DTextureSRTInfo;
@@ -2,7 +2,7 @@
#define J3DMODELLOADER_H
#include "dolphin/types.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
class J3DModelData;
class J3DMaterialTable;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef J3DUCLIPPER_H
#define J3DUCLIPPER_H
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
class J3DUClipper {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DSPPROC_H
#define DSPPROC_H
#include "dolphin/dsp/dsp.h"
#include "dolphin/dsp.h"
void DsyncFrame2ch(u32 param_0, u32 param_1, u32 param_2);
void DsyncFrame4ch(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
+1 -11
View File
@@ -1,22 +1,12 @@
#ifndef OSDSP_TASK_H
#define OSDSP_TASK_H
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/dsp.h"
struct DSPTaskInfo;
extern DSPTaskInfo* DSP_prior_task;
#ifdef __cplusplus
extern "C" {
#endif
void __DSPHandler(OSInterrupt interrupt, OSContext* context);
#ifdef __cplusplus
}
#endif
void DsyncFrame2(u32 param_0, u32 param_1, u32 param_2);
#endif /* OSDSP_TASK_H */
+3
View File
@@ -104,6 +104,9 @@ struct TLinkList : public TNodeLinkList {
TNodeLinkList::const_iterator::operator++();
return *this;
}
friend bool operator==(const_iterator a, const_iterator b) { return a == b; }
friend bool operator!=(const_iterator a, const_iterator b) { return !(a == b); }
};
TLinkListNode* Element_toNode(T* element) const { return &element->ocObject_; }
+1 -1
View File
@@ -2,7 +2,7 @@
#define JKRARAMPIECE_H
#include "JSystem/JSupport/JSUList.h"
#include "dolphin/ar/arq.h"
#include "dolphin/arq.h"
#include "dolphin/os/OSMessage.h"
#include "dolphin/os/OSMutex.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define JKRDVDFILE_H
#include "JSystem/JKernel/JKRFile.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
#include "dolphin/os/OSMessage.h"
#include "dolphin/os/OSMutex.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JKRFILEFINDER_H
#define JKRFILEFINDER_H
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
class JKRFileFinder {
public:
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JMATH_H
#define JMATH_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param_3);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JPADRAWINFO_H
#define JPADRAWINFO_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
class JPADrawInfo {
public:
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JPAMATH_H
#define JPAMATH_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "JSystem/JGeometry.h"
void JPAGetDirMtx(JGeometry::TVec3<f32> const& param_0, f32 (*param_1)[4]);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JSGOBJECT_H
#define JSGOBJECT_H
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
namespace JStage {
struct TObject {
@@ -4,7 +4,7 @@
#include "JSystem/JStudio/JStudio/fvb.h"
#include "JSystem/JStudio/JStudio/stb.h"
#include "JSystem/JStudio/JStudio/ctb.h"
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
#include "dolphin/mtx/vec.h"
namespace JStudio {
@@ -1,7 +1,7 @@
#ifndef JSTUDIO_MATH_H
#define JSTUDIO_MATH_H
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
namespace JStudio {
namespace math {
+1 -1
View File
@@ -2,7 +2,7 @@
#define JUTASSERT_H
#include "dolphin/types.h"
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#ifdef DEBUG
#define JUT_ASSERT(LINE, COND) \
+1 -1
View File
@@ -94,7 +94,7 @@ private:
private:
/* 0x20 */ u32 field_0x20;
/* 0x24 */ u32 mMaxLines;
/* 0x24 */ int mMaxLines;
/* 0x28 */ u8* mBuf;
/* 0x2C */ bool field_0x2c;
/* 0x30 */ int field_0x30;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JUTDIRECTFILE_H
#define JUTDIRECTFILE_H
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
#define JUTDF_BUFSIZE (0x800)
+3 -3
View File
@@ -3,7 +3,7 @@
#include "JSystem/JKernel/JKRDisposer.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/pad/Pad.h"
#include "dolphin/pad.h"
#include "dolphin/types.h"
typedef void (*callbackFn)(int, void*);
@@ -195,9 +195,9 @@ public:
struct CRumble {
CRumble(JUTGamePad* pad) { clear(pad); }
static PADMask sChannelMask[4];
static u32 sChannelMask[4];
static bool mStatus[4];
static PADMask mEnabled;
static u32 mEnabled;
enum ERumble {
VAL_0 = 0,
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef JUTGRAPHFIFO_H
#define JUTGRAPHFIFO_H
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
class JUTGraphFifo {
public:
+1 -1
View File
@@ -4,7 +4,7 @@
#include "dolphin/gx/GXStruct.h"
#include "dolphin/os/OSMessage.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/vi/vi.h"
#include "dolphin/vi.h"
typedef u8 (*Pattern)[2];
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef TPOSITION3_H
#define TPOSITION3_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "JSystem/JMath/JMath.h"
namespace JGeometry {
+1 -1
View File
@@ -2,7 +2,7 @@
#define C_LIB_H_
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
inline bool cLib_IsZero(f32 value) {
return fabsf(value) < 8e-11f;
@@ -1,5 +1,16 @@
#ifndef METROTRK_PORTABLE_MAIN_TRK_H
#define METROTRK_PORTABLE_MAIN_TRK_H
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRK_main(void);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MAIN_TRK_H */
@@ -1,35 +1,15 @@
#ifndef METROTRK_PORTABLE_MSGBUF_H
#define METROTRK_PORTABLE_MSGBUF_H
#include "dolphin/types.h"
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int MessageBufferID;
#define TRKMSGBUF_SIZE (0x800 + 0x80)
typedef struct TRKBuffer {
/* 0x00 */ u32 _00;
/* 0x04 */ BOOL isInUse;
/* 0x08 */ u32 length;
/* 0x0C */ u32 position;
/* 0x10 */ u8 data[TRKMSGBUF_SIZE];
} TRKBuffer;
/* typedef struct TRKBuffer {
u32 _00;
u32 _04;
s32 _08;
u32 _0C;
u32 _10;
u8 m_buffer[0x87C];
} TRKBuffer; */
s32 TRKSetBufferPosition(TRKBuffer*, u32);
DSError TRKSetBufferPosition(TRKBuffer* msg, u32 pos);
void* TRKGetBuffer(int);
void TRKResetBuffer(TRKBuffer* msg, BOOL keepData);
#ifdef __cplusplus
}
@@ -0,0 +1,26 @@
#ifndef OS_DOLPHIN_DDH_STUBS_H
#define OS_DOLPHIN_DDH_STUBS_H
#include "dolphin/os.h"
#include "amcstubs/AmcExi2Stubs.h"
#ifdef __cplusplus
extern "C" {
#endif
int ddh_cc_initialize(void* inputPendingPtrRef, AmcEXICallback monitorCallback);
int ddh_cc_shutdown();
int ddh_cc_open();
int ddh_cc_close();
int ddh_cc_read(u8* data, int size);
int ddh_cc_write(const u8* bytes, int length);
int ddh_cc_pre_continue();
int ddh_cc_post_stop();
int ddh_cc_peek();
int ddh_cc_initinterrupts();
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_DDH_STUBS_H */
@@ -0,0 +1,26 @@
#ifndef OS_DOLPHIN_GDEV_STUBS_H
#define OS_DOLPHIN_GDEV_STUBS_H
#include "dolphin/os.h"
#include "amcstubs/AmcExi2Stubs.h"
#ifdef __cplusplus
extern "C" {
#endif
int gdev_cc_initialize(void* inputPendingPtrRef, AmcEXICallback monitorCallback);
int gdev_cc_shutdown();
int gdev_cc_open();
int gdev_cc_close();
int gdev_cc_read(u8* data, int size);
int gdev_cc_write(const u8* bytes, int length);
int gdev_cc_pre_continue();
int gdev_cc_post_stop();
int gdev_cc_peek();
int gdev_cc_initinterrupts();
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_GDEV_STUBS_H */
@@ -1,6 +1,24 @@
#ifndef OS_DOLPHIN_UDP_STUBS_H
#define OS_DOLPHIN_UDP_STUBS_H
#include "dolphin/types.h"
#include "dolphin/os.h"
#ifdef __cplusplus
extern "C" {
#endif
int udp_cc_initialize(void* flagOut, __OSInterruptHandler handler);
int udp_cc_shutdown(void);
int udp_cc_open(void);
int udp_cc_close(void);
int udp_cc_read(u8* dest, int size);
int udp_cc_write(const u8* src, int size);
int udp_cc_peek(void);
int udp_cc_pre_continue(void);
int udp_cc_post_stop(void);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_UDP_STUBS_H */
@@ -1,17 +1,21 @@
#ifndef OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#define OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*DBCommFunc)();
typedef int (*DBCommInitFunc)(void*, OSInterruptHandler);
typedef int (*DBCommInitFunc)(void*, __OSInterruptHandler);
typedef int (*DBCommReadFunc)(u8*, int);
typedef int (*DBCommWriteFunc)(const u8*, int);
typedef struct DBCommTable {
DBCommInitFunc initialize_func;
DBCommFunc initinterrupts_func;
DBCommFunc init_interrupts_func;
DBCommFunc shutdown_func;
DBCommFunc peek_func;
DBCommReadFunc read_func;
@@ -24,6 +28,13 @@ typedef struct DBCommTable {
void UnreserveEXI2Port();
void ReserveEXI2Port();
s32 TRKWriteUARTN(const void*, u32);
UARTError TRKWriteUARTN(const void*, u32);
void TRKLoadContext(OSContext* ctx, u32 r4);
int InitMetroTRKCommTable(int hwId);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_DOLPHIN_TRK_GLUE_H */
@@ -9,7 +9,7 @@ extern "C" {
#endif
void TRKSwapAndGo();
void TRKTargetSetStopped(s32);
void TRKTargetSetStopped(unsigned int);
DSError TRKTargetInterrupt(TRKEvent*);
DSError TRKTargetSupportRequest();
void TRKDestructEvent(TRKEvent*);
@@ -124,16 +124,16 @@ typedef ProcessorState_PPC_6xx_7xx ProcessorState_PPC;
extern ProcessorState_PPC gTRKCPUState;
typedef struct TRKState {
/* 0x00 */ u32 GPR[32];
/* 0x80 */ u32 LR;
/* 0x84 */ u32 CTR;
/* 0x88 */ u32 XER;
/* 0x8C */ u32 MSR;
/* 0x90 */ u32 DAR;
/* 0x94 */ u32 DSISR;
/* 0x98 */ u32 stopped;
/* 0x9C */ u32 inputActivated;
/* 0xA0 */ void* inputPendingPtr;
u32 gpr[32]; // _00
u32 lr; // _80
u32 ctr; // _84
u32 xer; // _88
u32 msr; // _8C
u32 dar; // _90
u32 dsisr; // _94
BOOL isStopped; // _98
BOOL inputActivated; // _9C
void* inputPendingPtr; // _A0
} TRKState;
extern TRKState gTRKState;
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JAudio2/JAUAudibleParam.h"
#include "JSystem/TPosition3.hh"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
struct Z2Audible;
+1 -1
View File
@@ -5,7 +5,7 @@
#include "SSystem/SComponent/c_xyz.h"
#include "SSystem/SComponent/c_sxyz.h"
#include "d/bg/d_bg_w_base.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
class cBgS_GrpPassChk;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef D_KANKYO_D_KANKYO_RAIN_H
#define D_KANKYO_D_KANKYO_RAIN_H
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
struct cXyz;
struct _GXColor;
+5 -5
View File
@@ -71,18 +71,18 @@ public:
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB8, 0);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
i_GXPosition3s16(mDoGph_gInf_c::getMinX(), mDoGph_gInf_c::getMinY(), 0);
GXPosition3s16(mDoGph_gInf_c::getMinX(), mDoGph_gInf_c::getMinY(), 0);
GXTexCoord2s8(0, 0);
i_GXPosition3s16(mDoGph_gInf_c::getMaxX(), mDoGph_gInf_c::getMinY(), 0);
GXPosition3s16(mDoGph_gInf_c::getMaxX(), mDoGph_gInf_c::getMinY(), 0);
GXTexCoord2s8(1, 0);
i_GXPosition3s16(mDoGph_gInf_c::getMaxX(), mDoGph_gInf_c::getMaxY(), 0);
GXPosition3s16(mDoGph_gInf_c::getMaxX(), mDoGph_gInf_c::getMaxY(), 0);
GXTexCoord2s8(1, 1);
i_GXPosition3s16(mDoGph_gInf_c::getMinX(), mDoGph_gInf_c::getMaxY(), 0);
GXPosition3s16(mDoGph_gInf_c::getMinX(), mDoGph_gInf_c::getMaxY(), 0);
GXTexCoord2s8(0, 1);
i_GXEnd();
GXEnd();
}
} */
/* 801FE2E8 */ virtual ~dDlst_MENU_CAPTURE_c();
-3
View File
@@ -23,7 +23,6 @@
#define SECTION_DTORS10 __declspec(section ".dtors$10")
#define SECTION_DTORS15 __declspec(section ".dtors$15")
#define COMPILER_STRIP_GATE(NAME, VALUE) SECTION_DEAD void* const cg_##NAME = (void*)(VALUE)
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
#define REGISTER_CTORS(ADDR, FUNCTION) SECTION_CTORS void* const _ctors_##ADDR = (void*)(FUNCTION);
#else
#define SECTION_INIT __declspec(section ".init")
@@ -44,7 +43,6 @@
#define SECTION_DTORS10 __declspec(section ".dtors$10")
#define SECTION_DTORS15 __declspec(section ".dtors$15")
#define COMPILER_STRIP_GATE(NAME, VALUE) SECTION_DEAD void* const cg_##NAME = (void*)(VALUE)
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
#define REGISTER_CTORS(ADDR, FUNCTION) SECTION_CTORS void* const _ctors_##ADDR = (void*)(FUNCTION);
#endif
@@ -67,7 +65,6 @@
#define SECTION_DTORS10
#define SECTION_DTORS15
#define COMPILER_STRIP_GATE(...)
#define ALIGN_DECL(...)
#define REGISTER_CTORS(...)
// vscode doesn't like asm and nofralloc very much
+2 -2
View File
@@ -1,14 +1,14 @@
#ifndef AMCEXI2STUBS_H
#define AMCEXI2STUBS_H
#include "dolphin/os/OS.h"
#include "dolphin/os.h"
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef OSInterruptHandler AmcEXICallback;
typedef __OSInterruptHandler AmcEXICallback;
typedef enum {
AMC_EXI_NO_ERROR = 0,
@@ -15,6 +15,7 @@ void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length);
u32 ARInit(u32* stack_index_addr, u32 num_entries);
u32 ARAlloc(u32 length);
u32 ARGetSize(void);
u16 __ARGetInterruptStatus();
#ifdef __cplusplus
};
+1
View File
@@ -3,6 +3,7 @@
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSThread.h"
#include "dolphin/dsp.h"
#ifdef __cplusplus
extern "C" {
@@ -2,14 +2,15 @@
#define DSP_H
#include "dolphin/os/OSTime.h"
volatile u16 __DSPRegs[32] : 0xCC005000;
volatile u32 __AIRegs[8] : 0xCC006C00;
#include "dolphin/os/OSInterrupt.h"
#ifdef __cplusplus
extern "C" {
#endif
volatile u16 __DSPRegs[32] : 0xCC005000;
volatile u32 __AIRegs[8] : 0xCC006C00;
#define DSP_TASK_FLAG_CLEARALL 0x00000000
#define DSP_TASK_FLAG_ATTACHED 0x00000001
#define DSP_TASK_FLAG_CANCEL 0x00000002
@@ -19,6 +20,29 @@ extern "C" {
#define DSP_TASK_STATE_YIELD 2
#define DSP_TASK_STATE_DONE 3
#define DSP_MAILBOX_IN_HI (0)
#define DSP_MAILBOX_IN_LO (1)
#define DSP_MAILBOX_OUT_HI (2)
#define DSP_MAILBOX_OUT_LO (3)
#define DSP_CONTROL_STATUS (5)
#define DSP_ARAM_SIZE (9)
#define DSP_ARAM_MODE (11)
#define DSP_ARAM_REFRESH (13)
#define DSP_ARAM_DMA_MM_HI (16) // Main mem address
#define DSP_ARAM_DMA_MM_LO (17)
#define DSP_ARAM_DMA_ARAM_HI (18) // ARAM address
#define DSP_ARAM_DMA_ARAM_LO (19)
#define DSP_ARAM_DMA_SIZE_HI (20) // DMA buffer size
#define DSP_ARAM_DMA_SIZE_LO (21)
#define DSP_DMA_START_HI (24) // DMA start address
#define DSP_DMA_START_LO (25)
#define DSP_DMA_CONTROL_LEN (27)
#define DSP_DMA_BYTES_LEFT (29)
#define DSP_DMA_START_FLAG (0x8000) // set to start DSP
typedef void (*DSPCallback)(void* task);
typedef struct DSPTaskInfo DSPTaskInfo;
@@ -56,15 +80,16 @@ u32 DSPReadMailFromDSP(void);
void DSPSendMailToDSP(u32 mail);
void DSPAssertInt();
void DSPInit(void);
#ifdef __cplusplus
}
#endif
void DSPReleaseHalt2(u32 msg);
u16 DSP_CreateMap2(u32 msg);
int DSPSendCommands2(u32* msgs, u32 param_1, void (*param_2)(u16));
void DsetupTable(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
void DsetMixerLevel(f32 level);
void __DSPHandler(__OSInterrupt interrupt, OSContext* context);
#ifdef __cplusplus
}
#endif
#endif /* DSP_H */
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DSP_TASK_H
#define DSP_TASK_H
#include "dolphin/dsp/dsp.h"
#include "dolphin/dsp.h"
extern DSPTaskInfo* __DSP_tmp_task;
extern DSPTaskInfo* __DSP_last_task;
@@ -139,6 +139,8 @@ s32 DVDCancel(DVDCommandBlock* block);
void __DVDPrepareResetAsync(DVDCBCallback callbac);
BOOL DVDCompareDiskID(DVDDiskID* id1, DVDDiskID* id2);
DVDCommandBlock* __DVDPopWaitingQueue(void);
#ifdef __cplusplus
};
#endif
+7
View File
@@ -0,0 +1,7 @@
#ifndef GD_H
#define GD_H
#include "dolphin/gd/GDBase.h"
#include "dolphin/gd/GDGeometry.h"
#endif /* GD_H */
+25 -12
View File
@@ -1,7 +1,7 @@
#ifndef GDBASE_H
#define GDBASE_H
#include "dolphin/types.h"
#include "gx.h"
#ifdef __cplusplus
extern "C" {
@@ -23,41 +23,41 @@ void GDFlushCurrToMem();
void GDPadCurr32();
void GDOverflowed(void);
inline void __GDWrite(u8 data) {
static inline void __GDWrite(u8 data) {
*__GDCurrentDL->ptr++ = data;
}
inline void GDSetCurrent(GDLObj* obj) {
static inline void GDSetCurrent(GDLObj* obj) {
__GDCurrentDL = obj;
}
inline u32 GDGetGDLObjOffset(GDLObj* obj) {
static inline u32 GDGetGDLObjOffset(GDLObj* obj) {
return (u32)(obj->ptr - obj->start);
}
inline u8* GDGetCurrPointer() {
static inline u8* GDGetCurrPointer() {
return __GDCurrentDL->ptr;
}
inline s32 GDGetCurrOffset() {
static inline s32 GDGetCurrOffset() {
return __GDCurrentDL->ptr - __GDCurrentDL->start;
}
inline void GDSetCurrOffset(s32 offs) {
static inline void GDSetCurrOffset(s32 offs) {
__GDCurrentDL->ptr = __GDCurrentDL->start + offs;
}
inline void GDAdvCurrOffset(s32 offs) {
static inline void GDAdvCurrOffset(s32 offs) {
__GDCurrentDL->ptr += offs;
}
inline void GDOverflowCheck(u32 len) {
static inline void GDOverflowCheck(u32 len) {
if (__GDCurrentDL->ptr + len > __GDCurrentDL->end) {
GDOverflowed();
}
}
inline void GDWrite_u32(u32 v) {
static inline void GDWrite_u32(u32 v) {
GDOverflowCheck(4);
__GDWrite((v >> 24) & 0xff);
__GDWrite((v >> 16) & 0xff);
@@ -65,17 +65,30 @@ inline void GDWrite_u32(u32 v) {
__GDWrite((v >> 0) & 0xff);
}
inline void GDWrite_u16(u16 v) {
static inline void GDWrite_u16(u16 v) {
GDOverflowCheck(2);
__GDWrite(v >> 8);
__GDWrite(v & 0xff);
}
inline void GDWrite_u8(u8 v) {
static inline void GDWrite_u8(u8 v) {
GDOverflowCheck(1);
__GDWrite(v);
}
static inline void GDWriteCPCmd(u8 addr, u32 v) {
GDWrite_u8(8);
GDWrite_u8(addr);
GDWrite_u32(v);
}
static inline void GDWriteXFCmd(u16 addr, u32 v) {
GDWrite_u8(0x10);
GDWrite_u16(0);
GDWrite_u16(addr);
GDWrite_u32(v);
}
#ifdef __cplusplus
};
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GDGEOMETRY_H
#define GDGEOMETRY_H
#include "dolphin/types.h"
#include "gx.h"
#ifdef __cplusplus
extern "C" {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GFGEOMETRY_H
#define GFGEOMETRY_H
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
void GFSetGenMode2(u8 param_0, u8 param_1, u8 param_2, u8 param_3, _GXCullMode param_4);
+224
View File
@@ -0,0 +1,224 @@
#ifndef GX_H_
#define GX_H_
#include "dolphin/gx/GXAttr.h"
#include "dolphin/gx/GXBump.h"
#include "dolphin/gx/GXDisplayList.h"
#include "dolphin/gx/GXFifo.h"
#include "dolphin/gx/GXFrameBuf.h"
#include "dolphin/gx/GXGeometry.h"
#include "dolphin/gx/GXInit.h"
#include "dolphin/gx/GXLight.h"
#include "dolphin/gx/GXMisc.h"
#include "dolphin/gx/GXPerf.h"
#include "dolphin/gx/GXPixel.h"
#include "dolphin/gx/GXTev.h"
#include "dolphin/gx/GXTexture.h"
#include "dolphin/gx/GXTransform.h"
#ifdef __cplusplus
extern "C" {
#endif
// Pack value into bitfield
// clang-format off
#define GX_BITFIELD_SET(field, pos, size, value) (field) = __rlwimi((field), (value), 31 - (pos) - (size) + 1, (pos), (pos) + (size)-1)
#define GX_BITFIELD_TRUNC(field, pos, size, value) (__rlwimi((field), (value), 0, (pos), (pos) + (size)-1))
#define GX_BITGET(field, pos, size) ((field) >> (31 - (pos) - (size) + 1) & ((1 << (size)) - 1))
#define GX_GET_REG(reg, st, end) GX_BITGET(reg, st, (end - st + 1))
#define GX_SET_REG(reg, x, st, end) GX_BITFIELD_SET(reg, st, (end - st + 1), x)
#define GX_SET_TRUNC(reg, x, st, end) GX_BITFIELD_TRUNC((reg), (st), ((end) - (st) + 1), (x))
#define GXCOLOR_AS_U32(color) (*((u32*)&(color)))
#define INSERT_FIELD(reg, value, nbits, shift) \
(reg) = ((u32) (reg) & ~(((1 << (nbits)) - 1) << (shift))) | \
((u32) (value) << (shift));
#define FAST_FLAG_SET(regOrg, newFlag, shift, size) \
do { \
(regOrg) = (u32)__rlwimi((int)(regOrg), (int)(newFlag), (shift), (32 - (shift) - (size)), (31 - (shift))); \
} while (0);
// clang-format on
#define GX_LOAD_BP_REG 0x61
#define GX_NOP 0
typedef union {
u8 u8;
u16 u16;
u32 u32;
u64 u64;
s8 s8;
s16 s16;
s32 s32;
s64 s64;
f32 f32;
f64 f64;
} PPCWGPipe;
#define GXFIFO_ADDR 0xCC008000
volatile PPCWGPipe GXWGFifo : GXFIFO_ADDR;
#define GX_WRITE_U8(data) GXWGFifo.u8 = data;
#define GX_WRITE_U32(data) GXWGFifo.u32 = data;
#define GX_WRITE_F32(val) (GXWGFifo.f32 = (f32)val)
#define GX_CP_LOAD_REG(addr, data) \
GXWGFifo.s8 = GX_FIFO_CMD_LOAD_CP_REG; \
GXWGFifo.s8 = (addr); \
GXWGFifo.s32 = (data);
/**
* Header for an XF register load
*/
#define GX_XF_LOAD_REG_HDR(addr) \
GXWGFifo.s8 = GX_FIFO_CMD_LOAD_XF_REG; \
GXWGFifo.s32 = (addr);
/**
* Load immediate value into XF register
*/
#define GX_XF_LOAD_REG(addr, data) \
GX_XF_LOAD_REG_HDR(addr); \
GXWGFifo.s32 = (data);
/**
* Load immediate value into BP register
*/
#define GX_BP_LOAD_REG(data) \
GXWGFifo.s8 = GX_FIFO_CMD_LOAD_BP_REG; \
GXWGFifo.s32 = (data);
/**
* Load immediate values into multiple XF registers
*/
#define GX_XF_LOAD_REGS(size, addr) \
{ \
u32 cmd = (size) << 16 | addr; \
GX_XF_LOAD_REG_HDR(cmd); \
}
static inline void GXPosition3f32(const f32 x, const f32 y, const f32 z) {
GXWGFifo.f32 = x;
GXWGFifo.f32 = y;
GXWGFifo.f32 = z;
}
static inline void GXNormal3f32(const f32 x, const f32 y, const f32 z) {
GXWGFifo.f32 = x;
GXWGFifo.f32 = y;
GXWGFifo.f32 = z;
}
static inline void GXPosition2f32(const f32 x, const f32 z) {
GXWGFifo.f32 = x;
GXWGFifo.f32 = z;
}
static inline void GXColor1u32(const u32 c) {
GXWGFifo.u32 = c;
}
static inline void GXTexCoord2f32(const f32 s, const f32 t) {
GXWGFifo.f32 = s;
GXWGFifo.f32 = t;
}
static inline void GXTexCoord2u8(const u8 s, const u8 t) {
GXWGFifo.u8 = s;
GXWGFifo.u8 = t;
}
static inline void GXTexCoord1x8(const u8 s) {
GXWGFifo.u8 = s;
}
static inline void GXPosition2u16(const u16 x, const u16 y) {
GXWGFifo.u16 = x;
GXWGFifo.u16 = y;
}
static inline void GXPosition1x16(const u16 x) {
GXWGFifo.u16 = x;
}
static inline void GXPosition1x8(const u8 x) {
GXWGFifo.u8 = x;
}
static inline void GXPosition3s8(const s8 x, const s8 y, const s8 z) {
GXWGFifo.s8 = x;
GXWGFifo.s8 = y;
GXWGFifo.s8 = z;
}
static inline void GXPosition2s8(const s8 x, const s8 y) {
GXWGFifo.s8 = x;
GXWGFifo.s8 = y;
}
static inline void GXPosition2s16(const s16 x, const s16 y) {
GXWGFifo.s16 = x;
GXWGFifo.s16 = y;
}
static inline void GXPosition3s16(const s16 x, const s16 y, const s16 z) {
GXWGFifo.s16 = x;
GXWGFifo.s16 = y;
GXWGFifo.s16 = z;
}
static inline void GXTexCoord2s8(const s8 x, const s8 y) {
GXWGFifo.s8 = x;
GXWGFifo.s8 = y;
}
static inline void GXTexCoord2u16(const u16 x, const u16 y) {
GXWGFifo.u16 = x;
GXWGFifo.u16 = y;
}
static inline void GXTexCoord2s16(const s16 u, const s16 v) {
GXWGFifo.s16 = u;
GXWGFifo.s16 = v;
}
static inline void GFWriteBPCmd(u32 param_1) {
GXWGFifo.u8 = 0x61;
GXWGFifo.u32 = param_1;
}
static inline u32 GXReadCPReg(u32 addrLo, u32 addrHi) {
u32 hiStart, hiNew, lo;
hiStart = GX_GET_CP_REG(addrHi);
do {
hiNew = hiStart;
lo = GX_GET_CP_REG(addrLo);
hiStart = GX_GET_CP_REG(addrHi);
} while (hiStart != hiNew);
return ((hiStart << 16) | lo);
}
inline void GFFill(u16 param_1, u32 param_2) {
GXWGFifo.u8 = 0x10;
GXWGFifo.u16 = 0;
GXWGFifo.u16 = param_1;
GXWGFifo.u32 = param_2;
}
static inline void GXEnd(void) {}
extern GXRenderModeObj GXNtsc480IntDf;
extern GXRenderModeObj GXNtsc480Int;
extern GXRenderModeObj GXMpal480IntDf;
extern GXRenderModeObj GXPal528IntDf;
extern GXRenderModeObj GXEurgb60Hz480IntDf;
#ifdef __cplusplus
};
#endif
#endif
-213
View File
@@ -1,213 +0,0 @@
#ifndef GX_H_
#define GX_H_
#include "dolphin/gx/GXAttr.h"
#include "dolphin/gx/GXBump.h"
#include "dolphin/gx/GXDisplayList.h"
#include "dolphin/gx/GXFifo.h"
#include "dolphin/gx/GXFrameBuf.h"
#include "dolphin/gx/GXGeometry.h"
#include "dolphin/gx/GXLight.h"
#include "dolphin/gx/GXMisc.h"
#include "dolphin/gx/GXPerf.h"
#include "dolphin/gx/GXPixel.h"
#include "dolphin/gx/GXTev.h"
#include "dolphin/gx/GXTexture.h"
#include "dolphin/gx/GXTransform.h"
#ifdef __cplusplus
extern "C" {
#endif
// Pack value into bitfield
#define GX_BITFIELD_SET(field, pos, size, value) (field) = __rlwimi((field), (value), 31 - (pos) - (size) + 1, (pos), (pos) + (size)-1)
#define GX_BITGET(field, pos, size) ((field) >> (31 - (pos) - (size) + 1) & ((1 << (size)) - 1))
#define GX_GET_REG(reg, st, end) GX_BITGET(reg, st, (end - st + 1))
#define GX_SET_REG(reg, x, st, end) GX_BITFIELD_SET(reg, st, (end - st + 1), x)
#define INSERT_FIELD(reg, value, nbits, shift) \
(reg) = ((u32) (reg) & ~(((1 << (nbits)) - 1) << (shift))) | \
((u32) (value) << (shift));
#define FAST_FLAG_SET(regOrg, newFlag, shift, size) \
do { \
(regOrg) = (u32)__rlwimi((int)(regOrg), (int)(newFlag), (shift), (32 - (shift) - (size)), (31 - (shift))); \
} while (0);
#define GX_LOAD_BP_REG 0x61
#define GX_NOP 0
typedef union {
u8 u8;
u16 u16;
u32 u32;
u64 u64;
s8 s8;
s16 s16;
s32 s32;
s64 s64;
f32 f32;
f64 f64;
} PPCWGPipe;
#define GXFIFO_ADDR 0xCC008000
volatile PPCWGPipe GXFIFO : GXFIFO_ADDR;
#define GFX_FIFO(T) (*(volatile T*)GXFIFO_ADDR)
#define GX_WRITE_U8(data) GXFIFO.u8 = data;
#define GX_WRITE_U32(data) GXFIFO.u32 = data;
#define GX_WRITE_F32(val) (GXFIFO.f32 = (f32)val)
#define GX_CP_LOAD_REG(addr, data) \
GXFIFO.s8 = GX_FIFO_CMD_LOAD_CP_REG; \
GXFIFO.s8 = (addr); \
GXFIFO.s32 = (data);
/**
* Header for an XF register load
*/
#define GX_XF_LOAD_REG_HDR(addr) \
GXFIFO.s8 = GX_FIFO_CMD_LOAD_XF_REG; \
GXFIFO.s32 = (addr);
/**
* Load immediate value into XF register
*/
#define GX_XF_LOAD_REG(addr, data) \
GX_XF_LOAD_REG_HDR(addr); \
GXFIFO.s32 = (data);
/**
* Load immediate value into BP register
*/
#define GX_BP_LOAD_REG(data) \
GXFIFO.s8 = GX_FIFO_CMD_LOAD_BP_REG; \
GXFIFO.s32 = (data);
/**
* Load immediate values into multiple XF registers
*/
#define GX_XF_LOAD_REGS(size, addr) \
{ \
u32 cmd = (size) << 16 | addr; \
GX_XF_LOAD_REG_HDR(cmd); \
}
inline void GXPosition3f32(f32 x, f32 y, f32 z) {
GXFIFO.f32 = x;
GXFIFO.f32 = y;
GXFIFO.f32 = z;
}
inline void GXNormal3f32(f32 x, f32 y, f32 z) {
GXFIFO.f32 = x;
GXFIFO.f32 = y;
GXFIFO.f32 = z;
}
inline void GXPosition2f32(f32 x, f32 z) {
GXFIFO.f32 = x;
GXFIFO.f32 = z;
}
inline void GXColor1u32(u32 c) {
GFX_FIFO(u32) = c;
}
inline void GXTexCoord2f32(f32 s, f32 t) {
GFX_FIFO(f32) = s;
GFX_FIFO(f32) = t;
}
inline void GXTexCoord2u8(u8 s, u8 t) {
GFX_FIFO(u8) = s;
GFX_FIFO(u8) = t;
}
inline void GXTexCoord1x8(u8 s) {
GFX_FIFO(u8) = s;
}
inline void GXPosition2u16(u16 x, u16 y) {
GFX_FIFO(u16) = x;
GFX_FIFO(u16) = y;
}
inline void GXPosition1x16(u16 x) {
GFX_FIFO(u16) = x;
}
inline void GXPosition1x8(u8 x) {
GFX_FIFO(u8) = x;
}
inline void GXPosition3s8(s8 x, s8 y, s8 z) {
GFX_FIFO(s8) = x;
GFX_FIFO(s8) = y;
GFX_FIFO(s8) = z;
}
inline void GXPosition2s8(s8 x, s8 y) {
GFX_FIFO(s8) = x;
GFX_FIFO(s8) = y;
}
inline void GXPosition2s16(s16 x, s16 y) {
GFX_FIFO(s16) = x;
GFX_FIFO(s16) = y;
}
inline void i_GXPosition3s16(s16 x, s16 y, s16 z) {
GFX_FIFO(s16) = x;
GFX_FIFO(s16) = y;
GFX_FIFO(s16) = z;
}
inline void GXTexCoord2s8(s8 x, s8 y) {
GFX_FIFO(s8) = x;
GFX_FIFO(s8) = y;
}
inline void i_GXTexCoord2u16(u16 x, u16 y) {
GFX_FIFO(u16) = x;
GFX_FIFO(u16) = y;
}
inline void GXTexCoord2s16(const s16 u, const s16 v) {
GFX_FIFO(s16) = u;
GFX_FIFO(s16) = v;
}
inline void GFWriteBPCmd(u32 param_1) {
GXFIFO.u8 = 0x61;
GXFIFO.u32 = param_1;
}
static inline u32 GXReadCPReg(u32 addrLo, u32 addrHi) {
u32 hiStart, hiNew, lo;
hiStart = GX_GET_CP_REG(addrHi);
do {
hiNew = hiStart;
lo = GX_GET_CP_REG(addrLo);
hiStart = GX_GET_CP_REG(addrHi);
} while (hiStart != hiNew);
return ((hiStart << 16) | lo);
}
inline void GFFill(u16 param_1, u32 param_2) {
GXFIFO.u8 = 0x10;
GXFIFO.u16 = 0;
GXFIFO.u16 = param_1;
GXFIFO.u32 = param_2;
}
inline void i_GXEnd() {}
#ifdef __cplusplus
};
#endif
#endif
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -11,10 +11,10 @@ extern "C" {
void GXSetDispCopySrc(u16 left, u16 top, u16 width, u16 height);
void GXSetTexCopySrc(u16 left, u16 top, u16 width, u16 height);
void GXSetDispCopyDst(u16 arg0, u16 arg1);
void GXSetTexCopyDst(u16 width, u16 height, s32 fmt, GXBool mipmap);
void GXSetTexCopyDst(u16 width, u16 height, GXTexFmt format, GXBool useMIPmap);
void GXSetDispCopyFrame2Field(GXCopyMode mode);
void GXSetCopyClamp(GXFBClamp clamp);
u16 GXGetNumXfbLines(u32 efb_height, f32 y_scale);
u16 GXGetNumXfbLines(const u16 efbHeight, f32 yScale);
f32 GXGetYScaleFactor(u16 efb_height, u16 xfb_height);
u32 GXSetDispCopyYScale(f32 y_scale);
void GXSetCopyClear(GXColor color, u32 clear_z);
+118 -91
View File
@@ -1,97 +1,124 @@
#ifndef GXINIT_H
#define GXINIT_H
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#include "dolphin/mtx/mtx.h"
typedef GXTexRegion (*GXTexRegionCallback)(GXTexObj* obj);
typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 name);
#include "dolphin/gx/GXTexture.h"
#include "dolphin/mtx.h"
typedef struct _GXData {
/* 0x000 */ u16 field_0x0;
/* 0x002 */ u16 bpSentNot;
/* 0x004 */ u16 vNum;
/* 0x006 */ u16 vLim;
/* 0x008 */ u32 cpEnable;
/* 0x00C */ u32 cpStatus;
/* 0x010 */ u32 cpClr;
/* 0x014 */ u32 vcdLoReg;
/* 0x018 */ GXAttrType vcdHiReg;
/* 0x01C */ GXCompCnt vatA[8];
/* 0x03C */ GXCompCnt vatB[8];
/* 0x05C */ u32 vatC[8];
/* 0x07C */ u32 lpSize;
/* 0x080 */ u32 matIdxA;
/* 0x084 */ u32 matIdxB;
/* 0x088 */ u8 field_0x88[0xA8 - 0x88];
/* 0x0A8 */ GXColor ambColors[2];
/* 0x0B0 */ GXColor matColors[2];
/* 0x0B8 */ u32 suTs0[8]; // GX_MAX_TEXCOORD
/* 0x0D8 */ u32 suTs1[8]; // GX_MAX_TEXCOORD
/* 0x0F8 */ u32 suScis0;
/* 0x0FC */ u32 suScis1;
/* 0x100 */ u32 tref[GX_MAX_TEVSTAGE / 2];
/* 0x120 */ u32 iref;
/* 0x124 */ u32 bpMask;
/* 0x128 */ u32 field_0x128;
/* 0x12C */ u32 field_0x12c;
/* 0x130 */ u32 tevc[GX_MAX_TEVSTAGE];
/* 0x170 */ u32 teva[GX_MAX_TEVSTAGE];
/* 0x1B0 */ u32 tevKsel[GX_MAX_TEVSTAGE / 2];
/* 0x1D0 */ u32 cmode0;
/* 0x1D4 */ u32 cmode1;
/* 0x1D8 */ u32 zmode;
/* 0x1DC */ u32 peCtrl;
/* 0x1E0 */ u32 field_0x1e0;
/* 0x1E4 */ u32 field_0x1e4;
/* 0x1E8 */ u32 field_0x1e8;
/* 0x1EC */ u32 field_0x1ec;
/* 0x1F0 */ u32 field_0x1f0;
/* 0x1F4 */ u32 field_0x1f4;
/* 0x1F8 */ u32 field_0x1f8;
/* 0x1FC */ u32 cpTex;
/* 0x200 */ u8 field_0x200;
/* 0x204 */ u32 genMode;
/* 0x208 */ GXTexRegion TexRegions0[8];
/* 0x288 */ GXTexRegion TexRegions1[8];
/* 0x308 */ GXTexRegion TexRegions2[8];
/* 0x388 */ GXTlutRegion TlutRegions[16];
/* 0x488 */ GXTlutRegion field_0x488[4];
/* 0x4C8 */ GXTexRegionCallback texRegionCB;
/* 0x4CC */ GXTlutRegionCallback tlutRegionCB;
/* 0x4D0 */ GXAttrType nrmDataType;
/* 0x4D4 */ GXBool hasNrm;
/* 0x4D5 */ GXBool hasBiNrm;
/* 0x4D8 */ GXProjectionType projectionType;
/* 0x4DC */ f32 field_0x4dc;
/* 0x4E0 */ f32 field_0x4e0;
/* 0x4E4 */ f32 field_0x4e4;
/* 0x4E8 */ f32 field_0x4e8;
/* 0x4EC */ f32 field_0x4ec;
/* 0x4F0 */ f32 field_0x4f0;
/* 0x4F4 */ f32 vpLeft;
/* 0x4F8 */ f32 vpTop;
/* 0x4FC */ f32 vpWd;
/* 0x500 */ f32 vpHt;
/* 0x504 */ f32 vpNearz;
/* 0x508 */ f32 vpFarz;
/* 0x50C */ f32 zOffset;
/* 0x510 */ f32 zScale;
/* 0x514 */ u32 field_0x514[8];
/* 0x534 */ u32 field_0x534[8];
/* 0x558 */ u32 texmapId[9];
/* 0x578 */ u8 field_0x578[0x594 - 0x578];
/* 0x594 */ u32 tcsManEnab;
/* 0x598 */ u32 tevTcEnab;
/* 0x59C */ u32 perf0;
/* 0x5A0 */ u32 perf1;
/* 0x5A4 */ u32 perfSel;
/* 0x5A8 */ u8 inDispList;
/* 0x5A9 */ u8 dlSaveContext;
/* 0x5AA */ u8 abtWaitPECopy;
/* 0x5AB */ u8 dirtyVAT;
/* 0x5AC */ u32 dirtyFlags;
// Bypass and vertex info
u16 vNumNot; // _000, !(# flush verts to send)
u16 bpSentNot; // _002, !(bypass reg sent last?)
u16 vNum; // _004, # flush verts to send
u16 vLim; // _006, max vert size
// Command process (CP) regs
u32 cpEnable; // _008
u32 cpStatus; // _00C
u32 cpClr; // _010
u32 vcdLo; // _014
u32 vcdHi; // _018
u32 vatA[8]; // _01C
u32 vatB[8]; // _03C
u32 vatC[8]; // _05C
u32 lpSize; // _07C
u32 matIdxA; // _080
u32 matIdxB; // _084
// Index loading base/stride regs (pos, nrm, tex, light)
u32 indexBase[4]; // _088
u32 indexStride[4]; // _098
// Transform and lighting regs
u32 ambColor[2]; // _0A8
u32 matColor[2]; // _0B0
// Setup regs
u32 suTs0[8]; // _0B8
u32 suTs1[8]; // _0D8
u32 suScis0; // _0F8
u32 suScis1; // _0FC
// Raster regs
u32 tref[8]; // _100
u32 iref; // _120
// Bump/Indirect texture regs
u32 bpMask; // _124
u32 IndTexScale0; // _128
u32 IndTexScale1; // _12C
// Tev regs
u32 tevc[16]; // _130
u32 teva[16]; // _170
u32 tevKsel[8]; // _1B0
// Performance regs
u32 cmode0; // _1D0
u32 cmode1; // _1D4
u32 zmode; // _1D8
u32 peCtrl; // _1DC
// Display copy regs
u32 cpDispSrc; // _1E0
u32 cpDispSize; // _1E4
u32 cpDispStride; // _1E8
u32 cpDisp; // _1EC
// Texture copy regs
u32 cpTexSrc; // _1F0
u32 cpTexSize; // _1F4
u32 cpTexStride; // _1F8
u32 cpTex; // _1FC
GXBool cpTexZ; // _200
// General raster mode
u32 genMode; // _204
// Texture regions
GXTexRegion TexRegions0[GX_MAX_TEXMAP]; // _208
GXTexRegion TexRegions1[GX_MAX_TEXMAP]; // _288
GXTexRegion TexRegions2[GX_MAX_TEXMAP]; // _308
// Texture lookup table regions
GXTlutRegion TlutRegions[GX_MAX_TLUT_ALL]; // _388
GXTexRegionCallback texRegionCallback; // _4C8
GXTlutRegionCallback tlutRegionCallback; // _4CC
// Command processor vars
GXAttrType nrmType; // _4D0
GXBool hasNrms; // _4D4
GXBool hasBiNrms; // _4D5
u32 projType; // _4D8
f32 projMtx[6]; // _4DC
// Viewport parms
f32 vpLeft; // _4F4
f32 vpTop; // _4F8
f32 vpWd; // _4FC
f32 vpHt; // _500
f32 vpNearz; // _504
f32 vpFarz; // _508
f32 zOffset; // _50C
f32 zScale; // _510
// Texture regs
u32 tImage0[8]; // _514
u32 tMode0[8]; // _534
u32 texmapId[16]; // _554
u32 tcsManEnab; // _594
u32 tevTcEnab; // _598
// Performance metrics
GXPerf0 perf0; // _59C
GXPerf1 perf1; // _5A0
u32 perfSel; // _5A4
// Flags
GXBool inDispList; // _5A8
GXBool dlSaveContext; // _5A9
GXBool abtWaitPECopy; // _5AA
u8 dirtyVAT; // _5AB
u32 dirtyState; // _5AC
} GXData; // Size: 0x5B0
STATIC_ASSERT(sizeof(GXData) == 0x5B0);
@@ -121,7 +148,7 @@ extern vu16* __memReg;
inline void GXSetWasteFlags() {
GXData* data = __GXData;
data->dirtyFlags |= GX_DIRTY_SU_TEX | GX_DIRTY_BP_MASK;
data->dirtyState |= GX_DIRTY_SU_TEX | GX_DIRTY_BP_MASK;
data->bpSentNot = 0;
}
@@ -147,7 +174,7 @@ static inline u32 GXReadMEMReg(u32 addrLo, u32 addrHi)
return ((hiStart << 16) | lo);
}
GXTexRegion* __GXDefaultTexRegionCallback(GXTexObj* obj, GXTexMapID mapID);
GXTexRegion* __GXDefaultTexRegionCallback(const GXTexObj* obj, GXTexMapID mapID);
GXTlutRegion* __GXDefaultTlutRegionCallback(u32 tlut);
BOOL __GXShutdown(BOOL);
void __GXInitRevisionBits(void);
+1 -1
View File
@@ -7,7 +7,7 @@
extern "C" {
#endif
void GXSetMisc(u32 id, u32 value);
void GXSetMisc(GXMiscToken token, u32 val);
void GXFlush(void);
void __GXAbort(void);
void GXAbortFrame(void);
+12 -5
View File
@@ -2,6 +2,8 @@
#define GXSTRUCT_H
#include "global.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/vi.h"
typedef struct _GXColor {
/* 0x0 */ u8 r;
@@ -18,7 +20,7 @@ typedef struct _GXColorS10 {
} GXColorS10;
typedef struct _GXRenderModeObj {
/* 0x00 */ s32 vi_tv_mode;
/* 0x00 */ VITVMode vi_tv_mode;
/* 0x04 */ u16 fb_width;
/* 0x06 */ u16 efb_height;
/* 0x08 */ u16 xfb_height;
@@ -26,7 +28,7 @@ typedef struct _GXRenderModeObj {
/* 0x0C */ u16 vi_y_origin;
/* 0x0E */ u16 vi_width;
/* 0x10 */ u16 vi_height;
/* 0x14 */ s32 xfb_mode;
/* 0x14 */ VIXFBMode xfb_mode;
/* 0x18 */ u8 field_rendering;
/* 0x19 */ u8 antialiasing;
/* 0x1A */ u8 sample_pattern[12][2];
@@ -51,7 +53,7 @@ typedef struct _GXTexObj {
typedef struct _GXTlutObj {
/* 0x0 */ u32 format;
/* 0x4 */ u32 address;
/* 0x8 */ u32 numEntries;
/* 0x8 */ u16 numEntries;
} GXTlutObj;
typedef struct _GXLightObj {
@@ -91,11 +93,16 @@ typedef struct _GXFifoObj {
} GXFifoObj; // Size: 0x80
typedef struct _GXTexRegion {
/* 0x00 */ u8 dummy[0x10];
u32 unk0; // _00
u32 unk4; // _04
u32 unk8; // _08
u8 unkC; // _0C
u8 unkD; // _0D
} GXTexRegion; // Size: 0x10
typedef struct _GXTlutRegion {
/* 0x00 */ u8 dummy[0x10];
/* 0x00 */ u32 unk0;
/* 0x04 */ GXTlutObj tlutObj;
} GXTlutRegion; // Size: 0x10
#endif /* GXSTRUCT_H */
+8 -4
View File
@@ -1,14 +1,18 @@
#ifndef GXTEXTURE_H
#define GXTEXTURE_H
#include "dolphin/gx/GXInit.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef GXTexRegion* (*GXTexRegionCallback)(const GXTexObj* t_obj, GXTexMapID id);
typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod);
void __GetImageTileCount(u32 arg0, u16 arg1, u16 arg2, s32* arg3, s32* arg4, s32* arg5);
void __GetImageTileCount(GXTexFmt format, u16 width, u16 height, u32* a, u32* b, u32* c);
void GXInitTexObj(GXTexObj* obj, void* image, u16 width, u16 height, GXTexFmt fmt,
GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap);
void GXInitTexObjCI(GXTexObj* obj, void* image, u16 width, u16 height, GXCITexFmt format,
@@ -18,10 +22,10 @@ void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filter, GXTexFilter max_filt
GXAnisotropy aniso);
u16 GXGetTexObjWidth(GXTexObj* obj);
u16 GXGetTexObjHeight(GXTexObj* obj);
GXTexFmt GXGetTexObjFmt(GXTexObj* obj);
GXTexFmt GXGetTexObjFmt(const GXTexObj* obj);
GXTexWrapMode GXGetTexObjWrapS(GXTexObj* obj);
GXTexWrapMode GXGetTexObjWrapT(GXTexObj* obj);
GXBool GXGetTexObjMipMap(GXTexObj* obj);
GXBool GXGetTexObjMipMap(const GXTexObj* obj);
u32 GXGetTexObjTlut(GXTexObj* obj);
void GXLoadTexObj(GXTexObj* obj, GXTexMapID id);
void GXInitTlutObj(GXTlutObj* obj, void* lut, GXTlutFmt fmt, u16 entry_num);
+4 -4
View File
@@ -2,7 +2,7 @@
#define GXTRANSFORM_H
#include "dolphin/gx/GXEnum.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#ifdef __cplusplus
extern "C" {
@@ -10,18 +10,18 @@ extern "C" {
void GXProject(f32 model_x, f32 model_y, f32 model_z, Mtx model_mtx, f32* proj_mtx, f32* viewpoint,
f32* screen_x, f32* screen_y, f32* screen_z);
void GXSetProjection(Mtx44 mtx, GXProjectionType type);
void GXSetProjection(const Mtx44 proj, GXProjectionType type);
void GXSetProjectionv(f32* p);
void GXGetProjectionv(f32* p);
void GXLoadPosMtxImm(Mtx mtx, u32 id);
void GXLoadNrmMtxImm(Mtx mtx, u32 id);
void GXSetCurrentMtx(u32 id);
void GXLoadTexMtxImm(Mtx mtx, u32 id, GXTexMtxType type);
void GXLoadTexMtxImm(const Mtx mtx, u32 id, GXTexMtxType type);
void GXSetViewport(f32 x_orig, f32 y_orig, f32 width, f32 height, f32 near_z, f32 far_z);
void GXGetViewportv(f32* p);
void GXSetScissor(u32 left, u32 top, u32 width, u32 height);
void GXGetScissor(u32* left, u32* top, u32* width, u32* height);
void GXSetScissorBoxOffset(u32 x_offset, u32 y_offset);
void GXSetScissorBoxOffset(s32 x_offset, s32 y_offset);
void GXSetClipMode(GXClipMode mode);
#ifdef __cplusplus
@@ -3,12 +3,16 @@
#include "dolphin/mtx/mtx44.h"
#include "dolphin/mtx/quat.h"
#include "dolphin/types.h"
#include "dolphin/mtx/vec.h"
#ifdef __cplusplus
extern "C" {
#endif
// ====== MATRIX ====== //
#define MTXDegToRad(a) ((a)*0.01745329252f)
typedef f32 Mtx[3][4];
typedef f32 Mtx33[3][3];
typedef f32 Mtx23[2][3];
@@ -20,15 +24,14 @@ void PSMTXIdentity(Mtx m);
void PSMTXCopy(const Mtx src, Mtx dst);
void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab);
u32 PSMTXInverse(const Mtx src, Mtx inv);
void PSMTXRotRad(Mtx m, u8 axis, f32 rad);
void PSMTXRotTrig(Mtx m, u8 axis, f32 sin, f32 cos);
f64 __PSMTXRotAxisRadInternal(f64 param_1, f64 param_2, int param_3, int param_4);
void PSMTXRotRad(Mtx m, char axis, f32 rad);
void PSMTXRotTrig(Mtx m, char axis, f32 sin, f32 cos);
void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad);
void PSMTXTrans(Mtx m, f32 x, f32 y, f32 z);
void PSMTXTransApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z);
void PSMTXScale(Mtx m, f32 x, f32 y, f32 z);
void PSMTXScaleApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z);
void PSMTXQuat(Mtx m, const Quaternion* q);
void PSMTXQuat(Mtx m, const PSQuaternion* q);
void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target);
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, f32 scale_s, f32 scale_t, f32 trans_s,
@@ -83,6 +86,32 @@ inline void C_MTXRotAxisRad(Mtx m, const Vec* axis, f32 rad) {
#define MTXQuat PSMTXQuat
#endif
// ====== MATRIX VECTOR ====== //
void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst);
void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dst);
void PSMTXMultVecArray(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
void PSMTXMultVecArraySR(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
/* When compiling in debug mode, use C implementations */
#ifdef DEBUG
// TODO: Add debug rom C implementations
/* #define MTXMultVec C_MTXMultVec
#define MTXMultVecSR C_MTXMultVecSR
#define MTXMultVecArray C_MTXMultVecArray
#define MTXMultVecArraySR C_MTXMultVecArraySR */
#define MTXMultVec PSMTXMultVec
#define MTXMultVecSR PSMTXMultVecSR
#define MTXMultVecArray PSMTXMultVecArray
#define MTXMultVecArraySR PSMTXMultVecArraySR
#else
#define MTXMultVec PSMTXMultVec
#define MTXMultVecSR PSMTXMultVecSR
#define MTXMultVecArray PSMTXMultVecArray
#define MTXMultVecArraySR PSMTXMultVecArraySR
#endif
#ifdef __cplusplus
};
#endif
-38
View File
@@ -1,38 +0,0 @@
#ifndef MTXVEC_H
#define MTXVEC_H
#include "dolphin/mtx/mtx.h"
#ifdef __cplusplus
extern "C" {
#endif
void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst);
void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dst);
void PSMTXMultVecArray(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
void PSMTXMultVecArraySR(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
/* When compiling in debug mode, use C implementations */
#ifdef DEBUG
// TODO: Add debug rom C implementations
/* #define MTXMultVec C_MTXMultVec
#define MTXMultVecSR C_MTXMultVecSR
#define MTXMultVecArray C_MTXMultVecArray
#define MTXMultVecArraySR C_MTXMultVecArraySR */
#define MTXMultVec PSMTXMultVec
#define MTXMultVecSR PSMTXMultVecSR
#define MTXMultVecArray PSMTXMultVecArray
#define MTXMultVecArraySR PSMTXMultVecArraySR
#else
#define MTXMultVec PSMTXMultVec
#define MTXMultVecSR PSMTXMultVecSR
#define MTXMultVecArray PSMTXMultVecArray
#define MTXMultVecArraySR PSMTXMultVecArraySR
#endif
#ifdef __cplusplus
};
#endif
#endif /* MTXVEC_H */
+2
View File
@@ -11,6 +11,8 @@ typedef struct Quaternion {
f32 x, y, z, w;
} Quaternion;
typedef f32 PSQuaternion[4];
void PSQUATMultiply(const Quaternion* a, const Quaternion* b, Quaternion* ab);
void C_QUATRotAxisRad(Quaternion* q, const Vec* axis, f32 rad);
void C_QUATSlerp(const Quaternion* p, const Quaternion* q, Quaternion* r, f32 t);
-5
View File
@@ -1,5 +0,0 @@
#ifndef ODENOTSTUB_H
#define ODENOTSTUB_H
#endif /* ODENOTSTUB_H */
@@ -2,7 +2,7 @@
#define OS_H_
#include "__va_arg.h"
#include "dolphin/dvd/dvd.h"
#include "dolphin/dvd.h"
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSAlloc.h"
@@ -94,9 +94,13 @@ void OSVAttention(const char* fmt, va_list args);
void OSReportInit(void);
#ifdef DEBUG
#define OS_REPORT(...) OSReport(__VA_ARGS__);
#define OS_REPORT(...) OSReport(__VA_ARGS__)
#define OS_PANIC(msg) OSPanic(__FILE__, __LINE__, msg)
#define ASSERTMSG(exp, msg) (void)((exp) || (OSPanic(__FILE__, __LINE__, (msg)), 0))
#else
#define OS_REPORT(...)
#define OS_PANIC(...)
#define ASSERTMSG(exp, msg) ((void)0)
#endif
extern u8 __OSReport_disable;
@@ -107,14 +111,14 @@ extern u8 __OSReport_enable;
extern BOOL __OSIsGcam;
extern u32 BOOT_REGION_START : 0x812FDFF0;
extern u32 BOOT_REGION_START : 0x8044babc;
extern u32 BOOT_REGION_END : 0x812FDFEC;
void OSReportInit__Fv(void); // needed for inline asm
u8* OSGetStackPointer(void);
void __OSFPRInit(void);
static void InquiryCallback(u32 param_0, DVDCommandBlock* param_1);
static void InquiryCallback(s32 param_0, DVDCommandBlock* param_1);
void OSInit(void);
static void OSExceptionInit(void);
void __OSDBIntegrator(void);
@@ -169,7 +173,7 @@ inline void OSf32tou8(f32* f, u8* out) {
*out = __OSf32tou8(*f);
}
inline void i_OSInitFastCast(void) {
static inline void OSInitFastCast(void) {
// clang-format off
asm {
li r3, 4
@@ -304,6 +308,7 @@ struct GLOBAL_MEMORY {
#define OSUncachedToCached(ucaddr) ((void*)((u8*)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED)))
extern OSTime __OSStartTime;
extern BOOL __OSInIPL;
#ifdef __cplusplus
};
+20 -17
View File
@@ -53,15 +53,18 @@ typedef enum {
#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(OS_INTR_MEM_2)
#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(OS_INTR_MEM_3)
#define OS_INTERRUPTMASK_MEM_ADDRESS OS_INTERRUPTMASK(OS_INTR_MEM_ADDRESS)
#define OS_INTERRUPTMASK_MEM_RESET \
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3)
#define OS_INTERRUPTMASK_MEM \
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3 | OS_INTERRUPTMASK_MEM_ADDRESS)
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3 | OS_INTERRUPTMASK_MEM_ADDRESS)
#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(OS_INTR_DSP_AI)
#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(OS_INTR_DSP_ARAM)
#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(OS_INTR_DSP_DSP)
#define OS_INTERRUPTMASK_DSP \
(OS_INTERRUPTMASK_DSP_AI | OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP)
(OS_INTERRUPTMASK_DSP_AI | OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP)
#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(OS_INTR_AI_AI)
#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI)
@@ -70,21 +73,21 @@ typedef enum {
#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(OS_INTR_EXI_0_TC)
#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(OS_INTR_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_0 \
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT)
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(OS_INTR_EXI_1_EXI)
#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(OS_INTR_EXI_1_TC)
#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(OS_INTR_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_1 \
(OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT)
(OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(OS_INTR_EXI_2_EXI)
#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(OS_INTR_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI_2 (OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI \
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT | \
OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT | \
OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT | \
OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT | \
OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_PI_PE_TOKEN OS_INTERRUPTMASK(OS_INTR_PI_PE_TOKEN)
#define OS_INTERRUPTMASK_PI_PE_FINISH OS_INTERRUPTMASK(OS_INTR_PI_PE_FINISH)
@@ -99,27 +102,27 @@ typedef enum {
#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(OS_INTR_PI_DEBUG)
#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(OS_INTR_PI_HSP)
#define OS_INTERRUPTMASK_PI \
(OS_INTERRUPTMASK_PI_CP | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI | \
OS_INTERRUPTMASK_PI_RSW | OS_INTERRUPTMASK_PI_ERROR | OS_INTERRUPTMASK_PI_VI | \
OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH | OS_INTERRUPTMASK_PI_DEBUG | \
OS_INTERRUPTMASK_PI_HSP)
(OS_INTERRUPTMASK_PI_CP | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI | \
OS_INTERRUPTMASK_PI_RSW | OS_INTERRUPTMASK_PI_ERROR | OS_INTERRUPTMASK_PI_VI | \
OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH | OS_INTERRUPTMASK_PI_DEBUG | \
OS_INTERRUPTMASK_PI_HSP)
typedef s16 OSInterrupt;
typedef s16 __OSInterrupt;
typedef u32 OSInterruptMask;
typedef void (*OSInterruptHandler)(OSInterrupt interrupt, OSContext* context);
typedef void (*__OSInterruptHandler)(__OSInterrupt interrupt, OSContext* context);
BOOL OSDisableInterrupts(void);
void __RAS_OSDisableInterrupts_end(void);
BOOL OSEnableInterrupts(void);
BOOL OSRestoreInterrupts(BOOL enable);
OSInterruptHandler __OSSetInterruptHandler(OSInterrupt interrupt, OSInterruptHandler handler);
OSInterruptHandler __OSGetInterruptHandler(s16 index);
__OSInterruptHandler __OSSetInterruptHandler(__OSInterrupt interrupt, __OSInterruptHandler handler);
__OSInterruptHandler __OSGetInterruptHandler(s16 index);
void __OSInterruptInit(void);
static OSInterruptMask SetInterruptMask(OSInterruptMask param_0, OSInterruptMask param_1);
OSInterruptMask __OSMaskInterrupts(OSInterruptMask mask);
OSInterruptMask __OSUnmaskInterrupts(OSInterruptMask mask);
void __OSDispatchInterrupt(u8 interrupt, OSContext* context);
static void ExternalInterruptHandler(OSInterrupt interrupt, OSContext* context);
static void ExternalInterruptHandler(__OSInterrupt interrupt, OSContext* context);
void __RAS_OSDisableInterrupts_begin(void);
void __RAS_OSDisableInterrupts_end(void);
+1 -1
View File
@@ -17,7 +17,7 @@ extern "C" {
#define OS_PROTECT_CONTROL_WRITE 0x02
#define OS_PROTECT_CONTROL_RDWR (OS_PROTECT_CONTROL_READ | OS_PROTECT_CONTROL_WRITE)
static void MEMIntrruptHandler(OSInterrupt interrupt, struct OSContext* context);
static void MEMIntrruptHandler(__OSInterrupt interrupt, struct OSContext* context);
void OSProtectRange(u32 channel, void* address, u32 nBytes, u32 control);
static void Config24MB(void);
static void Config48MB(void);
+4
View File
@@ -22,6 +22,10 @@ typedef struct OSMessageQueue {
#define OS_MESSAGE_NOBLOCK 0
#define OS_MESSAGE_BLOCK 1
typedef enum {
OS_MSG_PERSISTENT = (1 << 0),
} OSMessageFlags;
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, s32 msgCount);
BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, s32 flags);
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msg, s32 flags);
+1 -1
View File
@@ -28,7 +28,7 @@ vu32 __PIRegs[12] : 0xCC003000;
#define OS_RESET_PRIO_GX 127
#define OS_RESET_PRIO_ALARM 4294967295
typedef s32 (*OSResetFunction)(s32);
typedef BOOL (*OSResetFunction)(BOOL final);
typedef struct OSResetFunctionInfo {
/* 0x0 */ OSResetFunction func;
+1 -1
View File
@@ -68,7 +68,7 @@ struct OSThread {
OSMutexQueue owned_mutexes;
OSThreadLink active_threads_link;
u8* stack_base;
u8* stack_end;
u32* stack_end;
u8* error_code;
void* data[2];
};
-5
View File
@@ -1,5 +0,0 @@
#ifndef __PPC_EABI_INIT_H
#define __PPC_EABI_INIT_H
#endif /* __PPC_EABI_INIT_H */
@@ -9,12 +9,10 @@ extern "C" {
typedef struct OSContext OSContext;
typedef enum PADMask {
PAD_CHAN3_BIT = (1 << 28),
PAD_CHAN2_BIT = (1 << 29),
PAD_CHAN1_BIT = (1 << 30),
PAD_CHAN0_BIT = (1 << 31),
} PADMask;
#define PAD_CHAN0_BIT 0x80000000
#define PAD_CHAN1_BIT 0x40000000
#define PAD_CHAN2_BIT 0x20000000
#define PAD_CHAN3_BIT 0x10000000
#define PAD_SPEC_0 0
#define PAD_SPEC_1 1
@@ -70,11 +68,6 @@ void PADClamp(PADStatus* status);
u32 PADRead(PADStatus* status);
void PADControlMotor(s32 channel, u32 command);
BOOL PADRecalibrate(u32 mask);
static void PADOriginCallback(s32 chan, u32 error, OSContext* context);
static void PADOriginUpdateCallback(s32 chan, u32 error, OSContext* context);
static void PADProbeCallback(s32 chan, u32 error, OSContext* context);
static void PADTypeAndStatusCallback(s32 chan, u32 type);
static void PADReceiveCheckCallback(s32 chan, u32 type);
#ifdef __cplusplus
};
+1
View File
@@ -1,6 +1,7 @@
#ifndef PADCLAMP_H
#define PADCLAMP_H
#include "dolphin/pad.h"
#ifdef __cplusplus
extern "C" {
+3 -3
View File
@@ -102,10 +102,10 @@ typedef union SIComm_u {
BOOL SIBusy(void);
BOOL SIIsChanBusy(s32 chan);
static void SIInterruptHandler(OSInterrupt interrupt, OSContext* context);
static void SIInterruptHandler(__OSInterrupt interrupt, OSContext* context);
static BOOL SIEnablePollingInterrupt(BOOL enable);
BOOL SIRegisterPollingHandler(OSInterruptHandler handler);
BOOL SIUnregisterPollingHandler(OSInterruptHandler handler);
BOOL SIRegisterPollingHandler(__OSInterruptHandler handler);
BOOL SIUnregisterPollingHandler(__OSInterruptHandler handler);
void SIInit(void);
u32 SIGetStatus(s32 chan);
void SISetCommand(s32 chan, u32 command);
+2
View File
@@ -32,6 +32,8 @@ typedef int BOOL;
#define READU32_BE(ptr, offset) \
(((u32)ptr[offset] << 24) | ((u32)ptr[offset + 1] << 16) | ((u32)ptr[offset + 2] << 8) | (u32)ptr[offset + 3]);
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
#include "stddef.h"
#define INT32_MAX (0x7fffffff)
+147
View File
@@ -0,0 +1,147 @@
#ifndef VI_H
#define VI_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _GXRenderModeObj GXRenderModeObj;
#define VI_INTERLACE (0)
#define VI_NON_INTERLACE (1)
#define VI_PROGRESSIVE (2)
#define VI_3D (3)
// Video output formats
#define VI_NTSC (0)
#define VI_PAL (1)
#define VI_MPAL (2)
#define VI_DEBUG (3)
#define VI_DEBUG_PAL (4)
#define VI_EURGB60 (5)
#define VI_GCA (6)
// Conversion to TVMode used in enums
#define VI_TVMODE(FMT, INT) (((FMT) << 2) + (INT))
// TV Modes
typedef enum {
// NTSC
VI_TVMODE_NTSC_INT = VI_TVMODE(VI_NTSC, VI_INTERLACE), // 0
VI_TVMODE_NTSC_DS = VI_TVMODE(VI_NTSC, VI_NON_INTERLACE), // 1
VI_TVMODE_NTSC_PROG = VI_TVMODE(VI_NTSC, VI_PROGRESSIVE), // 2
VI_TVMODE_NTSC_3D = VI_TVMODE(VI_NTSC, VI_3D), // 3
// PAL
VI_TVMODE_PAL_INT = VI_TVMODE(VI_PAL, VI_INTERLACE), // 4
VI_TVMODE_PAL_DS = VI_TVMODE(VI_PAL, VI_NON_INTERLACE), // 5
// MPAL
VI_TVMODE_MPAL_INT = VI_TVMODE(VI_MPAL, VI_INTERLACE), // 8
VI_TVMODE_MPAL_DS = VI_TVMODE(VI_MPAL, VI_NON_INTERLACE), // 9
// Debug
VI_TVMODE_DEBUG_INT = VI_TVMODE(VI_DEBUG, VI_INTERLACE), // 12
// Debug PAL
VI_TVMODE_DEBUG_PAL_INT = VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE), // 16
VI_TVMODE_DEBUG_PAL_DS = VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE), // 17
// EU RGB60
VI_TVMODE_EURGB60_INT = VI_TVMODE(VI_EURGB60, VI_INTERLACE), // 20
VI_TVMODE_EURGB60_DS = VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE), // 21
// GCA
VI_TVMODE_GCA_INT = VI_TVMODE(VI_GCA, VI_INTERLACE), // 24
VI_TVMODE_GCA_DS = VI_TVMODE(VI_GCA, VI_NON_INTERLACE), // 25
VI_TVMODE_GCA_PROG = VI_TVMODE(VI_GCA, VI_PROGRESSIVE), // 26
} VITVMode;
typedef enum { VI_XFBMODE_SF = 0, VI_XFBMODE_DF } VIXFBMode;
typedef void (*VIRetraceCallback)(u32);
typedef void (*VIPositionCallback)(s16 x, s16 y);
typedef struct VITimingInfo {
u8 equ; // _00
u16 acv; // _02
u16 prbOdd; // _04
u16 prbEven; // _06
u16 psbOdd; // _08
u16 psbEven; // _0A
u8 bs1; // _0C
u8 bs2; // _0D
u8 bs3; // _0E
u8 bs4; // _0F
u16 be1; // _10
u16 be2; // _12
u16 be3; // _14
u16 be4; // _16
u16 numHalfLines; // _18
u16 hlw; // _1A
u8 hsy; // _1C
u8 hcs; // _1D
u8 hce; // _1E
u8 hbe640; // _1F
u16 hbs640; // _20
u8 hbeCCIR656; // _24
u16 hbsCCIR656; // _26
} VITimingInfo;
typedef struct VIPositionInfo {
u16 dispPosX; // _00
u16 dispPosY; // _02
u16 dispSizeX; // _04
u16 dispSizeY; // _06
u16 adjDispPosX; // _08
u16 adjDispPosY; // _0A
u16 adjDispSizeY; // _0C
u16 adjPanPosY; // _0E
u16 adjPanSizeY; // _10
u16 fbSizeX; // _12
u16 fbSizeY; // _14
u16 panPosX; // _16
u16 panPosY; // _18
u16 panSizeX; // _1A
u16 panSizeY; // _1C
VIXFBMode xfbMode; // _20
u32 nonInter; // _24
u32 tv; // _28
u8 wordPerLine; // _2C
u8 std; // _2D
u8 wpl; // _2E
u32 bufAddr; // _30
u32 tfbb; // _34
u32 bfbb; // _38
u8 xof; // _3C
BOOL isBlack; // _40
BOOL is3D; // _44
u32 rbufAddr; // _48
u32 rtfbb; // _4C
u32 rbfbb; // _50
VITimingInfo* timing; // _54
} VIPositionInfo;
void VIWaitForRetrace(void);
void VISetNextFrameBuffer(void*);
VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback);
VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback);
void VIInit();
void VIConfigure(const GXRenderModeObj*);
void VIFlush();
void* VIGetNextFrameBuffer();
void* VIGetCurrentFrameBuffer();
void VISetBlack(BOOL);
u32 VIGetRetraceCount();
u32 VIGetDTVStatus();
u32 VIGetTvFormat(void);
vu16 __VIRegs[59] : 0xCC002000;
#ifdef __cplusplus
};
#endif
#endif /* VI_H */
-63
View File
@@ -1,63 +0,0 @@
#ifndef VI_H
#define VI_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _GXRenderModeObj GXRenderModeObj;
#define VI_TVMODE(format, interlace) (((format) << 2) + (interlace))
#define VI_INTERLACE 0
#define VI_NON_INTERLACE 1
#define VI_PROGRESSIVE 2
#define VI_NTSC 0
#define VI_PAL 1
#define VI_MPAL 2
#define VI_DEBUG 3
#define VI_DEBUG_PAL 4
#define VI_EURGB60 5
typedef enum {
VI_TVMODE_NTSC_INT = VI_TVMODE(VI_NTSC, VI_INTERLACE),
VI_TVMODE_NTSC_DS = VI_TVMODE(VI_NTSC, VI_NON_INTERLACE),
VI_TVMODE_NTSC_PROG = VI_TVMODE(VI_NTSC, VI_PROGRESSIVE),
VI_TVMODE_PAL_INT = VI_TVMODE(VI_PAL, VI_INTERLACE),
VI_TVMODE_PAL_DS = VI_TVMODE(VI_PAL, VI_NON_INTERLACE),
VI_TVMODE_EURGB60_INT = VI_TVMODE(VI_EURGB60, VI_INTERLACE),
VI_TVMODE_EURGB60_DS = VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE),
VI_TVMODE_MPAL_INT = VI_TVMODE(VI_MPAL, VI_INTERLACE),
VI_TVMODE_MPAL_DS = VI_TVMODE(VI_MPAL, VI_NON_INTERLACE),
VI_TVMODE_DEBUG_INT = VI_TVMODE(VI_DEBUG, VI_INTERLACE),
VI_TVMODE_DEBUG_PAL_INT = VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE),
VI_TVMODE_DEBUG_PAL_DS = VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE)
} VITVMode;
typedef enum { VI_XFBMODE_SF = 0, VI_XFBMODE_DF } VIXFBMode;
typedef void (*VIRetraceCallback)(u32);
void VIWaitForRetrace(void);
void VISetNextFrameBuffer(void*);
VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback);
VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback);
void VIInit();
void VIConfigure(GXRenderModeObj*);
void VIFlush();
void* VIGetNextFrameBuffer();
void* VIGetCurrentFrameBuffer();
void VISetBlack(BOOL);
u32 VIGetRetraceCount();
u32 VIGetDTVStatus();
vu16 __VIRegs[59] : 0xCC002000;
#ifdef __cplusplus
};
#endif
#endif /* VI_H */
+1 -1
View File
@@ -2,7 +2,7 @@
#define F_F_OP_VIEW_H_
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "f_pc/f_pc_leaf.h"
struct view_process_profile_definition {
+1 -1
View File
@@ -2,7 +2,7 @@
#define M_DO_M_DO_GRAPHIC_H
#include "JSystem/JFramework/JFWDisplay.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
class JUTFader;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef M_DO_M_DO_MACHINE_EXCEPTION_H
#define M_DO_M_DO_MACHINE_EXCEPTION_H
#include "dolphin/gx/GX.h"
#include "dolphin/gx.h"
class JUTConsole;
+2 -2
View File
@@ -3,7 +3,7 @@
#include "SSystem/SComponent/c_sxyz.h"
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/mtx.h"
#include "dolphin/types.h"
void mDoMtx_XYZrotS(Mtx, s16, s16, s16);
@@ -128,7 +128,7 @@ inline void mDoMtx_scale(Mtx m, f32 x, f32 y, f32 z) {
}
inline void mDoMtx_quat(Mtx m, const Quaternion* q) {
MTXQuat(m, q);
MTXQuat(m, (PSQuaternion*)q);
}
inline void cMtx_inverse(const Mtx a, Mtx b) {