Do not pass memory in controller device
This commit is contained in:
parent
03328cfc68
commit
776b355ee3
|
@ -13,29 +13,29 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
void
|
||||
controller_down(Uint8 *d, Uint8 mask)
|
||||
controller_down(Uint8 mask)
|
||||
{
|
||||
if(mask) {
|
||||
d[2] |= mask;
|
||||
uxn_eval(PEEK2(d));
|
||||
uxn.dev[0x82] |= mask;
|
||||
uxn_eval(PEEK2(&uxn.dev[0x80]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
controller_up(Uint8 *d, Uint8 mask)
|
||||
controller_up(Uint8 mask)
|
||||
{
|
||||
if(mask) {
|
||||
d[2] &= (~mask);
|
||||
uxn_eval(PEEK2(d));
|
||||
uxn.dev[0x82] &= (~mask);
|
||||
uxn_eval(PEEK2(&uxn.dev[0x80]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
controller_key(Uint8 *d, Uint8 key)
|
||||
controller_key(Uint8 key)
|
||||
{
|
||||
if(key) {
|
||||
d[3] = key;
|
||||
uxn_eval(PEEK2(d));
|
||||
d[3] = 0x00;
|
||||
uxn.dev[0x83] = key;
|
||||
uxn_eval(PEEK2(&uxn.dev[0x80]));
|
||||
uxn.dev[0x83] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
|
||||
#define CONTROL_VERSION 1
|
||||
|
||||
void controller_down(Uint8 *d, Uint8 mask);
|
||||
void controller_up(Uint8 *d, Uint8 mask);
|
||||
void controller_key(Uint8 *d, Uint8 key);
|
||||
void controller_down(Uint8 mask);
|
||||
void controller_up(Uint8 mask);
|
||||
void controller_key(Uint8 key);
|
||||
|
|
|
@ -158,14 +158,14 @@ emu_event(void)
|
|||
case XK_F4: emu_restart(boot_rom, 0); break;
|
||||
case XK_F5: emu_restart(boot_rom, 1); break;
|
||||
}
|
||||
controller_down(&uxn.dev[0x80], get_button(sym));
|
||||
controller_key(&uxn.dev[0x80], sym < 0x80 ? sym : (Uint8)buf[0]);
|
||||
controller_down(get_button(sym));
|
||||
controller_key(sym < 0x80 ? sym : (Uint8)buf[0]);
|
||||
} break;
|
||||
case KeyRelease: {
|
||||
KeySym sym;
|
||||
char buf[7];
|
||||
XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
|
||||
controller_up(&uxn.dev[0x80], get_button(sym));
|
||||
controller_up(get_button(sym));
|
||||
} break;
|
||||
case ButtonPress: {
|
||||
XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
|
||||
|
|
Loading…
Reference in New Issue