aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-07-03 08:13:23 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-07-03 08:13:23 +0200
commit06e65bea3a778b2dae5af77a7935ae3868ddd4d3 (patch)
tree3af954ebead7540c9478d0a026ca2e59f3cf7b64 /libpsn00b
parent472cf1c254ea5be5aff8a6c7067cbed2d467d85b (diff)
downloadpsn00bsdk-06e65bea3a778b2dae5af77a7935ae3868ddd4d3.tar.gz
Fix setjmp.h, FntSort(), examples, rewrite system/timer
Diffstat (limited to 'libpsn00b')
-rw-r--r--libpsn00b/include/setjmp.h4
-rw-r--r--libpsn00b/psxgpu/font.c21
2 files changed, 18 insertions, 7 deletions
diff --git a/libpsn00b/include/setjmp.h b/libpsn00b/include/setjmp.h
index 0f05b67..a7597e0 100644
--- a/libpsn00b/include/setjmp.h
+++ b/libpsn00b/include/setjmp.h
@@ -11,13 +11,13 @@
#include <stdint.h>
-typedef struct _JumpBuffer {
+typedef struct {
uint32_t ra, sp, fp;
uint32_t s0, s1, s2, s3, s4, s5, s6, s7;
uint32_t gp;
} JumpBuffer;
-typedef JumpBuffer *jmp_buf;
+typedef JumpBuffer jmp_buf[1];
#ifdef __cplusplus
extern "C" {
diff --git a/libpsn00b/psxgpu/font.c b/libpsn00b/psxgpu/font.c
index ce45874..020015e 100644
--- a/libpsn00b/psxgpu/font.c
+++ b/libpsn00b/psxgpu/font.c
@@ -194,7 +194,7 @@ void *FntFlush(int id) {
break;
}
- i = toupper( *text )-32;
+ i = toupper( *text ) - ' ';
if( i > 0 ) {
@@ -236,11 +236,22 @@ void *FntSort(uint32_t *ot, void *pri, int x, int y, const char *text) {
DR_TPAGE *tpage;
SPRT_8 *sprt = (SPRT_8*)pri;
- int i;
+ int i, sx, sy;
+
+ sx = x;
+ sy = y;
while( *text != 0 ) {
- i = toupper( *text )-32;
+ if (*text == '\n') {
+ sx = x;
+ sy += 8;
+ text++;
+
+ continue;
+ }
+
+ i = toupper( *text ) - ' ';
if( i > 0 ) {
@@ -248,7 +259,7 @@ void *FntSort(uint32_t *ot, void *pri, int x, int y, const char *text) {
setSprt8(sprt);
setShadeTex(sprt, 1);
setSemiTrans(sprt, 1);
- setXY0(sprt, x, y);
+ setXY0(sprt, sx, sy);
setUV0(sprt, (i % 16) * 8, (i / 16) * 8);
sprt->clut = _font_clut;
addPrim(ot, sprt);
@@ -256,7 +267,7 @@ void *FntSort(uint32_t *ot, void *pri, int x, int y, const char *text) {
}
- x += 8;
+ sx += 8;
text++;
}