560
|
1 /* SPUdec.c
|
|
2 Skeleton of function spudec_process_controll() was written by Apri.
|
|
3 Further works:
|
|
4 LGB,... (yeah, try to improve it and insert your name here! ;-) */
|
|
5
|
|
6
|
|
7 #include <stdio.h>
|
|
8 #include "spudec.h"
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13 void spudec_process_control(unsigned char *control, int size, int* d1, int* d2)
|
|
14 {
|
|
15 int off = 2;
|
|
16 int a,b; /* Temporary vars */
|
|
17
|
|
18 do {
|
|
19 int type = control[off];
|
|
20 off++;
|
|
21 printf("cmd=%d ",type);
|
|
22
|
|
23 switch(type) {
|
|
24 case 0x00:
|
|
25 /* Menu ID, 1 byte */
|
|
26 printf("Menu ID\n");
|
|
27 break;
|
|
28 case 0x01:
|
|
29 /* Start display */
|
|
30 printf("Start display!\n");
|
|
31 // gSpudec.geom.bIsVisible = 1;
|
|
32 break;
|
|
33 case 0x03:
|
|
34 /* Palette */
|
|
35 printf("Palette\n");
|
|
36 // palette[3] = &(gSpudec.clut[(control[off] >> 4)]);
|
|
37 // palette[2] = &(gSpudec.clut[control[off] & 0xf]);
|
|
38 // palette[1] = &(gSpudec.clut[(control[off+1] >> 4)]);
|
|
39 // palette[0] = &(gSpudec.clut[control[off+1] & 0xf]);
|
|
40 off+=2;
|
|
41 break;
|
|
42 case 0x04:
|
|
43 /* Alpha */
|
|
44 printf("Alpha\n");
|
|
45 // alpha[3] = control[off] & 0xf0;
|
|
46 // alpha[2] = (control[off] & 0xf) << 4;
|
|
47 // alpha[1] = control[off+1] & 0xf0;
|
|
48 // alpha[0] = (control[off+1] & 0xf) << 4;
|
|
49 off+=2;
|
|
50 break;
|
|
51 case 0x05:
|
|
52 /* Co-ords */
|
|
53 a = (control[off] << 16) + (control[off+1] << 8) + control[off+2];
|
|
54 b = (control[off+3] << 16) + (control[off+4] << 8) + control[off+5];
|
|
55
|
|
56 printf("Coords col: %d - %d row: %d - %d\n",a >> 12,a & 0xfff,b >> 12,b & 0xfff);
|
|
57
|
|
58 // gSpudec.geom.start_col = a >> 12;
|
|
59 // gSpudec.geom.end_col = a & 0xfff;
|
|
60 // gSpudec.geom.start_row = b >> 12;
|
|
61 // gSpudec.geom.end_row = b & 0xfff;
|
|
62
|
|
63 off+=6;
|
|
64 break;
|
|
65 case 0x06:
|
|
66 /* Graphic lines */
|
|
67 *(d1) = (control[off] << 8) + control[off+1];
|
|
68 *(d2) = (control[off+2] << 8) + control[off+3];
|
|
69 printf("Graphic pos color: %d b/w: %d\n",*d1,*d2);
|
|
70 off+=4;
|
|
71 break;
|
|
72 case 0xff:
|
|
73 /* All done, bye-bye */
|
|
74 printf("Done!\n");
|
|
75 return;
|
|
76 break;
|
|
77 default:
|
|
78 printf("spudec: Error determining control type 0x%02x.\n",type);
|
|
79 return;
|
|
80 break;
|
|
81 }
|
|
82
|
|
83 /* printf("spudec: Processsed control type 0x%02x.\n",type); */
|
|
84 } while(off < size);
|
|
85 }
|
|
86
|
|
87
|
|
88
|