Results 1 to 5 of 5
  1. #1
    fakeness's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    0

    The Goal of Detours

    So I am trying to make my own now and I was wondering, what is the goal of a detour function/what does it do? If anyone wants to help that would be cool but I dont think anyone will. Also don't flame me for trying.

  2. #2
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    494
    Reputation
    104
    Thanks
    626
    Basically, a detour is used to intercept a function. It takes the first instructions of the target you are detouring, and replaces it with a jmp to your function. The original function is saved, and then executed after your function has been executed. This is known as a trampoline.

  3. The Following User Says Thank You to Saltine For This Useful Post:

    [MPGH]AVGN (11-28-2011)

  4. #3
    fakeness's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by Saltine View Post
    Basically, a detour is used to intercept a function. It takes the first instructions of the target you are detouring, and replaces it with a jmp to your function. The original function is saved, and then executed after your function has been executed. This is known as a trampoline.
    Could you just tell me the final result of detours because that doesn't really help.

  5. #4
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    494
    Reputation
    104
    Thanks
    626
    Quote Originally Posted by fakeness View Post
    Could you just tell me the final result of detours because that doesn't really help.
    What do you mean? That is what a detour does. You detour present in CA so it runs your menu rendering thing before each time the game calls present, etc.

  6. The Following User Says Thank You to Saltine For This Useful Post:

    fakeness (11-28-2011)

  7. #5
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,035
    Reputation
    340
    Thanks
    2,785
    My Mood
    Sad
    Before you find out what a detour is, you'll need to know that programs run code, which runs serially. This means that code is executed one "instruction" at a time (going in one direction). These instructions tell your processor what to do - print out a character on the screen, change the colour of a pixel on your screen, add 1 and 2 together and save it somewhere or perhaps printing out a document through a printing port.

    Like a real-world detour, a detour in computer engineering is altering path that the instructions take. For hacking purposes, we alter the path to our own instructions, so that we can get to the code instructions that draws a menu on the screen or activates a hack whenever the detoured code runs.

    A more life-like example would be to run X whenever Y happens. Coming back to our real-world car example, the police would want a speed camera to be set off whenever a car goes past it. Fortunately, in the real world, we can use light detectors or other mechanisms to do this. In everyday computers, you don't have detection mechanisms like the above, so you use instruction detours instead. The end result is the same - when your targeted instructions are run, your own code/instructions are run too.

    EDIT: Yet another (better) example would be the person inside the car. He is the processing unit. He processes instructions. He's driving the car, executing the instructions to make the car go forward. However, we set a detour to activate the speed camera. So, every time he reaches the speed camera, he will take a detour, get out of the car, activate the speed camera, return and continue driving the car.

    Coming back to Combat Arms, you can use detours to get the code that draws a menu inside Combat Arms to run when Combat Arms is drawing the environment - the world, map and players. You can also use detours for a variety of other purposes, perhaps detouring calls to "SetPlayerPosition()" so you can filter out which positions should or shouldn't be set. You can even use detours to detour a game closing, to prevent people from closing the game and keep them inside the game for whatever reason (make them suffer or force them to click an ad)

    Of course, this is a convoluted thing to explain and I've only summarized it. There are issues like how the speed camera takes the speed of the vehicle if he gets out of it (parameter passing), and so on. This is only an example to help you understand detouring and so it isn't as detailed or as accurate as a computer scientist might tell another computer scientist.
    Last edited by freedompeace; 11-28-2011 at 10:56 PM.

  8. The Following 7 Users Say Thank You to freedompeace For This Useful Post:

    Deuce. (11-28-2011),fakeness (11-30-2011),flameswor10 (11-28-2011),[MPGH]Flengo (11-30-2011),nbss (05-11-2012),OBrozz (11-30-2011),Saltine (11-29-2011)

Similar Threads

  1. Detours, whats the problem with them
    By Clarkie in forum Combat Arms Coding Help & Discussion
    Replies: 17
    Last Post: 05-30-2011, 11:42 PM
  2. Replies: 38
    Last Post: 12-29-2010, 10:16 AM
  3. My Goals for the Weekend!
    By R3V in forum General
    Replies: 28
    Last Post: 02-05-2010, 09:21 AM
  4. Post the scariest shit you have seen!
    By arunforce in forum General
    Replies: 26
    Last Post: 08-17-2007, 11:16 PM
  5. NHL Goal of the Year
    By arunforce in forum General
    Replies: 1
    Last Post: 12-03-2006, 09:43 PM