public long GetNsoAddress(NsoTypeEnum type) { long addr = 0; for (int i = 0; i < (int)type; i++) { if (Nsos[i] != null) { addr += Nsos[i].EndAddress; } } return((addr + 0xFFF) & ~0xFFF); }
public MemAddress(string s) { IsSymbol = s.StartsWith("!"); if (IsSymbol) { Symbol = s.Substring(1); } else { if (!Regex.IsMatch(s, @"^(rtld|main|sdk)\+(([0-9]{1,})|(0x[0-9a-fA-F]{1,}))$")) { throw new PatchConfigException($"Invalid address : {s}"); } var split = s.Split('+'); NsoType = (NsoTypeEnum)Enum.Parse(typeof(NsoTypeEnum), split[0]); Offset = (split[1].StartsWith("0x")) ? uint.Parse(split[1].Substring(2), NumberStyles.HexNumber) : uint.Parse(split[1]); } }
public long GetAddress(ExeFS exefs, List <Tuple <string, uint> > symbols) { if (IsSymbol) { foreach (var sym in symbols) { if (sym.Item1 == Symbol) { return(exefs.GetNsoAddress(NsoTypeEnum.sdk) + sym.Item2); } } throw new PatchConfigException($"Could not find symbol : {Symbol}"); } else { NsoTypeEnum type = NsoType; if (type == NsoTypeEnum.sdk) { type = NsoTypeEnum.subsdk0; } return(exefs.GetNsoAddress(type) + Offset); } }
public Nso GetNso(NsoTypeEnum type) { return(Nsos[(int)type]); }
public void SetNso(Nso nso, NsoTypeEnum type) { Nsos[(int)type] = nso; }