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]); }
private void OnEnable() { if (!initialized) { return; } UI_ACItemGrid currentlyLoadedGrid = UI_ACItemGrid.LastInstanceOfItemGrid; if (currentlyLoadedGrid == null) { return; } IRAMReadWriter currentWriter = currentlyLoadedGrid.GetCurrentlyActiveReadWriter(); foreach (AdditionalButton b in spawnedButtons) { if (b.AssociatedPanel.RequiresActiveConnection) { if (currentWriter != null) { b.AssociatedPanel.CurrentConnection = currentWriter; } b.SetActiveForConnection(currentWriter != null); } else { b.SetActiveForConnection(true); } } }
/// <summary> /// Returns null if settings selected bot is active /// </summary> /// <returns>Active readwriter</returns> public IRAMReadWriter GetCurrentlyActiveReadWriter() { InjectionProtocol currentIP = UI_Settings.GetInjectionProtocol(); IRAMReadWriter toRet = null; switch (currentIP) { case InjectionProtocol.Sysbot: if (CurrentSysBot.Connected) { toRet = CurrentSysBot; } break; case InjectionProtocol.UsbBot: #if UNITY_STANDALONE || UNITY_EDITOR if (CurrentUSBBot.Connected) { toRet = CurrentUSBBot; } #elif PLATFORM_ANDROID if (CurrentUSBBotAndroid.Connected) { toRet = CurrentUSBBotAndroid; } #endif break; } return(toRet); }
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 PocketInjector(IReadOnlyList <Item> items, IRAMReadWriter bot) { Items = items; Bot = bot; }
// 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); }