mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 12:47:46 +00:00
Connection working again. Fixed type 7 ping packet.
This commit is contained in:
parent
7c22cece93
commit
2e683892c8
5 changed files with 20 additions and 18 deletions
|
@ -93,7 +93,6 @@
|
|||
<Compile Include="packets\send\actor\inventory\EquipmentSetupPacket.cs" />
|
||||
<Compile Include="packets\send\actor\RemoveActorPacket.cs" />
|
||||
<Compile Include="packets\send\actor\SetActorNamePacket.cs" />
|
||||
<Compile Include="packets\send\actor\SetActorPropetyPacket.cs" />
|
||||
<Compile Include="packets\send\actor\SetActorSpeedPacket.cs" />
|
||||
<Compile Include="packets\send\actor\SetActorStatePacket.cs" />
|
||||
<Compile Include="packets\send\actor\SetActorTargetAnimatedPacket.cs" />
|
||||
|
|
|
@ -43,14 +43,11 @@ namespace FFXIVClassic_Lobby_Server
|
|||
if (packet.header.isEncrypted == 0x01)
|
||||
BasePacket.decryptPacket(client.blowfish, ref packet);
|
||||
|
||||
packet.debugPrintPacket();
|
||||
|
||||
List<SubPacket> subPackets = packet.getSubpackets();
|
||||
foreach (SubPacket subpacket in subPackets)
|
||||
{
|
||||
if (subpacket.header.type == 0x01)
|
||||
{
|
||||
BasePacket init = InitPacket.buildPacket(0, Utils.UnixTimeStampUTC());
|
||||
{
|
||||
BasePacket reply2 = new BasePacket("./packets/login/login2.bin");
|
||||
|
||||
//Already Handshaked
|
||||
|
@ -65,7 +62,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
}
|
||||
|
||||
client.queuePacket(init);
|
||||
|
||||
client.queuePacket(reply2);
|
||||
break;
|
||||
}
|
||||
|
@ -121,13 +118,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||
|
||||
//Get Character info
|
||||
//Create player actor
|
||||
client.queuePacket(init);
|
||||
client.queuePacket(reply2);
|
||||
break;
|
||||
}
|
||||
else if (subpacket.header.type == 0x08)
|
||||
else if (subpacket.header.type == 0x07)
|
||||
{
|
||||
|
||||
BasePacket init = InitPacket.buildPacket(BitConverter.ToUInt32(packet.data, 0x10), Utils.UnixTimeStampUTC());
|
||||
client.queuePacket(init);
|
||||
}
|
||||
else if (subpacket.header.type == 0x03)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
|
||||
mProcessor = new PacketProcessor(mConnectedPlayerList, mConnectionList);
|
||||
|
||||
//mGameThread = new Thread(new ThreadStart(mProcessor.update));
|
||||
//mGameThread.Start();
|
||||
return true;
|
||||
|
@ -69,6 +71,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
|
||||
private void acceptCallback(IAsyncResult result)
|
||||
{
|
||||
Log.conn("TEST.");
|
||||
ClientConnection conn = null;
|
||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||
|
||||
|
@ -133,7 +136,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
//Build packets until can no longer or out of data
|
||||
while(true)
|
||||
{
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer);
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
||||
//If can't build packet, break, else process another
|
||||
if (basePacket == null)
|
||||
break;
|
||||
|
@ -142,13 +145,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
|
||||
//Not all bytes consumed, transfer leftover to beginning
|
||||
if (offset <= bytesRead)
|
||||
if (offset < bytesRead)
|
||||
Array.Copy(conn.buffer, offset, conn.buffer, 0, bytesRead - offset);
|
||||
|
||||
//Build any queued subpackets into basepackets and send
|
||||
conn.flushQueuedSendPackets();
|
||||
|
||||
if (offset <= bytesRead)
|
||||
if (offset < bytesRead)
|
||||
//Need offset since not all bytes consumed
|
||||
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
||||
else
|
||||
|
@ -185,18 +188,21 @@ namespace FFXIVClassic_Lobby_Server
|
|||
/// <param name="offset">Current offset in buffer.</param>
|
||||
/// <param name="buffer">Incoming buffer.</param>
|
||||
/// <returns>Returns either a BasePacket or null if not enough data.</returns>
|
||||
public BasePacket buildPacket(ref int offset, byte[] buffer)
|
||||
public BasePacket buildPacket(ref int offset, byte[] buffer, int bytesRead)
|
||||
{
|
||||
BasePacket newPacket = null;
|
||||
|
||||
//Too small to even get length
|
||||
if (buffer.Length <= offset + 1)
|
||||
if (bytesRead <= offset)
|
||||
return null;
|
||||
|
||||
ushort packetSize = BitConverter.ToUInt16(buffer, offset);
|
||||
|
||||
//Too small to whole packet
|
||||
if (buffer.Length <= offset + packetSize)
|
||||
if (bytesRead < offset + packetSize)
|
||||
return null;
|
||||
|
||||
if (buffer.Length < offset + packetSize)
|
||||
return null;
|
||||
|
||||
newPacket = new BasePacket(buffer, ref offset);
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||
if (header.type == 0x3)
|
||||
Array.Copy(getGameMessageBytes(), 0, outBytes, SUBPACKET_SIZE, GAMEMESSAGE_SIZE);
|
||||
|
||||
Array.Copy(data, 0, outBytes, SUBPACKET_SIZE + header.type == 0x3 ? GAMEMESSAGE_SIZE : 0, data.Length);
|
||||
Array.Copy(data, 0, outBytes, SUBPACKET_SIZE + (header.type == 0x3 ? GAMEMESSAGE_SIZE : 0), data.Length);
|
||||
return outBytes;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.login
|
|||
{
|
||||
class InitPacket
|
||||
{
|
||||
public static BasePacket buildPacket(uint unknown, uint time)
|
||||
public static BasePacket buildPacket(uint actorID, uint time)
|
||||
{
|
||||
byte[] data = new byte[0x18];
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.send.login
|
|||
binWriter.Write((uint)0);
|
||||
binWriter.Write((uint)0xFFFFFD7F);
|
||||
|
||||
binWriter.Write((uint)unknown);
|
||||
binWriter.Write((uint)actorID);
|
||||
binWriter.Write((uint)time);
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
Loading…
Add table
Reference in a new issue