From dd02d870ef6830aa04ca698a4c2ac2807ed91e91 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sun, 6 Sep 2020 23:58:43 +0200 Subject: [PATCH 1/6] Fix CIA reset defaults and unused register return value. --- src/cia.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cia.cpp b/src/cia.cpp index d668762a..e4db9699 100644 --- a/src/cia.cpp +++ b/src/cia.cpp @@ -1119,6 +1119,9 @@ static uae_u8 ReadCIAA (unsigned int addr, uae_u32 *flags) else return getciatod(ciaatod) >> 24; } + else { + return 0xff; + } break; case 12: #if KB_DEBUG @@ -1234,6 +1237,9 @@ static uae_u8 ReadCIAB (unsigned int addr, uae_u32 *flags) else return getciatod(ciabtod) >> 24; } + else { + return 0xff; + } break; case 12: return ciabsdr; @@ -1597,7 +1603,7 @@ void CIA_reset (void) ciaapra = 0; ciaadra = 0; ciaatod = ciabtod = 0; ciaatodon = ciabtodon = 0; ciaaicr = ciabicr = ciaaimask = ciabimask = 0; - ciaacra = ciaacrb = ciabcra = ciabcrb = 0x4; /* outmode = toggle; */ + ciaacra = ciaacrb = ciabcra = ciabcrb = 0; ciaala = ciaalb = ciabla = ciablb = ciaata = ciaatb = ciabta = ciabtb = 0xFFFF; ciaaalarm = ciabalarm = 0; ciabpra = 0x8C; ciabdra = 0; From 8367d954072461281b0d12ba28d1af3db6cc64cb Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Mon, 7 Sep 2020 00:00:24 +0200 Subject: [PATCH 2/6] Emulate HAM + DPF undocumented feature. --- src/drawing.cpp | 73 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/src/drawing.cpp b/src/drawing.cpp index 8e9c6e42..159c2ce6 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -2043,15 +2043,32 @@ static void init_ham_decoding (void) } #endif } else { - /* OCS/ECS mode HAM6 */ - while (unpainted_amiga-- > 0) { - int pv = pixdata.apixels[ham_decode_pixel++]; - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; - case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; - case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; - case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + if (!bpldualpf) { + /* OCS/ECS mode HAM6 */ + while (unpainted_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel++]; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + } + } + } + else { + /* OCS/ECS mode HAM6 + DPF */ + while (unpainted_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel++]; + int* lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; + int idx = lookup[pv]; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[idx] & 0xfff; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (idx & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (idx & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (idx & 0xF) << 4; break; + } } } } @@ -2106,17 +2123,35 @@ static void decode_ham (int pix, int stoppos, int blank) } #endif } else { - /* OCS/ECS mode HAM6 */ - while (todraw_amiga-- > 0) { - int pv = pixdata.apixels[ham_decode_pixel]; - switch (pv & 0x30) - { - case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; - case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; - case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; - case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + if (!bpldualpf) { + /* OCS/ECS mode HAM6 */ + while (todraw_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel]; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv] & 0xfff; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break; + } + ham_linebuf[ham_decode_pixel++] = ham_lastcolor; + } + } + else { + /* OCS/ECS mode HAM6 + DPF */ + while (todraw_amiga-- > 0) { + int pv = pixdata.apixels[ham_decode_pixel]; + int* lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1; + int idx = lookup[pv]; + switch (pv & 0x30) + { + case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[idx] & 0xfff; break; + case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (idx & 0xF); break; + case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (idx & 0xF) << 8; break; + case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (idx & 0xF) << 4; break; + } + ham_linebuf[ham_decode_pixel++] = ham_lastcolor; } - ham_linebuf[ham_decode_pixel++] = ham_lastcolor; } } } From f17a5661fa1e4ddff07733937af2391f3af4845f Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Mon, 7 Sep 2020 00:00:35 +0200 Subject: [PATCH 3/6] Updated beta version --- src/osdep/target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osdep/target.h b/src/osdep/target.h index 3644f364..16fcb56f 100644 --- a/src/osdep/target.h +++ b/src/osdep/target.h @@ -22,7 +22,7 @@ #define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define AMIBERRYVERSION _T("Amiberry v3.2.1 (2020-09-06)") +#define AMIBERRYVERSION _T("Amiberry v3.3 beta (2020-09-06)") #define AMIBERRYDATE MAKEBD(2020, 9, 6) #define IHF_WINDOWHIDDEN 6 From 79e918dc0b2582eba18a6463f7456ce9fbb986f4 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Thu, 10 Sep 2020 19:19:45 +0200 Subject: [PATCH 4/6] Minor sync of filesys to WinUAE --- src/filesys.cpp | 9 ++++++--- src/threaddep/thread.h | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/filesys.cpp b/src/filesys.cpp index c0c9b5e8..cbf44a37 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -31,6 +31,8 @@ #include "uae.h" #include "memory.h" #include "custom.h" +#include "events.h" +#include "newcpu.h" #include "filesys.h" #include "autoconf.h" #include "fsusage.h" @@ -700,7 +702,7 @@ static void fixcharset (TCHAR *s) if (!s) return; ua_fs_copy (tmp, MAX_DPATH, s, '_'); - au_fs_copy (s, int(strlen (tmp)) + 1, tmp); + au_fs_copy (s, strlen (tmp) + 1, tmp); } TCHAR *validatevolumename (TCHAR *s, const TCHAR *def) @@ -6447,7 +6449,7 @@ static void action_free_record64(TrapContext *ctx, Unit *unit, dpacket *packet) /* We don't want multiple interrupts to be active at the same time. I don't * know whether AmigaOS takes care of that, but this does. */ -static uae_sem_t singlethread_int_sem = 0; +static uae_sem_t singlethread_int_sem; #define SHELLEXEC_MAX_CMD_LEN 512 @@ -6810,6 +6812,7 @@ static int filesys_iteration(UnitInfo *ui) /* The message is sent by our interrupt handler, so make sure an interrupt happens. */ do_uae_int_requested(); + trap_background_set_complete(ctx); return 1; } @@ -8637,7 +8640,7 @@ void filesys_vsync (void) return; if (heartbeat_task & 1) { - setsystime_vblank(); + setsystime_vblank (); heartbeat_task &= ~1; } } diff --git a/src/threaddep/thread.h b/src/threaddep/thread.h index 677169e3..d7721e2a 100644 --- a/src/threaddep/thread.h +++ b/src/threaddep/thread.h @@ -45,7 +45,11 @@ STATIC_INLINE void uae_set_thread_priority(uae_thread_id* id, int pri) STATIC_INLINE void uae_end_thread(uae_thread_id* tid) { - SDL_WaitThread(*tid, static_cast(nullptr)); + if (tid) + { + SDL_WaitThread(*tid, static_cast(nullptr)); + *tid = NULL; + } } STATIC_INLINE long uae_start_thread(const TCHAR* name, int (*f)(void*), void* arg, uae_thread_id* foo) From a7889b77367ec6d5f9aeff3d1dbcb011b508abbe Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sun, 13 Sep 2020 16:22:19 +0200 Subject: [PATCH 5/6] Implemented #692: Correct Aspect Ratio option for SDL2 back-end --- src/osdep/amiberry_gfx.cpp | 23 ++++++++++++++++------- src/osdep/gui/PanelDisplay.cpp | 5 ----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp index f26f317b..7d95e91f 100644 --- a/src/osdep/amiberry_gfx.cpp +++ b/src/osdep/amiberry_gfx.cpp @@ -394,17 +394,16 @@ int graphics_setup(void) write_log("Trying to get Current Video Driver...\n"); sdl_video_driver = SDL_GetCurrentVideoDriver(); - SDL_DisplayMode current_mode; - const auto should_be_zero = SDL_GetCurrentDisplayMode(0, ¤t_mode); + const auto should_be_zero = SDL_GetCurrentDisplayMode(0, &sdlMode); if (should_be_zero == 0) { - write_log("Current Display mode: bpp %i\t%s\t%i x %i\t%iHz\n", SDL_BITSPERPIXEL(current_mode.format), SDL_GetPixelFormatName(current_mode.format), current_mode.w, current_mode.h, current_mode.refresh_rate); - host_hz = current_mode.refresh_rate; + write_log("Current Display mode: bpp %i\t%s\t%i x %i\t%iHz\n", SDL_BITSPERPIXEL(sdlMode.format), SDL_GetPixelFormatName(sdlMode.format), sdlMode.w, sdlMode.h, sdlMode.refresh_rate); + host_hz = sdlMode.refresh_rate; } Uint32 sdl_window_mode; if (sdl_video_driver != nullptr && strcmp(sdl_video_driver,"x11") == 0 - && current_mode.w >= 800 && current_mode.h >= 600) + && sdlMode.w >= 800 && sdlMode.h >= 600) { // Only enable Windowed mode if we're running under x11 and the resolution is at least 800x600 sdl_window_mode = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; @@ -825,8 +824,18 @@ static void open_screen(struct uae_prefs* p) //pixel_format = SDL_PIXELFORMAT_RGB565; display_depth = 32; pixel_format = SDL_PIXELFORMAT_RGBA32; - const auto width = display_width * 2 >> p->gfx_resolution; - const auto height = display_height * 2 >> p->gfx_vresolution; + int width, height; + + if (changed_prefs.gfx_correct_aspect == 0) + { + width = sdlMode.w; + height = sdlMode.h; + } + else + { + width = display_width * 2 >> p->gfx_resolution; + height = display_height * 2 >> p->gfx_vresolution; + } if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) { diff --git a/src/osdep/gui/PanelDisplay.cpp b/src/osdep/gui/PanelDisplay.cpp index 824d6733..18f9f53d 100644 --- a/src/osdep/gui/PanelDisplay.cpp +++ b/src/osdep/gui/PanelDisplay.cpp @@ -623,11 +623,6 @@ void RefreshPanelDisplay() chkBlackerThanBlack->setSelected(changed_prefs.gfx_blackerthanblack); chkAspect->setSelected(changed_prefs.gfx_correct_aspect); -#ifdef USE_DISPMANX - chkAspect->setEnabled(true); -#else - chkAspect->setEnabled(false); -#endif chkFilterLowRes->setSelected(changed_prefs.gfx_lores_mode); if (changed_prefs.gfx_apmode[0].gfx_fullscreen == GFX_WINDOW) From 481661fbf16a646b951451fb402945008cf406a7 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sun, 13 Sep 2020 16:23:03 +0200 Subject: [PATCH 6/6] Bumped version date --- src/osdep/target.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osdep/target.h b/src/osdep/target.h index 16fcb56f..6a2cad52 100644 --- a/src/osdep/target.h +++ b/src/osdep/target.h @@ -22,8 +22,8 @@ #define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define AMIBERRYVERSION _T("Amiberry v3.3 beta (2020-09-06)") -#define AMIBERRYDATE MAKEBD(2020, 9, 6) +#define AMIBERRYVERSION _T("Amiberry v3.3 beta (2020-09-13)") +#define AMIBERRYDATE MAKEBD(2020, 9, 13) #define IHF_WINDOWHIDDEN 6