From 8acabb09952ee78626f11a7768ba9960e0405f90 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Mon, 16 Oct 2023 18:50:43 -0400 Subject: [PATCH 01/10] Correct copyright year --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc744964e..8422792bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,7 @@ if(NOT EMU_BUILD_NUM) set(EMU_BUILD_NUM 0) endif() if(NOT EMU_COPYRIGHT_YEAR) - set(EMU_COPYRIGHT_YEAR 2022) + set(EMU_COPYRIGHT_YEAR 2023) endif() add_subdirectory(src) From 98a5e6e8735590f7de27213d5df13f256b4f2dfe Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 12:43:34 -0400 Subject: [PATCH 02/10] Fix building on macos SDL --- src/unix/unix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/unix.c b/src/unix/unix.c index 860bc814f..8fbef12f0 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -21,6 +21,10 @@ #include #include +#ifdef __APPLE__ +# include "macOSXGlue.h" +#endif + #include <86box/86box.h> #include <86box/mem.h> #include <86box/rom.h> @@ -41,10 +45,6 @@ #include <86box/ui.h> #include <86box/gdbstub.h> -#ifdef __APPLE__ -# include "macOSXGlue.h" -#endif - static int first_use = 1; static uint64_t StartingTime; static uint64_t Frequency; From 1c01f1e2e29ebe7f54d67c491acee1b5eeabe7c0 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 12:43:53 -0400 Subject: [PATCH 03/10] Cleanups in src/unix --- src/unix/unix.c | 60 +++++++++++++++++++++++++++++++++++++++------ src/unix/unix_sdl.c | 4 +++ 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/unix/unix.c b/src/unix/unix.c index 8fbef12f0..c8ee4dd73 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -191,6 +191,7 @@ dynld_module(const char *name, dllimp_t *table) { dllimp_t *imp; void *modhandle = dlopen(name, RTLD_LAZY | RTLD_GLOBAL); + if (modhandle) { for (imp = table; imp->name != NULL; imp++) { if ((*(void **) imp->func = dlsym(modhandle, imp->name)) == NULL) { @@ -199,6 +200,7 @@ dynld_module(const char *name, dllimp_t *table) } } } + return modhandle; } @@ -405,7 +407,7 @@ plat_mmap(size_t size, uint8_t executable) #if defined __APPLE__ && defined MAP_JIT void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE | (executable ? MAP_JIT : 0), -1, 0); #else - void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE, -1, 0); + void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE, -1, 0); #endif return (ret < 0) ? NULL : ret; } @@ -427,6 +429,7 @@ plat_get_ticks_common(void) { uint64_t EndingTime; uint64_t ElapsedMicroseconds; + if (first_use) { Frequency = SDL_GetPerformanceFrequency(); StartingTime = SDL_GetPerformanceCounter(); @@ -434,6 +437,7 @@ plat_get_ticks_common(void) } EndingTime = SDL_GetPerformanceCounter(); ElapsedMicroseconds = ((EndingTime - StartingTime) * 1000000) / Frequency; + return ElapsedMicroseconds; } @@ -458,11 +462,13 @@ plat_remove(char *path) void ui_sb_update_icon_state(int tag, int state) { + /* No-op. */ } void ui_sb_update_icon(int tag, int active) { + /* No-op. */ } void @@ -474,25 +480,26 @@ plat_delay_ms(uint32_t count) void ui_sb_update_tip(int arg) { + /* No-op. */ } void ui_sb_update_panes(void) { + /* No-op. */ } void ui_sb_update_text(void) { + /* No-op. */ } void path_get_dirname(char *dest, const char *path) { int c = (int) strlen(path); - char *ptr; - - ptr = (char *) path; + char *ptr = (char *) path; while (c > 0) { if (path[c] == '/' || path[c] == '\\') { @@ -511,6 +518,7 @@ volatile int cpu_thread_run = 1; void ui_sb_set_text_w(wchar_t *wstr) { + /* No-op. */ } int @@ -634,6 +642,7 @@ ui_msgbox_header(int flags, void *header, void *message) { SDL_MessageBoxData msgdata; SDL_MessageBoxButtonData msgbtn; + if (!header) header = (void *) (flags & MBX_ANSI) ? "86Box" : L"86Box"; if (header <= (void *) 7168) @@ -679,6 +688,7 @@ void plat_get_exe_name(char *s, int size) { char *basepath = SDL_GetBasePath(); + snprintf(s, size, "%s%s", basepath, basepath[strlen(basepath) - 1] == '/' ? "86box" : "/86box"); } @@ -699,6 +709,7 @@ plat_power_off(void) void ui_sb_bugui(char *str) { + /* No-op. */ } extern void sdl_blit(int x, int y, int w, int h); @@ -709,13 +720,17 @@ typedef struct mouseinputdata { int deltaz; int mousebuttons; } mouseinputdata; -SDL_mutex *mousemutex; -int real_sdl_w; -int real_sdl_h; + +SDL_mutex *mousemutex; +int real_sdl_w; +int real_sdl_h; + void ui_sb_set_ready(int ready) { + /* No-op. */ } + char *xargv[512]; // From musl. @@ -724,6 +739,7 @@ local_strsep(char **str, const char *sep) { char *s = *str; char *end; + if (!s) return NULL; end = s + strcspn(s, sep); @@ -732,6 +748,7 @@ local_strsep(char **str, const char *sep) else end = 0; *str = end; + return s; } @@ -761,6 +778,7 @@ plat_init_rom_paths(void) #ifndef __APPLE__ if (getenv("XDG_DATA_HOME")) { char xdg_rom_path[1024] = { 0 }; + strncpy(xdg_rom_path, getenv("XDG_DATA_HOME"), 1024); path_slash(xdg_rom_path); strncat(xdg_rom_path, "86Box/", 1024); @@ -774,6 +792,7 @@ plat_init_rom_paths(void) rom_add_path(xdg_rom_path); } else { char home_rom_path[1024] = { 0 }; + snprintf(home_rom_path, 1024, "%s/.local/share/86Box/", getenv("HOME") ? getenv("HOME") : getpwuid(getuid())->pw_dir); if (!plat_dir_check(home_rom_path)) @@ -788,6 +807,7 @@ plat_init_rom_paths(void) char *xdg_rom_paths = strdup(getenv("XDG_DATA_DIRS")); char *xdg_rom_paths_orig = xdg_rom_paths; char *cur_xdg_rom_path = NULL; + if (xdg_rom_paths) { while (xdg_rom_paths[strlen(xdg_rom_paths) - 1] == ':') { xdg_rom_paths[strlen(xdg_rom_paths) - 1] = '\0'; @@ -828,7 +848,9 @@ bool process_media_commands_3(uint8_t *id, char *fn, uint8_t *wp, int cmdargc) { bool err = false; + *id = atoi(xargv[1]); + if (xargv[2][0] == '\'' || xargv[2][0] == '"') { for (int curarg = 2; curarg < cmdargc; curarg++) { if (strlen(fn) + strlen(xargv[curarg]) >= PATH_MAX) { @@ -868,6 +890,7 @@ void (*f_rl_callback_handler_remove)(void) = NULL; #else # define LIBEDIT_LIBRARY "libedit.so" #endif + uint32_t timer_onesec(uint32_t interval, void *param) { @@ -882,6 +905,7 @@ monitor_thread(void *param) if (isatty(fileno(stdin)) && isatty(fileno(stdout))) { char *line = NULL; size_t n; + printf("86Box monitor console.\n"); while (!exit_event) { if (feof(stdin)) @@ -895,6 +919,7 @@ monitor_thread(void *param) if (line) { int cmdargc = 0; char *linecpy; + line[strcspn(line, "\r\n")] = '\0'; linecpy = strdup(line); if (!linecpy) { @@ -989,6 +1014,7 @@ monitor_thread(void *param) memset(fn, 0, sizeof(fn)); if (xargv[2][0] == '\'' || xargv[2][0] == '"') { int curarg = 2; + for (curarg = 2; curarg < cmdargc; curarg++) { if (strlen(fn) + strlen(xargv[curarg]) >= PATH_MAX) { err = true; @@ -1031,7 +1057,9 @@ monitor_thread(void *param) uint8_t wp; bool err = false; char fn[PATH_MAX]; + memset(fn, 0, sizeof(fn)); + if (!xargv[2] || !xargv[1]) { free(line); free(linecpy); @@ -1051,7 +1079,9 @@ monitor_thread(void *param) uint8_t wp; bool err = false; char fn[PATH_MAX]; + memset(fn, 0, sizeof(fn)); + if (!xargv[2] || !xargv[1]) { free(line); free(linecpy); @@ -1071,7 +1101,9 @@ monitor_thread(void *param) uint8_t wp; bool err = false; char fn[PATH_MAX]; + memset(fn, 0, sizeof(fn)); + if (!xargv[2] || !xargv[1]) { free(line); free(linecpy); @@ -1091,7 +1123,9 @@ monitor_thread(void *param) uint8_t wp; bool err = false; char fn[PATH_MAX]; + memset(fn, 0, sizeof(fn)); + if (!xargv[2] || !xargv[1]) { free(line); free(linecpy); @@ -1170,6 +1204,7 @@ main(int argc, char **argv) SDL_AddTimer(1000, timer_onesec, NULL); while (!is_quit) { static int mouse_inside = 0; + while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: @@ -1244,6 +1279,7 @@ main(int argc, char **argv) case SDL_RENDER_TARGETS_RESET: { extern void sdl_reinit_texture(void); + sdl_reinit_texture(); break; } @@ -1251,6 +1287,7 @@ main(int argc, char **argv) case SDL_KEYUP: { uint16_t xtkey = 0; + switch (event.key.keysym.scancode) { default: xtkey = sdl_to_xt[event.key.keysym.scancode]; @@ -1326,6 +1363,7 @@ plat_language_code(char *langcode) void plat_get_cpu_string(char *outbuf, uint8_t len) { char cpu_string[] = "Unknown"; + strncpy(outbuf, cpu_string, len); } @@ -1340,15 +1378,21 @@ plat_language_code_r(uint32_t lcid, char *outbuf, int len) void joystick_init(void) { + /* No-op. */ } + void joystick_close(void) { + /* No-op. */ } + void joystick_process(void) { + /* No-op. */ } + void startblit(void) { @@ -1365,9 +1409,11 @@ endblit(void) void ui_sb_mt32lcd(char *str) { + /* No-op. */ } void ui_hard_reset_completed(void) { + /* No-op. */ } diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index e20abbcd6..32324e129 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -167,6 +167,7 @@ sdl_real_blit(SDL_Rect *r_src) int ret; int winx; int winy; + SDL_GL_GetDrawableSize(sdl_win, &winx, &winy); SDL_RenderClear(sdl_render); @@ -526,10 +527,13 @@ ui_window_title(wchar_t *str) void ui_init_monitor(int monitor_index) { + /* No-op. */ } + void ui_deinit_monitor(int monitor_index) { + /* No-op. */ } void From e6e7ec9532f7aa1baf0b46532f090ba1ebbd65e6 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 14:00:49 -0400 Subject: [PATCH 04/10] 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. */ From b43116fdfb57b5ddcd5793c336c2e18ca75a79f1 Mon Sep 17 00:00:00 2001 From: linear cannon Date: Mon, 16 Oct 2023 23:04:23 -0400 Subject: [PATCH 05/10] net_pcap: use standard unsigned type names --- src/network/net_pcap.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index 4981fb9a3..e1747580b 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -122,15 +122,15 @@ struct pcap_if { }; struct pcap_send_queue { - u_int maxlen; /* Maximum size of the queue, in bytes. This + unsigned int maxlen; /* Maximum size of the queue, in bytes. This variable contains the size of the buffer field. */ - u_int len; /* Current size of the queue, in bytes. */ + unsigned int len; /* Current size of the queue, in bytes. */ char *buffer; /* Buffer containing the packets to be sent. */ }; typedef struct pcap_send_queue pcap_send_queue; -typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes); +typedef void (*pcap_handler)(unsigned char *user, const struct pcap_pkthdr *h, const unsigned char *bytes); #endif typedef struct { @@ -169,15 +169,15 @@ static int (*f_pcap_setnonblock)(void *, int, char *); static int (*f_pcap_set_immediate_mode)(void *, int); static int (*f_pcap_set_promisc)(void *, int); static int (*f_pcap_set_snaplen)(void *, int); -static int (*f_pcap_dispatch)(void *, int, pcap_handler callback, u_char *user); +static int (*f_pcap_dispatch)(void *, int, pcap_handler callback, unsigned char *user); static void *(*f_pcap_create)(const char *, char *); static int (*f_pcap_activate)(void *); static void *(*f_pcap_geterr)(void *); #ifdef _WIN32 static HANDLE (*f_pcap_getevent)(void *); static int (*f_pcap_sendqueue_queue)(void *, void *, void *); -static u_int (*f_pcap_sendqueue_transmit)(void *, void *, int sync); -static void *(*f_pcap_sendqueue_alloc)(u_int memsize); +static unsigned int (*f_pcap_sendqueue_transmit)(void *, void *, int sync); +static void *(*f_pcap_sendqueue_alloc)(unsigned int memsize); static void (*f_pcap_sendqueue_destroy)(void *); #else static int (*f_pcap_get_selectable_fd)(void *); @@ -294,7 +294,7 @@ net_pcap_thread(void *priv) break; case NET_EVENT_RX: - f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap); + f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (unsigned char *) pcap); break; default: @@ -341,7 +341,7 @@ net_pcap_thread(void *priv) } if (pfd[NET_EVENT_RX].revents & POLLIN) { - f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap); + f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (unsigned char *) pcap); } } From a810a847f79ed01ee2a78a4a33a4891d89d97054 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 05:52:50 -0400 Subject: [PATCH 06/10] Build SDL UI too on macos 11 --- .github/workflows/cmake.yml | 5 +++++ .github/workflows/codeql.yml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ae3f96de2..128b34093 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -406,6 +406,11 @@ jobs: new: on slug: -NDR ui: + - name: SDL GUI + qt: off + static: on + src-packages: >- + libsndfile - name: Qt GUI qt: on slug: -Qt diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 86467d657..e7835f1d9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -224,6 +224,7 @@ jobs: category: "/language:${{matrix.language}}" analyze-macos11: + name: "Analyze macOS 11 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)" runs-on: macos-11 @@ -254,6 +255,8 @@ jobs: new: on slug: -NDR ui: + - name: SDL GUI + qt: off - name: Qt GUI qt: on slug: -Qt From 5656cd7db89a3d985a4a84785cd15116197209b7 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 30 Aug 2023 05:51:47 -0400 Subject: [PATCH 07/10] Build SDL UI too on Linux --- .github/workflows/cmake.yml | 3 +++ .github/workflows/codeql.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 128b34093..bde200b6b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -313,6 +313,9 @@ jobs: new: on slug: -NDR ui: + - name: SDL GUI + qt: off + static: on - name: Qt GUI qt: on slug: -Qt diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e7835f1d9..ea196454a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -171,6 +171,8 @@ jobs: new: on slug: -NDR ui: + - name: SDL GUI + qt: off - name: Qt GUI qt: on slug: -Qt From 69c7e2a02ac9e9a58925abf47e9909881353c1fc Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 17 Oct 2023 03:41:14 -0400 Subject: [PATCH 08/10] Update codeql.yml --- .github/workflows/codeql.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ea196454a..5c23961d5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,6 +26,7 @@ on: jobs: analyze-msys2: + name: "Analyze Windows MSYS2 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, ${{ matrix.environment.msystem }})" runs-on: windows-2022 From da5b93d98081c5ac7e849cdec490fb89d72bf9b5 Mon Sep 17 00:00:00 2001 From: TC1995 Date: Tue, 17 Oct 2023 19:33:07 +0200 Subject: [PATCH 09/10] S3 fixes: Bit 11 of ports 0x82e8 and 0x86e8 (Current X and Current Y positions registers, respectively) are taken into account again without conflicting with OS/2 Warp 3/4's software cursor, fixes blitting issues with Neptune Build 5111.1's S3 driver and possibly some other builds and other stuff. --- src/video/vid_s3.c | 87 +++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 865087bf8..db86d273f 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -246,10 +246,10 @@ typedef struct s3_t { uint8_t pix_trans[4]; int ssv_state; - int cx, cy; - int px, py; - int sx, sy; - int dx, dy; + int16_t cx, cy; + int16_t px, py; + int16_t sx, sy; + int16_t dx, dy; uint32_t src, dest, pattern; int poly_cx, poly_cx2; @@ -262,7 +262,6 @@ typedef struct s3_t { uint32_t dat_buf; int dat_count; int b2e8_pix, temp_cnt; - uint8_t cur_x_bit12, cur_y_bit12; int ssv_len; uint8_t ssv_dir; uint8_t ssv_draw; @@ -712,15 +711,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) switch (port) { case 0x8148: case 0x82e8: - s3->accel.cur_y_bitres = (s3->accel.cur_y_bitres & 0xff00) | val; s3->accel.cur_y = (s3->accel.cur_y & 0xf00) | val; s3->accel.poly_cy = s3->accel.cur_y; break; case 0x8149: case 0x82e9: - s3->accel.cur_y_bitres = (s3->accel.cur_y_bitres & 0xff) | (val << 8); s3->accel.cur_y = (s3->accel.cur_y & 0xff) | ((val & 0x0f) << 8); - s3->accel.cur_y_bit12 = val & 0x10; s3->accel.poly_cy = s3->accel.cur_y; break; case 0x814a: @@ -736,16 +732,13 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) case 0x8548: case 0x86e8: - s3->accel.cur_x_bitres = (s3->accel.cur_x_bitres & 0xff00) | val; s3->accel.cur_x = (s3->accel.cur_x & 0xf00) | val; s3->accel.poly_cx = s3->accel.cur_x << 20; s3->accel.poly_x = s3->accel.poly_cx >> 20; break; case 0x8549: case 0x86e9: - s3->accel.cur_x_bitres = (s3->accel.cur_x_bitres & 0xff) | (val << 8); s3->accel.cur_x = (s3->accel.cur_x & 0xff) | ((val & 0x0f) << 8); - s3->accel.cur_x_bit12 = val & 0x10; s3->accel.poly_cx = s3->accel.poly_x = s3->accel.cur_x << 20; s3->accel.poly_x = s3->accel.poly_cx >> 20; break; @@ -884,14 +877,14 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) s3->accel.short_stroke = (s3->accel.short_stroke & 0xff) | (val << 8); s3->accel.ssv_state = 1; - s3->accel.cx = s3->accel.cur_x & 0x7ff; - s3->accel.cy = s3->accel.cur_y & 0x7ff; + s3->accel.cx = s3->accel.cur_x & 0xfff; + s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_x & 0x800) { - s3->accel.cx |= ~0x7ff; + if (s3->accel.cur_x & 0x1000) { + s3->accel.cx |= ~0xfff; } - if (s3->accel.cur_y & 0x800) { - s3->accel.cy |= ~0x7ff; + if (s3->accel.cur_y & 0x1000) { + s3->accel.cy |= ~0xfff; } if (s3->accel.cmd & 0x1000) { @@ -1426,14 +1419,14 @@ s3_accel_out_fifo_w(s3_t *s3, uint16_t port, uint16_t val) s3->accel.short_stroke = val; s3->accel.ssv_state = 1; - s3->accel.cx = s3->accel.cur_x & 0x7ff; - s3->accel.cy = s3->accel.cur_y & 0x7ff; + s3->accel.cx = s3->accel.cur_x & 0xfff; + s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_x & 0x800) { - s3->accel.cx |= ~0x7ff; + if (s3->accel.cur_x & 0x1000) { + s3->accel.cx |= ~0xfff; } - if (s3->accel.cur_y & 0x800) { - s3->accel.cy |= ~0x7ff; + if (s3->accel.cur_y & 0x1000) { + s3->accel.cy |= ~0xfff; } if (s3->accel.cmd & 0x1000) { @@ -6380,14 +6373,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ case 1: /*Draw line*/ if (!cpu_input) { - s3->accel.cx = s3->accel.cur_x & 0x7ff; - s3->accel.cy = s3->accel.cur_y & 0x7ff; + s3->accel.cx = s3->accel.cur_x & 0xfff; + s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_x & 0x800) - s3->accel.cx |= ~0x7ff; + if (s3->accel.cur_x & 0x1000) + s3->accel.cx |= ~0xfff; - if (s3->accel.cur_y & 0x800) - s3->accel.cy |= ~0x7ff; + if (s3->accel.cur_y & 0x1000) + s3->accel.cy |= ~0xfff; s3->accel.sy = s3->accel.maj_axis_pcnt; @@ -6615,14 +6608,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ { s3->accel.sx = s3->accel.maj_axis_pcnt & 0xfff; s3->accel.sy = s3->accel.multifunc[0] & 0xfff; - s3->accel.cx = s3->accel.cur_x & 0x7ff; - s3->accel.cy = s3->accel.cur_y & 0x7ff; + s3->accel.cx = s3->accel.cur_x & 0xfff; + s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_x & 0x800) { - s3->accel.cx |= ~0x7ff; + if (s3->accel.cur_x & 0x1000) { + s3->accel.cx |= ~0xfff; } - if (s3->accel.cur_y & 0x800) { - s3->accel.cy |= ~0x7ff; + if (s3->accel.cur_y & 0x1000) { + s3->accel.cy |= ~0xfff; } s3->accel.dest = dstbase + s3->accel.cy * s3->width; @@ -6844,14 +6837,14 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ if (s3->accel.desty_axstp & 0x800) s3->accel.dy |= ~0x7ff; - s3->accel.cx = s3->accel.cur_x & 0x7ff; - s3->accel.cy = s3->accel.cur_y & 0x7ff; + s3->accel.cx = s3->accel.cur_x & 0xfff; + s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_x & 0x800) { - s3->accel.cx |= ~0x7ff; + if (s3->accel.cur_x & 0x1000) { + s3->accel.cx |= ~0xfff; } - if (s3->accel.cur_y & 0x800) { - s3->accel.cy |= ~0x7ff; + if (s3->accel.cur_y & 0x1000) { + s3->accel.cy |= ~0xfff; } s3->accel.src = srcbase + s3->accel.cy * s3->width; @@ -7007,10 +7000,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.dy |= ~0xfff; s3->accel.cx = s3->accel.cur_x & 0xfff; - if (s3->accel.cur_x_bit12) + if (s3->accel.cur_x & 0x1000) s3->accel.cx |= ~0xfff; s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_y_bit12) + if (s3->accel.cur_y & 0x1000) s3->accel.cy |= ~0xfff; /*Align source with destination*/ @@ -7132,10 +7125,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.dy |= ~0xfff; s3->accel.cx = s3->accel.cur_x; - if (s3->accel.cur_x_bit12) + if (s3->accel.cur_x & 0x1000) s3->accel.cx |= ~0xfff; s3->accel.cy = s3->accel.cur_y; - if (s3->accel.cur_y_bit12) + if (s3->accel.cur_y & 0x1000) s3->accel.cy |= ~0xfff; } @@ -7323,10 +7316,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.dy |= ~0xfff; s3->accel.cx = s3->accel.cur_x & 0xfff; - if (s3->accel.cur_x_bit12) + if (s3->accel.cur_x & 0x1000) s3->accel.cx |= ~0xfff; s3->accel.cy = s3->accel.cur_y & 0xfff; - if (s3->accel.cur_y_bit12) + if (s3->accel.cur_y & 0x1000) s3->accel.cy |= ~0xfff; s3->accel.px = s3->accel.pat_x & 0xfff; From 0440d3738782b47cb19a2dd7b0cba72c0c4ca9e3 Mon Sep 17 00:00:00 2001 From: TC1995 Date: Thu, 19 Oct 2023 01:32:52 +0200 Subject: [PATCH 10/10] Small mach32/svga mapping fix (actually fixes font rendering on win3.1x using the Mach32 2.6 drivers) --- src/video/vid_ati_mach8.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/video/vid_ati_mach8.c b/src/video/vid_ati_mach8.c index 86926f26e..8e7174666 100644 --- a/src/video/vid_ati_mach8.c +++ b/src/video/vid_ati_mach8.c @@ -2427,16 +2427,6 @@ mach_out(uint16_t addr, uint8_t val, void *priv) svga_out(addr, val, svga); return; - case 0x3CF: - if (svga->gdcaddr == 6) { - uint8_t old_val = svga->gdcreg[6]; - svga->gdcreg[6] = val; - if ((svga->gdcreg[6] & 0xc) != (old_val & 0xc)) - mach32_updatemapping(mach); - return; - } - break; - case 0x3D4: svga->crtcreg = val & 0x3f; return;