View Single Post
Old 17.06.2006, 19:45   #10
mcrabben7
Архивный участник
 
Join Date: Apr 2006
Posts: 461
Default

Some progress:

Code:
switch ( opCode )
{
	//C4 Extended Packets
	case 0xD0:
		extOpCode = (BYTE)*(header+1);
		#ifdef __DEBUG__
			__asm { pushad }
			file << ">>>>>> ReceivePacket: C4 Extended (0x" << hex << opCode << ")(0x" << hex << extOpCode << ") received.\r\n";
			file.flush();
			__asm { popad }
		#endif
		//TODO: insert extended op code switch for C4 packets
		break;
	//RequestParty
	case 0x29:
		#ifdef __DEBUG__
			__asm { pushad }
			file << ">>>>>> ReceivePacket: RequestParty (0x" << hex << opCode << ") received.\r\n";
			file.flush();
			__asm { popad }
		#endif
		break;
	//RequestShowMiniMap
	case 0xCD:
		#ifdef __DEBUG__
			__asm { pushad }
			file << ">>>>>> ReceivePacket: Request Show Mini Map (0x" << hex << opCode << ") received.\r\n";
			file.flush();
			__asm { popad }
			ReplyRequestShowMiniMap(packet);
		#endif
}
And some logs:
Code:
L2C4Extend has started.
Got Process Handle 00000088.
Wrote L2Server.0050105D with new Server Protocol Revision [656].
Wrote L2Server.004907AA with new Server Window Name.
Wrote L2Server.0050F8F5 with ReceivePacket Hook.  New call address: ffe018d7.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/0/64/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/0/64/9c opcode: 0xd
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x63
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x3
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x66
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x9d
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x5b
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x48
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x30
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: f8/6c/64/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/0/c4/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/0/c4/9c opcode: 0xd
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x63
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x3
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x66
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x9d
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0x8
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
And some SPECIFIC parts of the logs above:
Code:
Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xd0
>>>>>> ReceivePacket: C4 Extended (0xd0)(0x0) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.

Entered HookReceivePacket: now calling L2Server.00500FF0.
>>> HookReceivePacket: now calling ReceivePacket.
>>> Entered ReceivePacket: now pulling data from the packet.
>>>>>> ReceivePacket: packet size: 58/cc/c4/9c opcode: 0xcd
>>>>>> ReceivePacket: Request Show Mini Map (0xcd) received.
>>> HookReceivePacket: ReceivePacket has returned.  Now finishing and calling L2Server.0050F8FC.
Note: I am still not sure which of the 4 packet sizes I printed to the log is the correct one. But so far, I haven't needed to use it, so, good for me I guess.

I managed to write a ReplyRequestShowMiniMap() function. Sadly, when I open the minimap using Alt + m or the button I will see the map, and immediately get disconnected on a dual login error, and on my older code, kicked for a 'protocol' error.

Code:
// Reply to Client Packet: RequestShowMiniMap(0xCD)
// Reply Packet format: cd
// 
// Enables the Alt+M / Map button functionality in-game
void ReplyRequestShowMiniMap(DWORD * packetStart)
{
	const char * format = "cd";
	__asm
	{
		push	0x0681			//dec: 1665
		push	0x00B6			//dec: 182
		push	format			//packet format 'cd'
		push	packetStart	//pushes the address of the start of the packet
		call	fSendToSinglePlayer
		//add		esp, 0x0C
		//jmp		0x0050FA7F		
	}
}
Work in progress...
mcrabben7 is offline