
Originally Posted by
DeadLinez
Don't Have CA installed atm so cant test it, pretty sure it works. Just bored, opened olly saw, and made it..Thanks
Code:
void ChangePitch(float* Pitch)
{
_asm
{
MOV EAX,3778CF58 //Moving pointer to EAX Register
MOV ECX,EAX //Moving EAX to ECX (We have this because you cant write the pointer directly to the register ECX, With an offset)
MOV EDX,ECX+18 //Moving ECX+0x18 to EDX
ADD ESP,8 //Adding 0x8 to ESP
PUSH Pitch //Pushing Our pitch
PUSH EAX //Pushing our Pointer
CALL EDX //Calling our shit
}
}
Unless you're working on a 16 bit machine or a very old compiler there's no reason why you can't use ANY register (even the stack registers) to write offsets and pointers. Also ADD ESP,8 before you're pushing your data can have bad effects, for all you know you're overwriting the return address or other important data.
No compiler and/or assembler worth it's name is going to allow this statement. I assume it means mov edx, [ecx+18h]
Having said that, here's an improved version:
Code:
void ChangePitch(float* Pitch)
{
_asm
{
MOV EAX,3778CF58 //Moving pointer to EAX Register
MOV EDX, eax //mov pointer to edx
PUSH Pitch //Pushing Our pitch
PUSH EAX //Pushing our Pointer
CALL [EDX+18h] //Calling our shit
ADD ESP,8 //Adding 0x8 to ESP
}
}
if mov ebx, ecx+18 instead assembles to mov edx, ecx add edx, 18h, the code would look like this:
Code:
void ChangePitch(float* Pitch)
{
_asm
{
MOV EAX,3778CF58 //Moving pointer to EAX Register
MOV EDX, eax //mov pointer to edx
ADD EDX, 18h // adding 18 h to our pointer to get the function name
PUSH Pitch //Pushing Our pitch
PUSH EAX //Pushing our Pointer
CALL EDX //Calling our shit
ADD ESP,8 //Adding 0x8 to ESP
}
}
Don't take this the wrong way, but I just like to improve everything I see

It's great to see that people realize ASM is far better then cpp
