mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
put a plugin-interface version into the meta data of each plugin. don't load plugins that don't match the current version.
This commit is contained in:
parent
c8db50cb20
commit
6a88941166
14 changed files with 73 additions and 13 deletions
|
@ -71,6 +71,24 @@ QString getPluginIIDFromMetaData(QJsonObject object) {
|
|||
return object[IID_KEY].toString();
|
||||
}
|
||||
|
||||
int getPluginInterfaceVersionFromMetaData(QJsonObject object) {
|
||||
static const char* METADATA_KEY = "MetaData";
|
||||
static const char* NAME_KEY = "version";
|
||||
|
||||
if (!object.contains(METADATA_KEY) || !object[METADATA_KEY].isObject()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto metaDataObject = object[METADATA_KEY].toObject();
|
||||
|
||||
if (!metaDataObject.contains(NAME_KEY) || !metaDataObject[NAME_KEY].isDouble()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int)(metaDataObject[NAME_KEY].toDouble());
|
||||
}
|
||||
|
||||
|
||||
QStringList preferredDisplayPlugins;
|
||||
QStringList disabledDisplays;
|
||||
QStringList disabledInputs;
|
||||
|
@ -122,7 +140,11 @@ const LoaderList& getLoadedPlugins() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (loader->load()) {
|
||||
if (getPluginInterfaceVersionFromMetaData(loader->metaData()) != HIFI_PLUGIN_INTERFACE_VERSION) {
|
||||
qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "interface version doesn't match, not loading:"
|
||||
<< getPluginInterfaceVersionFromMetaData(loader->metaData())
|
||||
<< "doesn't match" << HIFI_PLUGIN_INTERFACE_VERSION;
|
||||
} else if (loader->load()) {
|
||||
qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "loaded successfully";
|
||||
loadedPlugins.push_back(loader);
|
||||
} else {
|
||||
|
|
|
@ -61,3 +61,5 @@ private:
|
|||
DisplayPluginList _displayPlugins;
|
||||
InputPluginList _inputPlugins;
|
||||
};
|
||||
|
||||
static const int HIFI_PLUGIN_INTERFACE_VERSION = 1;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"HiFi 4:1 Audio Codec"}
|
||||
{
|
||||
"name":"HiFi 4:1 Audio Codec",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Kinect"}
|
||||
{
|
||||
"name":"Kinect",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Leap Motion"}
|
||||
{
|
||||
"name":"Leap Motion",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Neuron"}
|
||||
{
|
||||
"name":"Neuron",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"SDL2"}
|
||||
{
|
||||
"name":"SDL2",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Sixense"}
|
||||
{
|
||||
"name":"Sixense",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Spacemouse"}
|
||||
{
|
||||
"name":"Spacemouse",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Oculus Rift"}
|
||||
{
|
||||
"name":"Oculus Rift",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Oculus Rift"}
|
||||
{
|
||||
"name":"Oculus Rift",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"OpenVR (Vive)"}
|
||||
{
|
||||
"name":"OpenVR (Vive)",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"PCM Codec"}
|
||||
{
|
||||
"name":"PCM Codec",
|
||||
"version":1
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{"name":"Steam Client"}
|
||||
{
|
||||
"name":"Steam Client",
|
||||
"version":1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue