From a34c09fe01b1406cbc76067bbd3e8633e087baff Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Tue, 1 Dec 2009 05:59:43 +0000 Subject: [PATCH] GSdx: * Disable GSdx's internal AspectRatio setting when using GSOpen2 (pcsx2 0.9.7 controls aspect ratios internally now) * DX10 should be able to startup in fullscreen mode now, without needing to hit alt-enter (legacy 0.9.6 versions only) * Added some comments for a failed attempt to disable DX10's default Alt-Enter behavior. If someone knows how to do that properly, please feel free to submit a patch because DX10/Com breaks my mind. (see GSDevice10.cpp) * Remove DX11 for now since it's entirely unfinished anyway. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2279 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GS.cpp | 31 ++++++++++++++++++----------- plugins/GSdx/GSDevice10.cpp | 12 ++++++++++- plugins/GSdx/GSRenderer.cpp | 8 ++++++++ plugins/GSdx/GSRenderer.h | 2 ++ plugins/GSdx/GSSettingsDlg.cpp | 4 ++-- plugins/GSdx/vsprops/common.vsprops | 2 +- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index d349ef7edd..e402b37611 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -159,8 +159,8 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) default: case 0: case 1: case 2: dev = new GSDevice9(); break; case 3: case 4: case 5: dev = new GSDevice10(); break; - case 6: case 7: case 8: dev = new GSDevice11(); break; #if 0 + case 6: case 7: case 8: dev = new GSDevice11(); break; case 9: case 10: case 11: dev = new GSDeviceOGL(); break; #endif case 12: case 13: new GSDeviceNull(); break; @@ -175,8 +175,8 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) default: case 0: s_gs = new GSRendererDX9(); break; case 3: s_gs = new GSRendererDX10(); break; - case 6: s_gs = new GSRendererDX11(); break; #if 0 + case 6: s_gs = new GSRendererDX11(); break; case 9: s_gs = new GSRendererOGL(); break; #endif case 2: case 5: case 8: case 11: case 13: @@ -238,7 +238,8 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags ) { theApp.SetConfig("windowed", flags & 1); - theApp.SetConfig("vsync", flags & 2); + //theApp.SetConfig("vsync", flags & 2); + //theApp.SetConfig("aspectratio", 0); int renderer = theApp.GetConfig("renderer", 0); if( flags & 4 ) @@ -246,7 +247,11 @@ EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags ) renderer = 1; } - return _GSopen( dsp, NULL, renderer ); + INT32 retval = _GSopen( dsp, NULL, renderer ); + s_gs->SetAspectRatio(0); // PCSX2 manages the aspect ratios + s_gs->SetVsync(flags & 2); + + return retval; } EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt) @@ -321,16 +326,18 @@ EXPORT_C GSvsync(int field) { #ifdef _WINDOWS - MSG msg; - - memset(&msg, 0, sizeof(msg)); - - while(msg.message != WM_QUIT && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + if( s_gs->m_wnd.IsManaged() ) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } + MSG msg; + memset(&msg, 0, sizeof(msg)); + + while(msg.message != WM_QUIT && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } #endif s_gs->VSync(field); diff --git a/plugins/GSdx/GSDevice10.cpp b/plugins/GSdx/GSDevice10.cpp index 267aa4d05f..f3ae52052a 100644 --- a/plugins/GSdx/GSDevice10.cpp +++ b/plugins/GSdx/GSDevice10.cpp @@ -56,6 +56,16 @@ bool GSDevice10::Create(GSWnd* wnd) memset(&scd, 0, sizeof(scd)); + // FIXME : Someone with a brain for DX10 and COM figure out how to make this IDXGIFactory + // call mess work. I fail at this stuff. Thanks! --air + + // Also... should this be GS plugin territory, or should we incorporate it into PCSX2? + // (I'm thinking a dynamic loading of the DXGI dll, and general invocation that way). + + //CComPtr pFactory; + //hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory) ); + //pFactory->MakeWindowAssociation( (HWND)m_wnd->GetHandle(), DXGI_MWA_NO_WINDOW_CHANGES ); + scd.BufferCount = 2; scd.BufferDesc.Width = 1; scd.BufferDesc.Height = 1; @@ -66,7 +76,7 @@ bool GSDevice10::Create(GSWnd* wnd) scd.OutputWindow = (HWND)m_wnd->GetHandle(); scd.SampleDesc.Count = 1; scd.SampleDesc.Quality = 0; - scd.Windowed = TRUE; + scd.Windowed = !!theApp.GetConfig("windowed", 1); // Crashes when 2 threads work on the swapchain, as in pcsx2/wx when it provides us // an external window handle (which could be attached to any thread other than the GS one). diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 7c2b8f120d..bc56b4b71c 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -281,6 +281,13 @@ void GSRenderer::SetFrameLimit(bool limit) if( m_dev ) m_dev->SetVsync(m_vsync && m_framelimit); } +void GSRenderer::SetVsync(bool enabled) +{ + m_vsync = enabled; + if( m_dev ) m_dev->SetVsync(m_vsync && m_framelimit); +} + + void GSRenderer::VSync(int field) { GSPerfMonAutoTimer pmat(m_perfmon); @@ -341,6 +348,7 @@ void GSRenderer::VSync(int field) if( !m_wnd.SetWindowText(s.c_str()) ) { + // [TODO] // We don't have window title rights, or the window has no title, // so let's use actual OSD! } diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 6018442230..352b8a3a41 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -95,6 +95,8 @@ public: return m_upscale_multiplier; } + void SetAspectRatio(int aspect) { m_aspectratio = aspect; } + void SetVsync(bool enabled); void SetFrameLimit(bool limit); // TODO : Implement proper locking here *if needed* (not sure yet if it is) --air diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index af93448666..2e19b5593d 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -33,10 +33,10 @@ GSSetting GSSettingsDlg::g_renderers[] = {3, "Direct3D10 (Hardware)", NULL}, {4, "Direct3D10 (Software)", NULL}, {5, "Direct3D10 (Null)", NULL}, + #if 0 {6, "Direct3D11 (Hardware)", NULL}, {7, "Direct3D11 (Software)", NULL}, {8, "Direct3D11 (Null)", NULL}, - #if 0 {9, "OpenGL (Hardware)", NULL}, {10, "OpenGL (Software)", NULL}, {11, "OpenGL (Null)", NULL}, @@ -112,7 +112,7 @@ void GSSettingsDlg::OnInit() } bool isdx10avail = GSUtil::IsDirect3D10Available(); - bool isdx11avail = GSUtil::IsDirect3D11Available(); + bool isdx11avail = false; //GSUtil::IsDirect3D11Available(); vector renderers; diff --git a/plugins/GSdx/vsprops/common.vsprops b/plugins/GSdx/vsprops/common.vsprops index d4e9aa2832..1d6c20294a 100644 --- a/plugins/GSdx/vsprops/common.vsprops +++ b/plugins/GSdx/vsprops/common.vsprops @@ -16,7 +16,7 @@ />