diff --git a/engines/sci/sfx/device/devices.cpp b/engines/sci/sfx/device/devices.cpp index a2d2cd58b3d..c4a9f4808f2 100644 --- a/engines/sci/sfx/device/devices.cpp +++ b/engines/sci/sfx/device/devices.cpp @@ -47,23 +47,21 @@ struct _midi_device **devices[] = { devices_opl2, }; -static struct _midi_device *find_dev(int type, char *name) { +void *sfx_find_device(int type, char *name) { + struct _midi_device *dev = NULL; int i = 0; if (!type) return NULL; - if (!name) - return devices[type][0]; + if (!name) { + dev = devices[type][0]; + } else { + while (devices[type][i] && !strcmp(name, devices[type][i]->name)) + ++i; - while (devices[type][i] && !strcmp(name, devices[type][i]->name)) - ++i; - - return devices[type][i]; -} - -void *sfx_find_device(int type, char *name) { - struct _midi_device *dev = find_dev(type, name); + dev = devices[type][i]; + } if (dev) { if (dev->init(dev)) {