private void SetupPlayerAndEnemy() { // 10F4F4 + offsets for player player = new Entity(0x10F4F4, 0x40, 0x44, 0x34, 0x38, 0x3C, 0xF8) { multi = new int[] { 0x0 } }; // Base address of the module "ac_client.exe" is used player.pointerAddress = mem.ReadMultiLevelPointer(pro[0].MainModule.BaseAddress.ToInt32() + player.baseAddr, 4, player.multi); int playerTeamNum = mem.ReadInt(player.pointerAddress + 0x32C); for (int i = 1; i <= totalPlayers; i++) { // Player, enemies and team all share same offset var e = new Entity(0x10F4F8, 0x40, 0x44, 0x34, 0x38, 0x3C, 0xF8) { multi = new int[] { 0x4 * i, 0x0 } }; e.pointerAddress = mem.ReadMultiLevelPointer(pro[0].MainModule.BaseAddress.ToInt32() + e.baseAddr, 4, e.multi); if (mem.ReadInt(e.pointerAddress + 0x32C) != playerTeamNum) { this.enemies.Add(e); // Add enemies of other team. Solution only works in TDM } } }
private void tmrProcess_Tick(object sender, EventArgs e) { if (gameFound && !SA[0].HasExited) { // Only the base address or multiLevel addresses need to be established first int playerBaseAddress = mem.ReadInt(offsets.baseAddr); // Stores an address which is the base address of the player struct. int XAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.xPos); // Multi level pointer with 2 offsets is needed to find the address of X position, // then this address can be read as a float. int ZAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.zPos); int YAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.yPos); lblX.Text = mem.ReadFloat(XAddress).ToString(); lblZ.Text = mem.ReadFloat(ZAddress).ToString(); lblY.Text = mem.ReadFloat(YAddress).ToString(); lblHealth.Text = mem.ReadFloat(playerBaseAddress + offsets.health).ToString(); int Hotkey = ProcessMemoryReaderApi.GetKeyState(0x74);//F5 if ((Hotkey & 0x8000) != 0) { // Teleport to Grove Street mem.WriteFloat(XAddress, 2495); mem.WriteFloat(ZAddress, -1668); mem.WriteFloat(YAddress, 13); } int Hotkey2 = ProcessMemoryReaderApi.GetKeyState(0x75);//F6 if ((Hotkey2 & 0x8000) != 0) { // Teleport to Dome Stadium Roof mem.WriteFloat(XAddress, 2737); mem.WriteFloat(ZAddress, -1760); mem.WriteFloat(YAddress, 44); } int Hotkey3 = ProcessMemoryReaderApi.GetKeyState(0x76);//F7 if ((Hotkey3 & 0x8000) != 0) { // Teleport to Skyscraper mem.WriteFloat(XAddress, 1544); mem.WriteFloat(ZAddress, -1353); mem.WriteFloat(YAddress, 330); } } else { // Game has ended so stop performing readMemory etc gameFound = false; btnAttach.BackColor = Color.Red; btnAttach.Enabled = true; } }//tmrProcess
public ReadData_from_Mem(uint nProcessID, int _baseAddress, int[] offset) { pmr = new ProcessMemoryReader(); pmr.OpenProcess(nProcessID); baseAddress = pmr.ReadMultiLevelPointer(_baseAddress, 4, offset); }
private void GetEnemyState(ProcessMemoryReader mem) { int base_ptr = attachProc.MainModule.BaseAddress.ToInt32() + 0x00175BC4; for (int i = 0; i < 30; i++) { int[] offsetArray = { i * 4, 0 }; // 0, 4, 8, 12 총 30명의 플레이어 데이터를 불러온다 int player_base = mem.ReadMultiLevelPointer(base_ptr, 4, offsetArray); enemyPlayer[i] = new Playerdata(player_base); enemyPlayer[i].SetPlayerData(mem); enemyPlayer[i].distance = GetDistance(mainPlayer, enemyPlayer[i]); enemyPlayer[i].head_x_angle = Get2DDegree(mainPlayer, enemyPlayer[i]); enemyPlayer[i].head_y_angle = GetYDegree(mainPlayer, enemyPlayer[i]); } }
private void LoopTMR_Tick(object sender, EventArgs e) { if (attach) { try { // Step2 Value를 찾아서 모니터링 (현재 값이 무엇인지 계속적으로 확인) int step2SturctAddress = mem.ReadMultiLevelPointer(step2Data.baseAddress, 4, step2Data.multiLevel); int step2value = mem.ReadInt(step2SturctAddress + step2Data.offsets.health); Step2ValueLBL.Text = "Step 2 Value: " + step2value; // Step8 Value를 찾아서 모니터링 int step8SturctAddress = mem.ReadMultiLevelPointer(step8Data.baseAddress, 4, step8Data.multiLevel); int step8value = mem.ReadInt(step8SturctAddress + step8Data.offsets.health); Step8ValueLBL.Text = "Step 8 Value: " + step8value; // Step9의 플레이어 데이터를 모니터링 int p1Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P1multiLevel); int p2Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P2multiLevel); int p3Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P3multiLevel); int p4Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P4multiLevel); P1LBL.Text = "P1: [" + mem.ReadInt(p1Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p1Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p1Base + step9PlayerData.healthOffset); P2LBL.Text = "P2: [" + mem.ReadInt(p2Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p2Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p2Base + step9PlayerData.healthOffset); P3LBL.Text = "P3: [" + mem.ReadInt(p3Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p3Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p3Base + step9PlayerData.healthOffset); P4LBL.Text = "P4: [" + mem.ReadInt(p4Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p4Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p4Base + step9PlayerData.healthOffset); // 크랙을 동작시켰을때, 현재 크랙이 값을 수정하도록 만드는 작업 int hotkey = ProcessMemoryReaderApi.GetKeyState(0x02); // 마우스 오른쪽키에 대한 상태 if ((hotkey & 0x8000) != 0) // 키가 눌렸을 경우 { if (crackState == false) // 크랙이 꺼져있는 경우에는 크랙 켜고 크랙 시도! { crackState = true; CrackStatusLBL.Text = "크랙 상태: On"; } else // 크랙이 켜져있는 경우에는 크랙을 끕니다. { crackState = false; CrackStatusLBL.Text = "크랙 상태: Off"; } } if (crackState) { Step2Solve(step2SturctAddress); // step2 Value를 1000으로 수정 Step8Solve(step8SturctAddress); // step2 Value를 1000으로 수정 } } catch (Exception ex) { crackState = false; MessageBox.Show("읽기 쓰기 오류: " + ex.Message); } } }
static private int off_rifle_ammo = 0x150; // Assault rifle ammo #endregion static public bool monitorMemoryValues(ProcessMemoryReader Mem) { int LocalPlayerAddress = Mem.ReadMultiLevelPointer(LocalPlayerBase, 4, LocalPlayerOff); int HealthValue = Mem.ReadInt(LocalPlayerAddress + off_health); int RiffleAmmoValue = Mem.ReadInt(LocalPlayerAddress + off_rifle_ammo); if ((HealthValue > 100) && (!Form1.detected)) { Mem.WriteInt(LocalPlayerAddress + off_health, 10); MessageBox.Show("Possible Cheat Detected"); return(true); } return(false); }
private void LoopTMR_Tick(object sender, EventArgs e) { if (attach) { try { // step2 value를 찿아서 모니터링 int structAddr = mem.ReadMultiLevelPointer( step2Data.baseAdress, 4, step2Data.multiLevel); ValueLBL.Text = "Step2Value : " + mem.ReadInt(structAddr + step2Data.offsets.step2_health); // 크랙이 값을 수정하는 코드 int hotkey = ProcessMemoryReaderApi.GetKeyState(0x02); // mouse_R button- 0x02 if ((hotkey & 0x8000) != 0) //키가눌렸을 경우 { if (crackState == false) { crackState = true; CrackStatusLBL.Text = "크랙 상태 : ON"; } else { crackState = false; CrackStatusLBL.Text = "크랙 상태 : OFF"; } } if (crackState) { Step2Solve(structAddr); //value 를 1000으로 고정해주는 함수 } } catch (Exception ex) { crackState = false; MessageBox.Show("읽기 쓰기 에러 !!!" + ex.Message); throw; } }//크랙을 동작시켰을때, 현재크랙의 값을 수정 }
void UpdatePlayerInfo() { int playerBase = Mem.ReadMultiLevelPointer(myProcess[0].MainModule.BaseAddress.ToInt32() + m_mainPlayer.baseAddress, 4, m_mainPlayer.multiLevel); int hp = Mem.ReadInt(playerBase - MainOffset + PlayerOffsets[0]); Vector3 pos = new Vector3(Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[1]), Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[2]), Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[3])); Vector3 velo = new Vector3(Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[4]), Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[5]), Mem.ReadFloat(playerBase - MainOffset + PlayerOffsets[6])); m_mainPlayer.Update(Mem.ReadInt(playerBase - MainOffset + PlayerOffsets[0]), pos, velo); foreach (PlayerData ai in m_AiPlayer) { int aiBase = Mem.ReadMultiLevelPointer(myProcess[0].MainModule.BaseAddress.ToInt32() + ai.baseAddress, 4, ai.multiLevel); hp = Mem.ReadInt(aiBase - MainOffset + PlayerOffsets[0]); pos = new Vector3(Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[1]), Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[2]), Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[3])); velo = new Vector3(Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[4]), Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[5]), Mem.ReadFloat(aiBase - MainOffset + PlayerOffsets[6])); ai.Update(hp, pos, velo); } }
private void timer1_Tick(object sender, EventArgs e) { if (ProcessFound) { // Store entities memory addresses int LocalPlayerAddress = Mem.ReadMultiLevelPointer(LocalPlayerBase, 4, LocalPlayerOff); int Enemy1Address = Mem.ReadMultiLevelPointer(Enemy1Base, 4, Enemy1Off); // Read Local PLayer Values int HealthValue = Mem.ReadInt(LocalPlayerAddress + off_health); int RiffleAmmoValue = Mem.ReadInt(LocalPlayerAddress + off_rifle_ammo); // Read Enemy 1 Values int Enemy1HealthValue = Mem.ReadInt(Enemy1Address); float Enemy1XPosValue = Mem.ReadFloat(Enemy1Address - Enemy1XPos); float Enemy1YPosValue = Mem.ReadFloat(Enemy1Address - Enemy1YPos); float Enemy1ZPosValue = Mem.ReadFloat(Enemy1Address - Enemy1ZPos); // Local Player Lables Health.Text = "Health: " + HealthValue.ToString(); RiffleAmmo.Text = "Riffle Ammo: " + RiffleAmmoValue.ToString(); // Enemy 1 Lables enemy1_hp_lable.Text = "Enemy 1 HP: " + Enemy1HealthValue.ToString(); enemy1_xpos_lable.Text = "X-Pos: " + Enemy1XPosValue.ToString(); enemy1_ypos_lable.Text = "Y-Pos: " + Enemy1YPosValue.ToString(); enemy1_zpos_lable.Text = "Z-Pos: " + Enemy1ZPosValue.ToString(); if (RiffleAmmoValue < 5) { // Set Local Player Riffle Ammo to 20 if it less than 5 Mem.WriteInt(LocalPlayerAddress + off_rifle_ammo, 20); // Set Local Player HP to 1000 when ammo is less han 5 Mem.WriteInt(LocalPlayerAddress + off_health, 1000); } // Left mouse button pressed int pressedLeftMouse = ProcessMemoryReaderApi.GetKeyState(01); if ((pressedLeftMouse & 0x8000) != 0) { Mem.WriteInt(LocalPlayerAddress + off_fire, 1); // Remove Y-axin recoil when shooting float Ymouse_pos = Mem.ReadFloat(LocalPlayerAddress + off_Ymouse); Ymouse_pos -= 0.38f; Mem.WriteFloat(LocalPlayerAddress + off_Ymouse, Ymouse_pos); } else { Mem.WriteInt(LocalPlayerAddress + off_fire, 0); } // F1 button pressed int pressedF1 = ProcessMemoryReaderApi.GetKeyState(0x70); if ((pressedF1 & 0x8000) != 0) { Mem.WriteFloat(LocalPlayerAddress + off_XPos, Enemy1XPosValue); Mem.WriteFloat(LocalPlayerAddress + off_YPos, Enemy1YPosValue); Mem.WriteFloat(LocalPlayerAddress + off_ZPos, Enemy1ZPosValue); } } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 0) { PlayerBase = PlayerBaseHM; multiLevel = new int[] { 0x04 }; labelActive = "health"; } else if (comboBox1.SelectedIndex == 1) { PlayerBase = PlayerBaseHM; multiLevel = new int[] { 0x04 }; labelActive = "mana"; } else if (comboBox1.SelectedIndex == 2) { PlayerBase = PlayerbaseMA; multiLevel = new int[] { 0x00 }; labelActive = "mslot1"; } else if (comboBox1.SelectedIndex == 3) { PlayerBase = PlayerbaseMA + 0x4; multiLevel = new int[] { 0x00 }; labelActive = "mslot2"; } else if (comboBox1.SelectedIndex == 4) { PlayerBase = PlayerbaseMA + 0x8; multiLevel = new int[] { 0x00 }; labelActive = "mslot3"; } else if (comboBox1.SelectedIndex == 5) { PlayerBase = PlayerbaseMA + 0xC; multiLevel = new int[] { 0x00 }; labelActive = "mslot4"; } else if (comboBox1.SelectedIndex == 6) { PlayerBase = PlayerbaseMA + 0x10; multiLevel = new int[] { 0x00 }; labelActive = "aslot1"; } else if (comboBox1.SelectedIndex == 7) { PlayerBase = PlayerbaseMA + 0x14; multiLevel = new int[] { 0x00 }; labelActive = "aslot2"; } else if (comboBox1.SelectedIndex == 8) { PlayerBase = PlayerbaseMA + 0x18; multiLevel = new int[] { 0x00 }; labelActive = "aslot3"; } else if (comboBox1.SelectedIndex == 9) { PlayerBase = PlayerbaseMA + 0x1C; multiLevel = new int[] { 0x00 }; labelActive = "aslot4"; } player.baseAddress = PlayerBase; player.multilevel = multiLevel; playerBase = Mem.ReadMultiLevelPointer(PlayerBase, 4, player.multilevel); }