public ulong GetPointerAddress(ISwitchConnectionSync sb, string ptr) { uint finadd = 0; if (!ptr.EndsWith("]")) { finadd = GetHexValue(ptr.Split('+').Last()); } var jumps = ptr.Replace("main", "").Replace("[", "").Replace("]", "").Split(new[] { "+" }, StringSplitOptions.RemoveEmptyEntries); var initaddress = GetHexValue(jumps[0].Trim()); ulong address = BitConverter.ToUInt64(sb.ReadBytesMain(initaddress, 0x8), 0); foreach (var j in jumps) { var val = GetHexValue(j.Trim()); if (val == initaddress) { continue; } if (val == finadd) { address += val; break; } address = BitConverter.ToUInt64(sb.ReadBytesAbsolute(address + val, 0x8), 0); } return(address); }
// Connection and getting values private void ButtonConnect_Click(object sender, EventArgs e) { int Port = int.Parse(TextBoxPort.Text); if (Connected == false) { // Connect button behaviour cfg.IP = TextBoxIP.Text; cfg.Port = Port; Connection = cfg.CreateSync(); Connection.Connect(); ReloadValues(); // Toggle buttons and fields TextBoxIP.Enabled = false; TextBoxPort.Enabled = false; ButtonSysbotRead.Enabled = true; // Player SysBotPouchItem1Count.Enabled = true; SysBotPouchItem2Count.Enabled = true; SysBotPouchItem3Count.Enabled = true; SysBotPouchItem4Count.Enabled = true; SysBotPouchItem5Count.Enabled = true; SysBotHunterCoordXCount.Enabled = true; SysBotHunterCoordYCount.Enabled = true; SysBotHunterCoordZCount.Enabled = true; // Quest SysBotMonsterHPCount.Enabled = true; SysBotHunterHPCount.Enabled = true; Connected = true; ButtonConnect.Text = "Diconnect"; } else { // Disconnect button behaviour Connection.Disconnect(); // Toggle buttons and fields TextBoxIP.Enabled = true; TextBoxPort.Enabled = true; ButtonSysbotRead.Enabled = false; // Player SysBotPouchItem1Count.Enabled = false; SysBotPouchItem2Count.Enabled = false; SysBotPouchItem3Count.Enabled = false; SysBotPouchItem4Count.Enabled = false; SysBotPouchItem5Count.Enabled = false; SysBotHunterCoordXCount.Enabled = false; SysBotHunterCoordYCount.Enabled = false; SysBotHunterCoordZCount.Enabled = false; // Quest SysBotMonsterHPCount.Enabled = false; SysBotHunterHPCount.Enabled = false; Connected = false; ButtonConnect.Text = "Connect"; } }
public static void WriteUInt(uint input, ulong offset, ISwitchConnectionSync sb) { byte value = Convert.ToByte(input); byte[] byteArray = new byte[1]; byteArray[0] = value; sb.WriteBytesAbsolute(byteArray, offset); return; }
// sb and getting values private void ButtonConnect_Click(object sender, EventArgs e) { int Port = int.Parse(TextBoxPort.Text); if (Connected == false) { // Connect button behaviour cfg.IP = TextBoxIP.Text; cfg.Port = Port; sb = cfg.CreateSync(); sb.Connect(); ReloadValues(); // Toggle buttons and fields TextBoxIP.Enabled = false; TextBoxPort.Enabled = false; ButtonSysbotRead.Enabled = true; StatusConnection.ForeColor = Color.Green; StatusConnection.Text = "Connected"; Connected = true; ButtonConnect.Text = "Disconnect"; SysBotLog.Text += Environment.NewLine + "Successfully connected."; } else { // Disconnect button behaviour sb.Disconnect(); // Toggle buttons and fields TextBoxIP.Enabled = true; TextBoxPort.Enabled = true; ButtonSysbotRead.Enabled = false; // Player SysBotZeniCount.Enabled = false; SysBotPointsCount.Enabled = false; SysBotPouchItem1Count.Enabled = false; SysBotPouchItem2Count.Enabled = false; SysBotPouchItem3Count.Enabled = false; SysBotPouchItem4Count.Enabled = false; SysBotPouchItem5Count.Enabled = false; SysBotHunterCoordXCount.Enabled = false; SysBotHunterCoordYCount.Enabled = false; SysBotHunterCoordZCount.Enabled = false; // Quest SysBotHunterHPCount.Enabled = false; SysBotHunterStaminaCount.Enabled = false; SysBotMonster1HPCount.Enabled = false; StatusConnection.ForeColor = Color.Red; StatusConnection.Text = "Disconnected"; Connected = false; ButtonConnect.Text = "Connect"; SysBotLog.Text += Environment.NewLine + "Successfully disconnected."; } }
// sb and getting values private void ButtonConnect_Click(object sender, EventArgs e) { int Port = int.Parse(TextBoxPort.Text); if (Connected == false) { // Connect button behaviour cfg.IP = TextBoxIP.Text; cfg.Port = Port; sb = cfg.CreateSync(); sb.Connect(); ReloadValues(); // Toggle buttons and fields TextBoxIP.Enabled = false; TextBoxPort.Enabled = false; ButtonSysbotRead.Enabled = true; PointsTotalNumeric.Enabled = true; StatusConnection.ForeColor = Color.Green; StatusConnection.Text = "Connected"; Connected = true; ButtonConnect.Text = "Disconnect"; SysBotLog.Text += Environment.NewLine + "Successfully connected."; } else { // Disconnect button behaviour sb.Disconnect(); // Toggle buttons and fields TextBoxIP.Enabled = true; TextBoxPort.Enabled = true; ButtonSysbotRead.Enabled = false; PointsTotalNumeric.Enabled = false; StatusConnection.ForeColor = Color.Red; StatusConnection.Text = "Disconnected"; Connected = false; ButtonConnect.Text = "Connect"; SysBotLog.Text += Environment.NewLine + "Successfully disconnected."; } }
public static void WriteFloat(float input, ulong offset, ISwitchConnectionSync sb) { byte[] Bytes = BitConverter.GetBytes(input); sb.WriteBytesAbsolute(Bytes, offset); }