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 aebb694d86..6e1a403daa 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp @@ -30,6 +30,7 @@ #include #endif int fd = -1; + bool hasDHCP = false; bool CEXIETHERNET::deactivate() { close(fd); @@ -67,6 +68,9 @@ bool CEXIETHERNET::activate() { ioctl( fd, TUNSETNOCSUM, 1 ); #endif DEBUGPRINT("Returned Socket name is: %s\n", ifr.ifr_name); + system("brctl addif pan0 Dolphin"); + system("ifconfig Dolphin up"); + sleep(5); resume(); return true; @@ -132,23 +136,26 @@ bool CEXIETHERNET::startRecv() { DEBUGPRINT("already waiting\n"); return true; } - u32 BytesRead = 0; u8 B[1514]; - if((BytesRead = read(fd, B, 1500)) > 0) + if((mRecvBufferLength = read(fd, B, 1500)) > 0) { //mRecvBuffer.write(B, BytesRead); //strncat(mRecvBuffer.p(), B, BytesRead); - memcpy((char*)mRecvBuffer.p(), (const char*)B, BytesRead); + memcpy(mRecvBuffer, B, mRecvBufferLength); } - DEBUGPRINT("Read %d bytes\n", BytesRead); - mRecvBufferLength = BytesRead; + DEBUGPRINT("Read %d bytes\n", mRecvBufferLength); + if(hasDHCP && mRecvBufferLength == 342) + { + DEBUGPRINT("DHCP offer packet\n"); + //exit(0); + } handleRecvdPacket(); return true; } bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) { if(!isActivated()) - activate(); + return false; DEBUGPRINT( "Packet: 0x"); for(int a = 0; a < size; ++a) { @@ -163,6 +170,8 @@ bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) } else DEBUGPRINT("Sent out the correct number of bytes: %d\n", size); + if(size == 342) + hasDHCP = true; recordSendComplete(); //exit(0); return true; diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp index 3f414a218f..68f2b7dbe6 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp @@ -200,6 +200,7 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize) } case BBA_NCRA: { + DEBUGPRINT("\t\t[INFO]BBA_NCRA-----------------------------------------------------------\n"); // Correct, we use the swap here u32 SwappedData = (u8)Common::swap32(_uData); //u32 SwappedData = _uData; @@ -427,10 +428,10 @@ u32 CEXIETHERNET::ImmRead(u32 _uSize) uResult = Common::swap32(uResult); //Whinecube : we have a byteswap problem... //DEBUGPRINT("Mem spot is 0x%02x uResult is 0x%x\n", mBbaMem[mReadP], uResult); - #ifndef _WIN32 - //if(CheckRecieved()) - //startRecv(); - #endif + /*#ifndef _WIN32 + if(CheckRecieved()) + startRecv(); + #endif*/ DEBUGPRINT( "\t[INFO]Read from BBA address 0x%0*X, %i byte%s: 0x%0*X\n",mReadP >= CB_OFFSET ? 4 : 2, mReadP, _uSize, (_uSize==1?"":"s"),_uSize*2, getbitsw(uResult, 0, _uSize * 8 - 1)); mReadP = mReadP + _uSize; return uResult; @@ -474,6 +475,7 @@ void CEXIETHERNET::DMARead(u32 _uAddr, u32 _uSize) memcpy(Memory::GetPointer(_uAddr), mBbaMem + mReadP, _uSize); DEBUGPRINT("DMA Read from BBA address 0x%0*X, %i bytes\n", mReadP >= CB_OFFSET ? 4 : 2, mReadP, _uSize); + //exit(0); mReadP = mReadP + (u16)_uSize; return; }