From 5c472bcf77bdec4502434155d12e0c7e7a679f6c Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 13 Jan 2020 06:34:57 +1000 Subject: [PATCH] Default to D3D and DirectSound if they're present --- BizHawk.Client.Common/config/Config.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index e3fbb05b13..87ab93e039 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -269,8 +269,17 @@ namespace BizHawk.Client.Common public int DispPrescale = 1; + private static bool DetectDirectX() + { + if (OSTailoredCode.IsUnixHost) return false; + var p = OSTailoredCode.LinkedLibManager.LoadOrNull("d3dx9_43.dll"); + if (p == null) return false; + OSTailoredCode.LinkedLibManager.FreeByPtr(p.Value); + return true; + } + /// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that. - public EDispMethod DispMethod = EDispMethod.OpenGL; + public EDispMethod DispMethod = DetectDirectX() ? EDispMethod.SlimDX9 : EDispMethod.OpenGL; public int DispChrome_FrameWindowed = 2; public bool DispChrome_StatusBarWindowed = true; @@ -298,7 +307,7 @@ namespace BizHawk.Client.Common public int DispCropBottom = 0; // Sound options - public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.OpenAL; + public ESoundOutputMethod SoundOutputMethod = DetectDirectX() ? ESoundOutputMethod.DirectSound : ESoundOutputMethod.OpenAL; public bool SoundEnabled = true; public bool SoundEnabledNormal = true; public bool SoundEnabledRWFF = true;