Quick commit while I move over to windows

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3294 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2009-05-29 03:58:06 +00:00
parent 8feeb22d09
commit b059284b55
2 changed files with 21 additions and 10 deletions

View File

@ -30,6 +30,7 @@
#include <assert.h> #include <assert.h>
#endif #endif
int fd = -1; int fd = -1;
bool hasDHCP = false;
bool CEXIETHERNET::deactivate() bool CEXIETHERNET::deactivate()
{ {
close(fd); close(fd);
@ -67,6 +68,9 @@ bool CEXIETHERNET::activate() {
ioctl( fd, TUNSETNOCSUM, 1 ); ioctl( fd, TUNSETNOCSUM, 1 );
#endif #endif
DEBUGPRINT("Returned Socket name is: %s\n", ifr.ifr_name); DEBUGPRINT("Returned Socket name is: %s\n", ifr.ifr_name);
system("brctl addif pan0 Dolphin");
system("ifconfig Dolphin up");
sleep(5);
resume(); resume();
return true; return true;
@ -132,23 +136,26 @@ bool CEXIETHERNET::startRecv() {
DEBUGPRINT("already waiting\n"); DEBUGPRINT("already waiting\n");
return true; return true;
} }
u32 BytesRead = 0;
u8 B[1514]; u8 B[1514];
if((BytesRead = read(fd, B, 1500)) > 0) if((mRecvBufferLength = read(fd, B, 1500)) > 0)
{ {
//mRecvBuffer.write(B, BytesRead); //mRecvBuffer.write(B, BytesRead);
//strncat(mRecvBuffer.p(), 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); DEBUGPRINT("Read %d bytes\n", mRecvBufferLength);
mRecvBufferLength = BytesRead; if(hasDHCP && mRecvBufferLength == 342)
{
DEBUGPRINT("DHCP offer packet\n");
//exit(0);
}
handleRecvdPacket(); handleRecvdPacket();
return true; return true;
} }
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
{ {
if(!isActivated()) if(!isActivated())
activate(); return false;
DEBUGPRINT( "Packet: 0x"); DEBUGPRINT( "Packet: 0x");
for(int a = 0; a < size; ++a) for(int a = 0; a < size; ++a)
{ {
@ -163,6 +170,8 @@ bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
} }
else else
DEBUGPRINT("Sent out the correct number of bytes: %d\n", size); DEBUGPRINT("Sent out the correct number of bytes: %d\n", size);
if(size == 342)
hasDHCP = true;
recordSendComplete(); recordSendComplete();
//exit(0); //exit(0);
return true; return true;

View File

@ -200,6 +200,7 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
} }
case BBA_NCRA: case BBA_NCRA:
{ {
DEBUGPRINT("\t\t[INFO]BBA_NCRA-----------------------------------------------------------\n");
// Correct, we use the swap here // Correct, we use the swap here
u32 SwappedData = (u8)Common::swap32(_uData); u32 SwappedData = (u8)Common::swap32(_uData);
//u32 SwappedData = _uData; //u32 SwappedData = _uData;
@ -427,10 +428,10 @@ u32 CEXIETHERNET::ImmRead(u32 _uSize)
uResult = Common::swap32(uResult); //Whinecube : we have a byteswap problem... uResult = Common::swap32(uResult); //Whinecube : we have a byteswap problem...
//DEBUGPRINT("Mem spot is 0x%02x uResult is 0x%x\n", mBbaMem[mReadP], uResult); //DEBUGPRINT("Mem spot is 0x%02x uResult is 0x%x\n", mBbaMem[mReadP], uResult);
#ifndef _WIN32 /*#ifndef _WIN32
//if(CheckRecieved()) if(CheckRecieved())
//startRecv(); startRecv();
#endif #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)); 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; mReadP = mReadP + _uSize;
return uResult; return uResult;
@ -474,6 +475,7 @@ void CEXIETHERNET::DMARead(u32 _uAddr, u32 _uSize)
memcpy(Memory::GetPointer(_uAddr), mBbaMem + mReadP, _uSize); memcpy(Memory::GetPointer(_uAddr), mBbaMem + mReadP, _uSize);
DEBUGPRINT("DMA Read from BBA address 0x%0*X, %i bytes\n", DEBUGPRINT("DMA Read from BBA address 0x%0*X, %i bytes\n",
mReadP >= CB_OFFSET ? 4 : 2, mReadP, _uSize); mReadP >= CB_OFFSET ? 4 : 2, mReadP, _uSize);
//exit(0);
mReadP = mReadP + (u16)_uSize; mReadP = mReadP + (u16)_uSize;
return; return;
} }