mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- [Psy-X] more GTE functions, fix macros
This commit is contained in:
parent
0c05af3318
commit
e2684f3ff3
@ -79,7 +79,19 @@ int CFC2_S(int reg);
|
||||
#define gte_ldbkdir( r0, r1, r2 ) \
|
||||
{ CTC2(r0, 13); \
|
||||
CTC2(r1, 14); \
|
||||
CTC2(r2, 15);}
|
||||
CTC2(r2, 15); }
|
||||
|
||||
// mtc2 12,13,14
|
||||
#define gte_ldsxy3( r0, r1, r2 )\
|
||||
{ MTC2(*(uint*)r0, 12); \
|
||||
MTC2(*(uint*)r2, 14); \
|
||||
MTC2(*(uint*)r1, 13); }
|
||||
|
||||
// mtc2 12,13,14
|
||||
#define gte_ldsxy3c( r0 ) \
|
||||
{ MTC2(*(uint*)((char*)r0+0), 12 ); \
|
||||
MTC2(*(uint*)((char*)r0+4), 13 ); \
|
||||
MTC2(*(uint*)((char*)r0+8), 14 ); }
|
||||
|
||||
// ctc2 24,25
|
||||
#define gte_SetGeomOffset( r0, r1 )\
|
||||
@ -88,16 +100,16 @@ int CFC2_S(int reg);
|
||||
|
||||
// ctc2 13,14,15
|
||||
#define gte_SetBackColor( r0, r1, r2 ) \
|
||||
{ CTC2(r0 << 4, 13); \
|
||||
CTC2(r1 << 4, 14); \
|
||||
CTC2(r2 << 4, 15); }
|
||||
{ CTC2(r0 << 4, 13); \
|
||||
CTC2(r1 << 4, 14); \
|
||||
CTC2(r2 << 4, 15); }
|
||||
|
||||
|
||||
// ctc2 21, 22, 23
|
||||
#define gte_SetFarColor( r0, r1, r2 ) \
|
||||
{ CTC2(r0 << 4, 21); \
|
||||
CTC2(r1 << 4, 22); \
|
||||
CTC2(r2 << 4, 23); }
|
||||
{ CTC2(r0 << 4, 21); \
|
||||
CTC2(r1 << 4, 22); \
|
||||
CTC2(r2 << 4, 23); }
|
||||
|
||||
// load ctc2 8-11
|
||||
#define gte_SetLightMatrix( r0 ) \
|
||||
@ -159,11 +171,12 @@ int CFC2_S(int reg);
|
||||
// please refer to official Psy-Q PSX SDK headers
|
||||
// and this: https://github.com/ogamespec/pops-gte/blob/master/docs/gte.txt
|
||||
|
||||
#define gte_rtv0tr() docop2(0x480012);
|
||||
#define gte_rt() docop2(0x480012);
|
||||
#define gte_rtv0tr() gte_rt()
|
||||
#define gte_rtv0() docop2(0x486012);
|
||||
#define gte_lcir() docop2(0x4DE012);
|
||||
#define gte_llir() docop2(0x4BE012);
|
||||
|
||||
#define gte_ll() docop2(0x4A6412);
|
||||
#define gte_rtir() docop2(0x49E012)
|
||||
#define gte_rtps() docop2(0x180001)
|
||||
#define gte_rtpt() docop2(0x280030)
|
||||
@ -302,9 +315,9 @@ int CFC2_S(int reg);
|
||||
|
||||
// ctc2 5,6,7
|
||||
#define gte_ldtr( r0, r1, r2 ) \
|
||||
{ CTC2(*(uint*)((char*)r0), 5);\
|
||||
CTC2(*(uint*)((char*)r1), 6);\
|
||||
CTC2(*(uint*)((char*)r2), 7);}
|
||||
{ CTC2(r0, 5);\
|
||||
CTC2(r1, 6);\
|
||||
CTC2(r2, 7);}
|
||||
|
||||
// cfc2 5,6,7
|
||||
#define gte_sttr( r0 ) \
|
||||
|
@ -42,10 +42,17 @@ VECTOR *ApplyRotMatrix(SVECTOR *v0, VECTOR *v1);
|
||||
VECTOR *ApplyRotMatrixLV(VECTOR *v0, VECTOR *v1);
|
||||
SVECTOR *ApplyMatrixSV(MATRIX *m, SVECTOR *v0, SVECTOR *v1);
|
||||
VECTOR *ApplyMatrixLV(MATRIX *m, VECTOR *v0, VECTOR *v1);
|
||||
extern long RotTransPers(struct SVECTOR* v0, long* sxy, long* p, long* flag);
|
||||
extern void RotTrans(struct SVECTOR* v0, VECTOR* v1, long* flag);
|
||||
extern void RotTransSV(SVECTOR* v0, SVECTOR* v1, long* flag);
|
||||
extern long RotTransPers(struct SVECTOR* v0, long* sxy, long* p, long* flag);
|
||||
extern long RotTransPers3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, long* sxy0, long* sxy1, long* sxy2, long* p, long* flag);
|
||||
extern long RotTransPers4(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, SVECTOR* v3, long* sxy0, long* sxy1, long* sxy2, long* sxy3, long* p, long* flag);
|
||||
extern void NormalColor(SVECTOR* v0, CVECTOR* v1);
|
||||
extern void NormalColor3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5);
|
||||
extern void NormalColorDpq(struct SVECTOR* v0, struct CVECTOR* v1, long p, struct CVECTOR* v2);
|
||||
extern void NormalColorCol(struct SVECTOR* v0, struct CVECTOR* v1, struct CVECTOR* v2);
|
||||
extern void NormalColorCol3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5, CVECTOR* v6);
|
||||
extern void LocalLight(SVECTOR* v0, VECTOR* v1);
|
||||
extern long RotAverageNclip4(struct SVECTOR* v0, struct SVECTOR* v1, struct SVECTOR* v2, struct SVECTOR* v3, long* sxy0/*arg_10*/, long* sxy1/*arg_14*/, long* sxy2/*arg_18*/, long* sxy3/*arg_1C*/, long* p/*arg_20*/, long* otz/*arg_24*/, long* flag/*arg_28*/);
|
||||
extern MATRIX* MulMatrix0(MATRIX* m0, MATRIX* m1, MATRIX* m2);
|
||||
extern MATRIX* MulMatrix(MATRIX* m0, MATRIX* m1);
|
||||
@ -61,6 +68,9 @@ extern MATRIX* RotMatrixZ(long r, MATRIX *m);
|
||||
extern MATRIX* TransMatrix(MATRIX* m, VECTOR* v);
|
||||
extern MATRIX* ScaleMatrix(MATRIX* m, VECTOR* v);
|
||||
extern MATRIX* MulRotMatrix(MATRIX* m0);
|
||||
extern void ColorDpq(VECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2);
|
||||
extern void ColorCol(VECTOR* v0, CVECTOR* v1, CVECTOR* v2);
|
||||
extern long NormalClip(long sxy0, long sxy1, long sxy2);
|
||||
extern void SetDQA(int iDQA);
|
||||
extern void SetDQB(int iDQB);
|
||||
extern void SetFogNear(long a, long h);
|
||||
|
@ -100,49 +100,112 @@ void PopMatrix()
|
||||
}
|
||||
}
|
||||
|
||||
long RotTransPers(struct SVECTOR* v0, long* sxy, long* p, long* flag)
|
||||
{
|
||||
gte_ldv0(v0);
|
||||
|
||||
gte_rtps();
|
||||
|
||||
gte_stsxy(sxy);
|
||||
gte_stdp(p);
|
||||
gte_stflg(flag);
|
||||
|
||||
int z;
|
||||
gte_stsz(&z);
|
||||
|
||||
return z >> 2;
|
||||
}
|
||||
|
||||
void RotTrans(struct SVECTOR* v0, VECTOR* v1, long* flag)
|
||||
{
|
||||
long lVar1;
|
||||
gte_RotTrans(v0, v1, flag);
|
||||
}
|
||||
|
||||
void RotTransSV(SVECTOR* v0, SVECTOR* v1, long* flag)
|
||||
{
|
||||
gte_ldv0(v0);
|
||||
|
||||
gte_rtv0tr();
|
||||
|
||||
gte_stlvnl(v1);
|
||||
gte_rt();
|
||||
gte_stsv(v1);
|
||||
gte_stflg(flag);
|
||||
}
|
||||
|
||||
long RotTransPers(struct SVECTOR* v0, long* sxy, long* p, long* flag)
|
||||
{
|
||||
int sz;
|
||||
gte_RotTransPers(v0, sxy, p, flag, &sz);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
long RotTransPers3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, long* sxy0, long* sxy1, long* sxy2, long* p, long* flag)
|
||||
{
|
||||
int sz;
|
||||
gte_RotTransPers3(v0, v1, v2, sxy0, sxy1, sxy2, p, flag, &sz);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
long RotTransPers4(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, SVECTOR* v3, long* sxy0, long* sxy1, long* sxy2, long* sxy3, long* p, long* flag)
|
||||
{
|
||||
long _flag;
|
||||
int sz;
|
||||
|
||||
gte_ldv3(v0, v1, v2);
|
||||
gte_rtpt();
|
||||
|
||||
gte_stsxy3(sxy0, sxy1, sxy2);
|
||||
|
||||
gte_stflg(&_flag);
|
||||
|
||||
gte_ldv0(v3);
|
||||
gte_rtps();
|
||||
|
||||
gte_stsxy(sxy3);
|
||||
gte_stflg(flag);
|
||||
gte_stdp(p);
|
||||
|
||||
*flag |= _flag;
|
||||
gte_stszotz(&sz);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
void NormalColor(SVECTOR* v0, CVECTOR* v1)
|
||||
{
|
||||
gte_NormalColor(v0, v1);
|
||||
}
|
||||
|
||||
void NormalColor3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5)
|
||||
{
|
||||
gte_NormalColor3(v0, v1, v2, v3, v4, v5);
|
||||
}
|
||||
|
||||
void NormalColorDpq(struct SVECTOR* v0, struct CVECTOR* v1, long p, struct CVECTOR* v2)
|
||||
{
|
||||
gte_ldv0(v0);
|
||||
gte_ldrgb(v1);
|
||||
gte_lddp(p);
|
||||
gte_ncds();
|
||||
gte_strgb(v2);
|
||||
gte_NormalColorDpq(v0, v1, p, v2);
|
||||
}
|
||||
|
||||
void NormalColorCol(struct SVECTOR* v0, struct CVECTOR* v1, struct CVECTOR* v2)
|
||||
{
|
||||
gte_ldv0(v0);
|
||||
gte_ldrgb(v1);
|
||||
gte_nccs();
|
||||
gte_strgb(v2);
|
||||
gte_NormalColorCol(v0, v1, v2);
|
||||
}
|
||||
|
||||
void NormalColorCol3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5, CVECTOR* v6)
|
||||
{
|
||||
gte_NormalColorCol3(v0,v1,v2,v3,v4,v5,v6);
|
||||
}
|
||||
|
||||
void DpqColor(CVECTOR* v0, long p, CVECTOR* v1)
|
||||
{
|
||||
gte_DpqColor(v0, &p, v1);
|
||||
}
|
||||
|
||||
void ColorDpq(VECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2)
|
||||
{
|
||||
gte_ColorDpq(v0, v1, p, v2);
|
||||
}
|
||||
|
||||
void ColorCol(VECTOR* v0, CVECTOR* v1, CVECTOR* v2)
|
||||
{
|
||||
gte_ColorCol(v0, v1, v2);
|
||||
}
|
||||
|
||||
long NormalClip(long sxy0, long sxy1, long sxy2)
|
||||
{
|
||||
long opz;
|
||||
|
||||
gte_NormalClip(&sxy0, &sxy1, &sxy2, &opz);
|
||||
|
||||
return opz;
|
||||
}
|
||||
|
||||
void LocalLight(SVECTOR* v0, VECTOR* v1)
|
||||
{
|
||||
gte_LocalLight(v0, v1);
|
||||
}
|
||||
|
||||
long RotAverageNclip4(struct SVECTOR* v0, struct SVECTOR* v1, struct SVECTOR* v2, struct SVECTOR* v3, long* sxy0/*arg_10*/, long* sxy1/*arg_14*/, long* sxy2/*arg_18*/, long* sxy3/*arg_1C*/, long* p/*arg_20*/, long* otz/*arg_24*/, long* flag/*arg_28*/)
|
||||
@ -922,4 +985,4 @@ long SquareRoot0(long a)
|
||||
idx = a << (lzcs - 24);
|
||||
|
||||
return SQRT[idx - 64] << (31 - lzcs >> 1) >> 12;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user