Index: uisimulator/common/io.c =================================================================== RCS file: /cvsroot/rockbox/uisimulator/common/io.c,v retrieving revision 1.29 diff -u -r1.29 io.c --- uisimulator/common/io.c 11 Mar 2006 16:16:15 -0000 1.29 +++ uisimulator/common/io.c 8 Jun 2006 07:56:28 -0000 @@ -311,23 +311,32 @@ void* ptr2, int bufwrap, void **pd) { void *hdr; - const char *path = "archos/_temp_codec.dll"; + char path[256]; int fd; int copy_n; #ifdef WIN32 char buf[256]; #endif + int count; *pd = NULL; /* We have to create the dynamic link library file from ram - so we could simulate the codec loading. */ + so we could simulate the codec loading. + Note that the DLL cannot be overwritten whilst in use so + multiple codecs (especially when voice is in use) may require + multiple DLLs. */ + fd = -1; + count = 0; + while (fd < 0 && count < 999) { + sprintf(path, "archos/_temp_codec%d.dll", ++count); #ifdef WIN32 - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); #else - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); #endif + } if (fd < 0) { DEBUGF("failed to open for write: %s\n", path); return NULL;