Hello. I'm developing OpenMPT, and one of our users had trouble using this VST plugin in OpenMPT: After using it in a track and then trying to reload the track, the whole track failed load. This happens because OpenMPT can load zipped module files, so it first tries to read a file as a ZIP file, and if successful it tries to load a file from that ZIP file as a module. If the file wasn't a ZIP file, it will directly try to load it as a module instead.
What's the problem? Well, ZIP is a peculiar format. Some background information on that, in case you weren't aware: Most people would probably expect that a ZIP file must start with the "PK" magic bytes, but they don't really need to be at the start of the file. To read a ZIP file, you start by finding the central directory, which is placed towards the end of the file. It may not be at the exact end, because a comment text up to 64KB in length may follow. So a typical implementation will seek backwards within the last 64KB of the file to find the central directory (and it seems like many if not all ZIP libraries don't check if the declared length of that comment is actually identical to the number of byte past the end of the central directory). This mechanism is also the reason why you can open a self-extracting ZIP file (i.e. an EXE with embedded ZIP) in pretty much any software that can handle ZIP files - it will simply not care that there's an EXE stub in front of the ZIP.
As a consequence of this design, any music project file of any DAW where the plugin chunk dump by this plugin is placed close to the last 64KB of the project file is at the same time by definition also a valid ZIP file! And as a result of that, any software that, like OpenMPT, can open both regular ZIP files and also its own music project files will end up in a situation where a file is technically both a ZIP file and a music project file. I will try to find a workaround for OpenMPT, but as other DAWs could still encounter similar issues.
As a conclusion, I think it would make sense if RetroPlug didn't give a complete ZIP file as plugin chunk data to the host. I could think of several workarounds:
- XOR-"encrypt" the chunk data. Not very nice but it would avoid being detected as a ZIP file.
- Use a different standard archival container format that cannot be placed in the middle of another file, for example tar.gz
- Just don't use a container format at all and write your own (e.g. zero-terminated filename followed by compressed and uncompressed size fields, followed by zlib-compressed data).
- For backwards compatibility, the plugin should of course still try to load the plugin chunk as a ZIP file.