diff --git a/pcsx2/DEV9/PacketReader/NetLib.cpp b/pcsx2/DEV9/PacketReader/NetLib.cpp index ab9d664967..8d2c660f22 100644 --- a/pcsx2/DEV9/PacketReader/NetLib.cpp +++ b/pcsx2/DEV9/PacketReader/NetLib.cpp @@ -23,6 +23,8 @@ #include #endif +using namespace PacketReader::IP; + namespace PacketReader::NetLib { void WriteByte08(u8* data, int* index, u8 value) @@ -42,6 +44,11 @@ namespace PacketReader::NetLib } //Special + void WriteIPAddress(u8* data, int* index, IP_Address value) + { + *(IP_Address*)&data[*index] = value; + *index += sizeof(IP_Address); + } void WriteByteArray(u8* data, int* index, int length, u8* value) { memcpy(&data[*index], value, length); @@ -67,6 +74,11 @@ namespace PacketReader::NetLib } //Special + void ReadIPAddress(u8* data, int* index, IP_Address* value) + { + *value = *(IP_Address*)&data[*index]; + *index += sizeof(IP_Address); + } void ReadByteArray(u8* data, int* index, int length, u8* value) { memcpy(value, &data[*index], length); diff --git a/pcsx2/DEV9/PacketReader/NetLib.h b/pcsx2/DEV9/PacketReader/NetLib.h index 2f29ef6d3a..5860819f40 100644 --- a/pcsx2/DEV9/PacketReader/NetLib.h +++ b/pcsx2/DEV9/PacketReader/NetLib.h @@ -15,17 +15,21 @@ #pragma once +#include "DEV9/PacketReader/IP/IP_Address.h" + namespace PacketReader::NetLib { void WriteByte08(u8* data, int* index, u8 value); void WriteUInt16(u8* data, int* index, u16 value); void WriteUInt32(u8* data, int* index, u32 value); + void WriteIPAddress(u8* data, int* index, PacketReader::IP::IP_Address value); void WriteByteArray(u8* data, int* index, int length, u8* value); void ReadByte08(u8* data, int* index, u8* value); void ReadUInt16(u8* data, int* index, u16* value); void ReadUInt32(u8* data, int* index, u32* value); + void ReadIPAddress(u8* data, int* index, PacketReader::IP::IP_Address* value); void ReadByteArray(u8* data, int* index, int length, u8* value); } // namespace PacketReader::NetLib