Quantcast

Jump to content

» «
Photo

[HELP IN C++] Lock game memory (keep it from changing)

3 replies to this topic
343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#1

Posted 15 February 2014 - 11:16 PM Edited by 343 guilty spark, 15 February 2014 - 11:25 PM.

[GAME: GTA SA]

 so i have this code (asi plugin) to make the car steer where the camera is pointed like halo CE and halo 2 vista and

halo 3, and halo 4, and possibly halo 5 when it comes out.

void run(){
    running = true;
    float steer;
    DWORD pCar; // i know i can be a bike or a horse.
    while(running){
        pCar = getCar();
        if(playerDefined() && playerAlive() && pCar > 0 && keyToggoled(9) && !inMenu()){
                steer = getDeltaAngle(getCameraAngle(), getFixedPlayerAngle());
                steer = sinf(steer) * 1.2f; // x1.2 to steer faster
                if(steer < -STEER_LIMIT) steer = -STEER_LIMIT;
                if(steer > STEER_LIMIT) steer = STEER_LIMIT;
                *(float *) (pCar + 1172) = steer;
                  //****** PROBLEM **********
//                Sleep(1); // sleep => wont work! i must reset faster than the game does. d@#n it
        }else{
            Sleep(500);
        }    
    }
}

so i need a way to lock (pCar + 1172) where pCar is the car pointer, 1172 is the steering angle

how can i do that? or do you know a better way? if so then why did you take all this time to tell me?

WHY? to reduce cpu usage and make steering more efficient. (60 check per sec is good).

 

(this mod was released under the name "Halo Driving Style" but it causes the fps to drop)


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None
  • Contribution Award [Mods]

#2

Posted 16 February 2014 - 12:38 PM

Use Cheat Engine to find what assembly instructions of GTA SA write to your memory addresses.
NOP these addresses by 0x90 code with function in your plugin.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#3

Posted 16 February 2014 - 01:47 PM Edited by Wesser, 16 February 2014 - 04:12 PM.

You need to NOP 6 bytes at 0x006ADD22 and write DD D8 90 90 90 90 at 0x006ADD65 to prevent the game from updating the wheel steering angle for cars only. I advice you to learn the assembly language first and inject some code at these addresses rather than creating new threads which make your code desyncronized in relation to the execution of the one of the game.

Note: you may also consider m_fRearSteerAngle at CVehicle + 0x0498 and add 180 degrees to it for 4-wheel steering vehicles (like the Monster).

343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#4

Posted 16 February 2014 - 02:11 PM Edited by 343 guilty spark, 16 February 2014 - 02:50 PM.

THANK YOU.

i dont want to test if the player is driving a monster (i dont belive in monsters) or not, so CJ can kiss his eye! (if he can)

i have no idea how does code injection work, can you give an example?

 

 

EDIT. i tried it i works great with Sleep(100);

         thanks man!

 

MOD (OPEN SOURCE, someone broke in an broke the door):

http://www.gtagarage...ow.php?id=25226





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users