From 56c391fe18ff76f3146b0853ab4ae10b6cd9d678 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 10 Jul 2022 22:21:18 +0300 Subject: [PATCH] GDI render updates, old DirectDraw limits are gone. --- main.cpp | 6 +- od-win32/direct3d.cpp | 6 +- od-win32/direct3d.h | 1 + od-win32/direct3d11.cpp | 2 + od-win32/gdirender.cpp | 251 +++++++++++++++++++++++++--------- od-win32/picasso96_win.cpp | 6 +- od-win32/rp.cpp | 6 +- od-win32/statusline_win32.cpp | 6 +- od-win32/win32.cpp | 33 ++--- od-win32/win32_scaler.cpp | 13 -- od-win32/win32gfx.cpp | 12 +- od-win32/win32gui.cpp | 82 +++++------ 12 files changed, 243 insertions(+), 181 deletions(-) diff --git a/main.cpp b/main.cpp index e8e956fa..45c6b778 100644 --- a/main.cpp +++ b/main.cpp @@ -199,7 +199,7 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) if (ap->gfx_backbuffers >= 2) ap->gfx_vflip = -1; } - if (prefs->gf[i].gfx_filter == 0 && ((prefs->gf[i].gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode))) { + if (prefs->gf[i].gfx_filter == 0) { prefs->gf[i].gfx_filter = 1; } if (i == 0) { @@ -422,10 +422,6 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig) #ifdef _WIN32 if (p->monitoremu && p->monitoremu_mon > 0) { - if (!p->gfx_api) { - p->monitoremu_mon = 0; - error_log(_T("Multi virtual monitor support requires Direct3D mode.")); - } if (isfullscreen() != 0) { p->monitoremu_mon = 0; error_log(_T("Multi virtual monitor support requires windowed mode.")); diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index d7bf6fd2..8ce1750e 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -3680,8 +3680,9 @@ static bool xD3D_setcursor(int monid, int x, int y, int width, int height, float { struct d3dstruct *d3d = &d3ddata[monid]; - if (width < 0 || height < 0) - return true; + if (width < 0 || height < 0) { + return xD3D_goodenough() > 0; + } if (width && height) { d3d->cursor_offset2_x = d3d->cursor_offset_x * d3d->window_w / width; @@ -4239,6 +4240,7 @@ void d3d9_select(void) D3D_led = xD3D_led; D3D_getscanline = xD3D_getscanline; D3D_extoverlay = xD3D_extoverlay; + D3D_paint = NULL; } #endif diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index 255ead5e..09ffad88 100644 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -35,6 +35,7 @@ extern int(*D3D_debug)(int, int); extern void(*D3D_led)(int, int, int); extern bool(*D3D_getscanline)(int*, bool*); extern bool(*D3D_extoverlay)(struct extoverlay*); +extern void(*D3D_paint)(void); extern LPDIRECT3DSURFACE9 D3D_capture(int, int*,int*,int*,bool); extern bool D3D11_capture(int, void**,int*, int*,int*,bool); diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 4e343167..670f5b43 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -71,6 +71,7 @@ int(*D3D_debug)(int, int); void(*D3D_led)(int, int, int); bool(*D3D_getscanline)(int*, bool*); bool(*D3D_extoverlay)(struct extoverlay*); +void(*D3D_paint)(void); static HMODULE hd3d11, hdxgi, hd3dcompiler, dwmapi; @@ -5410,6 +5411,7 @@ void d3d11_select(void) D3D_led = xD3D11_led; D3D_getscanline = NULL; D3D_extoverlay = xD3D11_extoverlay; + D3D_paint = NULL; } void d3d_select(struct uae_prefs *p) diff --git a/od-win32/gdirender.cpp b/od-win32/gdirender.cpp index bd9a0ed4..85bdab5e 100644 --- a/od-win32/gdirender.cpp +++ b/od-win32/gdirender.cpp @@ -15,6 +15,7 @@ #include "statusline.h" #include "uae.h" #include "direct3d.h" +#include "gfxfilter.h" struct gdibm { @@ -32,51 +33,98 @@ struct gdistruct { int enabled; int num; - int width, height, depth; int wwidth, wheight; + int depth; HWND hwnd; HDC hdc; - HDC thdc; - HBITMAP hbm; HGDIOBJ oldbm; - void *bits; - int pitch; int statusbar_hx, statusbar_vx; int ledwidth, ledheight; + struct gdibm bm; + struct gdibm buf; struct gdibm osd; + struct gdibm cursor; + + float cursor_x, cursor_y; + float cursor_mx, cursor_my; + bool cursor_v, cursor_scale; + + RECT sr2, dr2, zr2; + int dmult, dmultxh, dmultxv; + int xoffset, yoffset; + float xmult, ymult; + int cursor_offset_x, cursor_offset_y, cursor_offset2_x, cursor_offset2_y; + + int bmxoffset, bmyoffset; + int bmwidth, bmheight; + bool refreshneeded; + bool eraseneeded; }; static struct gdistruct gdidata[MAX_AMIGAMONITORS]; -static void gdi_refresh(int monid) +static void gdi_restore(int monid, bool checkonly) { struct gdistruct *gdi = &gdidata[monid]; } -static void gdi_restore(int monid, bool checkonly) +static void setupscenecoords(struct gdistruct *gdi) { - struct gdistruct *gdi = &gdidata[monid]; + RECT sr, dr, zr; + + getfilterrect2(gdi->num, &dr, &sr, &zr, gdi->wwidth, gdi->wheight, gdi->bm.width / gdi->dmult, gdi->bm.height / gdi->dmult, gdi->dmult, gdi->bm.width, gdi->bm.height); + + if (0 && !memcmp(&sr, &gdi->sr2, sizeof RECT) && !memcmp(&dr, &gdi->dr2, sizeof RECT) && !memcmp(&zr, &gdi->zr2, sizeof RECT)) { + return; + } + if (1) { + write_log(_T("POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d) S=%d*%d B=%d*%d\n"), + dr.left, dr.top, dr.right, dr.bottom, + sr.left, sr.top, sr.right, sr.bottom, + sr.right - sr.left, sr.bottom - sr.top, + zr.left, zr.top, + gdi->wwidth, gdi->wheight, + gdi->bm.width, gdi->bm.height); + } + + gdi->sr2 = sr; + gdi->dr2 = dr; + gdi->zr2 = zr; + + int w = sr.right - sr.left; + int h = sr.bottom - sr.top; + + int dw = dr.right - dr.left; + int dh = dr.bottom - dr.top; + + gdi->xmult = (float)gdi->wwidth / w; + gdi->ymult = (float)gdi->wheight / h; + + gdi->bmwidth = gdi->bm.width * gdi->xmult; + gdi->bmheight = gdi->bm.height * gdi->ymult; + + gdi->bmxoffset = (gdi->wwidth - gdi->bm.width) / 2; + gdi->bmyoffset = (gdi->wheight - gdi->bm.height) / 2; + +// gdi->bmxoffset -= zr.left / gdi->xmult; +// gdi->bmxoffset = (gdi->wwidth - w * gdi->xmult) / 2; +// gdi->bmyoffset = (gdi->wheight - h * gdi->ymult) / 2; + + //gdi->bmxoffset += (dw - gdi->wwidth) / gdi->xmult / 2; + +// gdi->bmxoffset += zr.left * gdi->xmult - ((sr.right - sr.left) - gdi->wwidth); +// gdi->bmyoffset = (gdi->wheight - gdi->bm.height) / 2; +// gdi->bmyoffset += zr.top * gdi->ymult - ((sr.bottom - sr.top) - gdi->wheight); + + gdi->eraseneeded = true; } -static void freetexture(int monid) +static void gdi_clear(int monid) { struct gdistruct *gdi = &gdidata[monid]; + if (gdi->hdc) { - if (gdi->thdc) { - if (gdi->hbm) { - if (gdi->oldbm) { - SelectObject(gdi->thdc, gdi->oldbm); - } - DeleteObject(gdi->hbm); - } - gdi->oldbm = NULL; - gdi->hbm = NULL; - gdi->bits = NULL; - DeleteDC(gdi->thdc); - gdi->thdc = NULL; - } - ReleaseDC(gdi->hwnd, gdi->hdc); - gdi->hdc = NULL; + Rectangle(gdi->hdc, 0, 0, gdi->wwidth, gdi->wheight); } } @@ -97,12 +145,17 @@ static void freesprite(struct gdistruct *gdi, struct gdibm *bm) } } +static void freetexture(int monid) +{ + struct gdistruct *gdi = &gdidata[monid]; + freesprite(gdi, &gdi->bm); +} + static bool allocsprite(struct gdistruct *gdi, struct gdibm *bm, int w, int h) { bm->thdc = CreateCompatibleDC(gdi->hdc); if (bm->thdc) { BITMAPV4HEADER bmi = { 0 }; - bmi.bV4Size = sizeof(BITMAPINFOHEADER); bmi.bV4Width = w; bmi.bV4Height = -h; @@ -113,10 +166,14 @@ static bool allocsprite(struct gdistruct *gdi, struct gdibm *bm, int w, int h) bm->height = h; bm->depth = gdi->depth; bm->pitch = ((w * bmi.bV4BitCount + 31) / 32) * 4; - bmi.bV4SizeImage = gdi->pitch * h; + bmi.bV4SizeImage = bm->pitch * h; bm->hbm = CreateDIBSection(gdi->hdc, (const BITMAPINFO*)&bmi, DIB_RGB_COLORS, &bm->bits, NULL, 0); if (bm->hbm) { bm->oldbm = SelectObject(bm->thdc, bm->hbm); + SelectObject(bm->thdc, GetStockObject(DC_PEN)); + SelectObject(bm->thdc, GetStockObject(DC_BRUSH)); + SetDCPenColor(bm->thdc, RGB(0, 0, 0)); + SetDCBrushColor(bm->thdc, RGB(0, 0, 0)); return true; } } @@ -131,25 +188,14 @@ static bool gdi_alloctexture(int monid, int w, int h) gdi->hdc = GetDC(gdi->hwnd); if (gdi->hdc) { - gdi->thdc = CreateCompatibleDC(gdi->hdc); - if (gdi->thdc) { - BITMAPV4HEADER bmi = { 0 }; - - bmi.bV4Size = sizeof(BITMAPINFOHEADER); - bmi.bV4Width = w; - bmi.bV4Height = -h; - bmi.bV4Planes = 1; - bmi.bV4V4Compression = BI_RGB; - bmi.bV4BitCount = gdi->depth; - gdi->width = w; - gdi->height = h; - gdi->pitch = ((w * bmi.bV4BitCount + 31) / 32) * 4; - bmi.bV4SizeImage = gdi->pitch * h; - gdi->hbm = CreateDIBSection(gdi->hdc, (const BITMAPINFO*)&bmi, DIB_RGB_COLORS, &gdi->bits, NULL, 0); - if (gdi->hbm) { - gdi->oldbm = SelectObject(gdi->thdc, gdi->hbm); - return true; - } + SelectObject(gdi->hdc, GetStockObject(DC_PEN)); + SelectObject(gdi->hdc, GetStockObject(DC_BRUSH)); + SetDCPenColor(gdi->hdc, RGB(0, 0, 0)); + SetDCBrushColor(gdi->hdc, RGB(0, 0, 0)); + if (allocsprite(gdi, &gdi->bm, w, h)) { + gdi->dmult = S2X_getmult(monid); + setupscenecoords(gdi); + return true; } } freetexture(monid); @@ -199,11 +245,11 @@ static void gdi_guimode(int monid, int guion) static uae_u8 *gdi_locktexture(int monid, int *pitch, int *height, int fullupdate) { struct gdistruct *gdi = &gdidata[monid]; - if (gdi->bits) { - *pitch = gdi->pitch; + if (gdi->bm.bits) { + *pitch = gdi->bm.pitch; if (height) - *height = gdi->height; - return (uae_u8*)gdi->bits; + *height = gdi->bm.height; + return (uae_u8*)gdi->bm.bits; } return NULL; } @@ -230,19 +276,53 @@ static bool gdi_renderframe(int monid, int mode, bool immediate) { struct gdistruct *gdi = &gdidata[monid]; - return gdi->hbm != NULL; + return gdi->bm.hbm != NULL; +} + +static void gdi_paint(void) +{ + for (int monid = 0; monid < MAX_AMIGAMONITORS; monid++) { + struct gdistruct *gdi = &gdidata[monid]; + if (!gdi->refreshneeded) { + continue; + } + gdi->refreshneeded = false; + + if (gdi->eraseneeded) { + Rectangle(gdi->buf.thdc, 0, 0, gdi->buf.width, gdi->buf.height); + gdi->eraseneeded = false; + } + + if (gdi->bm.hbm) { + setupscenecoords(gdi); + StretchBlt(gdi->buf.thdc, gdi->bmxoffset, gdi->bmyoffset, gdi->bmwidth, gdi->bmheight, gdi->bm.thdc, 0, 0, gdi->bm.width, gdi->bm.height, SRCCOPY); + } + if (gdi->cursor.active && gdi->cursor.hbm) { + TransparentBlt(gdi->buf.thdc, gdi->cursor.x, gdi->cursor.y, CURSORMAXWIDTH, CURSORMAXHEIGHT, gdi->cursor.thdc, 0, 0, CURSORMAXWIDTH, CURSORMAXHEIGHT, 0x000000); + } + if (gdi->osd.active && gdi->osd.hbm) { + TransparentBlt(gdi->buf.thdc, gdi->osd.x, gdi->osd.y, gdi->ledwidth, gdi->ledheight, gdi->osd.thdc, 0, 0, gdi->ledwidth, gdi->ledheight, 0x000000); + } + BitBlt(gdi->hdc, 0, 0, gdi->wwidth, gdi->wheight, gdi->buf.thdc, 0, 0, SRCCOPY); + } } static void gdi_showframe(int monid) { struct gdistruct *gdi = &gdidata[monid]; + gdi->refreshneeded = true; + RECT r; + r.left = 0; + r.top = 0; + r.right = gdi->wwidth; + r.bottom = gdi->wheight; + InvalidateRect(gdi->hwnd, &r, FALSE); +} - if (gdi->hbm) { - StretchBlt(gdi->hdc, 0, 0, gdi->wwidth, gdi->wheight, gdi->thdc, 0, 0, gdi->width, gdi->height, SRCCOPY); - } - if (gdi->osd.active && gdi->osd.hbm) { - TransparentBlt(gdi->hdc, gdi->osd.x, gdi->osd.y, gdi->ledwidth, gdi->ledheight, gdi->osd.thdc, 0, 0, gdi->ledwidth, gdi->ledheight, 0x000000); - } +static void gdi_refresh(int monid) +{ + gdi_clear(monid); + gdi_showframe(monid); } void gdi_free(int monid, bool immediate) @@ -250,6 +330,8 @@ void gdi_free(int monid, bool immediate) struct gdistruct *gdi = &gdidata[monid]; gdi->enabled = 0; freetexture(monid); + freesprite(gdi, &gdi->osd); + freesprite(gdi, &gdi->cursor); } static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv) @@ -264,15 +346,17 @@ static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, gdi->depth = depth; gdi->wwidth = w_w; gdi->wheight = w_h; + if (allocsprite(gdi, &gdi->buf, gdi->wwidth, gdi->wheight)) { + gdi->statusbar_hx = gdi->statusbar_vx = statusline_set_multiplier(monid, gdi->wwidth, gdi->wheight) / 100; + gdi->ledwidth = gdi->wwidth; + gdi->ledheight = TD_TOTAL_HEIGHT * gdi->statusbar_vx; + allocsprite(gdi, &gdi->osd, gdi->ledwidth, gdi->ledheight); + allocsprite(gdi, &gdi->cursor, CURSORMAXWIDTH, CURSORMAXHEIGHT); + gdi->enabled = 1; + return NULL; + } - gdi->statusbar_hx = gdi->statusbar_vx = statusline_set_multiplier(monid, gdi->wwidth, gdi->wheight) / 100; - gdi->ledwidth = gdi->wwidth; - gdi->ledheight = TD_TOTAL_HEIGHT * gdi->statusbar_vx; - allocsprite(gdi, &gdi->osd, gdi->ledwidth, gdi->ledheight); - - gdi->enabled = 1; - - return NULL; + return _T("failed to allocate buffer"); } static HDC gdi_getDC(int monid, HDC hdc) @@ -291,9 +375,41 @@ static int gdi_isenabled(int monid) return gdi->enabled ? -1 : 0; } -static void gdi_clear(int monid) +static bool gdi_setcursor(int monid, int x, int y, int width, int height, float mx, float my, bool visible, bool noscale) { struct gdistruct *gdi = &gdidata[monid]; + + if (width < 0 || height < 0) { + return true; + } + + if (width && height) { + gdi->cursor_offset2_x = gdi->cursor_offset_x * gdi->wwidth / width; + gdi->cursor_offset2_y = gdi->cursor_offset_y * gdi->wheight / height; + gdi->cursor_x = (float)x * gdi->wwidth / width; + gdi->cursor_y = (float)y * gdi->wheight / height; + gdi->cursor_mx = mx; + gdi->cursor_my = my; + } else { + gdi->cursor_x = gdi->cursor_y = 0; + gdi->cursor_offset2_x = gdi->cursor_offset2_y = 0; + } + gdi->cursor_scale = !noscale; + gdi->cursor.active = visible; + return true; + + return false; +} + +static uae_u8 *gdi_setcursorsurface(int monid, int *pitch) +{ + struct gdistruct* gdi = &gdidata[monid]; + + if (pitch) { + *pitch = gdi->cursor.pitch; + return (uae_u8*)gdi->cursor.bits; + } + return NULL; } void gdi_select(void) @@ -322,8 +438,8 @@ void gdi_select(void) D3D_clear = gdi_clear; D3D_canshaders = NULL; D3D_goodenough = NULL; - D3D_setcursor = NULL; - D3D_setcursorsurface = NULL; + D3D_setcursor = gdi_setcursor; + D3D_setcursorsurface = gdi_setcursorsurface; D3D_getrefreshrate = NULL; D3D_resize = NULL; D3D_change = NULL; @@ -333,4 +449,5 @@ void gdi_select(void) D3D_led = NULL; D3D_getscanline = NULL; D3D_extoverlay = NULL; + D3D_paint = gdi_paint; } diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index d877a81d..d89236e4 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -2692,7 +2692,7 @@ static void inituaegfx(TrapContext *ctx, uaecptr ABI) flags |= BIF_NOMEMORYMODEMIX; flags |= BIF_GRANTDIRECTACCESS; flags &= ~BIF_HARDWARESPRITE; - if (currprefs.gfx_api && D3D_goodenough () > 0 && D3D_setcursor && D3D_setcursor(0, -1, -1, -1, -1, 0, 0, false, false) && USE_HARDWARESPRITE && currprefs.rtg_hardwaresprite) { + if (D3D_setcursor && D3D_setcursor(0, -1, -1, -1, -1, 0, 0, false, false) && USE_HARDWARESPRITE && currprefs.rtg_hardwaresprite) { hwsprite = 1; flags |= BIF_HARDWARESPRITE; write_log (_T("P96: Hardware sprite support enabled\n")); @@ -4532,9 +4532,7 @@ void picasso_statusline(int monid, uae_u8 *dst) dst_width = vidinfo->width; pitch = vidinfo->rowbytes; statusline_getpos(monid, &slx, &sly, state->Width, dst_height); - if (currprefs.gfx_api) { - statusline_render(monid, dst + sly * pitch, vidinfo->pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); - } + statusline_render(monid, dst + sly * pitch, vidinfo->pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); int m = statusline_get_multiplier(monid) / 100; for (y = 0; y < TD_TOTAL_HEIGHT * m; y++) { uae_u8 *buf = dst + (y + sly) * pitch; diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 084449b0..f239109f 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1698,8 +1698,7 @@ static void sendfeatures (void) if (currprefs.gfx_api) feat |= RP_FEATURE_SCREENOVERLAY; if (WIN32GFX_IsPicassoScreen(mon)) { - if (currprefs.gfx_api) - feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN3X | RP_FEATURE_SCREEN4X; + feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN3X | RP_FEATURE_SCREEN4X; } else { feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN3X | RP_FEATURE_SCREEN4X; feat |= RP_FEATURE_SCALING_SUBPIXEL | RP_FEATURE_SCALING_STRETCH | RP_FEATURE_SCANLINES; @@ -1763,8 +1762,7 @@ void rp_fixup_options (struct uae_prefs *p) rp_filter_default = rp_filter = currprefs.gf[0].gfx_filter; if (rp_filter == 0) { rp_filter = UAE_FILTER_NULL; - if (currprefs.gfx_api) - changed_prefs.gf[0].gfx_filter = currprefs.gf[0].gfx_filter = rp_filter; + changed_prefs.gf[0].gfx_filter = currprefs.gf[0].gfx_filter = rp_filter; } fixup_size (p); diff --git a/od-win32/statusline_win32.cpp b/od-win32/statusline_win32.cpp index 4ab7ad31..1520c381 100644 --- a/od-win32/statusline_win32.cpp +++ b/od-win32/statusline_win32.cpp @@ -26,9 +26,7 @@ static char *td_new_numbers; bool softstatusline(void) { - if (currprefs.gfx_api > 0) - return false; - return (currprefs.leds_on_screen & STATUSLINE_TARGET) == 0; + return false; } void deletestatusline(int monid) @@ -279,8 +277,6 @@ void statusline_render(int monid, uae_u8 *buf, int bpp, int pitch, int width, in if (monid) return; - if (currprefs.gf[WIN32GFX_IsPicassoScreen(mon)].gfx_filter == 0 && !currprefs.gfx_api) - return; text = statusline_fetch(); //text = _T("Testing string 123!"); if (!text) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index c6baa4a7..720a0e45 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -2098,18 +2098,17 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, case WM_PAINT: { - static int recursive = 0; - if (recursive == 0) { - PAINTSTRUCT ps; - recursive++; - notice_screen_contents_lost(mon->monitor_id); - hDC = BeginPaint(hWnd, &ps); - /* Check to see if this WM_PAINT is coming while we've got the GUI visible */ - if (mon->manual_painting_needed) - updatedisplayarea(mon->monitor_id); - EndPaint(hWnd, &ps); - recursive--; + PAINTSTRUCT ps; + hDC = BeginPaint(hWnd, &ps); + if (D3D_paint) { + D3D_paint(); } + /* Check to see if this WM_PAINT is coming while we've got the GUI visible */ + if (mon->manual_painting_needed) { + updatedisplayarea(mon->monitor_id); + } + mon->manual_painting_needed = 0; + EndPaint(hWnd, &ps); } return 0; @@ -4183,19 +4182,11 @@ void target_fixup_options (struct uae_prefs *p) nojoy = true; } - if (p->rtg_hardwaresprite && !p->gfx_api) { - error_log(_T("GDI is not RTG hardware sprite compatible.")); - p->rtg_hardwaresprite = false; - } if (p->rtgboards[0].rtgmem_type >= GFXBOARD_HARDWARE) { p->rtg_hardwareinterrupt = false; p->rtg_hardwaresprite = false; p->win32_rtgmatchdepth = false; p->color_mode = 5; - if (p->ppc_model && !p->gfx_api) { - error_log(_T("Graphics board and PPC: Direct3D enabled.")); - p->gfx_api = os_win7 ? 2 : 1; - } } struct MultiDisplay *md = getdisplay(p, 0); @@ -4296,9 +4287,9 @@ void target_default_options (struct uae_prefs *p, int type) p->gfx_api = os_win7 ? 2 : (os_vista ? 1 : 0); if (p->gfx_api > 1) p->color_mode = 5; - if (p->gf[APMODE_NATIVE].gfx_filter == 0 && p->gfx_api) + if (p->gf[APMODE_NATIVE].gfx_filter == 0) p->gf[APMODE_NATIVE].gfx_filter = 1; - if (p->gf[APMODE_RTG].gfx_filter == 0 && p->gfx_api) + if (p->gf[APMODE_RTG].gfx_filter == 0) p->gf[APMODE_RTG].gfx_filter = 1; WIN32GUI_LoadUIString (IDS_INPUT_CUSTOM, buf, sizeof buf / sizeof (TCHAR)); for (int i = 0; i < GAMEPORT_INPUT_SETTINGS; i++) diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 595eb17e..12e4f387 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -269,12 +269,6 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int store_custom_limits (-1, -1, -1, -1); - if (!usedfilter && !currprefs.gfx_api) { - filter_horiz_zoom = filter_vert_zoom = 0.0; - filter_horiz_zoom_mult = filter_vert_zoom_mult = 1.0; - filter_horiz_offset = filter_vert_offset = 0.0; - } - if (mon->screen_is_picasso) { getrtgfilterrect2(monid, sr, dr, zr, dst_width, dst_height); if (D3D_getscalerect && D3D_getscalerect(monid, &mrmx, &mrmy, &mrsx, &mrsy, dst_width, dst_height)) { @@ -529,13 +523,6 @@ void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int doautoaspect = get_auto_aspect_ratio(monid, cw, ch, crealh, scalemode, &autoaspectratio); } - if (currprefs.gfx_api == 0) { - if (cx < 0) - cx = 0; - if (cy < 0) - cy = 0; - } - if (cv) { int diff; diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 5bac7d25..bb323518 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -72,9 +72,6 @@ #define SM_WINDOW 0 #define SM_FULLSCREEN_DX 2 -#define SM_OPENGL_WINDOW 3 -#define SM_OPENGL_FULLWINDOW 9 -#define SM_OPENGL_FULLSCREEN_DX 4 #define SM_D3D_WINDOW 5 #define SM_D3D_FULLWINDOW 10 #define SM_D3D_FULLSCREEN_DX 6 @@ -3916,13 +3913,8 @@ retry: if (!mon->screen_is_picasso) { - if (currprefs.gfx_api == 0 && currprefs.gf[0].gfx_filter == 0) { - allocsoftbuffer(mon->monitor_id, _T("draw"), &avidinfo->drawbuffer, mon->currentmode.flags, - mon->currentmode.native_width, mon->currentmode.native_height, mon->currentmode.current_depth); - } else { - allocsoftbuffer(mon->monitor_id, _T("draw"), &avidinfo->drawbuffer, mon->currentmode.flags, - 1920, 1280, mon->currentmode.current_depth); - } + allocsoftbuffer(mon->monitor_id, _T("draw"), &avidinfo->drawbuffer, mon->currentmode.flags, + 1920, 1280, mon->currentmode.current_depth); if (currprefs.monitoremu || currprefs.cs_cd32fmv || (currprefs.genlock && currprefs.genlock_image) || currprefs.cs_color_burst || currprefs.gfx_grayscale) { allocsoftbuffer(mon->monitor_id, _T("monemu"), &avidinfo->tempbuffer, mon->currentmode.flags, mon->currentmode.amiga_width > 1024 ? mon->currentmode.amiga_width : 1024, diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 8b0cb2bd..0a7617e3 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -280,40 +280,40 @@ struct GUIPAGE { }; static struct GUIPAGE ppage[MAX_C_PAGES]; -static bool ischecked (HWND hDlg, DWORD id) +static bool ischecked(HWND hDlg, DWORD id) { - return IsDlgButtonChecked (hDlg, id) == BST_CHECKED; + return IsDlgButtonChecked(hDlg, id) == BST_CHECKED; } -static void setchecked (HWND hDlg, DWORD id, bool checked) +static void setchecked(HWND hDlg, DWORD id, bool checked) { - CheckDlgButton (hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); } -static void setfocus (HWND hDlg, int id) +static void setfocus(HWND hDlg, int id) { - SendMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem (hDlg, id), TRUE); + SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, id), TRUE); } -static void ew (HWND hDlg, DWORD id, int enable) +static void ew(HWND hDlg, DWORD id, int enable) { if (id == -1) return; - HWND w = GetDlgItem (hDlg, id); + HWND w = GetDlgItem(hDlg, id); if (!w) return; - if (!enable && w == GetFocus ()) - SendMessage (hDlg, WM_NEXTDLGCTL, 0, FALSE); - EnableWindow (w, !!enable); + if (!enable && w == GetFocus()) + SendMessage(hDlg, WM_NEXTDLGCTL, 0, FALSE); + EnableWindow(w, !!enable); } -static void hide (HWND hDlg, DWORD id, int hide) +static void hide(HWND hDlg, DWORD id, int hide) { HWND w; if (id == -1) return; - w = GetDlgItem (hDlg, id); + w = GetDlgItem(hDlg, id); if (!w) return; - if (hide && w == GetFocus ()) - SendMessage (hDlg, WM_NEXTDLGCTL, 0, FALSE); - ShowWindow (w, hide ? SW_HIDE : SW_SHOW); + if (hide && w == GetFocus()) + SendMessage(hDlg, WM_NEXTDLGCTL, 0, FALSE); + ShowWindow(w, hide ? SW_HIDE : SW_SHOW); } static void parsefilepath(TCHAR *path, int maxlen) @@ -11219,11 +11219,7 @@ static void enable_for_expansiondlg(HWND hDlg) ew(hDlg, IDC_RTG_DISPLAYSELECT, rtg2); ew(hDlg, IDC_RTG_VBINTERRUPT, rtg3); ew(hDlg, IDC_RTG_THREAD, rtg3 && en); - if (!workprefs.gfx_api) { - workprefs.rtg_hardwaresprite = false; - CheckDlgButton(hDlg, IDC_RTG_HWSPRITE, FALSE); - } - ew(hDlg, IDC_RTG_HWSPRITE, rtg3 && workprefs.gfx_api); + ew(hDlg, IDC_RTG_HWSPRITE, rtg3); } static void values_to_expansiondlg(HWND hDlg) @@ -12289,7 +12285,7 @@ static void enable_for_miscdlg (HWND hDlg) ew (hDlg, IDC_ASSOCIATELIST, !rp_isactive ()); ew (hDlg, IDC_ASSOCIATE_ON, !rp_isactive ()); ew (hDlg, IDC_ASSOCIATE_OFF, !rp_isactive ()); - ew (hDlg, IDC_DXMODE_OPTIONS, workprefs.gfx_api == 2 || (full_property_sheet && workprefs.gfx_api == 0)); + ew (hDlg, IDC_DXMODE_OPTIONS, workprefs.gfx_api == 2); bool paused = false; bool nosound = false; @@ -19611,9 +19607,7 @@ static void enable_for_hw3ddlg (HWND hDlg) if (v && uf->yuv) { vv2 = TRUE; } - if (workprefs.gfx_api) { - v = vv = vv2 = vv3 = vv4 = TRUE; - } + v = vv = vv2 = vv3 = vv4 = TRUE; if (filter_nativertg) { vv4 = FALSE; } @@ -19622,16 +19616,16 @@ static void enable_for_hw3ddlg (HWND hDlg) ew(hDlg, IDC_FILTERHZMULT, v && !as); ew(hDlg, IDC_FILTERVZMULT, v && !as); - ew(hDlg, IDC_FILTERHZ, v); - ew(hDlg, IDC_FILTERVZ, v); + ew(hDlg, IDC_FILTERHZ, v && vv4); + ew(hDlg, IDC_FILTERVZ, v && vv4); ew(hDlg, IDC_FILTERHO, v && vv4); ew(hDlg, IDC_FILTERVO, v && vv4); ew(hDlg, IDC_FILTERSLR, vv3); ew(hDlg, IDC_FILTERXL, vv2); ew(hDlg, IDC_FILTERXLV, vv2); ew(hDlg, IDC_FILTERXTRA, vv2); - ew(hDlg, IDC_FILTERFILTERH, workprefs.gfx_api); - ew(hDlg, IDC_FILTERFILTERV, workprefs.gfx_api); + ew(hDlg, IDC_FILTERFILTERH, TRUE); + ew(hDlg, IDC_FILTERFILTERV, TRUE); ew(hDlg, IDC_FILTERSTACK, workprefs.gfx_api); ew(hDlg, IDC_FILTERKEEPASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO); ew(hDlg, IDC_FILTERASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO); @@ -20276,14 +20270,12 @@ static void filter_handle (HWND hDlg) workprefs.gf[filter_nativertg].gfx_filter = 0; workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = 0; workprefs.gf[filter_nativertg].gfx_filter_filtermodev = 0; - if (workprefs.gfx_api) { - LRESULT item2 = xSendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_GETCURSEL, 0, 0L); - if (item2 != CB_ERR) - workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = (int)item2; - item2 = xSendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_GETCURSEL, 0, 0L); - if (item2 != CB_ERR) - workprefs.gf[filter_nativertg].gfx_filter_filtermodev = (int)item2; - } + LRESULT item2 = xSendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_GETCURSEL, 0, 0L); + if (item2 != CB_ERR) + workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = (int)item2; + item2 = xSendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_GETCURSEL, 0, 0L); + if (item2 != CB_ERR) + workprefs.gf[filter_nativertg].gfx_filter_filtermodev = (int)item2; if (item > 0) { if (item > UAE_FILTER_LAST) { _stprintf (workprefs.gf[filter_nativertg].gfx_filtershader[filterstackpos], _T("%s.fx"), tmp + 5); @@ -20303,8 +20295,6 @@ static void filter_handle (HWND hDlg) if (workprefs.gf[filter_nativertg].gfx_filtershader[i][0]) workprefs.gf[filter_nativertg].gfx_filter = UAE_FILTER_NULL; } - if (workprefs.gf[filter_nativertg].gfx_filter == 0 && !workprefs.gfx_api) - workprefs.gf[filter_nativertg].gfx_filter_autoscale = 0; } int overlaytype = xSendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_GETCURSEL, 0, 0L); @@ -20515,8 +20505,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (item == AUTOSCALE_SEPARATOR) item++; workprefs.gf[filter_nativertg].gfx_filter_autoscale = item; - if (workprefs.gf[filter_nativertg].gfx_filter_autoscale && workprefs.gf[filter_nativertg].gfx_filter == 0 && !workprefs.gfx_api) - workprefs.gf[filter_nativertg].gfx_filter = 1; // NULL values_to_hw3ddlg (hDlg, false); enable_for_hw3ddlg (hDlg); } @@ -20637,14 +20625,8 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM xSendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_horiz_zoom); } } - if (fd->gfx_filter_horiz_zoom != fdwp->gfx_filter_horiz_zoom) { - fdwp->gfx_filter_horiz_zoom = fd->gfx_filter_horiz_zoom; - fdwp->changed = true; - } - if (fd->gfx_filter_vert_zoom != fdwp->gfx_filter_vert_zoom) { - fdwp->gfx_filter_vert_zoom = fd->gfx_filter_vert_zoom; - fdwp->changed = true; - } + fdwp->gfx_filter_horiz_zoom = fd->gfx_filter_horiz_zoom; + fdwp->gfx_filter_vert_zoom = fd->gfx_filter_vert_zoom; fdwp->gfx_filter_horiz_offset = (float)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0); fdwp->gfx_filter_vert_offset = (float)SendMessage(GetDlgItem(hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0); fd->gfx_filter_horiz_offset = fdwp->gfx_filter_horiz_offset; @@ -21676,7 +21658,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) drv = pt.x - window_led_drives; drv /= (window_led_drives_end - window_led_drives) / 4; drvdrag = 1; - if (drv < 0 || drv > 3) + if (drv < 0 || drv >= currprefs.nr_floppies) drv = 0; corner = -2; } -- 2.47.3