Please help, addresses, offsets etc

Posts 1–14 of 14 · Page 1 of 1
Please help, addresses, offsets etc
Ok.

Is an address the thing you add on to CShell?

What is an offset?

What is the thing you add in the loop called, like usually its 4.

---------- Post added at 09:51 AM ---------- Previous post was at 09:44 AM ----------

@giniyat101 can u help
You do a weapon loop. That means you lopo through all weapons. Every weapon has its ID. In this case the Weapon ID = i.
Then you multiplicate it with 4 because it is 4 bytes .
i see. is it always 4 bytes? and what is an offset
example of a offset: 0x269C
(this is no reload)
Quote Originally Posted by Swag View Post
example of a offset: 0x269C
(this is no reload)
yeah ok thanks. for no reload, you would need addy (i think its 0x296508 or something), and offset 0x269C, is that all? so code would be like
Code:
for(i=0;i<560;i++)
{
     DWORD change = ((CShell + addy) + 4 * i);
     *(float*)(change) = 45.0f;
}
Quote Originally Posted by _corn_ View Post
yeah ok thanks. for no reload, you would need addy (i think its 0x296508 or something), and offset 0x269C, is that all? so code would be like
Code:
for(i=0;i<560;i++)
{
     DWORD change = ((CShell + addy) + 4 * i);
     *(float*)(change) = 45.0f;
}
yea i think it will
Ok thanks all

/solved
/req close
Quote Originally Posted by _corn_ View Post
Ok thanks all

/solved
/req close
@_corn_
wait u need to add Weapon Pointer in DWORD change = *(DWORD*)(WeaponPointer +(4*i));
Quote Originally Posted by DaRk View Post
@_corn_
wait u need to add Weapon Pointer in DWORD change = *(DWORD*)(WeaponPointer +(4*i));
what about the offset?? where does that go?
Haha thanks for this we have the same problem I will just wait until the others reply
The structs look like this :
struct WeaponInfo
{
BYTE Something[0x2424]; //Begins at 0, ends at 0x2423
float OldNoReload; //WeaponInfo + 0x2424 (Old offset, I'm not longer hacking CrossFire so much)
};
struct WeaponMgr
{
WeaponInfo *WepInf[0x600]; //Every pointer takes 4 Bytes because every 32-bit application has got an address range of 4 Bytes
};

Somewhere in CShell.dll :
WeaponMgr *Weapons;
Quote Originally Posted by derh.acker View Post
The structs look like this :
struct WeaponInfo
{
BYTE Something[0x2424]; //Begins at 0, ends at 0x2423
float OldNoReload; //WeaponInfo + 0x2424 (Old offset, I'm not longer hacking CrossFire so much)
};
struct WeaponMgr
{
WeaponInfo *WepInf[0x600]; //Every pointer takes 4 Bytes because every 32-bit application has got an address range of 4 Bytes
};

Somewhere in CShell.dll :
WeaponMgr *Weapons;
i don't understand sorry
Quote Originally Posted by _corn_ View Post
i don't understand sorry
like this:
Code:
if(WeaponPointer)
{
	for(int i=0; i<576; i++)
	{
		DWORD wep = *(DWORD*)(WeaponPointer+(4*i));
		{
			if(wep)
			{
				*(float*)(wep + offset) = value;
			}
		}
	}
}
WeaponPointer = 0xA68F80
*(float*)(x) first "converts" x to a pointer to a float, then the * before the first ( reads from or writes to the pointer.
In 32-bit assembly reading looks like
MOV [register], DWORD PTR DS:[x]
and writing
MOV DWORD PTR DS:[x], [register]

Every 32-bit pointer is a DWORD, every 64-bit pointer is a QWORD (if the application is compiled in 32 bits, it would also be DWORD in 64 bit systems)


The structs look like this :
struct WeaponInfo
{
BYTE Something[0x2424]; //Begins at 0, ends at 0x2423
float OldNoReload; //WeaponInfo + 0x2424 (Old offset, I'm not longer hacking CrossFire so much)
};
struct WeaponMgr
{
WeaponInfo *WepInf[600]; //Every pointer takes 4 Bytes because every 32-bit application has got an address range of 4 Bytes
};

Somewhere in CShell.dll :
WeaponMgr *Weapons;
WeaponMgr *Weapons is a pointer to a WeaponMgr structure.
So if this WeaponMgr struct begins at A00000 (as an example) the Pointer "Weapons" is A00000.
WeaponInfo *WepInf[600] means that in the WeaponMgr struct are 600 Pointers (600 Pointers take 2400 Bytes) to WeaponInfo structures.
When one of the WeaponInfo structures begins at A00000, one of the pointers is A00000.
Every WeaponInfo structure contains information about a specific weapon (like how long the reload animation is).

If you want to read a value from every weapon, the compiler will compile it like this :
MOV ECX, 0 // Self-explaining
MOV EAX, DWORD PTR DS:[[WeaponMgr]] // Moves to the register EAX where WepInf points to
5A0012 MOV EDX, 4 x ECX // Every 32-bit pointer takes 4 Bytes, so it multiplies ECX (in a for-loop normally i)
ADD EDX, EAX //Adds EAX to EDX (If WepInf points to A00000 and EDX is 8 (i = 2), EDX now will be A00008
MOV EDX, DWORD PTR DS:[EDX] //Moves the Pointer to the WeaponInfo structure to EDX
MOV EBX, DWORD PTR DS:[EDX + Offset] //Moves the Value of an information of a weapon to EBX
CMP ECX, 600 //Compare ECX with 600
INC ECX // Add 1 to ECX
JL 5A0012 //Jump to 5A0012 if ECX is smaller than 600
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us