diff --git a/ReClass.NET/CodeGenerator/CppCodeGenerator.cs b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs index b6495aab..543e5f6f 100644 --- a/ReClass.NET/CodeGenerator/CppCodeGenerator.cs +++ b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs @@ -437,9 +437,16 @@ private void WriteNode(IndentedTextWriter writer, BaseNode node, ILogger logger) if (simpleType != null) { //$"{type} {node.Name}; //0x{node.Offset.ToInt32():X04} {node.Comment}".Trim(); - writer.Write(simpleType); - writer.Write(" "); - writer.Write(node.Name); + if (node.IsCustomType) + { + writer.Write(node.GetCustomTypeName()); + } + else + { + writer.Write(simpleType); + writer.Write(" "); + writer.Write(node.Name); + } writer.Write("; //0x"); writer.Write($"{node.Offset:X04}"); if (!string.IsNullOrEmpty(node.Comment)) @@ -451,7 +458,14 @@ private void WriteNode(IndentedTextWriter writer, BaseNode node, ILogger logger) } else if (node is BaseWrapperNode) { - writer.Write(ResolveWrappedType(node, false, logger)); + if (node.IsCustomType) + { + writer.Write(node.GetCustomTypeName()); + } + else + { + writer.Write(ResolveWrappedType(node, false, logger)); + } writer.Write("; //0x"); writer.Write($"{node.Offset:X04}"); if (!string.IsNullOrEmpty(node.Comment)) diff --git a/ReClass.NET/Nodes/BaseNode.cs b/ReClass.NET/Nodes/BaseNode.cs index adef39e5..f2513ea9 100644 --- a/ReClass.NET/Nodes/BaseNode.cs +++ b/ReClass.NET/Nodes/BaseNode.cs @@ -520,6 +520,32 @@ protected void DrawInvalidMemoryIndicatorIcon(DrawContext context, int y) AddIcon(context, 0, y, Properties.Resources.B16x16_Error, HotSpot.NoneId, HotSpotType.None); } } + + /// + /// + public bool IsCustomType { get => (Name.Length > 0 && Name[0] == '#'); } + + /// + /// + public string GetCustomTypeName() + { + return Name.Substring(1); + } + + /// + /// + public string GetCustomType() + { + string name = Name; + int len; + if (name.IndexOf('*') != -1) + len = name.LastIndexOf('*') + 1; + else + len = name.LastIndexOf(' '); + if (len == -1) + return Name; + return name.Substring(0, len); + } } [ContractClassFor(typeof(BaseNode))] diff --git a/ReClass.NET/Nodes/BaseNumericNode.cs b/ReClass.NET/Nodes/BaseNumericNode.cs index 61782ca6..41928bb7 100644 --- a/ReClass.NET/Nodes/BaseNumericNode.cs +++ b/ReClass.NET/Nodes/BaseNumericNode.cs @@ -40,7 +40,12 @@ protected Size DrawNumeric(DrawContext context, int x, int y, Image icon, string x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { + int xx = x; x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + if (IsCustomType) + { + AddText(context, xx, y, context.Settings.IndexColor, HotSpot.NoneId, GetCustomType()); + } } x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "=") + context.Font.Width; x = AddText(context, x, y, context.Settings.ValueColor, 0, value) + context.Font.Width; diff --git a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs index ee042751..b9186af5 100644 --- a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs +++ b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs @@ -48,7 +48,12 @@ protected Size Draw(DrawContext context, int x, int y, string type) x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { + int xx = x; x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); + if (IsCustomType) + { + AddText(context, xx, y, context.Settings.IndexColor, HotSpot.NoneId, GetCustomType()); + } } x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); x = AddText(context, x, y, context.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString());