mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 17:10:45 -05:00
Don't automatch deobfuscator given method names
This commit is contained in:
parent
c9a036d6db
commit
82eec7b657
@ -1,6 +1,6 @@
|
||||
{
|
||||
"MappingPath": "",
|
||||
"TokensToMatch": [
|
||||
"TypeNamesToMatch": [
|
||||
"Class",
|
||||
"GClass",
|
||||
"GStruct",
|
||||
@ -8,5 +8,10 @@
|
||||
"ValueStruct",
|
||||
"Interface",
|
||||
"GInterface"
|
||||
],
|
||||
"MethodsToIgnore": [
|
||||
"method_",
|
||||
"smethod_",
|
||||
"vmethod_"
|
||||
]
|
||||
}
|
@ -13,7 +13,12 @@ public class Settings
|
||||
public string MappingPath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The re-mapper will look for these tokens in class names, otherwise they will be skipped
|
||||
/// The re-mapper will look for these classes, otherwise they will be skipped
|
||||
/// </summary>
|
||||
public required List<string> TokensToMatch { get; set; }
|
||||
public required List<string> TypeNamesToMatch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of method names to be ignored during the auto-match process.
|
||||
/// </summary>
|
||||
public required List<string> MethodsToIgnore { get; set; }
|
||||
}
|
@ -10,8 +10,8 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
|
||||
private List<TypeDef>? CandidateTypes { get; set; }
|
||||
|
||||
private static List<string> _tokens = DataProvider.Settings.TypeNamesToMatch;
|
||||
private static List<string> _methodsToIgnore = DataProvider.Settings.TypeNamesToMatch;
|
||||
private static readonly List<string> TypesToMatch = DataProvider.Settings.TypeNamesToMatch;
|
||||
private static readonly List<string> MethodsToIgnore = DataProvider.Settings.MethodsToIgnore;
|
||||
|
||||
public void AutoMatch(string assemblyPath, string oldTypeName, string newTypeName)
|
||||
{
|
||||
@ -22,8 +22,7 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
|
||||
Module = module;
|
||||
CandidateTypes = Module.GetTypes()
|
||||
.Where(t => _tokens.Any(token => t.Name.StartsWith(token)))
|
||||
// .Where(t => t.Name != oldTypeName)
|
||||
.Where(t => TypesToMatch.Any(token => t.Name.StartsWith(token)))
|
||||
.ToList();
|
||||
|
||||
var targetTypeDef = FindTargetType(oldTypeName);
|
||||
@ -166,17 +165,21 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
// Methods in target that are not in candidate
|
||||
var includeMethods = target.Methods
|
||||
.Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter)
|
||||
.Where(m => !MethodsToIgnore.Any(mi => m.Name.String.StartsWith(mi)))
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(candidate.Methods
|
||||
.Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter)
|
||||
.Where(m => !MethodsToIgnore.Any(mi => m.Name.String.StartsWith(mi)))
|
||||
.Select(s => s.Name.ToString()));
|
||||
|
||||
// Methods in candidate that are not in target
|
||||
var excludeMethods = candidate.Methods
|
||||
.Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter)
|
||||
.Where(m => !MethodsToIgnore.Any(mi => m.Name.String.StartsWith(mi)))
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(target.Methods
|
||||
.Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter)
|
||||
.Where(m => !MethodsToIgnore.Any(mi => m.Name.String.StartsWith(mi)))
|
||||
.Select(s => s.Name.ToString()));
|
||||
|
||||
foreach (var include in includeMethods)
|
||||
|
Loading…
x
Reference in New Issue
Block a user