summaryrefslogtreecommitdiff
path: root/arm9/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/lib')
-rw-r--r--arm9/lib/include/FX_types.h106
-rw-r--r--arm9/lib/include/GX_g3_util.h4
-rw-r--r--arm9/lib/include/NNS_g3d.h89
-rw-r--r--arm9/lib/include/fx.h160
-rw-r--r--arm9/lib/src/FX_vec.c10
-rw-r--r--arm9/lib/src/GX_g3_util.c2
6 files changed, 258 insertions, 113 deletions
diff --git a/arm9/lib/include/FX_types.h b/arm9/lib/include/FX_types.h
new file mode 100644
index 00000000..b5b56348
--- /dev/null
+++ b/arm9/lib/include/FX_types.h
@@ -0,0 +1,106 @@
+#ifndef GUARD_FX_TYPES_H
+#define GUARD_FX_TYPES_H
+
+typedef s16 fx16;
+typedef s32 fx32;
+typedef s64 fx64;
+typedef s64 fx64c;
+
+#define FX16_INT_MASK 0xF000
+#define FX16_INT_ABS_MASK 0x7000
+#define FX16_FRAC_MASK 0x0FFF
+#define FX16_INT_SHIFT 0xC
+
+#define FX32_INT_MASK 0xFFFFF000
+#define FX32_INT_ABS_MASK 0x7FFFF000
+#define FX32_FRAC_MASK 0x00000FFF
+#define FX32_INT_SHIFT 0xC
+
+#define FX64_INT_MASK 0xFFFFFFFFFFFFF000
+#define FX64_INT_ABS_MASK 0x7FFFFFFFFFFFF000
+#define FX64_FRAC_MASK 0x0000000000000FFF
+#define FX64_INT_SHIFT 0xC
+
+#define FX64C_INT_MASK 0xFFFFFFFF00000000
+#define FX64C_INT_ABS_MASK 0x7FFFFFFF00000000
+#define FX64C_FRAC_MASK 0x00000000FFFFFFFF
+#define FX64C_INT_SHIFT 0x20
+
+#define FX_INT(TYPE, x) (((x) & TYPE ## _INT_MASK) >> TYPE ## _INT_SHIFT)
+#define FX_INT_ABS(TYPE, x) (((x) & TYPE ## _INT_ABS_MASK) >> TYPE ## _INT_SHIFT)
+#define FX_FRAC(TYPE, x) ((x) & TYPE ## _FRAC_MASK)
+
+#define FX16_INT(x) FX_INT(FX16, x)
+#define FX16_INT_ABS(x) FX_INT_ABS(FX16, x)
+#define FX16_FRAC(x) FX_FRAC(FX16, x)
+
+#define FX32_INT(x) FX_INT(FX32, x)
+#define FX32_INT_ABS(x) FX_INT_ABS(FX32, x)
+#define FX32_FRAC(x) FX_FRAC(FX32, x)
+
+#define FX64_INT(x) FX_INT(FX64, x)
+#define FX64_INT_ABS(x) FX_INT_ABS(FX64, x)
+#define FX64_FRAC(x) FX_FRAC(FX64, x)
+
+#define FX64C_INT(x) FX_INT(FX64C, x)
+#define FX64C_INT_ABS(x) FX_INT_ABS(FX64C, x)
+#define FX64C_FRAC(x) FX_FRAC(FX64C, x)
+
+//TODO: clean up these macros
+#define FX32_MUL_NO_ROUND(a, b) ((fx32)(((fx64)(a) * (b)) >> FX32_INT_SHIFT))
+#define FX32_MUL(a, b) ((fx32)((((fx64)(a) * (b) + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT)))
+#define FX32_MUL_ADD_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) + (fx64)c * d) >> FX32_INT_SHIFT))
+//the extra term here is for rounding
+#define FX32_MUL_SUB_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) - (fx64)c * d + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT))
+
+#define FX_MUL_FX32_FX64C(a, b) ((fx32)((((a) * (b) + ((fx64)1 << (FX64C_INT_SHIFT - 1))) >> FX64C_INT_SHIFT)))
+
+#define FX_FX16_TO_F32(x) ((f32)((x) / (f32)(1 << FX16_SHIFT)))
+#define FX_F32_TO_FX16(x) ((fx16)(((x) > 0) ? \
+ (fx16)((x) * (1 << FX16_INT_SHIFT) + 0.5f ) : \
+ (fx16)((x) * (1 << FX16_INT_SHIFT) - 0.5f )))
+#define FX_F32_TO_FX32(x) ((fx32)(((x) > 0) ? \
+ (fx32)((x) * (1 << FX32_INT_SHIFT) + 0.5f ) : \
+ (fx32)((x) * (1 << FX32_INT_SHIFT) - 0.5f )))
+#define FX16_CONST(x) FX_F32_TO_FX16(x)
+#define FX32_CONST(x) FX_F32_TO_FX32(x)
+
+#define FX16_ONE ((fx16)0x1000)
+#define FX32_ONE ((fx32)0x00001000L)
+
+typedef struct Vecx32
+{
+ fx32 x;
+ fx32 y;
+ fx32 z;
+} VecFx32;
+
+typedef struct Vecx16
+{
+ fx16 x;
+ fx16 y;
+ fx16 z;
+} VecFx16;
+
+//Matrices are indexed as [column][row]
+typedef struct Mtx44
+{
+ fx32 _[16];
+} MtxFx44;
+
+typedef struct Mtx43
+{
+ fx32 _[12];
+} MtxFx43;
+
+typedef struct Mtx33
+{
+ fx32 _[9];
+} MtxFx33;
+
+typedef struct Mtx22
+{
+ fx32 _[4];
+} MtxFx22;
+
+#endif //GUARD_FX_TYPES_H
diff --git a/arm9/lib/include/GX_g3_util.h b/arm9/lib/include/GX_g3_util.h
index a9bc4c17..7a35f545 100644
--- a/arm9/lib/include/GX_g3_util.h
+++ b/arm9/lib/include/GX_g3_util.h
@@ -1,9 +1,11 @@
#ifndef GUARD_GX_G3_UTIL_H
#define GUARD_GX_G3_UTIL_H
+#include "FX_types.h"
+
void G3i_PerspectiveW_(fx32 fovsin, fx32 fovcos, fx32 ratio, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx);
void G3i_OrthoW_(fx32 top, fx32 bottom, fx32 left, fx32 right, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx);
-void G3i_LookAt_(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *c, u32 load, struct Mtx44 *mtx);
+void G3i_LookAt_(const struct Vecx32 *a, const struct Vecx32 *b, const struct Vecx32 *c, BOOL load, struct Mtx43 *mtx);
void G3_RotX(fx32 sinphi, fx32 cosphi);
void G3_RotY(fx32 sinphi, fx32 cosphi);
void G3_RotZ(fx32 sinphi, fx32 cosphi);
diff --git a/arm9/lib/include/NNS_g3d.h b/arm9/lib/include/NNS_g3d.h
new file mode 100644
index 00000000..f9a3a1b8
--- /dev/null
+++ b/arm9/lib/include/NNS_g3d.h
@@ -0,0 +1,89 @@
+#ifndef GUARD_NNS_G3D_H
+#define GUARD_NNS_G3D_H
+
+#include "fx.h"
+
+typedef enum
+{
+ NNS_G3D_GLB_FLAG_FLUSH_WVP = 0x00000001,
+ NNS_G3D_GLB_FLAG_FLUSH_VP = 0x00000002,
+ NNS_G3D_GLB_FLAG_INVBASE_UPTODATE = 0x00000004,
+ NNS_G3D_GLB_FLAG_INVCAMERA_UPTODATE = 0x00000008,
+ NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE = 0x00000010,
+ NNS_G3D_GLB_FLAG_INVBASECAMERA_UPTODATE = 0x00000020,
+ NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE = 0x00000040,
+
+ NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE = 0x00000080,
+
+ NNS_G3D_GLB_FLAG_SRTCAMERA_UPTODATE = NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE,
+ NNS_G3D_GLB_FLAG_FLUSH_ALT = NNS_G3D_GLB_FLAG_FLUSH_WVP
+}
+ NNSG3dGlbFlag;
+
+typedef struct
+{
+ /*0x000*/ u32 cmd0;
+ /*0x004*/ u32 mtxmode_proj;
+ /*0x008*/ MtxFx44 projMtx;
+
+ /*0x048*/ u32 mtxmode_posvec;
+ /*0x04C*/ MtxFx43 cameraMtx;
+
+ /*0x07C*/ u32 cmd1;
+ /*0x080*/ u32 lightVec[4];
+
+ /*0x090*/ u32 cmd2;
+ /*0x094*/ u32 prmMatColor0;
+ /*0x098*/ u32 prmMatColor1;
+ /*0x09C*/ u32 prmPolygonAttr;
+ /*0x0A0*/ u32 prmViewPort;
+
+ /*0x0A4*/ u32 cmd3;
+ /*0x0A8*/ u32 lightColor[4];
+
+ /*0x0B8*/ u32 cmd4;
+ /*0x0BC*/ MtxFx33 prmBaseRot;
+ /*0x0E0*/ VecFx32 prmBaseTrans;
+ /*0x0EC*/ VecFx32 prmBaseScale;
+ /*0x0F8*/ u32 prmTexImageParam;
+
+ /*0x0FC*/ u32 flag;
+ /*0x100*/ MtxFx43 invCameraMtx;
+ /*0x130*/ MtxFx43 srtCameraMtx;
+ /*0x160*/ MtxFx43 invSrtCameraMtx;
+
+ /*0x190*/ MtxFx43 invBaseMtx;
+
+ /*0x1C0*/ MtxFx44 invProjMtx;
+ /*0x200*/ MtxFx44 invCameraProjMtx;
+
+ /*0x240*/ VecFx32 camPos;
+ /*0x24C*/ VecFx32 camUp;
+ /*0x258*/ VecFx32 camTarget;
+}
+NNSG3dGlb;
+
+extern NNSG3dGlb NNS_G3dGlb;
+
+static inline void NNS_G3dGlbLookAt(const VecFx32 * camPos, const VecFx32 * camUp, const VecFx32 * camTarget)
+{
+ NNS_G3dGlb.camPos = *camPos;
+ NNS_G3dGlb.camUp = *camUp;
+ NNS_G3dGlb.camTarget = *camTarget;
+ MTX_LookAt(camPos, camUp, camTarget, &NNS_G3dGlb.cameraMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVCAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVBASECAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE | NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE);
+}
+
+static inline void NNS_G3dGlbPerspective(fx32 fovySin, fx32 fovyCos, fx32 aspect, fx32 n, fx32 f)
+{
+ MTX_Perspective(fovySin, fovyCos, aspect, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
+static inline void NNS_G3dGlbOrtho(fx32 t, fx32 b, fx32 l, fx32 r, fx32 n, fx32 f)
+{
+ MTX_Ortho(t, b, l, r, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
+#endif //GUARD_NNS_G3D_H
diff --git a/arm9/lib/include/fx.h b/arm9/lib/include/fx.h
index 38506194..de851f62 100644
--- a/arm9/lib/include/fx.h
+++ b/arm9/lib/include/fx.h
@@ -1,107 +1,8 @@
#ifndef GUARD_FX_H
#define GUARD_FX_H
-typedef s16 fx16;
-typedef s32 fx32;
-typedef s64 fx64;
-typedef s64 fx64c;
-
-#define FX16_INT_MASK 0xF000
-#define FX16_INT_ABS_MASK 0x7000
-#define FX16_FRAC_MASK 0x0FFF
-#define FX16_INT_SHIFT 0xC
-
-#define FX32_INT_MASK 0xFFFFF000
-#define FX32_INT_ABS_MASK 0x7FFFF000
-#define FX32_FRAC_MASK 0x00000FFF
-#define FX32_INT_SHIFT 0xC
-
-#define FX64_INT_MASK 0xFFFFFFFFFFFFF000
-#define FX64_INT_ABS_MASK 0x7FFFFFFFFFFFF000
-#define FX64_FRAC_MASK 0x0000000000000FFF
-#define FX64_INT_SHIFT 0xC
-
-#define FX64C_INT_MASK 0xFFFFFFFF00000000
-#define FX64C_INT_ABS_MASK 0x7FFFFFFF00000000
-#define FX64C_FRAC_MASK 0x00000000FFFFFFFF
-#define FX64C_INT_SHIFT 0x20
-
-#define FX_INT(TYPE, x) (((x) & TYPE ## _INT_MASK) >> TYPE ## _INT_SHIFT)
-#define FX_INT_ABS(TYPE, x) (((x) & TYPE ## _INT_ABS_MASK) >> TYPE ## _INT_SHIFT)
-#define FX_FRAC(TYPE, x) ((x) & TYPE ## _FRAC_MASK)
-
-#define FX16_INT(x) FX_INT(FX16, x)
-#define FX16_INT_ABS(x) FX_INT_ABS(FX16, x)
-#define FX16_FRAC(x) FX_FRAC(FX16, x)
-
-#define FX32_INT(x) FX_INT(FX32, x)
-#define FX32_INT_ABS(x) FX_INT_ABS(FX32, x)
-#define FX32_FRAC(x) FX_FRAC(FX32, x)
-
-#define FX64_INT(x) FX_INT(FX64, x)
-#define FX64_INT_ABS(x) FX_INT_ABS(FX64, x)
-#define FX64_FRAC(x) FX_FRAC(FX64, x)
-
-#define FX64C_INT(x) FX_INT(FX64C, x)
-#define FX64C_INT_ABS(x) FX_INT_ABS(FX64C, x)
-#define FX64C_FRAC(x) FX_FRAC(FX64C, x)
-
-//TODO: clean up these macros
-#define FX32_MUL_NO_ROUND(a, b) ((fx32)(((fx64)(a) * (b)) >> FX32_INT_SHIFT))
-#define FX32_MUL(a, b) ((fx32)((((fx64)(a) * (b) + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT)))
-#define FX32_MUL_ADD_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) + (fx64)c * d) >> FX32_INT_SHIFT))
-//the extra term here is for rounding
-#define FX32_MUL_SUB_MUL(a, b, c, d) ((fx32)(((fx64)(a) * (b) - (fx64)c * d + (1 << (FX32_INT_SHIFT - 1))) >> FX32_INT_SHIFT))
-
-#define FX_MUL_FX32_FX64C(a, b) ((fx32)((((a) * (b) + ((fx64)1 << (FX64C_INT_SHIFT - 1))) >> FX64C_INT_SHIFT)))
-
-#define FX_FX16_TO_F32(x) ((f32)((x) / (f32)(1 << FX16_SHIFT)))
-#define FX_F32_TO_FX16(x) ((fx16)(((x) > 0) ? \
- (fx16)((x) * (1 << FX16_INT_SHIFT) + 0.5f ) : \
- (fx16)((x) * (1 << FX16_INT_SHIFT) - 0.5f )))
-#define FX_F32_TO_FX32(x) ((fx32)(((x) > 0) ? \
- (fx32)((x) * (1 << FX32_INT_SHIFT) + 0.5f ) : \
- (fx32)((x) * (1 << FX32_INT_SHIFT) - 0.5f )))
-#define FX16_CONST(x) FX_F32_TO_FX16(x)
-#define FX32_CONST(x) FX_F32_TO_FX32(x)
-
-#define FX16_ONE ((fx16)0x1000)
-#define FX32_ONE ((fx32)0x00001000L)
-
-struct Vecx32
-{
- fx32 x;
- fx32 y;
- fx32 z;
-};
-
-struct Vecx16
-{
- fx16 x;
- fx16 y;
- fx16 z;
-};
-
-//Matrices are indexed as [column][row]
-struct Mtx44
-{
- fx32 _[16];
-};
-
-struct Mtx43
-{
- fx32 _[12];
-};
-
-struct Mtx33
-{
- fx32 _[9];
-};
-
-struct Mtx22
-{
- fx32 _[4];
-};
+#include "FX_types.h"
+#include "GX_g3_util.h"
//FX
void FX_Init();
@@ -112,15 +13,15 @@ u16 FX_Atan(fx32 x);
u16 FX_Atan2(fx32 x, fx32 y);
//Vec
-void VEC_Add(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst);
-void VEC_Subtract(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst);
+void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst);
+void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst);
void VEC_Fx16Add(struct Vecx16 *x, struct Vecx16 *y, struct Vecx16 *dst);
-fx32 VEC_DotProduct(struct Vecx32 *x, struct Vecx32 *y);
+fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b);
fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b);
-void VEC_CrossProduct(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst);
+void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst);
void VEC_Fx16CrossProduct(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst);
fx32 VEC_Mag(struct Vecx32 *a);
-void VEC_Normalize(struct Vecx32 *a, struct Vecx32 *dst);
+void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst);
void VEC_Fx16Normalize(struct Vecx16 *a, struct Vecx16 *dst);
void VEC_MultAdd(fx32 factor, struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst);
@@ -172,4 +73,51 @@ void MTX_ScaleApply22(struct Mtx22 *mtx, struct Mtx22 *dst, fx32 x, fx32 y);
void MTX_Identity22_(struct Mtx22 *mtx);
void MTX_Rot22_(struct Mtx22 *mtx, fx32 sinphi, fx32 cosphi);
+// Trig
+extern const fx16 FX_SinCosTable_[];
+
+static inline fx16 FX_SinIdx(int idx)
+{
+ return FX_SinCosTable_[((idx >> 4) << 1)];
+}
+
+static inline fx16 FX_CosIdx(int idx)
+{
+ return FX_SinCosTable_[((idx >> 4) << 1) + 1];
+}
+
+static inline fx32 FX32_CAST(s64 res)
+{
+ return (fx32)res;
+}
+
+static inline fx32 FX_MulInline(fx32 v1, fx32 v2)
+{
+ return FX32_CAST(((s64)v1 * v2 + 0x800LL) >> FX32_INT_SHIFT);
+}
+
+#define FX_Mul(v1, v2) FX_MulInline(v1, v2)
+
+static inline void VEC_Set(struct Vecx32 * vec, fx32 x, fx32 y, fx32 z)
+{
+ vec->x = x;
+ vec->y = y;
+ vec->z = z;
+}
+
+static inline void MTX_LookAt(const VecFx32 * camPos, const VecFx32 * camUp, const VecFx32 * target, MtxFx43 * mtx)
+{
+ G3i_LookAt_(camPos, camUp, target, FALSE, mtx);
+}
+
+static inline void MTX_Perspective(fx32 fovySin, fx32 fovyCos, fx32 aspect, fx32 n, fx32 f, MtxFx44 * mtx)
+{
+ G3i_PerspectiveW_(fovySin, fovyCos, aspect, n, f, FX32_ONE, FALSE, mtx);
+}
+
+static inline void MTX_Ortho(fx32 t, fx32 b, fx32 l, fx32 r, fx32 n, fx32 f, MtxFx44 * mtx)
+{
+ G3i_OrthoW_(t, b, l, r, n, f, FX32_ONE, FALSE, mtx);
+}
+
#endif //GUARD_FX_H
diff --git a/arm9/lib/src/FX_vec.c b/arm9/lib/src/FX_vec.c
index 39dd3076..8550b54a 100644
--- a/arm9/lib/src/FX_vec.c
+++ b/arm9/lib/src/FX_vec.c
@@ -1,13 +1,13 @@
#include "global.h"
#include "fx.h"
-ARM_FUNC void VEC_Add(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
+ARM_FUNC void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
dst->x = a->x + b->x;
dst->y = a->y + b->y;
dst->z = a->z + b->z;
}
-ARM_FUNC void VEC_Subtract(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
+ARM_FUNC void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
dst->x = a->x - b->x;
dst->y = a->y - b->y;
dst->z = a->z - b->z;
@@ -19,7 +19,7 @@ ARM_FUNC void VEC_Fx16Add(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst
dst->z = (s16)(a->z + b->z);
}
-ARM_FUNC fx32 VEC_DotProduct(struct Vecx32 *a, struct Vecx32 *b){
+ARM_FUNC fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b){
return (fx32)(((fx64)a->x * b->x + (fx64)a->y * b->y + (fx64)a->z * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
}
@@ -30,7 +30,7 @@ ARM_FUNC fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b){
return (fx32)(((fx64)temp1 + temp2) >> FX64_INT_SHIFT);
}
-ARM_FUNC void VEC_CrossProduct(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
+ARM_FUNC void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
fx32 x, y, z;
x = (fx32)(((fx64)a->y * b->z - (fx64)a->z * b->y + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
y = (fx32)(((fx64)a->z * b->x - (fx64)a->x * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
@@ -60,7 +60,7 @@ ARM_FUNC fx32 VEC_Mag(struct Vecx32 *a){
return ((fx32)reg_CP_SQRT_RESULT + 1) >> 1;
}
-ARM_FUNC void VEC_Normalize(struct Vecx32 *a, struct Vecx32 *dst){
+ARM_FUNC void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst){
fx64 l2 = (fx64)a->x * a->x;
l2 += (fx64)a->y * a->y;
l2 += (fx64)a->z * a->z;
diff --git a/arm9/lib/src/GX_g3_util.c b/arm9/lib/src/GX_g3_util.c
index e647f1c7..b4fdd0cc 100644
--- a/arm9/lib/src/GX_g3_util.c
+++ b/arm9/lib/src/GX_g3_util.c
@@ -165,7 +165,7 @@ ARM_FUNC void G3i_OrthoW_(fx32 top, fx32 bottom, fx32 left, fx32 right, fx32 nea
}
}
-ARM_FUNC void G3i_LookAt_(struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *c, u32 load, struct Mtx44 *mtx){
+ARM_FUNC void G3i_LookAt_(const struct Vecx32 *a, const struct Vecx32 *b, const struct Vecx32 *c, BOOL load, struct Mtx43 *mtx){
struct Vecx32 temp, temp1, temp2;
fx32 c1, c2, c3;
vu32 *reg_ptr;