C
C#•3y ago
Matt

get the address from pointer offsets.

Trying to make a function to grab an address from pointer offsets. New to pointers and tried to follow a tutorial using Pymem but write it in c# which I'm far more comfortable with. Hasn't gone so well. The function returns 0 from a correct input. Would really appreciate the help if someone knows what I'm doing wrong
public int GetPointerAddress(int baseAddress, int[] offsets)
{
int bytesRead = 0;
byte[] newAddrBytes = new byte[4];
Program.ReadProcessMemory((int)tyexeHandle, baseAddress, newAddrBytes, 4, ref bytesRead);
int addr = BitConverter.ToInt32(newAddrBytes, 0);
foreach(int i in offsets)
{
if (i != offsets[offsets.Length - 1])
{
bytesRead = 0;
byte[] newAddr = new byte[4];
Program.ReadProcessMemory((int)tyexeHandle, baseAddress + 1, newAddr, 4, ref bytesRead);
addr = BitConverter.ToInt32(newAddrBytes, 0);
}
}
return addr + offsets[offsets.Length - 1];
}
public int GetPointerAddress(int baseAddress, int[] offsets)
{
int bytesRead = 0;
byte[] newAddrBytes = new byte[4];
Program.ReadProcessMemory((int)tyexeHandle, baseAddress, newAddrBytes, 4, ref bytesRead);
int addr = BitConverter.ToInt32(newAddrBytes, 0);
foreach(int i in offsets)
{
if (i != offsets[offsets.Length - 1])
{
bytesRead = 0;
byte[] newAddr = new byte[4];
Program.ReadProcessMemory((int)tyexeHandle, baseAddress + 1, newAddr, 4, ref bytesRead);
addr = BitConverter.ToInt32(newAddrBytes, 0);
}
}
return addr + offsets[offsets.Length - 1];
}
7 Replies
Buddy
Buddy•3y ago
What are you making?
Matt
MattOP•3y ago
Console app to read and write to the memory of another process The other process has an address that changes on reload so I need to use pointers, hence the function
Buddy
Buddy•3y ago
What process?
Matt
MattOP•3y ago
A game called Ty the Tasmanian Tiger I have done memory writing with this game before successfully the issue is my lack of knowledge of pointers
Kouhai
Kouhai•3y ago
I'm not really sure if we can provide help or it's against the server's rules 😅
Matt
MattOP•3y ago
not sure why it would be against server rules but thanks anyway
Jester
Jester•3y ago
if its against a TOS its against the server rules, and still its a little too sus maybe github or youtube has probably the answers you need
Want results from more Discord servers?
Add your server