mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Cleanup dev9 base tree.
This commit is contained in:
parent
6986030cd9
commit
7b428bb6b0
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -171,9 +171,7 @@ s32 DEV9init()
|
|||
}
|
||||
#endif
|
||||
|
||||
int rxbi;
|
||||
|
||||
for (rxbi = 0; rxbi < (SMAP_BD_SIZE / 8); rxbi++)
|
||||
for (int rxbi = 0; rxbi < (SMAP_BD_SIZE / 8); rxbi++)
|
||||
{
|
||||
smap_bd_t* pbd = (smap_bd_t*)&dev9.dev9R[SMAP_BD_RX_BASE & 0xffff];
|
||||
pbd = &pbd[rxbi];
|
||||
|
@ -309,7 +307,6 @@ u8 DEV9read8(u32 addr)
|
|||
if (!EmuConfig.DEV9.EthEnable && !EmuConfig.DEV9.HddEnable)
|
||||
return 0;
|
||||
|
||||
u8 hard;
|
||||
if (addr >= ATA_DEV9_HDD_BASE && addr < ATA_DEV9_HDD_END)
|
||||
{
|
||||
Console.Error("DEV9: ATA does not support 8bit reads %lx", addr);
|
||||
|
@ -322,9 +319,10 @@ u8 DEV9read8(u32 addr)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
return (u8)FLASHread32(addr, 1);
|
||||
return static_cast<u8>(FLASHread32(addr, 1));
|
||||
}
|
||||
|
||||
u8 hard = 0;
|
||||
switch (addr)
|
||||
{
|
||||
case SPD_R_PIO_DATA:
|
||||
|
@ -339,9 +337,7 @@ u8 DEV9read8(u32 addr)
|
|||
{
|
||||
if (dev9.eeprom_command == 2) //read
|
||||
{
|
||||
if (dev9.eeprom_bit == 0xFF)
|
||||
hard = 0;
|
||||
else
|
||||
if (dev9.eeprom_bit != 0xFF)
|
||||
hard = ((dev9.eeprom[dev9.eeprom_address] << dev9.eeprom_bit) & 0x8000) >> 11;
|
||||
dev9.eeprom_bit++;
|
||||
if (dev9.eeprom_bit == 16)
|
||||
|
@ -350,11 +346,7 @@ u8 DEV9read8(u32 addr)
|
|||
dev9.eeprom_bit = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
hard = 0;
|
||||
}
|
||||
else
|
||||
hard = 0;
|
||||
//DevCon.WriteLn("DEV9: SPD_R_PIO_DATA 8bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
|
@ -375,7 +367,6 @@ u16 DEV9read16(u32 addr)
|
|||
if (!EmuConfig.DEV9.EthEnable && !EmuConfig.DEV9.HddEnable)
|
||||
return 0;
|
||||
|
||||
u16 hard;
|
||||
if (addr >= ATA_DEV9_HDD_BASE && addr < ATA_DEV9_HDD_END)
|
||||
{
|
||||
return dev9.ata->Read16(addr);
|
||||
|
@ -387,9 +378,10 @@ u16 DEV9read16(u32 addr)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
return (u16)FLASHread32(addr, 2);
|
||||
return static_cast<u16>(FLASHread32(addr, 2));
|
||||
}
|
||||
|
||||
u16 hard = 0;
|
||||
switch (addr)
|
||||
{
|
||||
case SPD_R_INTR_STAT:
|
||||
|
@ -412,9 +404,7 @@ u16 DEV9read16(u32 addr)
|
|||
{
|
||||
if (dev9.eeprom_command == 2) //read
|
||||
{
|
||||
if (dev9.eeprom_bit == 0xFF)
|
||||
hard = 0;
|
||||
else
|
||||
if (dev9.eeprom_bit != 0xFF)
|
||||
hard = ((dev9.eeprom[dev9.eeprom_address] << dev9.eeprom_bit) & 0x8000) >> 11;
|
||||
dev9.eeprom_bit++;
|
||||
if (dev9.eeprom_bit == 16)
|
||||
|
@ -423,11 +413,7 @@ u16 DEV9read16(u32 addr)
|
|||
dev9.eeprom_bit = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
hard = 0;
|
||||
}
|
||||
else
|
||||
hard = 0;
|
||||
//DevCon.WriteLn("DEV9: SPD_R_PIO_DATA 16bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
|
@ -447,7 +433,6 @@ u16 DEV9read16(u32 addr)
|
|||
return hard;
|
||||
|
||||
case SPD_R_REV_3:
|
||||
hard = 0;
|
||||
if (EmuConfig.DEV9.HddEnable)
|
||||
hard |= SPD_CAPS_ATA;
|
||||
if (EmuConfig.DEV9.EthEnable)
|
||||
|
@ -465,7 +450,6 @@ u16 DEV9read16(u32 addr)
|
|||
return dev9.xfr_ctrl;
|
||||
case SPD_R_DBUF_STAT:
|
||||
{
|
||||
hard = 0;
|
||||
if (dev9.if_ctrl & SPD_IF_READ) //Semi async
|
||||
{
|
||||
HDDWriteFIFO(); //Yes this is not a typo
|
||||
|
@ -476,18 +460,18 @@ u16 DEV9read16(u32 addr)
|
|||
}
|
||||
FIFOIntr();
|
||||
|
||||
const u8 count = (u8)((dev9.fifo_bytes_write - dev9.fifo_bytes_read) / 512);
|
||||
const u8 count = static_cast<u8>((dev9.fifo_bytes_write - dev9.fifo_bytes_read) / 512);
|
||||
if (dev9.xfr_ctrl & SPD_XFR_WRITE) //or ifRead?
|
||||
{
|
||||
hard = (u8)(SPD_DBUF_AVAIL_MAX - count);
|
||||
hard |= (count == 0) ? SPD_DBUF_STAT_1 : (u16)0;
|
||||
hard |= (count > 0) ? SPD_DBUF_STAT_2 : (u16)0;
|
||||
hard = static_cast<u8>(SPD_DBUF_AVAIL_MAX - count);
|
||||
hard |= (count == 0) ? SPD_DBUF_STAT_1 : static_cast<u16>(0);
|
||||
hard |= (count > 0) ? SPD_DBUF_STAT_2 : static_cast<u16>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hard = count;
|
||||
hard |= (count < SPD_DBUF_AVAIL_MAX) ? SPD_DBUF_STAT_1 : (u16)0;
|
||||
hard |= (count == 0) ? SPD_DBUF_STAT_2 : (u16)0;
|
||||
hard |= (count < SPD_DBUF_AVAIL_MAX) ? SPD_DBUF_STAT_1 : static_cast<u16>(0);
|
||||
hard |= (count == 0) ? SPD_DBUF_STAT_2 : static_cast<u16>(0);
|
||||
//If overflow (HDD->SPEED), set both SPD_DBUF_STAT_2 & SPD_DBUF_STAT_FULL
|
||||
//and overflow INTR set
|
||||
}
|
||||
|
@ -515,7 +499,6 @@ u32 DEV9read32(u32 addr)
|
|||
if (!EmuConfig.DEV9.EthEnable && !EmuConfig.DEV9.HddEnable)
|
||||
return 0;
|
||||
|
||||
u32 hard;
|
||||
if (addr >= ATA_DEV9_HDD_BASE && addr < ATA_DEV9_HDD_END)
|
||||
{
|
||||
Console.Error("DEV9: ATA does not support 32bit reads %lx", addr);
|
||||
|
@ -528,10 +511,10 @@ u32 DEV9read32(u32 addr)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
return (u32)FLASHread32(addr, 4);
|
||||
return static_cast<u32>(FLASHread32(addr, 4));
|
||||
}
|
||||
|
||||
hard = dev9Ru32(addr);
|
||||
const u32 hard = dev9Ru32(addr);
|
||||
Console.Error("DEV9: Unknown 32bit read at address %lx value %x", addr, hard);
|
||||
return hard;
|
||||
}
|
||||
|
@ -556,7 +539,7 @@ void DEV9write8(u32 addr, u8 value)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
FLASHwrite32(addr, (u32)value, 1);
|
||||
FLASHwrite32(addr, static_cast<u32>(value), 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -666,7 +649,7 @@ void DEV9write16(u32 addr, u16 value)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
FLASHwrite32(addr, (u32)value, 2);
|
||||
FLASHwrite32(addr, static_cast<u32>(value), 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -978,7 +961,7 @@ void DEV9write32(u32 addr, u32 value)
|
|||
}
|
||||
if ((addr >= FLASH_REGBASE) && (addr < (FLASH_REGBASE + FLASH_REGSIZE)))
|
||||
{
|
||||
FLASHwrite32(addr, (u32)value, 4);
|
||||
FLASHwrite32(addr, static_cast<u32>(value), 4);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -81,7 +81,7 @@ namespace InternalServers
|
|||
{
|
||||
#ifdef _WIN32
|
||||
/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
const WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
WSADATA wsaData{0};
|
||||
const int err = WSAStartup(wVersionRequested, &wsaData);
|
||||
|
@ -162,14 +162,14 @@ namespace InternalServers
|
|||
DNS_Packet* ret = new DNS_Packet();
|
||||
ret->id = dns.id; //TODO, drop duplicate requests based on ID
|
||||
ret->SetQR(true);
|
||||
ret->SetOpCode((u8)DNS_OPCode::Query);
|
||||
ret->SetOpCode(static_cast<u8>(DNS_OPCode::Query));
|
||||
ret->SetAA(false);
|
||||
ret->SetTC(false);
|
||||
ret->SetRD(true);
|
||||
ret->SetRA(true);
|
||||
ret->SetAD(false);
|
||||
ret->SetCD(false);
|
||||
ret->SetRCode((u8)DNS_RCode::NoError);
|
||||
ret->SetRCode(static_cast<u8>(DNS_RCode::NoError));
|
||||
//Counts
|
||||
ret->questions = dns.questions;
|
||||
|
||||
|
@ -292,8 +292,7 @@ namespace InternalServers
|
|||
data->session = this;
|
||||
data->url = url;
|
||||
|
||||
int ret = GetAddrInfoEx(converted_string.data(), nullptr, NS_ALL, 0, &hints, (ADDRINFOEX**)&data->result, nullptr, &data->overlapped, &DNS_Server::GetAddrInfoExCallback, &data->cancelHandle);
|
||||
|
||||
const int ret = GetAddrInfoEx(converted_string.data(), nullptr, NS_ALL, 0, &hints, (ADDRINFOEX**)&data->result, nullptr, &data->overlapped, &DNS_Server::GetAddrInfoExCallback, &data->cancelHandle);
|
||||
if (ret == WSA_IO_PENDING)
|
||||
return;
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -77,12 +77,11 @@ bool load_pcap()
|
|||
return true;
|
||||
|
||||
//Store old Search Dir
|
||||
wchar_t* oldDllDir;
|
||||
int len = GetDllDirectory(0, nullptr);
|
||||
if (len == 0)
|
||||
return false;
|
||||
|
||||
oldDllDir = new wchar_t[len];
|
||||
wchar_t* oldDllDir = new wchar_t[len];
|
||||
|
||||
if (len == 1)
|
||||
oldDllDir[0] = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -253,7 +253,7 @@ HANDLE TAPOpen(const std::string& device_guid)
|
|||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
BOOL bret = DeviceIoControl(handle.get(), TAP_IOCTL_GET_VERSION,
|
||||
const BOOL bret = DeviceIoControl(handle.get(), TAP_IOCTL_GET_VERSION,
|
||||
&version, sizeof(version),
|
||||
&version, sizeof(version), (LPDWORD)&version_len, NULL);
|
||||
|
||||
|
@ -400,14 +400,13 @@ bool TAPGetWin32Adapter(const std::string& name, PIP_ADAPTER_ADDRESSES adapter,
|
|||
//Note that we append to the collection during iteration
|
||||
for (size_t vi = 0; vi < searchList.size(); vi++)
|
||||
{
|
||||
int targetIndex = searchList[vi];
|
||||
|
||||
for (ULONG i = 0; i < table->NumEntries; i++)
|
||||
{
|
||||
int targetIndex = searchList[vi];
|
||||
MIB_IFSTACK_ROW row = table->Table[i];
|
||||
if (row.LowerLayerInterfaceIndex == targetIndex)
|
||||
{
|
||||
PIP_ADAPTER_ADDRESSES potentialAdapter = FindAdapterViaIndex(AdapterInfoReduced.get(), row.HigherLayerInterfaceIndex);
|
||||
const PIP_ADAPTER_ADDRESSES potentialAdapter = FindAdapterViaIndex(AdapterInfoReduced.get(), row.HigherLayerInterfaceIndex);
|
||||
if (potentialAdapter != nullptr)
|
||||
{
|
||||
Console.WriteLn(fmt::format("DEV9: {} is possible bridge (Check 1 passed)", StringUtil::WideStringToUTF8String(potentialAdapter->Description)));
|
||||
|
@ -598,7 +597,7 @@ bool TAPAdapter::recv(NetPacket* pkt)
|
|||
|
||||
if (!result)
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
const DWORD dwError = GetLastError();
|
||||
if (dwError == ERROR_IO_PENDING)
|
||||
{
|
||||
HANDLE readHandles[]{read.hEvent, cancel};
|
||||
|
@ -639,7 +638,7 @@ bool TAPAdapter::send(NetPacket* pkt)
|
|||
|
||||
if (!result)
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
const DWORD dwError = GetLastError();
|
||||
if (dwError == ERROR_IO_PENDING)
|
||||
{
|
||||
WaitForSingleObject(write.hEvent, INFINITE);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -75,8 +75,6 @@ static const char* getCmdName(u32 cmd)
|
|||
|
||||
void FLASHinit()
|
||||
{
|
||||
FILE* fd;
|
||||
|
||||
id = FLASH_ID_64MBIT;
|
||||
counter = 0;
|
||||
addrbyte = 0;
|
||||
|
@ -86,12 +84,10 @@ void FLASHinit()
|
|||
calculateECC(data);
|
||||
ctrl = FLASH_PP_READY;
|
||||
|
||||
fd = fopen("flash.dat", "rb");
|
||||
FILE* fd = fopen("flash.dat", "rb");
|
||||
if (fd != NULL)
|
||||
{
|
||||
size_t ret;
|
||||
|
||||
ret = fread(file, 1, CARD_SIZE_ECC, fd);
|
||||
const size_t ret = fread(file, 1, CARD_SIZE_ECC, fd);
|
||||
if (ret != CARD_SIZE_ECC)
|
||||
{
|
||||
DevCon.WriteLn("DEV9: Reading error.");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -70,7 +70,7 @@ bool rx_fifo_can_rx()
|
|||
return false;
|
||||
|
||||
//Check if there is space on fifo
|
||||
int rd_ptr = dev9Ru32(SMAP_R_RXFIFO_RD_PTR);
|
||||
const int rd_ptr = dev9Ru32(SMAP_R_RXFIFO_RD_PTR);
|
||||
int space = sizeof(dev9.rxfifo) -
|
||||
((dev9.rxfifo_wr_ptr - rd_ptr) & 16383);
|
||||
|
||||
|
@ -89,7 +89,7 @@ void rx_process(NetPacket* pk)
|
|||
{
|
||||
smap_bd_t* pbd = ((smap_bd_t*)&dev9.dev9R[SMAP_BD_RX_BASE & 0xffff]) + dev9.rxbdi;
|
||||
|
||||
int bytes = (pk->size + 3) & (~3);
|
||||
const int bytes = (pk->size + 3) & (~3);
|
||||
|
||||
if (!(pbd->ctrl_stat & SMAP_BD_RX_EMPTY))
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ void rx_process(NetPacket* pk)
|
|||
return;
|
||||
}
|
||||
|
||||
int pstart = (dev9.rxfifo_wr_ptr) & 16383;
|
||||
const int pstart = (dev9.rxfifo_wr_ptr) & 16383;
|
||||
int i = 0;
|
||||
while (i < bytes)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ u32 wswap(u32 d)
|
|||
void tx_process()
|
||||
{
|
||||
//we loop based on count ? or just *use* it ?
|
||||
u32 cnt = dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT);
|
||||
const u32 cnt = dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT);
|
||||
//spams// printf("tx_process : %u cnt frames !\n",cnt);
|
||||
|
||||
NetPacket pk;
|
||||
|
@ -159,7 +159,7 @@ void tx_process()
|
|||
}
|
||||
else
|
||||
{
|
||||
u32 base = (pbd->pointer - 0x1000) & 16383;
|
||||
const u32 base = (pbd->pointer - 0x1000) & 16383;
|
||||
DevCon.WriteLn("DEV9: Sending Packet from base %x, size %d", base, pbd->length);
|
||||
|
||||
pk.size = pbd->length;
|
||||
|
@ -277,7 +277,7 @@ void emac3_write(u32 addr)
|
|||
if (value & (SMAP_E3_PHY_READ))
|
||||
{
|
||||
value |= SMAP_E3_PHY_OP_COMP;
|
||||
int reg = value & (SMAP_E3_PHY_REG_ADDR_MSK);
|
||||
const int reg = value & (SMAP_E3_PHY_REG_ADDR_MSK);
|
||||
u16 val = dev9.phyregs[reg];
|
||||
switch (reg)
|
||||
{
|
||||
|
@ -342,7 +342,7 @@ u8 smap_read8(u32 addr)
|
|||
|
||||
u16 smap_read16(u32 addr)
|
||||
{
|
||||
int rv = dev9Ru16(addr);
|
||||
const int rv = dev9Ru16(addr);
|
||||
if (addr >= SMAP_BD_TX_BASE && addr < (SMAP_BD_TX_BASE + SMAP_BD_SIZE))
|
||||
{
|
||||
if (dev9.bd_swap)
|
||||
|
@ -497,8 +497,8 @@ u32 smap_read32(u32 addr)
|
|||
{
|
||||
if (addr >= SMAP_EMAC3_REGBASE && addr < SMAP_EMAC3_REGEND)
|
||||
{
|
||||
u32 hi = smap_read16(addr);
|
||||
u32 lo = smap_read16(addr + 2) << 16;
|
||||
const u32 hi = smap_read16(addr);
|
||||
const u32 lo = smap_read16(addr + 2) << 16;
|
||||
return hi | lo;
|
||||
}
|
||||
switch (addr)
|
||||
|
@ -517,7 +517,7 @@ u32 smap_read32(u32 addr)
|
|||
{
|
||||
int rd_ptr = dev9Ru32(SMAP_R_RXFIFO_RD_PTR) & 16383;
|
||||
|
||||
int rv = *((u32*)(dev9.rxfifo + rd_ptr));
|
||||
const int rv = *((u32*)(dev9.rxfifo + rd_ptr));
|
||||
|
||||
dev9Ru32(SMAP_R_RXFIFO_RD_PTR) = ((rd_ptr + 4) & 16383);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
|
@ -216,7 +216,7 @@ SocketAdapter::SocketAdapter()
|
|||
|
||||
#ifdef _WIN32
|
||||
/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
const WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
WSADATA wsaData{0};
|
||||
const int err = WSAStartup(wVersionRequested, &wsaData);
|
||||
|
@ -270,7 +270,7 @@ bool SocketAdapter::recv(NetPacket* pkt)
|
|||
EthernetFrame frame(ipPkt);
|
||||
frame.sourceMAC = internalMAC;
|
||||
frame.destinationMAC = ps2MAC;
|
||||
frame.protocol = (u16)EtherType::IPv4;
|
||||
frame.protocol = static_cast<u16>(EtherType::IPv4);
|
||||
|
||||
frame.WritePacket(pkt);
|
||||
InspectRecv(pkt);
|
||||
|
@ -295,8 +295,6 @@ bool SocketAdapter::send(NetPacket* pkt)
|
|||
if (NetAdapter::send(pkt))
|
||||
return true;
|
||||
|
||||
bool result = false;
|
||||
|
||||
EthernetFrame frame(pkt);
|
||||
|
||||
switch (frame.protocol)
|
||||
|
@ -350,7 +348,7 @@ bool SocketAdapter::send(NetPacket* pkt)
|
|||
return false;
|
||||
}
|
||||
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SocketAdapter::reset()
|
||||
|
@ -464,7 +462,7 @@ bool SocketAdapter::SendTCP(ConnectionKey Key, IP_Packet* ipPkt)
|
|||
Key.ps2Port = tcp.sourcePort;
|
||||
Key.srvPort = tcp.destinationPort;
|
||||
|
||||
int res = SendFromConnection(Key, ipPkt);
|
||||
const int res = SendFromConnection(Key, ipPkt);
|
||||
if (res == 1)
|
||||
return true;
|
||||
else if (res == 0)
|
||||
|
@ -561,7 +559,7 @@ int SocketAdapter::SendFromConnection(ConnectionKey Key, IP_Packet* ipPkt)
|
|||
|
||||
void SocketAdapter::HandleConnectionClosed(BaseSession* sender)
|
||||
{
|
||||
ConnectionKey key = sender->key;
|
||||
const ConnectionKey key = sender->key;
|
||||
connections.Remove(key);
|
||||
//Note, we delete something that is calling us
|
||||
//this is probably going to cause issues
|
||||
|
|
Loading…
Reference in New Issue