diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 46f888de4..d8fd26bf8 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -1049,7 +1049,12 @@ typedef struct { * First 8 words are integer portion of the 4x4 matrix * Last 8 words are the fraction portion of the 4x4 matrix */ +#ifdef GBI_FLOATS +// 4x4 float matrix +typedef float Mtx_t[4][4]; +#else typedef long Mtx_t[4][4]; +#endif typedef union { Mtx_t m; diff --git a/src/lib/mtx_c.c b/src/lib/mtx_c.c index b00044819..de3bcb975 100644 --- a/src/lib/mtx_c.c +++ b/src/lib/mtx_c.c @@ -366,6 +366,8 @@ void mtxF2L(Mtxf *src, Mtxf *dst) dst->l[3][2] = src30 << 16 | (src31 & 0xffff); dst->l[3][3] = src32 << 16 | (src33 & 0xffff); #else - bcopy(src, dst, sizeof(*dst)); + if (src != dst) { + bcopy(src, dst, sizeof(*dst)); + } #endif } diff --git a/src/lib/ultra/gu/mtxutil.c b/src/lib/ultra/gu/mtxutil.c index 1b3199fea..b461eee03 100644 --- a/src/lib/ultra/gu/mtxutil.c +++ b/src/lib/ultra/gu/mtxutil.c @@ -2,6 +2,11 @@ void guMtxF2L(f32 mf[4][4], Mtx *m) { +#ifdef GBI_FLOATS + if ((Mtx *)mf != m) { + bcopy(mf, m, sizeof(*m)); + } +#else int i, j; int e1, e2; int *ai, *af; @@ -18,6 +23,7 @@ void guMtxF2L(f32 mf[4][4], Mtx *m) *(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff); } } +#endif } void guMtxIdentF(float mf[4][4])