get the address from pointer offsets.

Mmcacutt9/11/2022
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];
        }
BBuddy9/11/2022
What are you making?
Mmcacutt9/11/2022
Console app to read and write to the memory of another process
Mmcacutt9/11/2022
The other process has an address that changes on reload so I need to use pointers, hence the function
BBuddy9/11/2022
What process?
Mmcacutt9/11/2022
A game called Ty the Tasmanian Tiger
Mmcacutt9/11/2022
I have done memory writing with this game before successfully
Mmcacutt9/11/2022
the issue is my lack of knowledge of pointers
KKouhai9/11/2022
I'm not really sure if we can provide help or it's against the server's rules 😅
Mmcacutt9/11/2022
not sure why it would be against server rules but thanks anyway
JJester9/12/2022
if its against a TOS its against the server rules, and still its a little too sus maybe
JJester9/12/2022
github or youtube has probably the answers you need