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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
From 67d81111cbbbcc799da7097b5a9222d4e8ac4107 Mon Sep 17 00:00:00 2001
From: Vasiliy Stelmachenok <ventureo@cachyos.org>
Date: Fri, 21 Mar 2025 14:04:59 +0300
Subject: [PATCH] winecfg: Add tweaks tab page
As of now, it currently allows you to:
- Enable ALSA driver for audio output
- Enable Wayland graphics driver
- Enable video decoding via FFmpeg (winedmo)
- Enable display mode emulation for X11
Signed-off-by: Vasiliy Stelmachenok <ventureo@cachyos.org>
---
programs/winecfg/Makefile.in | 1 +
programs/winecfg/main.c | 12 +++-
programs/winecfg/resource.h | 8 +++
programs/winecfg/tweaks.c | 123 +++++++++++++++++++++++++++++++++++
programs/winecfg/winecfg.h | 1 +
programs/winecfg/winecfg.rc | 13 ++++
6 files changed, 157 insertions(+), 1 deletion(-)
create mode 100644 programs/winecfg/tweaks.c
diff --git a/programs/winecfg/Makefile.in b/programs/winecfg/Makefile.in
index 1105a99e177..a51505902d1 100644
--- a/programs/winecfg/Makefile.in
+++ b/programs/winecfg/Makefile.in
@@ -14,6 +14,7 @@ SOURCES = \
logo.svg \
main.c \
staging.c \
+ tweaks.c \
theme.c \
winecfg.c \
winecfg.man.in \
diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
index b733b11be5e..48739f44997 100644
--- a/programs/winecfg/main.c
+++ b/programs/winecfg/main.c
@@ -58,7 +58,7 @@ PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
return 0;
}
-#define NUM_PROPERTY_PAGES 9
+#define NUM_PROPERTY_PAGES 10
static INT_PTR
doPropertySheet (HINSTANCE hInstance, HWND hOwner)
@@ -149,6 +149,16 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner)
psp[pg].lParam = 0;
pg++;
+ psp[pg].dwSize = sizeof (PROPSHEETPAGEW);
+ psp[pg].dwFlags = PSP_USETITLE;
+ psp[pg].hInstance = hInstance;
+ psp[pg].pszTemplate = MAKEINTRESOURCEW (IDD_TWEAKS);
+ psp[pg].pszIcon = NULL;
+ psp[pg].pfnDlgProc = TweaksDlgProc;
+ psp[pg].pszTitle = load_string (IDS_TAB_TWEAKS);
+ psp[pg].lParam = 0;
+ pg++;
+
psp[pg].dwSize = sizeof (PROPSHEETPAGEW);
psp[pg].dwFlags = PSP_USETITLE;
psp[pg].hInstance = hInstance;
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 803a0fc150e..16851e7adb8 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -47,6 +47,7 @@
#define IDS_WINECFG_TITLE_APP 18 /* App specific title */
#define IDS_TAB_STAGING 19
#define IDS_TAB_INPUT 20
+#define IDS_TAB_TWEAKS 21
#define IDI_WINECFG 100
#define IDI_LOGO 102
#define IDD_ABOUTCFG 107
@@ -58,6 +59,7 @@
#define IDD_DESKTOP_INTEGRATION 115
#define IDD_STAGING 116
#define IDD_INPUT_CONFIG 117
+#define IDD_TWEAKS 118
#define IDC_WINVER 1012
#define IDC_DESKTOP_WIDTH 1023
#define IDC_DESKTOP_HEIGHT 1024
@@ -223,6 +225,12 @@
#define IDC_ENABLE_HIDEWINE 9004
#define IDC_ENABLE_GTK3 9005
+/* Tweaks tab */
+#define IDC_ENABLE_ALSA 10001
+#define IDC_ENABLE_WAYLAND 10002
+#define IDC_ENABLE_FSHACK 10003
+#define IDC_ENABLE_FFMPEG 10004
+
/* About tab */
#define IDC_ABT_OWNER 8432
#define IDC_ABT_ORG 8433
diff --git a/programs/winecfg/tweaks.c b/programs/winecfg/tweaks.c
new file mode 100644
index 00000000000..6e7e45d4205
--- /dev/null
+++ b/programs/winecfg/tweaks.c
@@ -0,0 +1,123 @@
+#define COBJMACROS
+
+#include <windows.h>
+
+#include "resource.h"
+#include "winecfg.h"
+
+/*
+ * ALSA
+ */
+static BOOL alsa_get(void)
+{
+ BOOL ret;
+ WCHAR *value = get_reg_key(config_key, keypath(L"Drivers"), L"Audio", NULL);
+ ret = (value && !wcsicmp(value, L"alsa"));
+ free(value);
+ return ret;
+}
+static void alsa_set(BOOL status)
+{
+ set_reg_key(config_key, keypath(L"Drivers"), L"Audio", status ? L"alsa" : NULL);
+}
+
+/*
+ * Wayland
+ */
+static BOOL wayland_get(void)
+{
+ BOOL ret;
+ WCHAR *value = get_reg_key(config_key, keypath(L"Drivers"), L"Graphics", NULL);
+ ret = (value && !wcsicmp(value, L"wayland"));
+ free(value);
+ return ret;
+}
+static void wayland_set(BOOL status)
+{
+ set_reg_key(config_key, keypath(L"Drivers"), L"Graphics", status ? L"wayland" : NULL);
+}
+
+/*
+ * FS Hack
+ */
+static BOOL fshack_get(void)
+{
+ BOOL ret;
+ WCHAR *value = get_reg_key(config_key, keypath(L"X11 Driver"), L"EmulateModeset", NULL);
+ ret = (value && !wcsicmp(value, L"Y"));
+ free(value);
+ return ret;
+}
+static void fshack_set(BOOL status)
+{
+ set_reg_key(config_key, keypath(L"X11 Driver"), L"EmulateModeset", status ? L"Y" : NULL);
+}
+
+/*
+ * FFmpeg
+ */
+static BOOL ffmpeg_get(void)
+{
+ BOOL ret;
+ WCHAR *value = get_reg_key(config_key, keypath(L"MediaFoundation"), L"DisableGstByteStreamHandler", NULL);
+ ret = (value && !wcsicmp(value, L"Y"));
+ free(value);
+ return ret;
+}
+static void ffmpeg_set(BOOL status)
+{
+ set_reg_key(config_key, keypath(L"MediaFoundation"), L"DisableGstByteStreamHandler", status ? L"Y" : NULL);
+}
+
+static void load_staging_settings(HWND dialog)
+{
+ CheckDlgButton(dialog, IDC_ENABLE_ALSA, alsa_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_WAYLAND, wayland_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_FSHACK, fshack_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_FFMPEG, ffmpeg_get() ? BST_CHECKED : BST_UNCHECKED);
+}
+
+INT_PTR CALLBACK TweaksDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == PSN_SETACTIVE)
+ load_staging_settings(hDlg);
+ break;
+
+ case WM_SHOWWINDOW:
+ set_window_title(hDlg);
+ break;
+
+ case WM_DESTROY:
+ break;
+
+ case WM_COMMAND:
+ if (HIWORD(wParam) != BN_CLICKED) break;
+ switch (LOWORD(wParam))
+ {
+ case IDC_ENABLE_ALSA:
+ alsa_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_ALSA) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_ENABLE_WAYLAND:
+ wayland_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_WAYLAND) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_ENABLE_FSHACK:
+ fshack_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_FSHACK) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_ENABLE_FFMPEG:
+ ffmpeg_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_FFMPEG) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
index b83234470c1..d5ed6cf9f5c 100644
--- a/programs/winecfg/winecfg.h
+++ b/programs/winecfg/winecfg.h
@@ -89,6 +89,7 @@ INT_PTR CALLBACK LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK StagingDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK TweaksDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
index 4370d9b360c..aea7a3a5d07 100644
--- a/programs/winecfg/winecfg.rc
+++ b/programs/winecfg/winecfg.rc
@@ -39,6 +39,7 @@ BEGIN
IDS_TAB_DESKTOP_INTEGRATION "Desktop Integration"
IDS_TAB_AUDIO "Audio"
IDS_TAB_STAGING "Staging"
+ IDS_TAB_TWEAKS "Tweaks"
IDS_TAB_ABOUT "About"
IDS_TAB_INPUT "Input"
IDS_WINECFG_TITLE "Wine configuration"
@@ -337,6 +338,18 @@ BEGIN
CONTROL "Enable >K3 Theming",IDC_ENABLE_GTK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,100,230,8
END
+IDD_TWEAKS DIALOG 0, 0, 260, 220
+STYLE WS_CHILD | WS_DISABLED
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX "Tweaks",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.",IDC_STATIC,16,16,230,16
+ CONTROL "Enable &ALSA sound driver",IDC_ENABLE_ALSA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,40,230,8
+ CONTROL "Enable &Wayland graphics driver",IDC_ENABLE_WAYLAND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,230,8
+ CONTROL "Enable X11 display mode virtualization",IDC_ENABLE_FSHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,230,8
+ CONTROL "Enable video decoding via FFmpeg",IDC_ENABLE_FFMPEG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,230,8
+END
+
IDD_INPUT_CONFIG DIALOG 0, 0, 260, 220
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
--
2.49.0
|