Skip to content

Commit 001633b

Browse files
committed
Merge branch 'feat/hub-class-nav-parity'
Complete hub-class navigation parity (Architecture register predicates, Platform type-ref generation, StructureMember.BitOffset). Validated 24/24.
2 parents a019526 + bc8cbb5 commit 001633b

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

‎Handle/BNArchitecture.cs‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,25 @@ out ulong arrayLength
227227
return targets.ToArray();
228228
}
229229
}
230-
230+
231+
/// <summary>
232+
/// Whether the given register is a global register for this architecture.
233+
/// Mirrors C++ <c>Architecture::IsGlobalRegister</c>.
234+
/// </summary>
235+
public bool IsGlobalRegister(RegisterIndex reg)
236+
{
237+
return NativeMethods.BNIsArchitectureGlobalRegister(this.handle , reg);
238+
}
239+
240+
/// <summary>
241+
/// Whether the given register is a system register for this architecture.
242+
/// Mirrors C++ <c>Architecture::IsSystemRegister</c>.
243+
/// </summary>
244+
public bool IsSystemRegister(RegisterIndex reg)
245+
{
246+
return NativeMethods.BNIsArchitectureSystemRegister(this.handle , reg);
247+
}
248+
231249
public ILFlag[] Flags
232250
{
233251
get

‎Handle/BNPlatform.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,22 @@ public unsafe string GenerateAutoPlatformTypeId(QualifiedName name)
607607
}
608608
}
609609

610+
/// <summary>
611+
/// Generates an auto platform NamedTypeReference for the given qualified name and class.
612+
/// Mirrors C++ <c>Platform::GenerateAutoPlatformTypeReference</c> / Python
613+
/// <c>Platform.generate_auto_platform_type_ref</c>: builds the auto platform type ID for
614+
/// the name, then constructs a NamedTypeReference from the class, ID, and name.
615+
/// </summary>
616+
public NamedTypeReference GenerateAutoPlatformTypeReference(
617+
NamedTypeReferenceClass cls ,
618+
QualifiedName name
619+
)
620+
{
621+
string typeId = this.GenerateAutoPlatformTypeId(name);
622+
623+
return new NamedTypeReference(cls , typeId , name);
624+
}
625+
610626
/// <summary>
611627
/// Creates a new platform with types loaded from a type definition file.
612628
/// </summary>

‎Struct/BNStructureMember.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ public sealed class StructureMember : INativeWrapperEx<BNStructureMember>
6868

6969
public byte BitWidth { get; set; } = 0;
7070

71+
/// <summary>
72+
/// Total bit offset from the start of the structure (<c>Offset * 8 + BitPosition</c>).
73+
/// Mirrors Python <c>StructureMember.bit_offset</c>.
74+
/// </summary>
75+
public ulong BitOffset
76+
{
77+
get
78+
{
79+
return (this.Offset * 8) + this.BitPosition;
80+
}
81+
}
82+
7183
public StructureMember(
7284
BinaryNinja.Type kind,
7385
string name,

0 commit comments

Comments
 (0)