-static voidpf ZCALLBACK fopendisk_file_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
-{
- FILE_IOPOSIX *ioposix = NULL;
- char *diskFilename = NULL;
- voidpf ret = NULL;
- int i = 0;
-
- if (stream == NULL)
- return NULL;
- ioposix = (FILE_IOPOSIX*)stream;
- diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char));
- strncpy(diskFilename, (const char*)ioposix->filename, ioposix->filenameLength);
- for (i = ioposix->filenameLength - 1; i >= 0; i -= 1)
- {
- if (diskFilename[i] != '.')
- continue;
- snprintf(&diskFilename[i], ioposix->filenameLength - i, ".z%02u", number_disk + 1);
- break;
- }
- if (i >= 0)
- ret = fopen_file_func(opaque, diskFilename, mode);
- free(diskFilename);
- return ret;
-}
-