Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../Win32Tools/Win32Tools.h"
- #include "../MemProc/MemProc.h"
- #include "../Vector/Vector2D.h"
- typedef struct {
- DWORD addrX, addrY;
- Vector2D v;
- } Pos;
- Pos *
- pos_new (MemProc *mp, DWORD addrX, DWORD addrY)
- {
- Pos *p;
- if ((p = malloc(sizeof(Pos))) == NULL)
- return NULL;
- p->addrX = addrX + mp->base_addr;
- p->addrY = addrY + mp->base_addr;
- vector2D_set_pos (
- &p->v,
- read_memory_as_float(mp->proc, p->addrX),
- read_memory_as_float(mp->proc, p->addrY)
- );
- return p;
- }
- void
- pos_refresh (MemProc *mp, Pos *p)
- {
- vector2D_set_pos (
- &p->v,
- read_memory_as_float(mp->proc, p->addrX),
- read_memory_as_float(mp->proc, p->addrY)
- );
- }
- void
- pos_set (MemProc *mp, Pos *p, float newX, float newY)
- {
- vector2D_set_pos (&p->v, newX, newY);
- write_memory_as_float(mp->proc, p->addrX, newX);
- write_memory_as_float(mp->proc, p->addrY, newY);
- }
- int main ()
- {
- MemProc *mp = memproc_new("League of Legends.exe", "League of Legends (TM) Client");
- if (!mp->proc)
- {
- error("Please launch a game");
- return 0;
- }
- // All are world coordinates
- Pos *cam = pos_new(mp, 0x039F713C, 0x039F7144); // Camera position
- Pos *champ = pos_new(mp, 0x039F7318, 0x039F7320); // Champion position
- Pos *mouse = pos_new(mp, 0x039F7324, 0x039F732C); // Mouse position
- Pos *dest = pos_new(mp, 0x039F73F8, 0x039F7400); // Right click destination position
- while (1)
- {
- // Get the position from the game
- pos_refresh(mp, champ);
- pos_refresh(mp, mouse);
- pos_set (mp, cam,
- (champ->v.x + mouse->v.x) / 2.0,
- (champ->v.y + mouse->v.y) / 2.0
- );
- Sleep(5);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement