Code:
void _fastcall my_PacketEncrypt(VOID* Unk, VOID* Unk1, int bufferSize, packet* pBuffer, int* pTargetBuffer)
{
if(bufferSize == 21 && pBuffer->opcode == 0x0D) //movement packet
{
cout << "moving\n" << endl;
pBuffer->x = 100;
pBuffer->y = 100;
pBuffer->z = 100;
pBuffer->flags[2] = 1;
cout << "opcode:" << pBuffer->opcode << " x:" << pBuffer->x << " y:" << pBuffer->y << " z:" << pBuffer->z << endl;
}
orig_PacketEncrypt(Unk, Unk1, bufferSize, pBuffer, pTargetBuffer);
}
where packet is defined as a structure:
Code:
struct packet{
UINT16 opcode; //2 bytes
UINT16 Time1; //2 bytes
UINT16 Time2; //2 bytes
FLOAT x; //4 bytes
FLOAT y; //4 bytes
FLOAT z; //4 bytes
CHAR flags[3]; //3 bytes
};
and orig_PacketEncrypt is defined as
Code:
typedef VOID (_fastcall *tPacketEncrypt)(VOID* Unk, VOID* Unk1, int bufferSize, packet* pBuffer, int* pTargetBuffer);
VOID _fastcall my_PacketEncrypt(VOID* Unk, VOID* Unk1, int bufferSize, packet* pBuffer, int* pTargetBuffer);
tPacketEncrypt orig_PacketEncrypt = (tPacketEncrypt)(0x00A69C60);
Got it working, thanks so much! The problem was my structure of pBuffer. Flags were not 'changed' the way I thought they would be. :)