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>
#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;

View File

@ -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;
}