diff --git a/pcsx2/DEV9/PacketReader/IP/IP_Packet.cpp b/pcsx2/DEV9/PacketReader/IP/IP_Packet.cpp index 713eb16391..8b6ce41895 100644 --- a/pcsx2/DEV9/PacketReader/IP/IP_Packet.cpp +++ b/pcsx2/DEV9/PacketReader/IP/IP_Packet.cpp @@ -4,6 +4,7 @@ #include "IP_Packet.h" #include "DEV9/PacketReader/NetLib.h" +#include "common/BitUtils.h" #include "common/Console.h" namespace PacketReader::IP @@ -209,8 +210,8 @@ namespace PacketReader::IP for (size_t i = 0; i < options.size(); i++) opOffset += options[i]->GetLength(); - opOffset += opOffset % 4; //needs to be a whole number of 32bits - headerLength = opOffset; + //needs to be a whole number of 32bits + headerLength = Common::AlignUpPow2(opOffset, 4); } void IP_Packet::CalculateChecksum() diff --git a/pcsx2/DEV9/PacketReader/IP/TCP/TCP_Packet.cpp b/pcsx2/DEV9/PacketReader/IP/TCP/TCP_Packet.cpp index bd04627a23..c8d6971f6e 100644 --- a/pcsx2/DEV9/PacketReader/IP/TCP/TCP_Packet.cpp +++ b/pcsx2/DEV9/PacketReader/IP/TCP/TCP_Packet.cpp @@ -4,6 +4,7 @@ #include "TCP_Packet.h" #include "DEV9/PacketReader/NetLib.h" +#include "common/BitUtils.h" #include "common/Console.h" namespace PacketReader::IP::TCP @@ -232,8 +233,8 @@ namespace PacketReader::IP::TCP for (size_t i = 0; i < options.size(); i++) opOffset += options[i]->GetLength(); - opOffset += opOffset % 4; //needs to be a whole number of 32bits - headerLength = opOffset; + //needs to be a whole number of 32bits + headerLength = Common::AlignUpPow2(opOffset, 4); //Also write into dataOffsetAndNS_Flag u8 ns = dataOffsetAndNS_Flag & 1;