
Originally Posted by
Jhem
Hello @AeroMan
How can you tell that the
__asm mov Check, 1 // will tell if we entered the game?
the following code only gets runned when the game loads
Code:
//Addresses= Addresses + 400000 (Start address)
DWORD CoDJmpStart = 0x5BF5D9; //iw3sp.exe + 1BF5D9 - 89 84 8F 34030000 - mov[edi + ecx * 4 + 00000334], eax
DWORD CoDJmpBack = 0x5BF5E0; //iw3sp.exe + 1BF5E0 - 5B - pop ebx
__declspec(naked)void CallOfDuty_Check(void)
{
//We replace the original code here because we simply make a check in this tutorial.
//Replacing the eax with your val (mov eax, 10) could set your to 10 instead of dropping.
__asm mov[edi + ecx * 0x4 + 0x334], eax //Original code (set ammo)
__asm pushad //Push to stack
__asm mov Check, 1 //We set our check to 1, (Check = Defenition => We entered game!)
__asm popad //Stack to register
__asm jmp[CoDJmpBack] //Jmp back to our original code
}
Because the part where we jmp to this function gets only runned when we entered the game.
For example: The game is loading, we set our ammo to full so we start with a full clip of ammo when we first enter the game.
This part where the ammo is first set meant we have spawned and our character is ingame.
So we jmped from that code block (where the game sets it's ammo value -> we entered the game) to our code.
This means we executed our code the moment the game has set the ammo.
So then our code sets the 'Check' to value 1, meaning we entered the game.
Our default value was 0, so if it's 1 it has obviously executed the code.
At this point we execute our endscene or whatever you would like to.
Code:
if(Check){ code here }
So if we entered the game (Check = 1) the code is true and we execute the code between that check.
EDIT: __asm mov Check, 1
can be seen as Check = 1;
We simply put the value 1 inside Check.
I hope this makes sence, if not let me know and i'll try to explain it diffrently
