Can you help with this assembly language code?

I was looking at a piece of computer game code that I am trying to "improve". (ok maybe I suck in the game, but still want to play it). Could you please study the following code:

fld dword ptr[ebp+00007B1C]
fsub dword ptr[esp+64]
fst dword ptr[ebp+00007B1C]
call 004A2E48

      

This code is called every second for the level countdown timer. I need to stay at a certain level for a few minutes. If I can change the above code so that the value entered in the address [ebp + 00007B1C] is 0, then the game level will always time out and it will save me playing these crazy survival minigames.

I will explain what I understand from this code. Don't worry, you don't need to go deep into this. In the first line, we get the timer value. For example, if there are 97 seconds left, then this value will be loaded here.
On the second line, the value (1 second) is subtracted from 97.
On the third line, 96 is moved back into memory. Finally, we have a function call that will do other processing based on the remaining time.

Now all I have to do is patch this part of the code somehow so that the value that was pressed is 0 (in the third step).
Could you help me with this?

+2


source to share


3 answers


Replace

fld dword ptr[ebp+00007B1C]
fsub dword ptr[esp+64]

      



from

fldz ; Push zero on to top of floating point stack
nop ; From the end of the fldz to the beginning of the store instruction

      

+4


source


Another patch:
replace

fld dword ptr[ebp+00007B1C]

      



from

fld dword ptr[esp+64]
NOP
NOP

      

+2


source


Just release the second command. That is, figure out how many bytes the fsub command is taking and overwriting it with many bytecodes without an operation (0x90).

+1


source







All Articles