This repository has been archived by the owner on Jan 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwine-dxvk-helper.patch
183 lines (173 loc) · 7.65 KB
/
wine-dxvk-helper.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
diff -purN a/dlls/d3d11/dxvk.c b/dlls/d3d11/dxvk.c
--- a/dlls/d3d11/dxvk.c 2019-02-21 16:43:53.000000000 +0200
+++ b/dlls/d3d11/dxvk.c 2019-02-21 16:55:16.000000000 +0200
@@ -377,10 +377,11 @@ static HRESULT dxvk_swapchain_LeaveFullS
static HRESULT dxvk_swapchain_GetOutputFromMonitor(struct dxvk_swapchain *swapchain, HMONITOR monitor,
IDXGIOutput **output)
{
+ unsigned int i;
if (!output)
return DXGI_ERROR_INVALID_CALL;
- for (unsigned int i = 0; SUCCEEDED( IDXGIAdapter_EnumOutputs(swapchain->adapter, i, output) ); i++)
+ for (i = 0; SUCCEEDED( IDXGIAdapter_EnumOutputs(swapchain->adapter, i, output) ); i++)
{
DXGI_OUTPUT_DESC output_desc;
IDXGIOutput_GetDesc(*output, &output_desc);
@@ -995,4 +996,4 @@ HRESULT create_d3d_device_dxvk(IDXGIFact
HRESULT create_d3d_device_dxvk(IDXGIFactory *factory, IDXGIAdapter *adapter, UINT flags,
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, ID3D11Device **device_out){return E_FAIL;}
-#endif
\ No newline at end of file
+#endif
diff -purN a/loader/wine.inf.in b/loader/wine.inf.in
--- a/loader/wine.inf.in 2019-02-21 15:58:31.000000000 +0200
+++ b/loader/wine.inf.in 2019-02-21 16:15:42.000000000 +0200
@@ -569,6 +569,7 @@ HKLM,Software\Microsoft\DirectPlay\Servi
HKLM,Software\Microsoft\DirectPlay\Service Providers\Serial Connection For DirectPlay,"dwReserved2",0x10001,0x00000000
HKLM,Software\Microsoft\DirectPlay\Service Providers\Serial Connection For DirectPlay,"Guid",,"{0F1D6860-88D9-11cf-9C4E-00A0C905425E}"
HKLM,Software\Microsoft\DirectPlay\Service Providers\Serial Connection For DirectPlay,"Path",,"dpmodemx.dll"
+HKCU,Software\Wine\Direct3D,"dxvk",0x10001,0x00000000
[SessionMgr]
HKLM,%Control%\Session Manager,CriticalSectionTimeout,0x00040002,0x00278d00
diff -purN a/programs/winecfg/resource.h b/programs/winecfg/resource.h
--- a/programs/winecfg/resource.h 2019-02-21 15:58:31.000000000 +0200
+++ b/programs/winecfg/resource.h 2019-02-21 15:58:31.000000000 +0200
@@ -224,3 +224,4 @@
/* Staging tab */
#define IDC_ENABLE_NATIVE_D3D9 9001
+#define IDC_ENABLE_DXVK 9010
diff -purN a/programs/winecfg/staging.c b/programs/winecfg/staging.c
--- a/programs/winecfg/staging.c 2019-02-21 15:58:31.000000000 +0200
+++ b/programs/winecfg/staging.c 2019-02-21 19:45:27.784198782 +0200
@@ -50,13 +50,31 @@ static void nine_set(BOOL status)
set_reg_key(config_key, keypath("DllRedirects"), "d3d9", status ? "d3d9-nine.dll" : NULL);
}
+/*
+ * DXVK
+ */
+static BOOL dxvk_get(void)
+{
+ DWORD value = get_reg_key_dword(config_key, keypath("Direct3D"), "dxvk", 0);
+ return value == 1;
+}
+
+static void dxvk_set(BOOL status)
+{
+ set_reg_key_dword(config_key, keypath("Direct3D"), "dxvk", status ? 1 : 0);
+}
+
static void load_staging_settings(HWND dialog)
{
CheckDlgButton(dialog, IDC_ENABLE_NATIVE_D3D9, nine_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_DXVK, dxvk_get() ? BST_CHECKED : BST_UNCHECKED);
#if !defined(HAVE_D3D9NINE)
disable(IDC_ENABLE_NATIVE_D3D9);
#endif
+#if !defined(SONAME_LIBDXVK)
+ disable(IDC_ENABLE_DXVK);
+#endif
}
INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -86,6 +104,10 @@ INT_PTR CALLBACK StagingDlgProc(HWND hDl
nine_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_NATIVE_D3D9) == BST_CHECKED);
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
return TRUE;
+ case IDC_ENABLE_DXVK:
+ dxvk_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_DXVK) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
}
break;
}
diff -purN a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
--- a/programs/winecfg/winecfg.c 2019-02-15 22:34:44.000000000 +0200
+++ b/programs/winecfg/winecfg.c 2019-02-24 00:54:20.001285530 +0200
@@ -316,6 +316,57 @@ char *get_reg_key(HKEY root, const char
return szRet;
}
+DWORD get_reg_key_dword(HKEY root, const char *path, const char *name, DWORD def) {
+ WCHAR *wpath, *wname;
+ struct list *cursor;
+ struct setting *s;
+ DWORD *pval;
+ DWORD value;
+
+ WINE_TRACE("path=%s, name=%s, def=%X\n", path, name, def);
+
+ wpath = HeapAlloc(GetProcessHeap(), 0, (strlen(path)+1)*sizeof(WCHAR));
+ wname = HeapAlloc(GetProcessHeap(), 0, (strlen(name)+1)*sizeof(WCHAR));
+
+ MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, strlen(path)+1);
+ MultiByteToWideChar(CP_ACP, 0, name, -1, wname, strlen(name)+1);
+
+ LIST_FOR_EACH( cursor, &settings )
+ {
+ s = LIST_ENTRY(cursor, struct setting, entry);
+
+ if (root != s->root) continue;
+ if (lstrcmpiW(wpath, s->path) != 0) continue;
+ if (!s->name) continue;
+ if (lstrcmpiW(wname, s->name) != 0) continue;
+
+ memcpy(&value, s->value, sizeof(DWORD));
+
+ WINE_TRACE("found %s:%s in settings list, returning %X\n",
+ wine_dbgstr_w(wpath), wine_dbgstr_w(wname),
+ value);
+ goto end;
+ }
+
+ /* no, so get from the registry */
+ pval = get_config_key(root, wpath, wname, NULL);
+
+ if (pval) {
+ memcpy(&value, pval, sizeof(DWORD));
+ WINE_TRACE("returning %X\n", value);
+ HeapFree(GetProcessHeap(), 0, pval);
+ goto end;
+ }
+
+ value = def;
+
+end:
+ HeapFree(GetProcessHeap(), 0, wpath);
+ HeapFree(GetProcessHeap(), 0, wname);
+
+ return value;
+}
+
/**
* Used to set a registry key.
*
@@ -622,7 +673,8 @@ static void process_setting(struct setti
{
static const WCHAR softwareW[] = {'S','o','f','t','w','a','r','e','\\'};
HKEY key;
- BOOL needs_wow64 = (is_win64 && s->root == HKEY_LOCAL_MACHINE && s->path &&
+ BOOL needs_wow64 = (is_win64 && (s->root == HKEY_LOCAL_MACHINE ||
+ s->root == config_key) && s->path &&
!strncmpiW(s->path, softwareW, ARRAY_SIZE(softwareW)));
if (s->value)
diff -purN a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
--- a/programs/winecfg/winecfg.h 2019-02-21 19:25:10.156754003 +0200
+++ b/programs/winecfg/winecfg.h 2019-02-21 19:40:46.784452229 +0200
@@ -58,6 +58,7 @@ WCHAR *get_reg_keyW(HKEY root, const WCH
void set_reg_key(HKEY root, const char *path, const char *name, const char *value);
void set_reg_key_dword(HKEY root, const char *path, const char *name, DWORD value);
char *get_reg_key(HKEY root, const char *path, const char *name, const char *def);
+DWORD get_reg_key_dword(HKEY root, const char *path, const char *name, DWORD def);
BOOL reg_key_exists(HKEY root, const char *path, const char *name);
void apply(void);
char **enumerate_values(HKEY root, char *path);
diff -purN a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
--- a/programs/winecfg/winecfg.rc 2019-02-21 15:58:31.000000000 +0200
+++ b/programs/winecfg/winecfg.rc 2019-02-21 15:58:31.000000000 +0200
@@ -319,7 +319,8 @@ FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "Staging settings",IDC_STATIC,8,4,244,210
LTEXT "The following settings are experimental and may break stuff!\nMake sure to reset them again in case of a problem.\nGallium Nine requires MESA graphic drivers and AMD/Nvidia GPU.\n",IDC_STATIC,16,16,230,24
- CONTROL "Enable &Gallium Nine for better D3D9 graphic performance.",IDC_ENABLE_NATIVE_D3D9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,40,230,8
+ CONTROL "Enable &Gallium Nine for better D3D9 graphics performance.",IDC_ENABLE_NATIVE_D3D9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,48,230,8
+ CONTROL "Enable &DXVK for better D3D10/11 graphics performance.",IDC_ENABLE_DXVK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,63,230,8
END
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL