commit 9c34a59
neauoire
·
2022-04-05 16:10:29 +0000 UTC
parent 6213089
Removed controller as Device
5 files changed,
+23,
-22
M
build.sh
+1,
-1
1@@ -22,4 +22,4 @@ fi
2 echo "Done."
3
4 # echo "Running.."
5-bin/uxn11 ~/roms/catclock.rom
6+bin/uxn11 ~/roms/left.rom
+14,
-14
1@@ -14,39 +14,39 @@ WITH REGARD TO THIS SOFTWARE.
2 */
3
4 void
5-controller_down(Device *d, Uint8 mask)
6+controller_down(Uxn *u, Uint8 *d, Uint8 mask)
7 {
8 if(mask) {
9- d->dat[2] |= mask;
10- uxn_eval(d->u, GETVECTOR(d));
11+ d[2] |= mask;
12+ uxn_eval(u, GETVEC(d));
13 }
14 }
15
16 void
17-controller_up(Device *d, Uint8 mask)
18+controller_up(Uxn *u, Uint8 *d, Uint8 mask)
19 {
20 if(mask) {
21- d->dat[2] &= (~mask);
22- uxn_eval(d->u, GETVECTOR(d));
23+ d[2] &= (~mask);
24+ uxn_eval(u, GETVEC(d));
25 }
26 }
27
28 void
29-controller_key(Device *d, Uint8 key)
30+controller_key(Uxn *u, Uint8 *d, Uint8 key)
31 {
32 if(key) {
33- d->dat[3] = key;
34- uxn_eval(d->u, GETVECTOR(d));
35- d->dat[3] = 0x00;
36+ d[3] = key;
37+ uxn_eval(u, GETVEC(d));
38+ d[3] = 0x00;
39 }
40 }
41
42 void
43-controller_special(Device *d, Uint8 key)
44+controller_special(Uxn *u, Uint8 *d, Uint8 key)
45 {
46 if(key) {
47- d->dat[4] = key;
48- uxn_eval(d->u, GETVECTOR(d));
49- d->dat[4] = 0x00;
50+ d[4] = key;
51+ uxn_eval(u, GETVEC(d));
52+ d[4] = 0x00;
53 }
54 }
+4,
-4
1@@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
2 WITH REGARD TO THIS SOFTWARE.
3 */
4
5-void controller_down(Device *d, Uint8 mask);
6-void controller_up(Device *d, Uint8 mask);
7-void controller_key(Device *d, Uint8 key);
8-void controller_special(Device *d, Uint8 key);
9+void controller_down(Uxn *u, Uint8 *d, Uint8 mask);
10+void controller_up(Uxn *u, Uint8 *d, Uint8 mask);
11+void controller_key(Uxn *u, Uint8 *d, Uint8 key);
12+void controller_special(Uxn *u, Uint8 *d, Uint8 key);
+1,
-0
1@@ -22,6 +22,7 @@ typedef unsigned int Uint32;
2 #define DEVPEEK16(o, x) { (o) = (d->dat[(x)] << 8) + d->dat[(x) + 1]; }
3 #define DEVPOKE16(x, y) { d->dat[(x)] = (y) >> 8; d->dat[(x) + 1] = (y); }
4 #define GETVECTOR(d) ((d)->dat[0] << 8 | (d)->dat[1])
5+#define GETVEC(d) ((d)[0] << 8 | (d)[1])
6
7 /* clang-format on */
8
+3,
-3
1@@ -144,14 +144,14 @@ processEvent(void)
2 KeySym sym;
3 char buf[7];
4 XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
5- controller_down(devctrl, get_button(sym));
6- controller_key(devctrl, sym < 0x80 ? sym : buf[0]);
7+ controller_down(devctrl->u, devctrl->dat, get_button(sym));
8+ controller_key(devctrl->u, devctrl->dat, sym < 0x80 ? sym : buf[0]);
9 } break;
10 case KeyRelease: {
11 KeySym sym;
12 char buf[7];
13 XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
14- controller_up(devctrl, get_button(sym));
15+ controller_up(devctrl->u, devctrl->dat, get_button(sym));
16 } break;
17 case ButtonPress: {
18 XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;