public static ulong FollowMainPointer(IRAMReadWriter connection, long[] jumps, bool isBeriBase) { // beri sys-botbase can solve entire pointer if (isBeriBase) { return((ulong)((long)connection.FollowMainPointer(jumps.Take(jumps.Length - 1).ToArray()) + jumps[jumps.Length - 1])); } // solve pointer manually var ofs = (ulong)jumps[0]; // won't work with negative first jump var address = BitConverter.ToUInt64(connection.ReadBytes(ofs, 8, RWMethod.Main), 0); for (int i = 1; i < jumps.Length - 1; ++i) { var jump = jumps[i]; if (jump > 0) { address += (ulong)jump; } else { address -= (ulong)Math.Abs(jump); } byte[] bytes = connection.ReadBytes(address, 0x8, RWMethod.Absolute); address = BitConverter.ToUInt64(bytes, 0); } return(address + (ulong)jumps[jumps.Length - 1]); }
public static string GetFirstPlayerTownName(IRAMReadWriter rw) { ulong address = OffsetHelper.getPlayerIdAddress(SysBotController.CurrentOffsetFirstPlayerUInt) - 0xB8 + 0x04; byte[] tName = rw.ReadBytes(address, 20); return(StringUtil.GetString(tName, 0, 10)); }
public static string[] FetchPlayerNames(IRAMReadWriter rw) { List <string> toRet = new List <string>(); for (int i = 0; i < 8; ++i) { ulong address = OffsetHelper.getPlayerIdAddress(SysBotController.CurrentOffsetFirstPlayerUInt) - 0xB8 + 0x20 + (OffsetHelper.PlayerSize * (ulong)i); byte[] pName = rw.ReadBytes((uint)address, 20); string name = string.Empty; if (!isZeroArray(pName)) { name = StringUtil.GetString(pName, 0, 10); } toRet.Add(name == string.Empty ? string.Format("No one ({0})", (char)((uint)'A' + i)) : name); } return(toRet.ToArray()); }
public bool ReadValidate(out byte[] data) { PlayerItemSet.GetOffsetLength(WriteOffset, out var offset, out var size); data = Bot.ReadBytes(offset, size); return(Validate(data)); }
// jpeg sizes are 100k-200k bytes so I gave up on this because the load time simply isn't worth it (around 15 seconds over usb) public void FetchPlayerJpeg(int playerNumber, IRAMReadWriter rw) { ulong address = OffsetHelper.getPlayerProfileMainAddress(SysBotController.CurrentOffsetFirstPlayerUInt) - 0xB8 + 0x10 + (OffsetHelper.PlayerSize * (ulong)playerNumber); int length = BitConverter.ToInt32(rw.ReadBytes((uint)address, 4), 0); }
public bool ReadValidate(out byte[] data) { data = Bot.ReadBytes(DataOffset, size); return(Validate(data)); }