Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed 'Auto-name' into 'Init from RTTI' and it now also inits the v…
…table pointer automatically.
  • Loading branch information
FransBouma committed Jul 3, 2023
commit b61edca698a3c7111c2d328e289ea966340b81f4
4 changes: 2 additions & 2 deletions ReClass.NET/Controls/MemoryViewControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public void Reset()
}


public void AutoNameCurrentClassFromRTTI(ClassNode classNode)
public void InitCurrentClassFromRTTI(ClassNode classNode)
{
var args = new DrawContextRequestEventArgs { Node = classNode };

Expand All @@ -721,7 +721,7 @@ public void AutoNameCurrentClassFromRTTI(ClassNode classNode)
Address = args.BaseAddress,
Level = 0,
};
classNode.AutoNameFromRTTI(view);
classNode.InitFromRTTI(view);
}
}
}
72 changes: 36 additions & 36 deletions ReClass.NET/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ReClass.NET/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ private void memoryViewControl_SelectionChanged(object sender, EventArgs e)

addBytesToolStripDropDownButton.Enabled = parentContainer != null || isContainerNode;
insertBytesToolStripDropDownButton.Enabled = selectedNodes.Count == 1 && parentContainer != null && !isContainerNode;
autoNameClassToolStripMenuItem.Enabled = nodeIsClass;
initClassToolStripMenuItem.Enabled = nodeIsClass;

var enabled = selectedNodes.Count > 0 && !nodeIsClass;
toolStrip.Items.OfType<TypeToolStripButton>().ForEach(b => b.Enabled = enabled);
Expand Down Expand Up @@ -1054,15 +1054,15 @@ private void memoryViewControl_DrawContextRequested(object sender, DrawContextRe
}


private void autoNameClassToolStripMenuItem_Click(object sender, EventArgs e)
private void initClassToolStripMenuItem_Click(object sender, EventArgs e)
{
var selectedNodes = memoryViewControl.GetSelectedNodes();
var node = selectedNodes.FirstOrDefault()?.Node;
if (node == null || !(node is ClassNode))
{
return;
}
memoryViewControl.AutoNameCurrentClassFromRTTI(node as ClassNode);
memoryViewControl.InitCurrentClassFromRTTI(node as ClassNode);
}
}
}
9 changes: 6 additions & 3 deletions ReClass.NET/Nodes/BaseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ public abstract class BaseNode
/// <summary>Gets or sets the parent node.</summary>
public BaseNode ParentNode { get; internal set; }

/// <summary>Gets a value indicating whether this node is wrapped into an other node. We see classnodes never as wrapped.</summary>
public bool IsWrapped => (ParentNode is BaseWrapperNode && !(this is ClassNode));
/// <summary>Gets a value indicating whether this node is wrapped into an other node. </summary>
public bool IsWrapped => (ParentNode is BaseWrapperNode);
Comment thread
FransBouma marked this conversation as resolved.
Outdated

/// <summary>All nodes that are wrapped can't be selected except classnodes because they have a context menu</summary>
public bool CanBeSelected => (!IsWrapped || (this is ClassNode));
Comment thread
FransBouma marked this conversation as resolved.
Outdated

/// <summary>Gets or sets a value indicating whether this node is hidden.</summary>
public bool IsHidden { get; set; }
Expand Down Expand Up @@ -376,7 +379,7 @@ protected void AddSelection(DrawContext context, int x, int y, int height)
Contract.Requires(context != null);
Contract.Requires(context.Graphics != null);

if (y > context.ClientArea.Bottom || y + height < 0 || IsWrapped)
if (y > context.ClientArea.Bottom || y + height < 0 || !CanBeSelected)
{
return;
}
Expand Down
13 changes: 10 additions & 3 deletions ReClass.NET/Nodes/ClassNode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Drawing;
using System.Linq;
Expand Down Expand Up @@ -52,8 +53,12 @@ public static ClassNode Create()
return new ClassNode(true);
}


public void AutoNameFromRTTI(DrawContext context)

/// <summary>
/// Initializes the class' name and vtable node from RTTI information, if it's not set already
/// </summary>
/// <param name="context"></param>
public void InitFromRTTI(DrawContext context)
{
// first node should be a VTable node or a hex64/32 node
if (Nodes.Count <= 0)
Expand All @@ -77,7 +82,9 @@ public void AutoNameFromRTTI(DrawContext context)
if (!string.IsNullOrEmpty(rttiInfoFromFirstNode))
{
// convert first node to vtable node
#warning IMPLEMENT: CONVERT NODE TO VTABLE NODE
var newVTableNode = BaseNode.CreateInstanceFromType(typeof(VirtualMethodTableNode));
var createdNodes = new List<BaseNode>();
this.ReplaceChildNode(firstNode, newVTableNode, ref createdNodes);
}
}
}
Expand Down