diff --git a/VAX/vax_vc.c b/VAX/vax_vc.c index 2112cb17..d5a13222 100644 --- a/VAX/vax_vc.c +++ b/VAX/vax_vc.c @@ -270,6 +270,9 @@ DEBTAB vc_debug[] = { {"MBC", DBG_INT6}, {"SPARE", DBG_INT7}, {"INT", DBG_INT0|DBG_INT1|DBG_INT2|DBG_INT3|DBG_INT4|DBG_INT5|DBG_INT6|DBG_INT7}, + {"VMOUSE", SIM_VID_DBG_MOUSE}, + {"VKEY", SIM_VID_DBG_KEY}, + {"VVIDEO", SIM_VID_DBG_VIDEO}, {0} }; @@ -798,7 +801,7 @@ if (dptr->flags & DEV_DIS) return vid_close (); if (!vid_active) { - r = vid_open (VC_XSIZE, VC_YSIZE); /* display size */ + r = vid_open (dptr, VC_XSIZE, VC_YSIZE); /* display size */ if (r != SCPE_OK) return r; printf ("QVSS Display Created. "); diff --git a/sim_video.c b/sim_video.c index 27d62c71..1d373921 100644 --- a/sim_video.c +++ b/sim_video.c @@ -71,8 +71,9 @@ SDL_Thread *vid_thread_id; /* event thread handle * SDL_Color vid_palette[256]; KEY_EVENT_QUEUE vid_key_events; /* keyboard events */ MOUSE_EVENT_QUEUE vid_mouse_events; /* mouse events */ +DEVICE *vid_dev; -t_stat vid_open (uint32 width, uint32 height) +t_stat vid_open (DEVICE *dptr, uint32 width, uint32 height) { if (!vid_active) { vid_active = TRUE; @@ -106,6 +107,7 @@ if (!vid_active) { SDL_SetColors (vid_image, vid_palette, 0, 2); memset (&vid_key_state, 0, sizeof(vid_key_state)); + vid_dev = dptr; } return SCPE_OK; } @@ -120,6 +122,7 @@ if (vid_active) { user_event.user.code = EVENT_CLOSE; user_event.user.data1 = NULL; user_event.user.data2 = NULL; + vid_dev = NULL; SDL_PushEvent (&user_event); } @@ -536,6 +539,7 @@ if (vid_mouse_captured) { if (!sim_is_running) return; if (SDL_SemWait (vid_key_events.sem) == 0) { + sim_debug (SIM_VID_DBG_KEY,vid_dev, "Keyboard Event: State: %d, Keysym: %d\n", event->state, event->keysym); if (vid_key_events.count < MAX_EVENTS) { if (event->state == SDL_PRESSED) { if (!vid_key_state[event->keysym.sym]) { /* Key was not down before */ @@ -585,6 +589,7 @@ if ((event->x == 0) || if (!sim_is_running) return; if (SDL_SemWait (vid_mouse_events.sem) == 0) { + sim_debug (SIM_VID_DBG_MOUSE,vid_dev, "Mouse Move Event: (%d,%d)\n", event->xrel, event->yrel); if (vid_mouse_events.count < MAX_EVENTS) { ev.x_rel = event->xrel; ev.y_rel = (-event->yrel); @@ -628,6 +633,7 @@ if (!vid_mouse_captured) { if (!sim_is_running) return; if (SDL_SemWait (vid_mouse_events.sem) == 0) { + sim_debug (SIM_VID_DBG_MOUSE,vid_dev, "Mouse Button Event: State: %d, Button: %d, (%d,%d)\n", event->state, event->button, event->x, event->y); if (vid_mouse_events.count < MAX_EVENTS) { state = (event->state == SDL_PRESSED) ? TRUE : FALSE; ev.x_rel = 0; diff --git a/sim_video.h b/sim_video.h index 939f31f4..cbaa6259 100644 --- a/sim_video.h +++ b/sim_video.h @@ -168,7 +168,7 @@ struct key_event { typedef struct mouse_event SIM_MOUSE_EVENT; typedef struct key_event SIM_KEY_EVENT; -t_stat vid_open (uint32 width, uint32 height); +t_stat vid_open (DEVICE *dptr, uint32 width, uint32 height); t_stat vid_close (void); t_stat vid_poll_kb (SIM_KEY_EVENT *ev); t_stat vid_poll_mouse (SIM_MOUSE_EVENT *ev); @@ -180,4 +180,8 @@ t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, void* desc); extern t_bool vid_active; +#define SIM_VID_DBG_MOUSE 0x01000000 +#define SIM_VID_DBG_KEY 0x02000000 +#define SIM_VID_DBG_VIDEO 0x04000000 + #endif