Page 1 of 1

memory offsets, possible to do negative?

Posted: Sun May 20, 2012 10:02 pm
by lisa
Is it possible to do a negative offset, so instead of offsetting to a greater memory address offset to an earlier address?

Issue I am having at the moment is I have a section of memory and I have an address with a set of offsets which are reliable but I am struggling to find a reliable address+offsets for an address which is always 0x60 before the address I can get reliably.

Offsets that are reliable are

Code: Select all

{0x18,0xC8,0xC,0x34,0x264,0x8},
As an example the reliable offsets point to
13454DE0
but I also want the value at
13454D80

Any thoughts?

--=== Edit ===--

Turns out it isn't always 0x60 before the address, so that won't work.
I'd still like to know if it's possible though just for curiosities sake.

Re: memory offsets, possible to do negative?

Posted: Sun May 20, 2012 10:52 pm
by Administrator
Well, I don't really think that would be possible normally because an unsigned int is needed. You can, however, just subtract 0x60 from the address and use a memory reading function on that new address; that would accomplish the same thing and be easier to read.

Re: memory offsets, possible to do negative?

Posted: Mon May 21, 2012 4:04 am
by lisa
Since I couldn't find a set of offsets that was 100% reliable I did a lot more testing, turned out when 1 set of offsets failed another worked so I came up with this as a solution, testing it now and seems good so far.

Code: Select all

		playermaxhp = memoryReadFloatPtr(getProc(), addresses.playerbase, addresses.playermaxhpoffset) or 0
		if playermaxhp == 0 then
			playermaxhp = memoryReadFloatPtr(getProc(), addresses.playerbase, addresses.playermaxhp2offset) or 0
		end
So if the first set fails it uses the second set.