diff --git a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp index 14dcb3db6d..1bcd1d2e14 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp @@ -18,6 +18,8 @@ #include "../Memmap.h" #include "../EXI_Device.h" #include "../EXI_DeviceEthernet.h" + #include +#include bool CEXIETHERNET::deactivate() { return true; @@ -36,3 +38,43 @@ bool CEXIETHERNET::activate() { return false; //TODO: Activate Device! } +bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) +{ + DEBUGPRINT( "Packet: 0x"); + for(int a = 0; a < size; ++a) + { + DEBUGPRINT( "%02X", etherpckt[a]); + } + DEBUGPRINT( " : Size: %d\n", size); + int raw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_TCP); + DEBUGPRINT("Raw socket is : %d\n", raw_socket); + int sm=1; + const int *val=&sm; + int result = setsockopt(raw_socket, IPPROTO_IP, IP_HDRINCL, val, sizeof(sm)); + DEBUGPRINT("Result is : %d\n", result); + int numBytesWrit = write(raw_socket, etherpckt, size); + if(numBytesWrit != size) + { + DEBUGPRINT("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit); + return false; + } + //fwrite(etherpckt, size, size, raw_socket); + /*DWORD numBytesWrit; + OVERLAPPED overlap; + ZERO_OBJECT(overlap); + //overlap.hEvent = mHRecvEvent; + TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap)); + if(numBytesWrit != size) + { + DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit); + FAIL(UE_BBA_ERROR); + }*/ + recordSendComplete(); + //exit(0); + return true; +} +bool CEXIETHERNET::handleRecvdPacket() +{ + DEBUGPRINT(" Handle received Packet!\n"); + exit(0); +} diff --git a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp index 2ddcf1a0b0..f2c8d63285 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp @@ -37,3 +37,31 @@ bool CEXIETHERNET::activate() { return false; //TODO: Activate Device! } +bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) +{ + DEBUGPRINT( "Packet: 0x"); + for(int a = 0; a < size; ++a) + { + DEBUGPRINT( "%02X", etherpckt[a]); + } + DEBUGPRINT( " : Size: %d\n", size); + //fwrite(etherpckt, size, size, raw_socket); + /*DWORD numBytesWrit; + OVERLAPPED overlap; + ZERO_OBJECT(overlap); + //overlap.hEvent = mHRecvEvent; + TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap)); + if(numBytesWrit != size) + { + DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit); + FAIL(UE_BBA_ERROR); + }*/ + recordSendComplete(); + //exit(0); + return true; +} +bool CEXIETHERNET::handleRecvdPacket() +{ + DEBUGPRINT(" Handle received Packet!\n"); + exit(0); +} diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp index ee08367cc3..be058c4d37 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp @@ -133,33 +133,6 @@ void CEXIETHERNET::recordSendComplete() mPacketsSent++; } -bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) -{ - DEBUGPRINT( "Packet: 0x"); - for(int a = 0; a < size; ++a) - { - DEBUGPRINT( "%02X", etherpckt[a]); - } - DEBUGPRINT( " : Size: %d\n", size); - /*DWORD numBytesWrit; - OVERLAPPED overlap; - ZERO_OBJECT(overlap); - //overlap.hEvent = mHRecvEvent; - TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap)); - if(numBytesWrit != size) - { - DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit); - FAIL(UE_BBA_ERROR); - }*/ - recordSendComplete(); - //exit(0); - return true; -} -bool CEXIETHERNET::handleRecvdPacket() -{ - DEBUGPRINT(" Handle received Packet!\n"); - exit(0); -} bool CEXIETHERNET::checkRecvBuffer() { if(mRecvBufferLength != 0) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h index c2a9583094..d628ad1730 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h @@ -18,6 +18,7 @@ #ifndef _EXIDEVICE_ETHERNET_H #define _EXIDEVICE_ETHERNET_H +void DEBUGPRINT (const char * format, ...); class WriteBuffer { public: WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;}