mirror of
https://github.com/zeldaret/tww.git
synced 2024-11-26 23:01:24 +00:00
GX work
This commit is contained in:
parent
0492ca2b52
commit
04a5b59db5
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -24,6 +24,7 @@
|
||||
"search.exclude": {
|
||||
"build/*/config.json": true,
|
||||
"build/**/*.MAP": true,
|
||||
"build/*/include/assets/**": true,
|
||||
"build.ninja": true,
|
||||
".ninja_*": true,
|
||||
"objdiff.json": true,
|
||||
|
@ -1143,20 +1143,20 @@ config.libs = [
|
||||
DolphinLib(
|
||||
"gx",
|
||||
[
|
||||
Object(NonMatching, "dolphin/gx/GXInit.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXInit.c", extra_cflags=["-opt nopeephole"]),
|
||||
Object(NonMatching, "dolphin/gx/GXFifo.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXAttr.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXMisc.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXGeometry.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXFrameBuf.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXLight.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXLight.c", extra_cflags=["-fp_contract off"]),
|
||||
Object(NonMatching, "dolphin/gx/GXTexture.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXBump.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXTev.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXPixel.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXStubs.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXDisplayList.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXTransform.c"),
|
||||
Object(NonMatching, "dolphin/gx/GXTransform.c", extra_cflags=["-fp_contract off"]),
|
||||
Object(NonMatching, "dolphin/gx/GXPerf.c"),
|
||||
],
|
||||
),
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifndef JMATH_H
|
||||
#define JMATH_H
|
||||
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
#include "dolphin/mtx/quat.h"
|
||||
#include "math.h"
|
||||
|
||||
bool JMANewSinTable(u8 numBits);
|
||||
void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* out);
|
||||
|
@ -205,6 +205,88 @@ inline void GFWriteBPCmd(u32 x) {
|
||||
|
||||
inline void GXEnd() {}
|
||||
|
||||
#define GX_WRITE_U8(ub) \
|
||||
GXFIFO.u8 = (u8)(ub)
|
||||
|
||||
#define GX_WRITE_U16(us) \
|
||||
GXFIFO.u16 = (u16)(us)
|
||||
|
||||
#define GX_WRITE_U32(ui) \
|
||||
GXFIFO.u32 = (u32)(ui)
|
||||
|
||||
#define GX_WRITE_F32(f) \
|
||||
GXFIFO.f32 = (f32)(f);
|
||||
|
||||
#define GX_WRITE_XF_REG(addr, value) \
|
||||
do { \
|
||||
GX_WRITE_U8(0x10); \
|
||||
GX_WRITE_U32(0x1000 + (addr)); \
|
||||
GX_WRITE_U32(value); \
|
||||
VERIF_XF_REG(addr, value); \
|
||||
} while (0)
|
||||
|
||||
#if DEBUG
|
||||
#define GX_WRITE_XF_REG_2(addr, value) \
|
||||
do { \
|
||||
u32 xfData = (value); &xfData; \
|
||||
GX_WRITE_U32(value); \
|
||||
VERIF_XF_REG_alt(addr, xfData); \
|
||||
} while (0)
|
||||
#define GX_WRITE_XF_REG_F(addr, value) \
|
||||
do { \
|
||||
f32 xfData = (value); \
|
||||
GX_WRITE_F32(value); \
|
||||
VERIF_XF_REG_alt(addr, *(u32 *)&xfData); \
|
||||
} while (0)
|
||||
#else
|
||||
#define GX_WRITE_XF_REG_2(addr, value) \
|
||||
do { \
|
||||
GX_WRITE_U32(value); \
|
||||
} while (0)
|
||||
#define GX_WRITE_XF_REG_F(addr, value) \
|
||||
do { \
|
||||
GX_WRITE_F32(value); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define GX_WRITE_RAS_REG(value) \
|
||||
do { \
|
||||
GX_WRITE_U8(0x61); \
|
||||
GX_WRITE_U32(value); \
|
||||
VERIF_RAS_REG(value); \
|
||||
} while (0)
|
||||
|
||||
#define GX_WRITE_SOME_REG2(a, b, c, addr) \
|
||||
do { \
|
||||
long regAddr; \
|
||||
GX_WRITE_U8(a); \
|
||||
GX_WRITE_U8(b); \
|
||||
GX_WRITE_U32(c); \
|
||||
regAddr = addr; \
|
||||
if (regAddr >= 0 && regAddr < 4) { \
|
||||
gx->indexBase[regAddr] = c; \
|
||||
} \
|
||||
} while (0)
|
||||
#define GX_WRITE_SOME_REG3(a, b, c, addr) \
|
||||
do { \
|
||||
long regAddr; \
|
||||
GX_WRITE_U8(a); \
|
||||
GX_WRITE_U8(b); \
|
||||
GX_WRITE_U32(c); \
|
||||
regAddr = addr; \
|
||||
if (regAddr >= 0 && regAddr < 4) { \
|
||||
gx->indexStride[regAddr] = c; \
|
||||
} \
|
||||
} while (0)
|
||||
#define GX_WRITE_SOME_REG4(a, b, c, addr) \
|
||||
do { \
|
||||
long regAddr; \
|
||||
GX_WRITE_U8(a); \
|
||||
GX_WRITE_U8(b); \
|
||||
GX_WRITE_U32(c); \
|
||||
regAddr = addr; \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -454,7 +454,7 @@ typedef enum _GXAnisotropy {
|
||||
|
||||
typedef enum _GXCITexFmt {
|
||||
/* 0x8 */ GX_TF_C4 = 8,
|
||||
/* 0x8 */ GX_TF_C8,
|
||||
/* 0x9 */ GX_TF_C8,
|
||||
/* 0xA */ GX_TF_C14X2
|
||||
} GXCITexFmt;
|
||||
|
||||
|
@ -81,8 +81,8 @@ typedef struct _GXData {
|
||||
// Texture regions
|
||||
/* 0x208 */ GXTexRegion TexRegions0[GX_MAX_TEXMAP];
|
||||
/* 0x288 */ GXTexRegion TexRegions1[4];
|
||||
/* 0x2C8 */ u32 m2C8;
|
||||
/* 0x2C8 */ u32 m2CC;
|
||||
/* 0x2C8 */ u32 nextTexRgn;
|
||||
/* 0x2C8 */ u32 nextTexRgnCI;
|
||||
|
||||
// Texture lookup table regions
|
||||
/* 0x2D0 */ GXTlutRegion TlutRegions[GX_MAX_TLUT_ALL];
|
||||
@ -140,6 +140,16 @@ extern u16* __cpReg;
|
||||
extern u16* __peReg;
|
||||
extern vu16* __memReg;
|
||||
|
||||
#define GX_GET_MEM_REG(offset) (*(vu16*)((vu16*)(__memReg) + (offset)))
|
||||
#define GX_GET_CP_REG(offset) (*(vu16*)((vu16*)(__cpReg) + (offset)))
|
||||
#define GX_GET_PE_REG(offset) (*(vu16*)((vu16*)(__peReg) + (offset)))
|
||||
#define GX_GET_PI_REG(offset) (*(vu32*)((vu32*)(__piReg) + (offset)))
|
||||
|
||||
#define GX_SET_MEM_REG(offset, val) (*(vu16*)((vu16*)(__memReg) + (offset)) = val)
|
||||
#define GX_SET_CP_REG(offset, val) (*(vu16*)((vu16*)(__cpReg) + (offset)) = val)
|
||||
#define GX_SET_PE_REG(offset, val) (*(vu16*)((vu16*)(__peReg) + (offset)) = val)
|
||||
#define GX_SET_PI_REG(offset, val) (*(vu32*)((vu32*)(__piReg) + (offset)) = val)
|
||||
|
||||
inline void GXSetWasteFlags() {
|
||||
GXData* data = __GXData;
|
||||
data->dirtyState |= GX_DIRTY_SU_TEX | GX_DIRTY_BP_MASK;
|
||||
|
@ -40,7 +40,7 @@ void GXSetTexCoordBias(GXTexCoordID coord, GXBool s_enable, GXBool t_enable);
|
||||
|
||||
void __SetSURegs();
|
||||
void __GXSetSUTexRegs();
|
||||
void __GXSetTmemConfig();
|
||||
void __GXSetTmemConfig(u32);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
@ -23,6 +23,8 @@ void GXGetScissor(u32* left, u32* top, u32* width, u32* height);
|
||||
void GXSetScissorBoxOffset(s32 x, s32 y);
|
||||
void GXSetClipMode(GXClipMode mode);
|
||||
|
||||
void __GXSetMatrixIndex(GXAttr index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -41,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
extern int __cntlzw(uint);
|
||||
extern int __rlwimi(int, int, int, int, int);
|
||||
extern void __dcbz(void*, int);
|
||||
|
||||
#define VERSION_JPN 0
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "JSystem/JParticle/JPAMath.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
|
||||
static f32 dummy() {
|
||||
return 1.0f;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "abort_exit.h"
|
||||
#include "critical_regions.h"
|
||||
#include "stddef.h"
|
||||
#include "NMWException.h"
|
||||
|
||||
void _ExitProcess();
|
||||
|
||||
extern void (*_dtors[])(void);
|
||||
|
||||
|
@ -4,9 +4,6 @@
|
||||
//
|
||||
|
||||
#include "d/actor/d_a_title.h"
|
||||
#include "d/res/res_tlogo.h"
|
||||
#include "d/res/res_tlogoe.h"
|
||||
#include "d/res/res_tlogoe0.h"
|
||||
#include "d/d_procname.h"
|
||||
#include "f_op/f_op_overlap_mng.h"
|
||||
#include "f_op/f_op_scene_mng.h"
|
||||
@ -18,6 +15,16 @@
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#if VERSION == VERSION_JPN
|
||||
#include "d/res/res_tlogo.h"
|
||||
#endif
|
||||
#if VERSION == VERSION_USA
|
||||
#include "d/res/res_tlogoe.h"
|
||||
#endif
|
||||
#if VERSION == VERSION_PAL
|
||||
#include "d/res/res_tlogoe0.h"
|
||||
#endif
|
||||
|
||||
// Note: For VERSION_PAL the "TlogoE0" string literal is modified at runtime.
|
||||
#define ARCNAME VERSION_SELECT("Tlogo", "TlogoE", "TlogoE0")
|
||||
|
||||
|
@ -127,36 +127,22 @@ void GXSetIndTexCoordScale(GXIndTexStageID texStage, GXIndTexScale scaleS, GXInd
|
||||
}
|
||||
|
||||
void GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord, GXTexMapID map) {
|
||||
GXData* data;
|
||||
|
||||
if (map == 0xFF) {
|
||||
map = GX_TEXMAP0;
|
||||
}
|
||||
|
||||
if (coord == 0xFF) {
|
||||
coord = GX_TEXCOORD0;
|
||||
}
|
||||
|
||||
switch (stage) {
|
||||
case GX_INDTEXSTAGE0:
|
||||
data = __GXData;
|
||||
GX_BITFIELD_SET(data->iref, 29, 3, map);
|
||||
GX_BITFIELD_SET(data->iref, 26, 3, coord);
|
||||
GX_BITFIELD_SET(__GXData->iref, 29, 3, map);
|
||||
GX_BITFIELD_SET(__GXData->iref, 26, 3, coord);
|
||||
break;
|
||||
case GX_INDTEXSTAGE1:
|
||||
data = __GXData;
|
||||
GX_BITFIELD_SET(data->iref, 23, 3, map);
|
||||
GX_BITFIELD_SET(data->iref, 20, 3, coord);
|
||||
GX_BITFIELD_SET(__GXData->iref, 23, 3, map);
|
||||
GX_BITFIELD_SET(__GXData->iref, 20, 3, coord);
|
||||
break;
|
||||
case GX_INDTEXSTAGE2:
|
||||
data = __GXData;
|
||||
GX_BITFIELD_SET(data->iref, 17, 3, map);
|
||||
GX_BITFIELD_SET(data->iref, 14, 3, coord);
|
||||
GX_BITFIELD_SET(__GXData->iref, 17, 3, map);
|
||||
GX_BITFIELD_SET(__GXData->iref, 14, 3, coord);
|
||||
break;
|
||||
case GX_INDTEXSTAGE3:
|
||||
data = __GXData;
|
||||
GX_BITFIELD_SET(data->iref, 11, 3, map);
|
||||
GX_BITFIELD_SET(data->iref, 8, 3, coord);
|
||||
GX_BITFIELD_SET(__GXData->iref, 11, 3, map);
|
||||
GX_BITFIELD_SET(__GXData->iref, 8, 3, coord);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4,37 +4,21 @@
|
||||
|
||||
char* __GXVersion = "<< Dolphin SDK - GX release build: Nov 10 2004 06:27:12 (0x2301) >>";
|
||||
|
||||
static GXFifoObj FifoObj;
|
||||
|
||||
static GXData gxData;
|
||||
|
||||
static GXFifoObj FifoObj;
|
||||
|
||||
GXData* const __GXData = &gxData;
|
||||
|
||||
GXTexRegion* __GXDefaultTexRegionCallback(const GXTexObj* obj, GXTexMapID id) {
|
||||
GXTexFmt format; // r31
|
||||
GXBool isMipMap; // r3
|
||||
GXTexFmt format;
|
||||
|
||||
format = GXGetTexObjFmt(obj);
|
||||
isMipMap = GXGetTexObjMipMap(obj);
|
||||
id = (GXTexMapID)(id % GX_MAX_TEXMAP);
|
||||
|
||||
switch (format) {
|
||||
case GX_TF_RGBA8:
|
||||
// if (isMipMap) {
|
||||
// return &__GXData->TexRegions2[id];
|
||||
// }
|
||||
return &__GXData->TexRegions1[id];
|
||||
|
||||
case GX_TF_C4:
|
||||
case GX_TF_C8:
|
||||
case GX_TF_C14X2:
|
||||
return &__GXData->TexRegions0[id];
|
||||
|
||||
default:
|
||||
if (isMipMap) {
|
||||
return &__GXData->TexRegions1[id];
|
||||
}
|
||||
return &__GXData->TexRegions0[id];
|
||||
if (format != GX_TF_C4 && format != GX_TF_C8 && format != GX_TF_C14X2) {
|
||||
return &__GXData->TexRegions0[__GXData->nextTexRgn++ % GX_MAX_TEXMAP];
|
||||
} else {
|
||||
return &__GXData->TexRegions1[__GXData->nextTexRgnCI++ % 4];
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,11 +152,6 @@ GXFifoObj* GXInit(void* base, u32 size) {
|
||||
GXSetCPUFifo(&FifoObj);
|
||||
GXSetGPFifo(&FifoObj);
|
||||
|
||||
if (!resetFuncRegistered) {
|
||||
// OSRegisterResetFunction(&GXResetFuncInfo);
|
||||
resetFuncRegistered = 1;
|
||||
}
|
||||
|
||||
__GXPEInit();
|
||||
EnableWriteGatherPipe();
|
||||
|
||||
@ -280,7 +259,6 @@ GXFifoObj* GXInit(void* base, u32 size) {
|
||||
|
||||
GFWriteBPCmd(0x67000000);
|
||||
|
||||
__GXSetIndirectMask(0);
|
||||
__GXSetTmemConfig(2);
|
||||
__GXInitGX();
|
||||
|
||||
@ -289,7 +267,6 @@ GXFifoObj* GXInit(void* base, u32 size) {
|
||||
|
||||
void __GXInitGX(void) {
|
||||
GXRenderModeObj* renderObj;
|
||||
GXTexObj texObj;
|
||||
Mtx ident;
|
||||
GXColor clearColor = {64, 64, 64, 255};
|
||||
GXColor ambColor = {0, 0, 0, 0};
|
||||
@ -395,19 +372,11 @@ void __GXInitGX(void) {
|
||||
GXSetChanMatColor(GX_COLOR1A1, matColor);
|
||||
|
||||
GXInvalidateTexAll();
|
||||
__GXData->nextTexRgn = 0;
|
||||
__GXData->nextTexRgnCI = 0;
|
||||
GXSetTexRegionCallback(__GXDefaultTexRegionCallback);
|
||||
GXSetTlutRegionCallback(__GXDefaultTlutRegionCallback);
|
||||
|
||||
GXInitTexObj(&texObj, DefaultTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP0);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP1);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP2);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP3);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP4);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP5);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP6);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP7);
|
||||
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR0A0);
|
||||
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD2, GX_TEXMAP2, GX_COLOR0A0);
|
||||
|
@ -1,13 +1,12 @@
|
||||
#include "dolphin/gx/GXTransform.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
void __GXSetMatrixIndex();
|
||||
#include "dolphin/gx/GXInit.h"
|
||||
|
||||
static void Copy6Floats(register f32 src[6], register f32 dst[6]) {
|
||||
register f32 ps_0, ps_1, ps_2;
|
||||
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
asm {
|
||||
psq_l ps_0, 0(src), 0, 0
|
||||
psq_l ps_1, 8(src), 0, 0
|
||||
@ -16,6 +15,7 @@ static void Copy6Floats(register f32 src[6], register f32 dst[6]) {
|
||||
psq_st ps_1, 8(dst), 0, 0
|
||||
psq_st ps_2, 16(dst), 0, 0
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ static void WriteProjPS(const register f32 src[6], register volatile void* dst)
|
||||
register f32 ps_0, ps_1, ps_2;
|
||||
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
asm {
|
||||
psq_l ps_0, 0(src), 0, 0
|
||||
psq_l ps_1, 8(src), 0, 0
|
||||
@ -31,6 +32,7 @@ static void WriteProjPS(const register f32 src[6], register volatile void* dst)
|
||||
psq_st ps_1, 0(dst), 0, 0
|
||||
psq_st ps_2, 0(dst), 0, 0
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@ -42,8 +44,6 @@ void GXProject(f32 model_x, f32 model_y, f32 model_z, Mtx model_mtx, f32* proj_m
|
||||
f32 var_f28;
|
||||
f32 var_f31;
|
||||
|
||||
ASSERTMSG(proj_mtx != NULL && viewpoint != NULL && screen_x != NULL && screen_y != NULL && screen_z != NULL, "GXGet*: invalid null pointer");
|
||||
|
||||
sp10[0] = (model_mtx[0][0] * model_x) + (model_mtx[0][1] * model_y) +
|
||||
(model_mtx[0][2] * model_z) + model_mtx[0][3];
|
||||
sp10[1] = (model_mtx[1][0] * model_x) + (model_mtx[1][1] * model_y) +
|
||||
@ -68,14 +68,9 @@ void GXProject(f32 model_x, f32 model_y, f32 model_z, Mtx model_mtx, f32* proj_m
|
||||
*screen_z = viewpoint[5] + (var_f31 * (var_f28 * (viewpoint[5] - viewpoint[4])));
|
||||
}
|
||||
|
||||
void __GXSetProjection(void) {
|
||||
GX_XF_LOAD_REGS(6, GX_XF_REG_PROJECTIONA);
|
||||
WriteProjPS(__GXData->projMtx, (volatile void*)GXFIFO_ADDR);
|
||||
GXFIFO.u32 = __GXData->projType;
|
||||
}
|
||||
|
||||
void GXSetProjection(const Mtx44 proj, GXProjectionType type) {
|
||||
volatile void* fifo;
|
||||
u32 reg;
|
||||
__GXData->projType = type;
|
||||
|
||||
__GXData->projMtx[0] = proj[0][0];
|
||||
@ -91,28 +86,58 @@ void GXSetProjection(const Mtx44 proj, GXProjectionType type) {
|
||||
__GXData->projMtx[3] = proj[1][2];
|
||||
}
|
||||
|
||||
__GXSetProjection();
|
||||
|
||||
reg = 0x00061020;
|
||||
GX_WRITE_U8(0x10);
|
||||
GX_WRITE_U32(reg);
|
||||
GX_WRITE_XF_REG_F(32, __GXData->projMtx[0]);
|
||||
GX_WRITE_XF_REG_F(33, __GXData->projMtx[1]);
|
||||
GX_WRITE_XF_REG_F(34, __GXData->projMtx[2]);
|
||||
GX_WRITE_XF_REG_F(35, __GXData->projMtx[3]);
|
||||
GX_WRITE_XF_REG_F(36, __GXData->projMtx[4]);
|
||||
GX_WRITE_XF_REG_F(37, __GXData->projMtx[5]);
|
||||
GX_WRITE_XF_REG_2(38, __GXData->projType);
|
||||
|
||||
__GXData->bpSentNot = GX_TRUE;
|
||||
}
|
||||
|
||||
void GXSetProjectionv(f32* proj) {
|
||||
__GXData->projType = proj[0] == 0.0f ? GX_PERSPECTIVE : GX_ORTHOGRAPHIC;
|
||||
Copy6Floats(&proj[1], __GXData->projMtx);
|
||||
__GXData->projType = proj[0];
|
||||
__GXData->projMtx[0] = proj[1];
|
||||
__GXData->projMtx[1] = proj[2];
|
||||
__GXData->projMtx[2] = proj[3];
|
||||
__GXData->projMtx[3] = proj[4];
|
||||
__GXData->projMtx[4] = proj[5];
|
||||
__GXData->projMtx[5] = proj[6];
|
||||
|
||||
__GXSetProjection();
|
||||
|
||||
GX_WRITE_U8(0x10);
|
||||
GX_WRITE_U32(0x00061020);
|
||||
GX_WRITE_XF_REG_F(32, __GXData->projMtx[0]);
|
||||
GX_WRITE_XF_REG_F(33, __GXData->projMtx[1]);
|
||||
GX_WRITE_XF_REG_F(34, __GXData->projMtx[2]);
|
||||
GX_WRITE_XF_REG_F(35, __GXData->projMtx[3]);
|
||||
GX_WRITE_XF_REG_F(36, __GXData->projMtx[4]);
|
||||
GX_WRITE_XF_REG_F(37, __GXData->projMtx[5]);
|
||||
GX_WRITE_XF_REG_2(38, __GXData->projType);
|
||||
__GXData->bpSentNot = GX_TRUE;
|
||||
}
|
||||
|
||||
void GXGetProjectionv(f32* proj) {
|
||||
*proj = (u32)__GXData->projType != GX_PERSPECTIVE ? 1.0f : 0.0f;
|
||||
Copy6Floats(__GXData->projMtx, &proj[1]);
|
||||
proj[0] = __GXData->projType;
|
||||
proj[1] = __GXData->projMtx[0];
|
||||
proj[2] = __GXData->projMtx[1];
|
||||
proj[3] = __GXData->projMtx[2];
|
||||
proj[4] = __GXData->projMtx[3];
|
||||
proj[5] = __GXData->projMtx[4];
|
||||
proj[6] = __GXData->projMtx[5];
|
||||
}
|
||||
|
||||
static void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) {
|
||||
register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5;
|
||||
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
asm {
|
||||
psq_l ps_0, 0(src), 0, 0
|
||||
psq_l ps_1, 8(src), 0, 0
|
||||
@ -128,6 +153,7 @@ static void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) {
|
||||
psq_st ps_4, 0(dst), 0, 0
|
||||
psq_st ps_5, 0(dst), 0, 0
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@ -140,6 +166,7 @@ static void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) {
|
||||
register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5;
|
||||
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
asm {
|
||||
psq_l ps_0, 0(src), 0, 0
|
||||
lfs ps_1, 8(src)
|
||||
@ -155,6 +182,7 @@ static void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) {
|
||||
psq_st ps_4, 0(dst), 0, 0
|
||||
stfs ps_5, 0(dst)
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@ -172,6 +200,7 @@ static void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) {
|
||||
register f32 ps_0, ps_1, ps_2, ps_3;
|
||||
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
asm {
|
||||
psq_l ps_0, 0(src), 0, 0
|
||||
psq_l ps_1, 8(src), 0, 0
|
||||
@ -183,6 +212,7 @@ static void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) {
|
||||
psq_st ps_2, 0(dst), 0, 0
|
||||
psq_st ps_3, 0(dst), 0, 0
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user