From: Toni Wilen Date: Tue, 21 Feb 2023 16:20:51 +0000 (+0200) Subject: Display rotation option (currently D3D9 only), to support Fast Draw Showdown (America... X-Git-Tag: 5.0.0~135 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=1f521d0744cb283509be3e854fc4d31bd515811b;p=francis%2Fwinuae.git Display rotation option (currently D3D9 only), to support Fast Draw Showdown (American Laser games) --- diff --git a/cfgfile.cpp b/cfgfile.cpp index a651e04a..d75c9128 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2394,6 +2394,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool(f, _T("gfx_vrr_monitor"), p->gfx_variable_sync != 0); cfgfile_dwrite_strarr(f, _T("gfx_overscanmode"), overscanmodes, p->gfx_overscanmode); cfgfile_dwrite(f, _T("gfx_monitorblankdelay"), _T("%d"), p->gfx_monitorblankdelay); + cfgfile_dwrite(f, _T("gfx_rotation"), _T("%d"), p->gfx_rotation); #ifdef GFXFILTER for (int j = 0; j < MAX_FILTERDATA; j++) { @@ -3606,6 +3607,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval(option, value, _T("gfx_horizontal_extra"), &p->gfx_extrawidth, 1) || cfgfile_intval(option, value, _T("gfx_vertical_extra"), &p->gfx_extraheight, 1) || cfgfile_intval(option, value, _T("gfx_monitorblankdelay"), &p->gfx_monitorblankdelay, 1) + || cfgfile_intval(option, value, _T("gfx_rotation"), &p->gfx_rotation, 1) || cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1) || cfgfile_intval (option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1) diff --git a/include/options.h b/include/options.h index c00a70b0..0668b632 100644 --- a/include/options.h +++ b/include/options.h @@ -609,6 +609,7 @@ struct uae_prefs { bool gfx_windowed_resize; int gfx_overscanmode; int gfx_monitorblankdelay; + int gfx_rotation; struct gfx_filterdata gf[3]; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 5b0a4af3..1101d1b4 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -253,7 +253,7 @@ static TCHAR *D3D_ErrorString (HRESULT dival) return dierr; } -static D3DXMATRIX* MatrixOrthoOffCenterLH (D3DXMATRIXA16 *pOut, float l, float r, float b, float t, float zn, float zf) +static D3DXMATRIX* MatrixOrthoOffCenterLH(D3DXMATRIXA16 *pOut, float l, float r, float b, float t, float zn, float zf) { pOut->_11=2.0f/r; pOut->_12=0.0f; pOut->_13=0.0f; pOut->_14=0.0f; pOut->_21=0.0f; pOut->_22=2.0f/t; pOut->_23=0.0f; pOut->_24=0.0f; @@ -262,7 +262,7 @@ static D3DXMATRIX* MatrixOrthoOffCenterLH (D3DXMATRIXA16 *pOut, float l, float r return pOut; } -static D3DXMATRIX* MatrixScaling (D3DXMATRIXA16 *pOut, float sx, float sy, float sz) +static D3DXMATRIX* MatrixScaling(D3DXMATRIXA16 *pOut, float sx, float sy, float sz) { pOut->_11=sx; pOut->_12=0.0f; pOut->_13=0.0f; pOut->_14=0.0f; pOut->_21=0.0f; pOut->_22=sy; pOut->_23=0.0f; pOut->_24=0.0f; @@ -271,7 +271,7 @@ static D3DXMATRIX* MatrixScaling (D3DXMATRIXA16 *pOut, float sx, float sy, float return pOut; } -static D3DXMATRIX* MatrixTranslation (D3DXMATRIXA16 *pOut, float tx, float ty, float tz) +static D3DXMATRIX* MatrixTranslation(D3DXMATRIXA16 *pOut, float tx, float ty, float tz) { pOut->_11=1.0f; pOut->_12=0.0f; pOut->_13=0.0f; pOut->_14=0.0f; pOut->_21=0.0f; pOut->_22=1.0f; pOut->_23=0.0f; pOut->_24=0.0f; @@ -2171,6 +2171,15 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender) MatrixScaling (&d3d->m_matWorld_out, sw + 0.5f / sw, sh + 0.5f / sh, 1.0f); + if (currprefs.gfx_rotation) { + const float PI = 3.14159265358979f; + D3DXMATRIXA16 mrot; + D3DXMatrixRotationZ(&mrot, PI / 180.0f * currprefs.gfx_rotation); + D3DXMATRIXA16 tmprmatrix; + D3DXMatrixMultiply(&tmprmatrix, &d3d->m_matWorld_out, &mrot); + d3d->m_matWorld_out = tmprmatrix; + } + d3d->cursor_offset_x = -zr.left; d3d->cursor_offset_y = -zr.top;