From e6e7ec9532f7aa1baf0b46532f090ba1ebbd65e6 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 14:00:49 -0400 Subject: [PATCH] Fix *nix SDL builds --- src/unix/unix.c | 9 ++++++--- src/unix/unix_sdl.c | 17 +++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/unix/unix.c b/src/unix/unix.c index c8ee4dd73..7b3fd56cf 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -643,12 +643,15 @@ ui_msgbox_header(int flags, void *header, void *message) SDL_MessageBoxData msgdata; SDL_MessageBoxButtonData msgbtn; +#if 0 if (!header) header = (void *) (flags & MBX_ANSI) ? "86Box" : L"86Box"; +#endif if (header <= (void *) 7168) - header = (void *) plat_get_string((int) header); + header = (void *) plat_get_string((uintptr_t) header); if (message <= (void *) 7168) - message = (void *) plat_get_string((int) message); + message = (void *) plat_get_string((uintptr_t) message); + msgbtn.buttonid = 1; msgbtn.text = "OK"; msgbtn.flags = 0; @@ -914,7 +917,7 @@ monitor_thread(void *param) line = f_readline("(86Box) "); else { printf("(86Box) "); - getline(&line, &n, stdin); + !getline(&line, &n, stdin); } if (line) { int cmdargc = 0; diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 32324e129..19af4b71e 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -51,7 +51,7 @@ int title_set = 0; int resize_pending = 0; int resize_w = 0; int resize_h = 0; -static uint8_t interpixels[17842176]; +static void *pixeldata; extern void RenderImGui(void); static void @@ -150,11 +150,15 @@ sdl_blit_shim(int x, int y, int w, int h, int monitor_index) params.y = y; params.w = w; params.h = h; + if (!(!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) || (monitor_index >= 1)) - video_copy(interpixels, &(buffer32->line[y][x]), h * 2048 * sizeof(uint32_t)); - if (screenshots) - video_screenshot(interpixels, 0, 0, 2048); + for (int row = 0; row < h; ++row) + video_copy(&(((uint8_t *) pixeldata)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t)); + + if (monitors[monitor_index].mon_screenshots) + video_screenshot((uint32_t *) pixeldata, 0, 0, 2048); blitreq = 1; + video_blit_complete_monitor(monitor_index); } @@ -214,7 +218,7 @@ sdl_blit(int x, int y, int w, int h) r_src.y = y; r_src.w = w; r_src.h = h; - SDL_UpdateTexture(sdl_tex, &r_src, interpixels, 2048 * 4); + SDL_UpdateTexture(sdl_tex, &r_src, pixeldata, 2048 * 4); blitreq = 0; sdl_real_blit(&r_src); @@ -271,8 +275,6 @@ sdl_close(void) sdl_flags = -1; } -static int old_capture = 0; - void sdl_enable(int enable) { @@ -393,7 +395,6 @@ plat_vidapi(char *api) static int sdl_init_common(int flags) { - wchar_t temp[128]; SDL_version ver; /* Get and log the version of the DLL we are using. */