summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhyperiris <hyperiris@gmail.com>2009-04-04 03:48:15 +0000
committerhyperiris <hyperiris@gmail.com>2009-04-04 03:48:15 +0000
commit5d72a992bf1e2fae307213a5954302cc90fd97c8 (patch)
tree3ae8f239425e2308ce667d15e281d1280801b797 /Source/Core
parent0478301c1e8013703d2c87a7a3b2cc45bae1d72d (diff)
OpenAL: fix CreativeLab bug. This bug causes hang on my machine.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2864 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Src/aldlist.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/Source/Core/AudioCommon/Src/aldlist.cpp b/Source/Core/AudioCommon/Src/aldlist.cpp
index 46e910dc59..66cd97a52c 100644
--- a/Source/Core/AudioCommon/Src/aldlist.cpp
+++ b/Source/Core/AudioCommon/Src/aldlist.cpp
@@ -47,30 +47,38 @@ ALDeviceList::ALDeviceList()
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) {
- if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
+ if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
+ {
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
index = 0;
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
- while (devices != NULL) {
- if (strcmp(defaultDeviceName, devices) == 0) {
+ while (devices != NULL && strlen(devices) > 0)
+ {
+ if (strcmp(defaultDeviceName, devices) == 0)
+ {
defaultDeviceIndex = index;
}
ALCdevice *device = alcOpenDevice(devices);
- if (device) {
+ if (device)
+ {
ALCcontext *context = alcCreateContext(device, NULL);
- if (context) {
+ if (context)
+ {
alcMakeContextCurrent(context);
// if new actual device name isn't already in the list, then add it...
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
bool bNewName = true;
- for (s32 i = 0; i < GetNumDevices(); i++) {
- if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
+ for (s32 i = 0; i < GetNumDevices(); i++)
+ {
+ if (strcmp(GetDeviceName(i), actualDeviceName) == 0)
+ {
bNewName = false;
}
}
- if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
- //memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); // the creative was brain broken.
+ if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0))
+ {
+ memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); // the creative was brain broken.
ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(s32), &ALDeviceInfo.iMajorVersion);