diff --git a/Visual Studio Projects/ALTAIR.vcproj b/Visual Studio Projects/ALTAIR.vcproj index 867eba94..49e56a4e 100644 --- a/Visual Studio Projects/ALTAIR.vcproj +++ b/Visual Studio Projects/ALTAIR.vcproj @@ -154,10 +154,10 @@ GenerateDebugInformation="false" ProgramDatabaseFile="$(OutDir)\ALTAIR.pdb" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -248,6 +248,10 @@ RelativePath="..\sim_tmxr.c" > + + + + + + @@ -453,6 +457,10 @@ RelativePath="..\sim_tmxr.h" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -333,6 +337,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/PDP10.vcproj b/Visual Studio Projects/PDP10.vcproj index 67e87f3f..d3f0c15c 100644 --- a/Visual Studio Projects/PDP10.vcproj +++ b/Visual Studio Projects/PDP10.vcproj @@ -306,6 +306,10 @@ RelativePath="..\sim_tmxr.c" > + + + + + + @@ -699,6 +703,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/PDP15.vcproj b/Visual Studio Projects/PDP15.vcproj index 0df0380d..97e37997 100644 --- a/Visual Studio Projects/PDP15.vcproj +++ b/Visual Studio Projects/PDP15.vcproj @@ -150,10 +150,10 @@ AdditionalLibraryDirectories="../../windows-build/PCRE/lib/" GenerateDebugInformation="false" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -272,6 +272,10 @@ RelativePath="..\sim_tmxr.c" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -287,6 +291,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/TX-0.vcproj b/Visual Studio Projects/TX-0.vcproj index 0aa5af18..e2c67d4a 100644 --- a/Visual Studio Projects/TX-0.vcproj +++ b/Visual Studio Projects/TX-0.vcproj @@ -148,10 +148,10 @@ AdditionalLibraryDirectories="../../windows-build/PCRE/lib/" GenerateDebugInformation="false" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -230,6 +230,10 @@ RelativePath="..\sim_tmxr.c" > + + @@ -307,6 +311,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/VAX730.vcproj b/Visual Studio Projects/VAX730.vcproj index bf7fd87e..1ca445db 100644 --- a/Visual Studio Projects/VAX730.vcproj +++ b/Visual Studio Projects/VAX730.vcproj @@ -309,6 +309,10 @@ RelativePath="..\sim_tmxr.c" > + + @@ -618,6 +622,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/VAX750.vcproj b/Visual Studio Projects/VAX750.vcproj index 10fccffc..bc624a44 100644 --- a/Visual Studio Projects/VAX750.vcproj +++ b/Visual Studio Projects/VAX750.vcproj @@ -317,6 +317,10 @@ RelativePath="..\sim_tmxr.c" > + + @@ -626,6 +630,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/VAX780.vcproj b/Visual Studio Projects/VAX780.vcproj index 55808eb7..25b83420 100644 --- a/Visual Studio Projects/VAX780.vcproj +++ b/Visual Studio Projects/VAX780.vcproj @@ -323,6 +323,10 @@ RelativePath="..\sim_tmxr.c" > + + @@ -636,6 +640,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/VAX8600.vcproj b/Visual Studio Projects/VAX8600.vcproj index 49bf6a7b..f00339cd 100644 --- a/Visual Studio Projects/VAX8600.vcproj +++ b/Visual Studio Projects/VAX8600.vcproj @@ -323,6 +323,10 @@ RelativePath="..\sim_tmxr.c" > + + @@ -628,6 +632,10 @@ RelativePath="..\sim_tmxr.h" > + + diff --git a/Visual Studio Projects/alpha.vcproj b/Visual Studio Projects/alpha.vcproj index e6329b12..db25417e 100644 --- a/Visual Studio Projects/alpha.vcproj +++ b/Visual Studio Projects/alpha.vcproj @@ -150,10 +150,10 @@ AdditionalLibraryDirectories="../../windows-build/PCRE/lib/" GenerateDebugInformation="false" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -268,6 +268,10 @@ RelativePath="..\sim_tmxr.c" > + + + + + + + + diff --git a/Visual Studio Projects/isys8020.vcproj b/Visual Studio Projects/isys8020.vcproj index fd013dac..391a762d 100644 --- a/Visual Studio Projects/isys8020.vcproj +++ b/Visual Studio Projects/isys8020.vcproj @@ -272,6 +272,10 @@ RelativePath="..\sim_tmxr.c" > + + + + diff --git a/Visual Studio Projects/lgp.vcproj b/Visual Studio Projects/lgp.vcproj index eb3a0e0d..21ea5e3f 100644 --- a/Visual Studio Projects/lgp.vcproj +++ b/Visual Studio Projects/lgp.vcproj @@ -150,10 +150,10 @@ AdditionalLibraryDirectories="../../windows-build/PCRE/lib/" GenerateDebugInformation="false" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -240,6 +240,10 @@ RelativePath="..\sim_tmxr.c" > + + + + + + + + + + + + diff --git a/Visual Studio Projects/swtp6800mp-a2.vcproj b/Visual Studio Projects/swtp6800mp-a2.vcproj index ccf718f3..6150da7f 100644 --- a/Visual Studio Projects/swtp6800mp-a2.vcproj +++ b/Visual Studio Projects/swtp6800mp-a2.vcproj @@ -150,10 +150,10 @@ AdditionalLibraryDirectories="../../windows-build/PCRE/lib/" GenerateDebugInformation="false" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" StackReserveSize="10485760" StackCommitSize="10485760" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" TargetMachine="1" @@ -268,6 +268,10 @@ RelativePath="..\sim_tmxr.c" > + + + + diff --git a/scp.c b/scp.c index 4c0d77f1..6c72b211 100644 --- a/scp.c +++ b/scp.c @@ -221,9 +221,7 @@ #include "sim_tape.h" #include "sim_ether.h" #include "sim_serial.h" -#if defined (USE_SIM_VIDEO) #include "sim_video.h" -#endif #include "sim_sock.h" #include "sim_frontpanel.h" #include @@ -2007,6 +2005,7 @@ detach_all (0, TRUE); /* close files */ sim_set_deboff (0, NULL); /* close debug */ sim_set_logoff (0, NULL); /* close log */ sim_set_notelnet (0, NULL); /* close Telnet */ +vid_close (); /* close video */ sim_ttclose (); /* close console */ AIO_CLEANUP; /* Asynch I/O */ sim_cleanup_sock (); /* cleanup sockets */ @@ -4339,9 +4338,7 @@ if (flag) { fprintf (st, "\n\t\tMemory Access: %s Endian", sim_end ? "Little" : "Big"); fprintf (st, "\n\t\tMemory Pointer Size: %d bits", (int)sizeof(dptr)*8); fprintf (st, "\n\t\t%s", sim_toffset_64 ? "Large File (>2GB) support" : "No Large File support"); -#if defined (USE_SIM_VIDEO) fprintf (st, "\n\t\tSDL Video support: %s", vid_version()); -#endif #if defined (HAVE_PCREPOSIX_H) fprintf (st, "\n\t\tPCRE RegEx support for EXPECT commands"); #elif defined (HAVE_REGEX_H) @@ -5452,7 +5449,7 @@ return SCPE_OK; const char *sim_dname (DEVICE *dptr) { -return (dptr->lname? dptr->lname: dptr->name); +return (dptr ? (dptr->lname? dptr->lname: dptr->name) : ""); } /* Get unit display name */ diff --git a/sim_video.c b/sim_video.c index 68a48463..d7596499 100644 --- a/sim_video.c +++ b/sim_video.c @@ -243,6 +243,7 @@ static int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst) #define EVENT_OPEN 7 /* vid_open request */ #define EVENT_EXIT 8 /* program exit */ #define EVENT_SCREENSHOT 9 /* show SDL capabilities */ +#define EVENT_BEEP 10 /* audio beep */ #define MAX_EVENTS 20 /* max events in queue */ typedef struct { @@ -265,6 +266,7 @@ int vid_thread (void* arg); int vid_video_events (void); void vid_show_video_event (void); void vid_screenshot_event (void); +void vid_beep_event (void); /* libSDL and libSDL2 have significantly different APIs. @@ -283,6 +285,8 @@ int32 vid_flags; /* Open Flags */ int32 vid_width; int32 vid_height; t_bool vid_ready; +static void vid_beep_setup (int duration_ms, int tone_frequency); +static void vid_beep_cleanup (void); #if SDL_MAJOR_VERSION == 1 /* @@ -379,6 +383,8 @@ SDL_Init (SDL_INIT_VIDEO); vid_main_thread_handle = SDL_CreateThread (main_thread , "simh-main", NULL); #endif +vid_beep_setup (400, 660); + while (1) { int status = SDL_WaitEvent (&event); if (status == 1) { @@ -394,8 +400,12 @@ while (1) { if (event.user.code == EVENT_SCREENSHOT) vid_screenshot_event (); else { - sim_printf ("main(): Unexpected User event: %d\n", event.user.code); - break; + if (event.user.code == EVENT_BEEP) + vid_beep_event (); + else { + sim_printf ("main(): Unexpected User event: %d\n", event.user.code); + break; + } } } } @@ -410,6 +420,7 @@ while (1) { } } SDL_WaitThread (vid_main_thread_handle, &status); +vid_beep_cleanup (); SDL_Quit (); return status; } @@ -608,7 +619,7 @@ user_event.user.code = EVENT_DRAW; user_event.user.data1 = (void *)vid_dst; user_event.user.data2 = (void *)vid_data; if (SDL_PushEvent (&user_event) < 0) { - sim_printf ("%s: vid_draw() SDL_PushEvent error: %s\n", sim_dname(vid_dev), SDL_GetError()); + sim_printf ("%s: vid_draw() SDL_PushEvent error: %s\n", vid_dev ? sim_dname(vid_dev) : "Video Device", SDL_GetError()); free (vid_dst); free (vid_data); } @@ -643,7 +654,7 @@ user_event.user.data1 = cursor; user_event.user.data2 = (void *)((size_t)visible); if (SDL_PushEvent (&user_event) < 0) { - sim_printf ("%s: vid_set_cursor() SDL_PushEvent error: %s\n", sim_dname(vid_dev), SDL_GetError()); + sim_printf ("%s: vid_set_cursor() SDL_PushEvent error: %s\n", vid_dev ? sim_dname(vid_dev) : "Video Device", SDL_GetError()); SDL_FreeCursor (cursor); } @@ -674,10 +685,10 @@ if ((x_delta) || (y_delta)) { vid_mouse_yrel += ev->y_rel; } if (SDL_SemPost (vid_mouse_events.sem)) - sim_printf ("%s: vid_set_cursor_position(): SDL_SemPost error: %s\n", sim_dname(vid_dev), SDL_GetError()); + sim_printf ("%s: vid_set_cursor_position(): SDL_SemPost error: %s\n", vid_dev ? sim_dname(vid_dev) : "Video Device", SDL_GetError()); } else { - sim_printf ("%s: vid_set_cursor_position(): SDL_SemWait error: %s\n", sim_dname(vid_dev), SDL_GetError()); + sim_printf ("%s: vid_set_cursor_position(): SDL_SemWait error: %s\n", vid_dev ? sim_dname(vid_dev) : "Video Device", SDL_GetError()); } vid_cursor_x = x; vid_cursor_y = y; @@ -1206,12 +1217,16 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) { ev.b1_state = vid_mouse_b1; ev.b2_state = vid_mouse_b2; ev.b3_state = vid_mouse_b3; + ev.x_pos = event->x; + ev.y_pos = event->y; if ((vid_mouse_events.count > 0) && /* Is there a tail event? */ (ev.b1_state == tail->b1_state) && /* With the same button state? */ (ev.b2_state == tail->b2_state) && (ev.b3_state == tail->b3_state)) { /* Merge the motion */ tail->x_rel += ev.x_rel; tail->y_rel += ev.y_rel; + tail->x_pos = ev.x_pos; + tail->y_pos = ev.y_pos; sim_debug (SIM_VID_DBG_MOUSE, vid_dev, "Mouse Move Event: Coalesced into pending event: (%d,%d) vid_mouse_rel:(%d,%d)\n", tail->x_rel, tail->y_rel, vid_mouse_xrel, vid_mouse_yrel); } @@ -1276,6 +1291,8 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) { if (vid_mouse_events.count < MAX_EVENTS) { ev.x_rel = 0; ev.y_rel = 0; + ev.x_pos = event->x; + ev.y_pos = event->y; ev.b1_state = vid_mouse_b1; ev.b2_state = vid_mouse_b2; ev.b3_state = vid_mouse_b3; @@ -1695,6 +1712,10 @@ if (0) while (SDL_PeepEvents (&event, 1, SDL_GETEVENT, SD vid_screenshot_event (); event.user.code = 0; /* Mark as done */ } + if (event.user.code == EVENT_BEEP) { + vid_beep_event (); + event.user.code = 0; /* Mark as done */ + } if (event.user.code != 0) { sim_printf ("vid_thread(): Unexpected user event code: %d\n", event.user.code); } @@ -1738,7 +1759,9 @@ SDL_SetHint (SDL_HINT_RENDER_DRIVER, "software"); SDL_Init (SDL_INIT_VIDEO); #endif +vid_beep_setup (400, 660); vid_video_events (); +vid_beep_cleanup (); SDL_Quit (); return 0; } @@ -2132,6 +2155,88 @@ while (_screenshot_stat == -1) return _screenshot_stat; } +#include +#include + +const int AMPLITUDE = 20000; +const int SAMPLE_FREQUENCY = 11025; +static int16 *vid_beep_data; +static int vid_beep_offset; +static int vid_beep_duration; +static int vid_beep_samples; + +static void vid_audio_callback(void *ctx, Uint8 *stream, int length) +{ +int16 *data = (int16 *)stream; +int i, sum, remnant = ((vid_beep_samples - vid_beep_offset) * sizeof (*vid_beep_data)); + +if (length > remnant) { + memset (stream + remnant, 0, length - remnant); + length = remnant; + if (remnant == 0) { + SDL_PauseAudio(1); + return; + } + } +memcpy (stream, &vid_beep_data[vid_beep_offset], length); +for (i=sum=0; i #endif /* HAVE_LIBSDL */