private static string GetModifiers(Il2CppMethodDefinition methodDef) { if (!methodModifiers.TryGetValue(methodDef, out string str)) { var sb = new StringBuilder(); var access = methodDef.flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK; switch (access) { case METHOD_ATTRIBUTE_PRIVATE: sb.Append("private "); break; case METHOD_ATTRIBUTE_PUBLIC: sb.Append("public "); break; case METHOD_ATTRIBUTE_FAMILY: sb.Append("protected "); break; case METHOD_ATTRIBUTE_ASSEM: case METHOD_ATTRIBUTE_FAM_AND_ASSEM: sb.Append("internal "); break; case METHOD_ATTRIBUTE_FAM_OR_ASSEM: sb.Append("protected internal "); break; } if ((methodDef.flags & METHOD_ATTRIBUTE_STATIC) != 0) { sb.Append("static "); } if ((methodDef.flags & METHOD_ATTRIBUTE_ABSTRACT) != 0) { sb.Append("abstract "); if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_REUSE_SLOT) { sb.Append("override "); } } else if ((methodDef.flags & METHOD_ATTRIBUTE_FINAL) != 0) { if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_REUSE_SLOT) { sb.Append("sealed override "); } } else if ((methodDef.flags & METHOD_ATTRIBUTE_VIRTUAL) != 0) { if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_NEW_SLOT) { sb.Append("virtual "); } else { sb.Append("override "); } } if ((methodDef.flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) != 0) { sb.Append("extern "); } methodModifiers.Add(methodDef, str = sb.ToString()); } return(str); }
public Il2CppRGCTXDefinition[] GetRGCTXDefinition(string imageName, Il2CppMethodDefinition methodDef) { Il2CppRGCTXDefinition[] collection = null; if (il2Cpp.Version >= 24.2) { il2Cpp.rgctxsDictionary[imageName].TryGetValue(methodDef.token, out collection); } else { if (methodDef.rgctxCount > 0) { collection = new Il2CppRGCTXDefinition[methodDef.rgctxCount]; Array.Copy(metadata.rgctxEntries, methodDef.rgctxStartIndex, collection, 0, methodDef.rgctxCount); } } return(collection); }
public ulong GetMethodPointer(string imageName, Il2CppMethodDefinition methodDef) { if (Version >= 24.2) { var methodToken = methodDef.token; var ptrs = codeGenModuleMethodPointers[imageName]; var methodPointerIndex = methodToken & 0x00FFFFFFu; return(ptrs[methodPointerIndex - 1]); } else { var methodIndex = methodDef.methodIndex; if (methodIndex >= 0) { return(methodPointers[methodIndex]); } } return(0); }
public string GetModifiers(Il2CppMethodDefinition methodDef) { if (methodModifiers.TryGetValue(methodDef, out string str)) { return(str); } var access = methodDef.flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK; switch (access) { case METHOD_ATTRIBUTE_PRIVATE: str += "private "; break; case METHOD_ATTRIBUTE_PUBLIC: str += "public "; break; case METHOD_ATTRIBUTE_FAMILY: str += "protected "; break; case METHOD_ATTRIBUTE_ASSEM: case METHOD_ATTRIBUTE_FAM_AND_ASSEM: str += "internal "; break; case METHOD_ATTRIBUTE_FAM_OR_ASSEM: str += "protected internal "; break; } if ((methodDef.flags & METHOD_ATTRIBUTE_STATIC) != 0) { str += "static "; } if ((methodDef.flags & METHOD_ATTRIBUTE_ABSTRACT) != 0) { str += "abstract "; if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_REUSE_SLOT) { str += "override "; } } else if ((methodDef.flags & METHOD_ATTRIBUTE_FINAL) != 0) { if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_REUSE_SLOT) { str += "sealed override "; } } else if ((methodDef.flags & METHOD_ATTRIBUTE_VIRTUAL) != 0) { if ((methodDef.flags & METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK) == METHOD_ATTRIBUTE_NEW_SLOT) { str += "virtual "; } else { str += "override "; } } if ((methodDef.flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) != 0) { str += "extern "; } methodModifiers.Add(methodDef, str); return(str); }