diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 366a142d62..93bc0eea4c 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -169,7 +169,7 @@ public int DispMultix = 36; public int DispMultiy = 0; public int DispMultianchor = 0; - public bool ForceGDI = false; + public bool DisplayGDI = false; public bool DisplayStatusBar = true; // Sound options diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 4d5b0128db..e213176b68 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -1215,7 +1215,7 @@ // this.forceGDIPPresentationToolStripMenuItem.Name = "forceGDIPPresentationToolStripMenuItem"; this.forceGDIPPresentationToolStripMenuItem.Size = new System.Drawing.Size(220, 22); - this.forceGDIPPresentationToolStripMenuItem.Text = "Force GDI+ Presentation"; + this.forceGDIPPresentationToolStripMenuItem.Text = "Use GDI+ Display Method"; this.forceGDIPPresentationToolStripMenuItem.Click += new System.EventHandler(this.forceGDIPPresentationToolStripMenuItem_Click); // // runInBackgroundToolStripMenuItem diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 0aac452912..1e31cdd909 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -428,7 +428,7 @@ namespace BizHawk.MultiClient private void forceGDIPPresentationToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Config.ForceGDI ^= true; + Global.Config.DisplayGDI ^= true; SyncPresentationMode(); } @@ -1099,7 +1099,7 @@ namespace BizHawk.MultiClient saveWindowPositionToolStripMenuItem.Checked = Global.Config.SaveWindowPosition; startPausedToolStripMenuItem.Checked = Global.Config.StartPaused; enableRewindToolStripMenuItem.Checked = Global.Config.RewindEnabled; - forceGDIPPresentationToolStripMenuItem.Checked = Global.Config.ForceGDI; + forceGDIPPresentationToolStripMenuItem.Checked = Global.Config.DisplayGDI; acceptBackgroundInputToolStripMenuItem.Checked = Global.Config.AcceptBackgroundInput; singleInstanceModeToolStripMenuItem.Checked = Global.Config.SingleInstanceMode; enableContextMenuToolStripMenuItem.Checked = Global.Config.ShowContextMenu; diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 24c9b19373..7b76a8939e 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -237,11 +237,10 @@ namespace BizHawk.MultiClient void SyncPresentationMode() { - bool gdi = Global.Config.ForceGDI; - if (Global.Direct3D == null) - { - gdi = Global.Config.ForceGDI = true; - } + bool gdi = Global.Config.DisplayGDI; + + if(Global.Direct3D == null) + gdi = true; if (renderTarget != null) { @@ -268,7 +267,19 @@ namespace BizHawk.MultiClient } else { - Global.RenderPanel = new Direct3DRenderPanel(Global.Direct3D, renderTarget); + try + { + var d3dPanel = new Direct3DRenderPanel(Global.Direct3D, renderTarget); + d3dPanel.CreateDevice(); + Global.RenderPanel = d3dPanel; + } + catch + { + Program.DisplayDirect3DError(); + Global.Direct3D.Dispose(); + Global.Direct3D = null; + SyncPresentationMode(); + } } } @@ -1547,6 +1558,7 @@ namespace BizHawk.MultiClient string fps_string = runloop_last_fps + " fps"; if (ff) fps_string += " >>"; Global.RenderPanel.FPS = fps_string; + Console.WriteLine(fps_string); } if (!suppressCaptureRewind && Global.Config.RewindEnabled) CaptureRewindState(); diff --git a/BizHawk.MultiClient/Program.cs b/BizHawk.MultiClient/Program.cs index b74c26399f..b2a2446c3d 100644 --- a/BizHawk.MultiClient/Program.cs +++ b/BizHawk.MultiClient/Program.cs @@ -26,10 +26,9 @@ namespace BizHawk.MultiClient try { Global.Direct3D = new Direct3D(); } catch { - //can fallback to GDI rendering - if (Global.Config.ForceGDI == true) - MessageBox.Show("Failure to initialize Directx, reverting to GDI rendering.", "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - Global.Config.ForceGDI = true; + //fallback to GDI rendering + if (!Global.Config.DisplayGDI) + DisplayDirect3DError(); } try @@ -87,5 +86,10 @@ namespace BizHawk.MultiClient mf.ProgramRunLoop(); } } + + public static void DisplayDirect3DError() + { + MessageBox.Show("Failure to initialize Direct3D, reverting to GDI+ display method. Change the option in Config > GUI or install DirectX web update.", "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } }