...
|
...
|
@@ -48,7 +48,7 @@ static SDL_Thread *stdin_thread;
|
48
|
48
|
|
49
|
49
|
/* devices */
|
50
|
50
|
|
51
|
|
-static Device *devscreen, *devmouse, *devctrl, *devaudio0;
|
|
51
|
+static Device *devscreen, *devaudio0;
|
52
|
52
|
static Uint8 zoom = 1;
|
53
|
53
|
static Uint32 stdin_event, audio0_event;
|
54
|
54
|
static Uint64 exec_deadline, deadline_interval, ms_interval;
|
...
|
...
|
@@ -265,8 +265,8 @@ start(Uxn *u, char *rom)
|
265
|
265
|
/* audio2 */ uxn_port(u, 0x5, audio_dei, audio_deo);
|
266
|
266
|
/* audio3 */ uxn_port(u, 0x6, audio_dei, audio_deo);
|
267
|
267
|
/* unused */ uxn_port(u, 0x7, nil_dei, nil_deo);
|
268
|
|
- /* control */ devctrl = uxn_port(u, 0x8, nil_dei, nil_deo);
|
269
|
|
- /* mouse */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
|
|
268
|
+ /* control */ uxn_port(u, 0x8, nil_dei, nil_deo);
|
|
269
|
+ /* mouse */ uxn_port(u, 0x9, nil_dei, nil_deo);
|
270
|
270
|
/* file0 */ uxn_port(u, 0xa, file_dei, file_deo);
|
271
|
271
|
/* file1 */ uxn_port(u, 0xb, file_dei, file_deo);
|
272
|
272
|
/* datetime */ uxn_port(u, 0xc, datetime_dei, nil_deo);
|
...
|
...
|
@@ -402,22 +402,22 @@ handle_events(Uxn *u)
|
402
|
402
|
}
|
403
|
403
|
/* Mouse */
|
404
|
404
|
else if(event.type == SDL_MOUSEMOTION)
|
405
|
|
- mouse_pos(u, devmouse->dat, clamp(event.motion.x - PAD, 0, uxn_screen.width - 1), clamp(event.motion.y - PAD, 0, uxn_screen.height - 1));
|
|
405
|
+ mouse_pos(u, u->dev[9].dat, clamp(event.motion.x - PAD, 0, uxn_screen.width - 1), clamp(event.motion.y - PAD, 0, uxn_screen.height - 1));
|
406
|
406
|
else if(event.type == SDL_MOUSEBUTTONUP)
|
407
|
|
- mouse_up(u, devmouse->dat, SDL_BUTTON(event.button.button));
|
|
407
|
+ mouse_up(u, u->dev[9].dat, SDL_BUTTON(event.button.button));
|
408
|
408
|
else if(event.type == SDL_MOUSEBUTTONDOWN)
|
409
|
|
- mouse_down(u, devmouse->dat, SDL_BUTTON(event.button.button));
|
|
409
|
+ mouse_down(u, u->dev[9].dat, SDL_BUTTON(event.button.button));
|
410
|
410
|
else if(event.type == SDL_MOUSEWHEEL)
|
411
|
|
- mouse_scroll(u, devmouse->dat, event.wheel.x, event.wheel.y);
|
|
411
|
+ mouse_scroll(u, u->dev[9].dat, event.wheel.x, event.wheel.y);
|
412
|
412
|
/* Controller */
|
413
|
413
|
else if(event.type == SDL_TEXTINPUT)
|
414
|
|
- controller_key(u, devctrl->dat, event.text.text[0]);
|
|
414
|
+ controller_key(u, u->dev[8].dat, event.text.text[0]);
|
415
|
415
|
else if(event.type == SDL_KEYDOWN) {
|
416
|
416
|
int ksym;
|
417
|
417
|
if(get_key(&event))
|
418
|
|
- controller_key(u, devctrl->dat, get_key(&event));
|
|
418
|
+ controller_key(u, u->dev[8].dat, get_key(&event));
|
419
|
419
|
else if(get_button(&event))
|
420
|
|
- controller_down(u, devctrl->dat, get_button(&event));
|
|
420
|
+ controller_down(u, u->dev[8].dat, get_button(&event));
|
421
|
421
|
else
|
422
|
422
|
do_shortcut(u, &event);
|
423
|
423
|
ksym = event.key.keysym.sym;
|
...
|
...
|
@@ -425,17 +425,17 @@ handle_events(Uxn *u)
|
425
|
425
|
return 1;
|
426
|
426
|
}
|
427
|
427
|
} else if(event.type == SDL_KEYUP)
|
428
|
|
- controller_up(u, devctrl->dat, get_button(&event));
|
|
428
|
+ controller_up(u, u->dev[8].dat, get_button(&event));
|
429
|
429
|
else if(event.type == SDL_JOYAXISMOTION) {
|
430
|
430
|
Uint8 vec = get_vector_joystick(&event);
|
431
|
431
|
if(!vec)
|
432
|
|
- controller_up(u, devctrl->dat, (0x03 << (!event.jaxis.axis * 2)) << 4);
|
|
432
|
+ controller_up(u, u->dev[8].dat, (3 << (!event.jaxis.axis * 2)) << 4);
|
433
|
433
|
else
|
434
|
|
- controller_down(u, devctrl->dat, (0x01 << ((vec + !event.jaxis.axis * 2) - 1)) << 4);
|
|
434
|
+ controller_down(u, u->dev[8].dat, (1 << ((vec + !event.jaxis.axis * 2) - 1)) << 4);
|
435
|
435
|
} else if(event.type == SDL_JOYBUTTONDOWN)
|
436
|
|
- controller_down(u, devctrl->dat, get_button_joystick(&event));
|
|
436
|
+ controller_down(u, u->dev[8].dat, get_button_joystick(&event));
|
437
|
437
|
else if(event.type == SDL_JOYBUTTONUP)
|
438
|
|
- controller_up(u, devctrl->dat, get_button_joystick(&event));
|
|
438
|
+ controller_up(u, u->dev[8].dat, get_button_joystick(&event));
|
439
|
439
|
/* Console */
|
440
|
440
|
else if(event.type == stdin_event)
|
441
|
441
|
console_input(u, event.cbutton.button);
|