aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-09-23 11:28:07 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-09-23 11:28:07 +0800
commit72b7d4168afc63db572539d41623c3ab0f09ddf4 (patch)
treeca6f3ba4e1deada4fb41ce6d34dd64e81afbc9b1 /libpsn00b
parent82a441e7bd3a5103330c7d5ca7f9df470953e586 (diff)
downloadpsn00bsdk-72b7d4168afc63db572539d41623c3ab0f09ddf4.tar.gz
Added strcat(), added gte_stsz() macro, added _boot() and fixed typos in setUVWH() macro
Diffstat (limited to 'libpsn00b')
-rw-r--r--libpsn00b/include/inline_c.h6
-rw-r--r--libpsn00b/include/psxapi.h2
-rw-r--r--libpsn00b/include/psxgpu.h6
-rw-r--r--libpsn00b/include/psxgte.h10
-rw-r--r--libpsn00b/libc/string.c12
-rw-r--r--libpsn00b/psxapi/sys/_boot.s10
6 files changed, 38 insertions, 8 deletions
diff --git a/libpsn00b/include/inline_c.h b/libpsn00b/include/inline_c.h
index 4341624..aa2c197 100644
--- a/libpsn00b/include/inline_c.h
+++ b/libpsn00b/include/inline_c.h
@@ -206,6 +206,12 @@
: "r"( r0 ), "r"( r1 ), "r"( r2 ) \
: "memory" )
+#define gte_stsz( r0 ) __asm__ volatile ( \
+ "swc2 $19, 0( %0 );" \
+ : \
+ : "r"( r0 ) \
+ : "memory" )
+
#define gte_stotz( r0 ) __asm__ volatile ( \
"swc2 $7, 0( %0 );" \
: \
diff --git a/libpsn00b/include/psxapi.h b/libpsn00b/include/psxapi.h
index d25e620..9abcd0c 100644
--- a/libpsn00b/include/psxapi.h
+++ b/libpsn00b/include/psxapi.h
@@ -159,6 +159,8 @@ void ChangeClearRCnt(int t, int m);
// Executable functions
int Exec(struct EXEC *exec, int argc, char *argv);
+void _boot(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/libpsn00b/include/psxgpu.h b/libpsn00b/include/psxgpu.h
index d6c68cf..215b59b 100644
--- a/libpsn00b/include/psxgpu.h
+++ b/libpsn00b/include/psxgpu.h
@@ -106,9 +106,9 @@
#define setUVWH( p, _u0, _v0, _w, _h ) \
(p)->u0 = _u0, (p)->v0 = _v0, \
- (p)->u1 = _u1+(_w), (p)->v1 = _v1, \
- (p)->u2 = _u2, (p)->v2 = _v2+(_h), \
- (p)->u2 = _u3+(_h), (p)->v2 = _v3+(_h)
+ (p)->u1 = _u0+(_w), (p)->v1 = _v0, \
+ (p)->u2 = _u0, (p)->v2 = _v0+(_h), \
+ (p)->u3 = _u0+(_h), (p)->v3 = _v0+(_h)
/*
diff --git a/libpsn00b/include/psxgte.h b/libpsn00b/include/psxgte.h
index 43d529a..98d9fa4 100644
--- a/libpsn00b/include/psxgte.h
+++ b/libpsn00b/include/psxgte.h
@@ -12,24 +12,24 @@
#define rcos(a) icos(a)
-typedef struct {
+typedef struct MATRIX {
short m[3][3];
int t[3];
} MATRIX;
-typedef struct {
+typedef struct VECTOR {
int vx, vy, vz;
} VECTOR;
-typedef struct {
+typedef struct SVECTOR {
short vx, vy, vz, pad;
} SVECTOR;
-typedef struct {
+typedef struct CVECTOR {
unsigned char r, g, b, cd;
} CVECTOR;
-typedef struct {
+typedef struct DVECTOR {
short vx, vy;
} DVECTOR;
diff --git a/libpsn00b/libc/string.c b/libpsn00b/libc/string.c
index 4943877..a14d950 100644
--- a/libpsn00b/libc/string.c
+++ b/libpsn00b/libc/string.c
@@ -56,6 +56,18 @@ char *strcpy(char *dst, const char *src)
return odst;
}
+char *strcat(char *dst, const char *src)
+{
+ char *o=dst;
+
+ while(*dst)
+ dst++;
+
+ strcpy(dst, src);
+
+ return o;
+}
+
char *strncat(char *s, const char *append, int len)
{
char *o=s;
diff --git a/libpsn00b/psxapi/sys/_boot.s b/libpsn00b/psxapi/sys/_boot.s
new file mode 100644
index 0000000..9052772
--- /dev/null
+++ b/libpsn00b/psxapi/sys/_boot.s
@@ -0,0 +1,10 @@
+.set noreorder
+.section .text
+
+.global _boot
+.type _boot, @function
+_boot:
+ addiu $t2, $0, 0xa0
+ jr $t2
+ addiu $t1, $0, 0xa0
+ \ No newline at end of file