From 0578443338d0783bde030ae1c7fcb6f3eb12b438 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Sat, 11 Jul 2020 13:47:28 -0400 Subject: [PATCH] Slight modification to previous commit: Keep config forward compatibility in this case. That way, if somedev tries to bisect something, they don't get pooped on by their config. --- src/BizHawk.Client.Common/config/ConfigExtensions.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.Common/config/ConfigExtensions.cs b/src/BizHawk.Client.Common/config/ConfigExtensions.cs index e6b4e7e4d2..dd8bf0ff70 100644 --- a/src/BizHawk.Client.Common/config/ConfigExtensions.cs +++ b/src/BizHawk.Client.Common/config/ConfigExtensions.cs @@ -6,9 +6,18 @@ namespace BizHawk.Client.Common { public static class ConfigExtensions { + private class TypeNameEncapsulator + { + public object o; + } private static JToken Serialize(object o) { - return JToken.FromObject(o, ConfigService.Serializer); + var tne = new TypeNameEncapsulator { o = o }; + return JToken.FromObject(tne, ConfigService.Serializer)["o"]; + + // Maybe todo: This code is identical to the code above, except that it does not emit the legacy "$type" + // parameter that we no longer need here. Leaving that in to make bisecting during this dev phase easier, and such. + // return JToken.FromObject(o, ConfigService.Serializer); } private static object Deserialize(JToken j, Type type) {