Plugins: Supporting USB export in Opus 10 & above

Opus 10 changed the way plugins indicate they are "USB Safe".

(USB Safe plugins that we know of were updated in advance so the change should not have broken anything.)

Being "USB Safe" means a plugin can be included when exporting Opus to a USB stick and that the plugin won't modify settings outside of the Opus config directory.

Old and new methods

[ul][li]Before Opus 10, plugins indicated they were USB safe by implementing the DVP_USBSafe (viewer plugins) or VFS_USBSafe (VFS plugins) functions, as described in the plugin SDK.

[li]From Opus 10 onwards, DVP_USBSafe and VFS_USBSafe are no longer used or required. Instead, Opus 10 looks for a simple XML manifest within the plugin's DLL resources. This allows Opus to obtain information on each plugin without having to load it as a library and, in turn, simplifies things when the 64-bit version of Opus is asked to export a 32-bit version to USB.

[li]Plugins can use both methods if they wish to support old and new versions of Opus. See the Maya IFF plugin source for an example.[/li][/ul]

Basic USB-Safe manifest

Most plugins only need a basic manifest specifying their name and that they are USB Safe. (The name appears in the list of plugins the user can choose from when exporting.)

<?xml version="1.0" encoding="UTF-8"?> <opus_plugin name="Example Plugin"> <usb_safe safe="yes" /> </opus_plugin>

The manifest should be added to the DLL's resources with ID 1 and type OPUS (see the Maya IFF plugin source for an example).

Note that the USB-Safe manifest is unrelated to the standard Windows XML manifest your DLL may already have. They're both XML and both added to the DLL resources but that is all they have in common. They should be separate resources and should not be merged together.

Specifying additional exports

The USB-Safe manifest can include a list of additional components which the plugin depends on and which need to be exported along with the main plugin DLL. (These components are usually EXE or DLL files and should be in the same directory as the plugin itself.) Here's an example:

<?xml version="1.0" encoding="UTF-8"?> <opus_plugin name="Example Plugin"> <usb_safe safe="yes"> <export>ExtraLibrary.dll</export> <export>ExtraTool.exe</export> <export platform="x86">Extra32BitLibrary.dll</export> <export platform="x64">Extra64BitLibrary.dll</export> </usb_safe> </opus_plugin>

For each listed component, specify platform="x86" or platform="x64" if it is only for 32-bit or 64-bit versions, respectively. If no platform is specified then the component will always be included.