mirror of
https://github.com/rcornwell/sims.git
synced 2026-04-06 21:49:35 +00:00
SCP: Updated to current.
This commit is contained in:
5
scp.c
5
scp.c
@@ -5921,10 +5921,13 @@ int32 toks = -1;
|
||||
fprintf (st, "%s", _sim_dname (dptr)); /* print dev name */
|
||||
if ((flag == 2) && dptr->description) {
|
||||
fprintf (st, "%s\n", dptr->description(dptr));
|
||||
fprintf (st, "%s", _sim_dname_space ());
|
||||
}
|
||||
else {
|
||||
if ((sim_switches & SWMASK ('D')) && dptr->description)
|
||||
if ((sim_switches & SWMASK ('D')) && dptr->description) {
|
||||
fprintf (st, "%s\n", dptr->description(dptr));
|
||||
fprintf (st, "%s", _sim_dname_space ());
|
||||
}
|
||||
}
|
||||
if (qdisable (dptr)) { /* disabled? */
|
||||
fprintf (st, "%s\n", "disabled");
|
||||
|
||||
15
sim_fio.c
15
sim_fio.c
@@ -569,7 +569,7 @@ struct SHMEM {
|
||||
|
||||
t_stat sim_shmem_open (const char *name, size_t size, SHMEM **shmem, void **addr)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
#if defined (HAVE_SHM_OPEN) && defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
*shmem = (SHMEM *)calloc (1, sizeof(**shmem));
|
||||
mode_t orig_mask;
|
||||
|
||||
@@ -626,26 +626,31 @@ if ((*shmem)->shm_base == MAP_FAILED) {
|
||||
*addr = (*shmem)->shm_base;
|
||||
return SCPE_OK;
|
||||
#else
|
||||
*shmem = NULL;
|
||||
return SCPE_NOFNC;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sim_shmem_close (SHMEM *shmem)
|
||||
{
|
||||
#if defined (HAVE_SHM_OPEN)
|
||||
if (shmem == NULL)
|
||||
return;
|
||||
if (shmem->shm_base != MAP_FAILED)
|
||||
munmap (shmem->shm_base, shmem->shm_size);
|
||||
if (shmem->shm_fd != -1)
|
||||
if (shmem->shm_fd != -1) {
|
||||
shm_unlink (shmem->shm_name);
|
||||
close (shmem->shm_fd);
|
||||
}
|
||||
free (shmem->shm_name);
|
||||
free (shmem);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32 sim_shmem_atomic_add (int32 *p, int32 v)
|
||||
{
|
||||
#if defined (HAVE_GCC_SYNC_BUILTINS)
|
||||
return __sync_add_and_fetch((int *) p, v);
|
||||
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
return __sync_add_and_fetch ((int *) p, v);
|
||||
#else
|
||||
return *p + v;
|
||||
#endif
|
||||
@@ -653,7 +658,7 @@ return *p + v;
|
||||
|
||||
t_bool sim_shmem_atomic_cas (int32 *ptr, int32 oldv, int32 newv)
|
||||
{
|
||||
#if defined (HAVE_GCC_SYNC_BUILTINS)
|
||||
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
return __sync_bool_compare_and_swap (ptr, oldv, newv);
|
||||
#else
|
||||
if (*ptr == oldv) {
|
||||
|
||||
57
sim_video.c
57
sim_video.c
@@ -1404,21 +1404,52 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
t_bool vid_is_fullscreen (void)
|
||||
{
|
||||
return SDL_GetWindowFlags (vid_window) & SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
|
||||
t_stat vid_set_fullscreen (t_bool flag)
|
||||
{
|
||||
if (flag)
|
||||
SDL_SetWindowFullscreen (vid_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
else
|
||||
SDL_SetWindowFullscreen (vid_window, 0);
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
static void vid_stretch(SDL_Rect *r)
|
||||
{
|
||||
/* Return in r a rectangle with the same aspect ratio as the video
|
||||
buffer but scaled to fit precisely in the output window. Normally,
|
||||
the buffer and the window have the same sizes, but if the window is
|
||||
resized, or fullscreen is in effect, they are not. */
|
||||
int w, h;
|
||||
SDL_GetRendererOutputSize(vid_renderer, &w, &h);
|
||||
if ((double)h / vid_height < (double)w / vid_width) {
|
||||
r->w = vid_width * h / vid_height;
|
||||
r->h = h;
|
||||
r->x = (w - r->w) / 2;
|
||||
r->y = 0;
|
||||
}
|
||||
else {
|
||||
r->w = w;
|
||||
r->h = vid_height * w / vid_width;
|
||||
r->x = 0;
|
||||
r->y = (h - r->h) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void vid_update (void)
|
||||
{
|
||||
SDL_Rect vid_dst;
|
||||
|
||||
vid_dst.x = 0;
|
||||
vid_dst.y = 0;
|
||||
vid_dst.w = vid_width;
|
||||
vid_dst.h = vid_height;
|
||||
|
||||
vid_stretch(&vid_dst);
|
||||
sim_debug (SIM_VID_DBG_VIDEO, vid_dev, "Video Update Event: \n");
|
||||
if (sim_deb)
|
||||
fflush (sim_deb);
|
||||
if (SDL_RenderClear (vid_renderer))
|
||||
sim_printf ("%s: Video Update Event: SDL_RenderClear error: %s\n", vid_dname(vid_dev), SDL_GetError());
|
||||
if (SDL_RenderCopy (vid_renderer, vid_texture, NULL, NULL))
|
||||
if (SDL_RenderCopy (vid_renderer, vid_texture, NULL, &vid_dst))
|
||||
sim_printf ("%s: Video Update Event: SDL_RenderCopy error: %s\n", vid_dname(vid_dev), SDL_GetError());
|
||||
SDL_RenderPresent (vid_renderer);
|
||||
}
|
||||
@@ -2368,4 +2399,16 @@ t_stat vid_screenshot (const char *filename)
|
||||
sim_printf ("video support unavailable\n");
|
||||
return SCPE_NOFNC|SCPE_NOMESSAGE;
|
||||
}
|
||||
|
||||
t_bool vid_is_fullscreen (void)
|
||||
{
|
||||
sim_printf ("video support unavailable\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
t_stat vid_set_fullscreen (t_bool flag)
|
||||
{
|
||||
sim_printf ("video support unavailable\n");
|
||||
return SCPE_OK;
|
||||
}
|
||||
#endif /* defined(USE_SIM_VIDEO) */
|
||||
|
||||
@@ -198,6 +198,8 @@ t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc);
|
||||
t_stat vid_show_video (FILE* st, UNIT* uptr, int32 val, CONST void* desc);
|
||||
t_stat vid_show (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, CONST char* desc);
|
||||
t_stat vid_screenshot (const char *filename);
|
||||
t_bool vid_is_fullscreen (void);
|
||||
t_stat vid_set_fullscreen (t_bool flag);
|
||||
|
||||
extern t_bool vid_active;
|
||||
void vid_set_cursor_position (int32 x, int32 y); /* cursor position (set by calling code) */
|
||||
|
||||
Reference in New Issue
Block a user