diff --git a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session.cpp b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session.cpp index 3c1d8965cb..ee57d04867 100644 --- a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session.cpp +++ b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session.cpp @@ -81,9 +81,9 @@ namespace Sessions ret->destinationPort = srcPort; ret->sequenceNumber = GetMyNumber(); - //DevCon.WriteLn("With MySeq: %d", ret->sequenceNumber); + //DevCon.WriteLn("With MySeq: %u", ret->sequenceNumber); ret->acknowledgementNumber = expectedSeqNumber; - //DevCon.WriteLn("With MyAck: %d", ret->acknowledgementNumber); + //DevCon.WriteLn("With MyAck: %u", ret->acknowledgementNumber); ret->windowSize = 2 * maxSegmentSize; diff --git a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_In.cpp b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_In.cpp index 138ab13c0e..4fce5d68c2 100644 --- a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_In.cpp +++ b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_In.cpp @@ -80,7 +80,9 @@ namespace Sessions int err = 0; int recived; - unsigned long available; + //FIONREAD uses unsigned long on windows and int on linux + //Zero init so we don't have bad data on any unused bytes + unsigned long available = 0; #ifdef _WIN32 err = ioctlsocket(client, FIONREAD, &available); #elif defined(__POSIX__) @@ -89,7 +91,7 @@ namespace Sessions if (err != SOCKET_ERROR) { if (available > maxSize) - Console.WriteLn("DEV9: TCP: Got a lot of data: %d Using: %d", available, maxSize); + Console.WriteLn("DEV9: TCP: Got a lot of data: %lu Using: %d", available, maxSize); buffer = std::make_unique(maxSize); recived = recv(client, (char*)buffer.get(), maxSize, 0); diff --git a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp index bebfab067e..db1fce3168 100644 --- a/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp +++ b/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp @@ -361,7 +361,7 @@ namespace Sessions //Done send } //ACK data - //DevCon.WriteLn("[SRV] ACK Data: %d", expectedSeqNumber); + //DevCon.WriteLn("[SRV] ACK Data: %u", expectedSeqNumber); TCP_Packet* ret = CreateBasePacket(); ret->SetACK(true); @@ -402,11 +402,11 @@ namespace Sessions TCP_Session::NumCheckResult TCP_Session::CheckRepeatSYNNumbers(TCP_Packet* tcp) { //DevCon.WriteLn("DEV9: TCP: CHECK_REPEAT_SYN_NUMBERS"); - //DevCon.WriteLn("DEV9: TCP: [SRV]CurrAckNumber = %d [PS2]Seq Number = %d", expectedSeqNumber, tcp->sequenceNumber); + //DevCon.WriteLn("DEV9: TCP: [SRV] CurrAckNumber = %u [PS2] Seq Number = %u", expectedSeqNumber, tcp->sequenceNumber); if (tcp->sequenceNumber != expectedSeqNumber - 1) { - Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From Repeated SYN Packet, Got %d Expected %d", tcp->sequenceNumber, (expectedSeqNumber - 1)); + Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From Repeated SYN Packet, Got %u Expected %u", tcp->sequenceNumber, (expectedSeqNumber - 1)); return NumCheckResult::Bad; } return NumCheckResult::OK; @@ -419,24 +419,24 @@ namespace Sessions std::tie(seqNum, oldSeqNums) = GetAllMyNumbers(); //DevCon.WriteLn("DEV9: TCP: CHECK_NUMBERS"); - //DevCon.WriteLn("DEV9: TCP: [SRV]CurrSeqNumber = %d [PS2]Ack Number = %d", seqNum, tcp->acknowledgementNumber); - //DevCon.WriteLn("DEV9: TCP: [SRV]CurrAckNumber = %d [PS2]Seq Number = %d", expectedSeqNumber, tcp->sequenceNumber); - //DevCon.WriteLn("DEV9: TCP: [PS2]Data Length = %d", tcp->GetPayload()->GetLength()); + //DevCon.WriteLn("DEV9: TCP: [SRV] CurrSeqNumber = %u [PS2] Ack Number = %u", seqNum, tcp->acknowledgementNumber); + //DevCon.WriteLn("DEV9: TCP: [SRV] CurrAckNumber = %u [PS2] Seq Number = %u", expectedSeqNumber, tcp->sequenceNumber); + //DevCon.WriteLn("DEV9: TCP: [PS2] Data Length = %u", tcp->GetPayload()->GetLength()); if (tcp->acknowledgementNumber != seqNum) { - //DevCon.WriteLn("DEV9: TCP: [PS2]Sent Outdated Acknowledgement Number, Got %d Expected %d", tcp->acknowledgementNumber, seqNum); + //DevCon.WriteLn("DEV9: TCP: [PS2] Sent Outdated Acknowledgement Number, Got %u Expected %u", tcp->acknowledgementNumber, seqNum); //Check if oldSeqNums contains tcp->acknowledgementNumber if (std::find(oldSeqNums.begin(), oldSeqNums.end(), tcp->acknowledgementNumber) == oldSeqNums.end()) { - Console.Error("DEV9: TCP: [PS2] Sent Unexpected Acknowledgement Number, did not Match Old Numbers, Got %d Expected %d", tcp->acknowledgementNumber, seqNum); + Console.Error("DEV9: TCP: [PS2] Sent Unexpected Acknowledgement Number, did not Match Old Numbers, Got %u Expected %u", tcp->acknowledgementNumber, seqNum); return NumCheckResult::Bad; } } else { - //DevCon.WriteLn("[PS2]CurrSeqNumber Acknowleged By PS2"); + //DevCon.WriteLn("[PS2] CurrSeqNumber Acknowleged By PS2"); myNumberACKed.store(true); } @@ -444,19 +444,19 @@ namespace Sessions { if (tcp->GetPayload()->GetLength() == 0) { - Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From ACK Packet, Got %d Expected %d", tcp->sequenceNumber, expectedSeqNumber); + Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From ACK Packet, Got %u Expected %u", tcp->sequenceNumber, expectedSeqNumber); } else { //Check if receivedPS2SeqNumbers contains tcp->sequenceNumber if (std::find(receivedPS2SeqNumbers.begin(), receivedPS2SeqNumbers.end(), tcp->sequenceNumber) == receivedPS2SeqNumbers.end()) { - Console.Error("DEV9: TCP: [PS2] Sent an Old Seq Number on an Data packet, Got %d Expected %d", tcp->sequenceNumber, expectedSeqNumber); + Console.Error("DEV9: TCP: [PS2] Sent an Old Seq Number on an Data packet, Got %u Expected %u", tcp->sequenceNumber, expectedSeqNumber); return NumCheckResult::GotOldData; } else { - Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From Data Packet, Got %d Expected %d", tcp->sequenceNumber, expectedSeqNumber); + Console.Error("DEV9: TCP: [PS2] Sent Unexpected Sequence Number From Data Packet, Got %u Expected %u", tcp->sequenceNumber, expectedSeqNumber); return NumCheckResult::Bad; } }