There is lots of ways to do it , but ill just stick to the most simple one. so lets get started
this tutorial return one offset as result !
What is this used for ? - used to create Find Offset Button / obviosly it can be used for much more
[HIDE]1.past this into your main event public partial class of your tool
public uint ZeroOffset; public int NumberOffsets = 0;
2.past this code some where in your tool before the button you going to use to find offset ! // this is the whole search event that will handle your search
public uint ContainsSequence(byte[] toSearch, byte[] toFind, uint StartOffset, int bytes) { for (int i = 0; (i + toFind.Length) < toSearch.Length; i += bytes) { bool flag = true; for (int j = 0; j < toFind.Length; j++) { if (toSearch != toFind[j]) { flag = false; break; } } if (flag) { NumberOffsets++; int num3 = ((int)StartOffset) + i; return (uint)num3; } } return 0; } private ulong Search(byte[] Search, uint Start, int Length, int bytes) { byte[] ReadBytes = PS3.Extension.ReadBytes(Start, Length); uint num = this.ContainsSequence(ReadBytes, Search, Start, bytes); if (num.Equals(this.ZeroOffset)) { return 0; //not found } else { int counter = 0; foreach (int value in Search) if (value == 1) ++counter; uint num2 = num + ((uint)counter); return num2; } }
Explanation of main search event params:
byte[] Search = bytes to search ( example: { 0x25, 0xFE, 0x27, 0xE0 }
Uint Start = the start of the location on the memory it means if randomly it jump from adress 32500000 and higher you put 0x32500000 as Uint Start
int Length = where to stop it means if start adress (Uint Start) 32500000 and its randomly appears between 32500000 and 32700000 you put 0x200000 as int Length cause 32700000 - 32500000 = 200000
int bytes = on what type of bytes to search "usualy we put 4 bytes"
3.Now create a button and put this code inside it
//Just random Bytes as an example, you will use yours "the bytes you want to search for" byte[] bytes = { 0x25, 0xFE, 0x27, 0xE0 }; //search function call //Uint Start //int Length ulong Found = Search(bytes, 0x32500000, 0x200000, 4); if (Found == ZeroOffset) { this.YourTextlabel.Text = "NOT FOUND"; } else { this.YourTextlabel.Text = "FOUND : " + string.Format("0x{0:X}", Found); }
Also u can define how much byte to add to the found result by changing the code like this
//Just random Bytes as an example, you will use yours "the bytes you want to search for" byte[] bytes = { 0x25, 0xFE, 0x27, 0xE0 }; / //search function call //Uint Start //int Length //add bytes ulong Found = Search(bytes, 0x32500000, 0x200000, 4) + 0x20; if (Found == ZeroOffset) { this.YourTextlabel.Text = "NOT FOUND"; } else { this.YourTextlabel.Text = "FOUND : " + string.Format("0x{0:X}", Found); }
[/HIDE]
Go to "Method 2"
I hope It helped you guys and have happy codding