commit 776b355
Devine Lu Linvega
·
2024-07-01 05:13:18 +0000 UTC
parent 03328cf
Do not pass memory in controller device
3 files changed,
+16,
-16
+10,
-10
1@@ -13,29 +13,29 @@ WITH REGARD TO THIS SOFTWARE.
2 */
3
4 void
5-controller_down(Uint8 *d, Uint8 mask)
6+controller_down(Uint8 mask)
7 {
8 if(mask) {
9- d[2] |= mask;
10- uxn_eval(PEEK2(d));
11+ uxn.dev[0x82] |= mask;
12+ uxn_eval(PEEK2(&uxn.dev[0x80]));
13 }
14 }
15
16 void
17-controller_up(Uint8 *d, Uint8 mask)
18+controller_up(Uint8 mask)
19 {
20 if(mask) {
21- d[2] &= (~mask);
22- uxn_eval(PEEK2(d));
23+ uxn.dev[0x82] &= (~mask);
24+ uxn_eval(PEEK2(&uxn.dev[0x80]));
25 }
26 }
27
28 void
29-controller_key(Uint8 *d, Uint8 key)
30+controller_key(Uint8 key)
31 {
32 if(key) {
33- d[3] = key;
34- uxn_eval(PEEK2(d));
35- d[3] = 0x00;
36+ uxn.dev[0x83] = key;
37+ uxn_eval(PEEK2(&uxn.dev[0x80]));
38+ uxn.dev[0x83] = 0;
39 }
40 }
+3,
-3
1@@ -11,6 +11,6 @@ WITH REGARD TO THIS SOFTWARE.
2
3 #define CONTROL_VERSION 1
4
5-void controller_down(Uint8 *d, Uint8 mask);
6-void controller_up(Uint8 *d, Uint8 mask);
7-void controller_key(Uint8 *d, Uint8 key);
8+void controller_down(Uint8 mask);
9+void controller_up(Uint8 mask);
10+void controller_key(Uint8 key);
+3,
-3
1@@ -158,14 +158,14 @@ emu_event(void)
2 case XK_F4: emu_restart(boot_rom, 0); break;
3 case XK_F5: emu_restart(boot_rom, 1); break;
4 }
5- controller_down(&uxn.dev[0x80], get_button(sym));
6- controller_key(&uxn.dev[0x80], sym < 0x80 ? sym : (Uint8)buf[0]);
7+ controller_down(get_button(sym));
8+ controller_key(sym < 0x80 ? sym : (Uint8)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(&uxn.dev[0x80], get_button(sym));
15+ controller_up(get_button(sym));
16 } break;
17 case ButtonPress: {
18 XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;