James Hawkins wrote:
Changelog:
- take audio autodetection out of winecfg and put it in winmm
- if driver is not found in the registry or the driver fails to
load, then autodetect driver
Thanks for another cool patch. It lessens the burden on the user. CC'ing ros-kernel as explained below.
Index: dlls/winmm/lolvldrv.c
RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v retrieving revision 1.58 diff -u -r1.58 lolvldrv.c --- dlls/winmm/lolvldrv.c 1 Jun 2004 19:40:48 -0000 1.58 +++ dlls/winmm/lolvldrv.c 25 Jul 2004 22:05:54 -0000 @@ -30,6 +30,8 @@ #include "winver.h" #include "winemm.h" #include "wine/debug.h" +#include "config.h" +#include "wine/port.h"
WINE_DEFAULT_DEBUG_CHANNEL(winmm);
@@ -711,6 +713,80 @@ }
/**************************************************************************
- MMDRV_AutoDetectDriver [internal]
- modified from programs/winecfg/audio.c
- */
+BOOL MMDRV_AutoDetectDriver(void) +{
- struct stat buf;
- const char *argv_new[4];
- int fd;
- char *driversFound[10];
- char *name[10];
- int numFound = 0;
- argv_new[0] = "/bin/sh";
I think the ReactOS people may have a few comments to make on this, now that they are using this DLL in ReactOS.
- argv_new[1] = "-c";
- argv_new[3] = NULL;
- /* try to detect arts */
- argv_new[2] = "ps awx|grep artsd|grep -v grep|grep artsd > /dev/null";
- if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
- {
driversFound[numFound] = "winearts.drv";
name[numFound] = "aRts";
numFound++;
- }
- /* try to detect jack */
- argv_new[2] = "ps awx|grep jackd|grep -v grep|grep jackd > /dev/null";
- if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
- {
driversFound[numFound] = "winejack.drv";
name[numFound] = "jack";
numFound++;
- }
- /* try to detect nas */
- /* TODO */
- /* try to detect audioIO (solaris) */
- /* TODO */
- /* try to detect alsa */
- if(!stat("/proc/asound", &buf))
- {
driversFound[numFound] = "winealsa.drv";
name[numFound] = "Alsa";
numFound++;
- }
- /* try to detect oss */
- fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
- if(fd)
- {
close(fd);
driversFound[numFound] = "wineoss.drv";
name[numFound] = "OSS";
numFound++;
- }
- if (numFound == 0)
- {
TRACE("Could not detect any audio devices/servers");
return FALSE;
- }
- /* TODO: possibly smarter handling of multiple drivers? */
- TRACE("Found driver %s\n", name[0]);
- return MMDRV_Install(driversFound[0], driversFound[0], FALSE);
+}
+/**************************************************************************
MMDRV_InitFromRegistry [internal]
*/ static BOOL MMDRV_InitFromRegistry(void) @@ -729,7 +805,9 @@ }
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
- BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type,
(LPVOID)buffer, &size);
This is only available in C99. We try to make Wine compile with as many C compilers as possible, including gcc 2.95, which doesn't allow this sort of thing.
- if (keyQueried) { p1 = buffer; while (p1) { p2 = strchr(p1, ';');
@@ -738,7 +816,11 @@ p1 = p2; } }
- /* if no driver specified in reg or driver fails to load then autodetect */
- if (!keyQueried || !ret)
ret |= MMDRV_AutoDetectDriver();
/* finish with mappers */ size = sizeof(buffer); if (!RegQueryValueExA(hKey, "WaveMapper", 0, &type, (LPVOID)buffer, &size))
Rob
This is only available in C99. We try to make Wine compile with as many C compilers as possible, including gcc 2.95, which doesn't allow this sort of thing.
What part of the code is only availabe in C99? I'll try to fix it so we can be compatible with other compilers.
On Sun, 25 Jul 2004 23:25:57 +0100, Robert Shearman rob@codeweavers.com wrote:
James Hawkins wrote:
Changelog:
- take audio autodetection out of winecfg and put it in winmm
- if driver is not found in the registry or the driver fails to
load, then autodetect driver
Thanks for another cool patch. It lessens the burden on the user. CC'ing ros-kernel as explained below.
Index: dlls/winmm/lolvldrv.c
RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v retrieving revision 1.58 diff -u -r1.58 lolvldrv.c --- dlls/winmm/lolvldrv.c 1 Jun 2004 19:40:48 -0000 1.58 +++ dlls/winmm/lolvldrv.c 25 Jul 2004 22:05:54 -0000 @@ -30,6 +30,8 @@ #include "winver.h" #include "winemm.h" #include "wine/debug.h" +#include "config.h" +#include "wine/port.h"
WINE_DEFAULT_DEBUG_CHANNEL(winmm);
@@ -711,6 +713,80 @@ }
/**************************************************************************
- MMDRV_AutoDetectDriver [internal]
- modified from programs/winecfg/audio.c
- */
+BOOL MMDRV_AutoDetectDriver(void) +{
- struct stat buf;
- const char *argv_new[4];
- int fd;
- char *driversFound[10];
- char *name[10];
- int numFound = 0;
- argv_new[0] = "/bin/sh";
I think the ReactOS people may have a few comments to make on this, now that they are using this DLL in ReactOS.
- argv_new[1] = "-c";
- argv_new[3] = NULL;
- /* try to detect arts */
- argv_new[2] = "ps awx|grep artsd|grep -v grep|grep artsd > /dev/null";
- if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
- {
driversFound[numFound] = "winearts.drv";
name[numFound] = "aRts";
numFound++;
- }
- /* try to detect jack */
- argv_new[2] = "ps awx|grep jackd|grep -v grep|grep jackd > /dev/null";
- if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
- {
driversFound[numFound] = "winejack.drv";
name[numFound] = "jack";
numFound++;
- }
- /* try to detect nas */
- /* TODO */
- /* try to detect audioIO (solaris) */
- /* TODO */
- /* try to detect alsa */
- if(!stat("/proc/asound", &buf))
- {
driversFound[numFound] = "winealsa.drv";
name[numFound] = "Alsa";
numFound++;
- }
- /* try to detect oss */
- fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
- if(fd)
- {
close(fd);
driversFound[numFound] = "wineoss.drv";
name[numFound] = "OSS";
numFound++;
- }
- if (numFound == 0)
- {
TRACE("Could not detect any audio devices/servers");
return FALSE;
- }
- /* TODO: possibly smarter handling of multiple drivers? */
- TRACE("Found driver %s\n", name[0]);
- return MMDRV_Install(driversFound[0], driversFound[0], FALSE);
+}
+/**************************************************************************
MMDRV_InitFromRegistry [internal]
*/ static BOOL MMDRV_InitFromRegistry(void) @@ -729,7 +805,9 @@ }
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
- BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type,
(LPVOID)buffer, &size);
This is only available in C99. We try to make Wine compile with as many C compilers as possible, including gcc 2.95, which doesn't allow this sort of thing.
- if (keyQueried) { p1 = buffer; while (p1) { p2 = strchr(p1, ';');
@@ -738,7 +816,11 @@ p1 = p2; } }
- /* if no driver specified in reg or driver fails to load then autodetect */
- if (!keyQueried || !ret)
ret |= MMDRV_AutoDetectDriver();
- /* finish with mappers */ size = sizeof(buffer); if (!RegQueryValueExA(hKey, "WaveMapper", 0, &type, (LPVOID)buffer, &size))
Rob
On Sun, 25 Jul 2004 17:33:19 -0500, James Hawkins wrote:
What part of the code is only availabe in C99? I'll try to fix it so we can be compatible with other compilers.
You can't declare variables in the middle of a block. They have to go at the start.
James Hawkins wrote:
This is only available in C99. We try to make Wine compile with as many C compilers as possible, including gcc 2.95, which doesn't allow this sort of thing.
What part of the code is only availabe in C99? I'll try to fix it so we can be compatible with other compilers.
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
- BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type,
^^^^ - all variable declarations must be done at the very start of a block of code.
(LPVOID)buffer, &size);
This is only available in C99. We try to make Wine compile with as many C compilers as possible, including gcc 2.95, which doesn't allow this sort of thing.
Rob
On Mon, 26 Jul 2004, Robert Shearman wrote: [...]
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
- BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type,
^^^^ - all variable declarations must be done at the very
start of a block of code.
Actually this is the start of a block of code since the character preceeding 'BOOL' is '{'.
Francois Gouget wrote:
On Mon, 26 Jul 2004, Robert Shearman wrote: [...]
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
- BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type,
^^^^ - all variable declarations must be done at the very
start of a block of code.
Actually this is the start of a block of code since the character preceeding 'BOOL' is '{'.
Not quite. After applying the patch, this is what you get:
/************************************************************************** * MMDRV_InitFromRegistry [internal] */ static BOOL MMDRV_InitFromRegistry(void) { HKEY hKey; char buffer[256]; char* p1; char* p2; DWORD type, size; BOOL ret = FALSE; TRACE("()\n");
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\Wine\Wine\Config\WinMM", &hKey)) { TRACE("Cannot open WinMM config key\n"); return FALSE; }
size = sizeof(buffer); BOOL keyQueried = !RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size);
On Mon, 26 Jul 2004, Robert Shearman wrote: [...]
Actually this is the start of a block of code since the character preceeding 'BOOL' is '{'.
Not quite. After applying the patch, this is what you get:
Ah, sorry. It the '-' I missed.