aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/psxgte.h
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2022-09-26 16:49:56 +0800
committerGitHub <noreply@github.com>2022-09-26 16:49:56 +0800
commitc4a2533d21dfd05cde841ea48c67b05e0e6a853f (patch)
treec7ef61653b157b69fb0956709366996ddbc4ecfa /libpsn00b/include/psxgte.h
parenta8b404b3400c3ebd8e0b923dcaefcc49ea563e36 (diff)
parent86f0064afb8200e60dd80827535cac30d0eab028 (diff)
downloadpsn00bsdk-c4a2533d21dfd05cde841ea48c67b05e0e6a853f.tar.gz
Merge pull request #55 from spicyjpeg/psxmdec
Full MDEC support, C library refactors, cleanups and bugfixes (v0.20)
Diffstat (limited to 'libpsn00b/include/psxgte.h')
-rw-r--r--libpsn00b/include/psxgte.h54
1 files changed, 30 insertions, 24 deletions
diff --git a/libpsn00b/include/psxgte.h b/libpsn00b/include/psxgte.h
index 7c10533..ddc988d 100644
--- a/libpsn00b/include/psxgte.h
+++ b/libpsn00b/include/psxgte.h
@@ -1,44 +1,45 @@
-#ifndef _PSXGTE_H
-#define _PSXGTE_H
+/*
+ * PSn00bSDK GTE library
+ * (C) 2019-2022 Lameguy64 - MPL licensed
+ */
+#ifndef __PSXGTE_H
+#define __PSXGTE_H
-#define ONE 4096
+#include <stdint.h>
+#define ONE (1 << 12)
-// For compatibility with official library syntax
-#define csin(a) isin(a)
-#define ccos(a) icos(a)
-#define rsin(a) isin(a)
-#define rcos(a) icos(a)
-
+/* Structure definitions */
-typedef struct MATRIX {
- short m[3][3];
- int t[3];
+typedef struct _MATRIX {
+ int16_t m[3][3];
+ int32_t t[3];
} MATRIX;
-typedef struct VECTOR {
- int vx, vy, vz;
+typedef struct _VECTOR {
+ int32_t vx, vy, vz;
} VECTOR;
-typedef struct SVECTOR {
- short vx, vy, vz, pad;
+typedef struct _SVECTOR {
+ int16_t vx, vy, vz, pad;
} SVECTOR;
-typedef struct CVECTOR {
- unsigned char r, g, b, cd;
+typedef struct _CVECTOR {
+ uint8_t r, g, b, cd;
} CVECTOR;
-typedef struct DVECTOR {
- short vx, vy;
+typedef struct _DVECTOR {
+ int16_t vx, vy;
} DVECTOR;
+/* Public API */
#ifdef __cplusplus
extern "C" {
#endif
-void InitGeom();
+void InitGeom(void);
// Integer SIN/COS functions (4096 = 360 degrees)
// Does not use tables!
@@ -70,11 +71,16 @@ void VectorNormalS(VECTOR *v0, SVECTOR *v1);
void Square0(VECTOR *v0, VECTOR *v1);
-int SquareRoot12( int v );
-int SquareRoot0( int v );
+int SquareRoot12(int v);
+int SquareRoot0(int v);
+
+#define csin(a) isin(a)
+#define ccos(a) icos(a)
+#define rsin(a) isin(a)
+#define rcos(a) icos(a)
#ifdef __cplusplus
}
#endif
-#endif // _PSXGTE_H
+#endif