Allow missing Compatibility sections in moduleinfo

Don't know why anyone would do this though.
This commit is contained in:
Robbert van der Helm
2023-03-12 13:29:03 +01:00
parent a35cd8da50
commit 0501aefd69
2 changed files with 19 additions and 5 deletions
+7
View File
@@ -17,6 +17,13 @@ Versioning](https://semver.org/spec/v2.0.0.html).
makes sure that Wine will keep using X11 even if Wayland support becomes makes sure that Wine will keep using X11 even if Wayland support becomes
available at some point. available at some point.
### yabridgectl
- VST 3.7.5 `moduleinfo.json` files without a `Compatibility` field are now
supported. Previously this would result in a parsing error because the whole
point of the `moduleinfo.json` files is to provide `Compatibility` mappings
for older VST2 plugins.
## [5.0.4] - 2023-02-23 ## [5.0.4] - 2023-02-23
### Fixed ### Fixed
+12 -5
View File
@@ -28,8 +28,12 @@ use std::fmt::Write;
pub struct ModuleInfo { pub struct ModuleInfo {
#[serde(rename = "Classes")] #[serde(rename = "Classes")]
classes: Vec<Class>, classes: Vec<Class>,
// The whole point of moduleinfo.json is so plugins can provide these compatibility mappings,
// but apparently there are now plugins that have a moduleinfo file without compatibility
// mappings
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "Compatibility")] #[serde(rename = "Compatibility")]
compatibility_mappings: Vec<CompatibilityMapping>, compatibility_mappings: Option<Vec<CompatibilityMapping>>,
#[serde(flatten)] #[serde(flatten)]
other: serde_jsonrc::Map<String, serde_jsonrc::Value>, other: serde_jsonrc::Map<String, serde_jsonrc::Value>,
} }
@@ -64,10 +68,13 @@ impl ModuleInfo {
class.cid = encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(&class.cid)?)); class.cid = encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(&class.cid)?));
} }
for mapping in &mut self.compatibility_mappings { if let Some(compatibility_mappings) = &mut self.compatibility_mappings {
mapping.new = encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(&mapping.new)?)); for mapping in compatibility_mappings {
for cid in &mut mapping.old { mapping.new =
*cid = encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(cid)?)) encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(&mapping.new)?));
for cid in &mut mapping.old {
*cid = encode_hex_uid(&rewrite_uid_byte_order(&decode_hex_uid(cid)?))
}
} }
} }