Added patches to allow EAX support to be disabled.

This commit is contained in:
Mark Harmstone 2015-04-05 14:47:34 +01:00
parent 9e0bb28fcb
commit 9138b6d929
2 changed files with 285 additions and 0 deletions

View File

@ -0,0 +1,190 @@
From caed927bcf9ac5ac4d45bb478e8b859916c62898 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Sun, 5 Apr 2015 14:44:04 +0100
Subject: dsound: Allow disabling of EAX support in the registry.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.0.5"
This is a multi-part message in MIME format.
--------------2.0.5
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
dlls/dsound/buffer.c | 13 +-----
dlls/dsound/dsound_private.h | 1 +
dlls/dsound/eax.c | 94 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+), 11 deletions(-)
--------------2.0.5
Content-Type: text/x-patch; name="0002-dsound-Allow-disabling-of-EAX-support-in-the-registr.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-dsound-Allow-disabling-of-EAX-support-in-the-registr.patch"
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 3641e32..e7663d3 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -1331,17 +1331,8 @@ static HRESULT WINAPI IKsPropertySetImpl_QuerySupport(IKsPropertySet *iface, REF
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
- if (IsEqualGUID(&DSPROPSETID_EAX_ReverbProperties, guidPropSet)) {
- if (dwPropID <= DSPROPERTY_EAX_DAMPING) {
- *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
- return S_OK;
- }
- } else if (IsEqualGUID(&DSPROPSETID_EAXBUFFER_ReverbProperties, guidPropSet)) {
- if (dwPropID <= DSPROPERTY_EAXBUFFER_REVERBMIX) {
- *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
- return S_OK;
- }
- }
+ if (EAX_QuerySupport(guidPropSet, dwPropID, pTypeSupport))
+ return S_OK;
return E_PROP_ID_UNSUPPORTED;
}
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index a9987d0..6453cef 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -234,6 +234,7 @@ LONG capped_refcount_dec(LONG *ref) DECLSPEC_HIDDEN;
HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
/* eax.c */
+BOOL WINAPI EAX_QuerySupport(REFGUID guidPropSet, ULONG dwPropID, ULONG *pTypeSupport) DECLSPEC_HIDDEN;
HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
ULONG dwPropID, void *pInstanceData, ULONG cbInstanceData, void *pPropData,
ULONG cbPropData, ULONG *pcbReturned) DECLSPEC_HIDDEN;
diff --git a/dlls/dsound/eax.c b/dlls/dsound/eax.c
index 4e98812..a0d55d4 100644
--- a/dlls/dsound/eax.c
+++ b/dlls/dsound/eax.c
@@ -34,6 +34,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(eax);
+static BOOL searched_reg = FALSE, eax_enabled = FALSE;
+
static const EAX_REVERBPROPERTIES presets[] = {
{ EAX_ENVIRONMENT_GENERIC, 0.5f, 1.493f, 0.5f },
{ EAX_ENVIRONMENT_PADDEDCELL, 0.25f, 0.1f, 0.0f },
@@ -809,6 +811,92 @@ void free_eax_buffer(IDirectSoundBufferImpl *dsb)
HeapFree(GetProcessHeap(), 0, dsb->eax.SampleBuffer);
}
+static BOOL get_app_key( HKEY *defkey, HKEY *appkey )
+{
+ char buffer[MAX_PATH+16];
+ DWORD len;
+
+ *appkey = 0;
+
+ /* @@ Wine registry key: HKCU\Software\Wine\EAX */
+ if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\EAX", defkey))
+ *defkey = 0;
+
+ len = GetModuleFileNameA(0, buffer, MAX_PATH);
+ if (len && len < MAX_PATH)
+ {
+ HKEY tmpkey;
+
+ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\EAX */
+ if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
+ {
+ char *p, *appname = buffer;
+ if ((p = strrchr(appname, '/'))) appname = p + 1;
+ if ((p = strrchr(appname, '\\'))) appname = p + 1;
+ strcat(appname, "\\EAX");
+
+ if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
+ RegCloseKey(tmpkey);
+ }
+ }
+
+ return *defkey || *appkey;
+}
+
+static BOOL get_config_key( HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size )
+{
+ if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size ))
+ return TRUE;
+
+ if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size ))
+ return TRUE;
+
+ return FALSE;
+}
+
+static BOOL is_eax_enabled(void)
+{
+ if (!searched_reg) {
+ HKEY defkey, appkey;
+ char buffer[MAX_PATH];
+
+ searched_reg = TRUE;
+
+ if (!get_app_key(&defkey, &appkey)) {
+ eax_enabled = FALSE;
+ return eax_enabled;
+ }
+
+ if (get_config_key(defkey, appkey, "Enabled", buffer, sizeof(buffer)))
+ eax_enabled = !strcmp(buffer, "true");
+
+ if (defkey) RegCloseKey(defkey);
+ if (appkey) RegCloseKey(appkey);
+ }
+
+ return eax_enabled;
+}
+
+BOOL WINAPI EAX_QuerySupport(REFGUID guidPropSet, ULONG dwPropID, ULONG *pTypeSupport)
+{
+ if (!is_eax_enabled())
+ return FALSE;
+
+ if (IsEqualGUID(&DSPROPSETID_EAX_ReverbProperties, guidPropSet)) {
+ if (dwPropID <= DSPROPERTY_EAX_DAMPING) {
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ return TRUE;
+ }
+ } else if (IsEqualGUID(&DSPROPSETID_EAXBUFFER_ReverbProperties, guidPropSet)) {
+ if (dwPropID <= DSPROPERTY_EAXBUFFER_REVERBMIX) {
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
ULONG dwPropID, void *pInstanceData, ULONG cbInstanceData, void *pPropData,
ULONG cbPropData, ULONG *pcbReturned)
@@ -816,6 +904,9 @@ HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
TRACE("(buf=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
buf, debugstr_guid(guidPropSet), dwPropID, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
+ if (!is_eax_enabled())
+ return E_PROP_ID_UNSUPPORTED;
+
*pcbReturned = 0;
if (IsEqualGUID(&DSPROPSETID_EAX_ReverbProperties, guidPropSet)) {
@@ -922,6 +1013,9 @@ HRESULT WINAPI EAX_Set(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
TRACE("(%p,%s,%d,%p,%d,%p,%d)\n",
buf, debugstr_guid(guidPropSet), dwPropID, pInstanceData, cbInstanceData, pPropData, cbPropData);
+ if (!is_eax_enabled())
+ return E_PROP_ID_UNSUPPORTED;
+
if (IsEqualGUID(&DSPROPSETID_EAX_ReverbProperties, guidPropSet)) {
buf->device->eax.using_eax = TRUE;
--------------2.0.5--

View File

@ -0,0 +1,95 @@
From 0008314c5601a3b5a4d5273b24d44393d449d3dd Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Sun, 5 Apr 2015 14:16:11 +0100
Subject: winecfg: Add checkbox to enable/disable EAX support.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.0.5"
This is a multi-part message in MIME format.
--------------2.0.5
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
programs/winecfg/resource.h | 1 +
programs/winecfg/staging.c | 21 +++++++++++++++++++++
programs/winecfg/winecfg.rc | 1 +
3 files changed, 23 insertions(+)
--------------2.0.5
Content-Type: text/x-patch; name="0001-winecfg-Add-checkbox-to-enable-disable-EAX-support.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-winecfg-Add-checkbox-to-enable-disable-EAX-support.patch"
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 4b21d16..a78d9af 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -213,6 +213,7 @@
/* Staging tab */
#define IDC_ENABLE_CSMT 9001
#define IDC_ENABLE_VAAPI 9002
+#define IDC_ENABLE_EAX 9003
/* About tab */
#define IDC_ABT_OWNER 8432
diff --git a/programs/winecfg/staging.c b/programs/winecfg/staging.c
index bda2e6e..0270ebd 100644
--- a/programs/winecfg/staging.c
+++ b/programs/winecfg/staging.c
@@ -65,10 +65,27 @@ static void vaapi_set(BOOL status)
set_reg_key(config_key, keypath("DXVA2"), "backend", status ? "va" : NULL);
}
+/*
+ * EAX
+ */
+static BOOL eax_get(void)
+{
+ BOOL ret;
+ char *value = get_reg_key(config_key, keypath("EAX"), "Enabled", NULL);
+ ret = (value && !strcmp(value, "true"));
+ HeapFree(GetProcessHeap(), 0, value);
+ return ret;
+}
+static void eax_set(BOOL status)
+{
+ set_reg_key(config_key, keypath("EAX"), "Enabled", status ? "true" : "false");
+}
+
static void load_staging_settings(HWND dialog)
{
CheckDlgButton(dialog, IDC_ENABLE_CSMT, csmt_get() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(dialog, IDC_ENABLE_VAAPI, vaapi_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_EAX, eax_get() ? BST_CHECKED : BST_UNCHECKED);
}
INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -102,6 +119,10 @@ INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
vaapi_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_VAAPI) == BST_CHECKED);
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
return TRUE;
+ case IDC_ENABLE_EAX:
+ eax_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_EAX) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
}
break;
}
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
index 171672d..0f1af19 100644
--- a/programs/winecfg/winecfg.rc
+++ b/programs/winecfg/winecfg.rc
@@ -315,6 +315,7 @@ BEGIN
LTEXT "The following settings are experimental and may break stuff!\nMake sure to reset them again in case of a problem.",IDC_STATIC,16,16,230,16
CONTROL "Enable &CSMT for better graphic performance",IDC_ENABLE_CSMT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,40,230,8
CONTROL "Enable &VAAPI as backend for DXVA2 GPU decoding",IDC_ENABLE_VAAPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,230,8
+ CONTROL "Enable Environmental Audio E&xtensions (EAX)",IDC_ENABLE_EAX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,230,8
END
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
--------------2.0.5--