From 48005b409302b680a0b8e747508ff32dec38ae23 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Fri, 24 Jul 2020 17:41:40 +0200 Subject: [PATCH] C++: Fix enum int top bit set compile errors in VS <= 2017 --- Il2CppInspector.Common/Cpp/CppField.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector.Common/Cpp/CppField.cs b/Il2CppInspector.Common/Cpp/CppField.cs index d4dcd85..f550f5f 100644 --- a/Il2CppInspector.Common/Cpp/CppField.cs +++ b/Il2CppInspector.Common/Cpp/CppField.cs @@ -81,6 +81,8 @@ namespace Il2CppInspector.Cpp public CppEnumField(string name, CppType type, object value) : base(name, type) => Value = value; - public override string ToString(string format = "") => Name + " = " + Value; + // We output as hex to avoid unsigned value compiler errors for top bit set values in VS <= 2017 + // We'll get compiler warnings instead but it will still compile + public override string ToString(string format = "") => $"{Name} = 0x{Value:x8}"; } }