Page 1 of 1

What exactly are Offsets? few other questions...

Posted: Thu Mar 04, 2010 9:42 pm
by Exempt
I noticed that in your Rom Bot scripts you have a main address then a bunch of offsets for like hp and stuff. Is it normal for all the character information to be stored close together or something?

Re: What exactly are Offsets? few other questions...

Posted: Sat Mar 06, 2010 12:39 am
by Administrator
An offset is simply a number of bytes that an address is 'off' from it's base. Typically, data will be stored in structs/classes, so yes, these pieces of data will be close to each other.

Here's an example:

Code: Select all

struct PLAYERINFO
{
  int health; // 4 bytes
  int maxhealth; // 4 bytes

  short lives; // 2 bytes
  char type; // 1 byte
} *PPLAYERINFO;
The PLAYERINFO struct is what you would have a base address to (lets pretend it's 0x00123400). Each of the pieces of the data would be 'offset' from it. health is at +0 bytes (0x0), maxhealth is at +4 bytes (0x4), lives is at +8 (0x8), and type is at +10 (0xA; but *may* be moved to 0xC due to compilers padding a short to 4 bytes).

Re: What exactly are Offsets? few other questions...

Posted: Sat Mar 06, 2010 3:00 pm
by Exempt
Thats good to know then. When you were searching for the main player address in rom how exactly did you come up with an address? I can find health and stuff but I have no idea how I'd search for a character address.

Re: What exactly are Offsets? few other questions...

Posted: Sat Mar 06, 2010 9:03 pm
by Administrator
When you find a health pointer, it'll show up as 0x12345600 + 0x1C or something like that. 0x12345600 would be the character base address, 0x1C the offset to get to health.

Re: What exactly are Offsets? few other questions...

Posted: Sun Mar 07, 2010 12:33 am
by Exempt
I see, appearently Xenimus was made sloppy because there is no pointers for stuff like hp/mp/position/mouse coord...It's all the first address I find.