aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxgpu/gettimimage.c
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
commitf3e040230772f978540a71aea43dfde200992922 (patch)
treebd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/psxgpu/gettimimage.c
downloadpsn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz
First commit
Diffstat (limited to 'libpsn00b/psxgpu/gettimimage.c')
-rw-r--r--libpsn00b/psxgpu/gettimimage.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libpsn00b/psxgpu/gettimimage.c b/libpsn00b/psxgpu/gettimimage.c
new file mode 100644
index 0000000..49ce8e9
--- /dev/null
+++ b/libpsn00b/psxgpu/gettimimage.c
@@ -0,0 +1,39 @@
+#include <psxgpu.h>
+
+int GetTimInfo(unsigned int *tim, TIM_IMAGE *timimg) {
+
+ unsigned int *rtim;
+
+ // Check ID
+ if( ( tim[0]&0xff ) != 0x10 ) {
+ return 1;
+ }
+
+ // Check version
+ if( ( (tim[0]>>8)&0xff ) != 0x0 ) {
+ return 2;
+ }
+
+ timimg->mode = tim[1];
+ rtim = tim+2;
+
+ // Clut present?
+ if( timimg->mode & 0x8 ) {
+
+ timimg->crect = (RECT*)(rtim+1);
+ timimg->caddr = (unsigned int*)(rtim+3);
+
+ rtim += rtim[0]>>2;
+
+ } else {
+
+ timimg->caddr = 0;
+
+ }
+
+ timimg->prect = (RECT*)(rtim+1);
+ timimg->paddr = (unsigned int*)(rtim+3);
+
+ return 0;
+
+}