mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 00:39:23 +01:00
Work being done. Had to change MAC address to my current one, Was being lazy to get MAC address from the device. One hack I was working with to get commercial games to work is removed, only one hack left. Socket Test responds to the DHCP packets every few tries, kind of a fail still. Haven't tested in Windows yet. If only commercial games worked, and socket test didn't fail still
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3465 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8b9b796ff5
commit
5b9f26c660
@ -27,8 +27,6 @@
|
|||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
bool hasDHCP = false;
|
|
||||||
#define IGNOREARP true
|
|
||||||
bool CEXIETHERNET::deactivate()
|
bool CEXIETHERNET::deactivate()
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -52,7 +50,7 @@ bool CEXIETHERNET::activate() {
|
|||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
int err;
|
int err;
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE;
|
||||||
|
|
||||||
strncpy(ifr.ifr_name, "Dolphin", IFNAMSIZ);
|
strncpy(ifr.ifr_name, "Dolphin", IFNAMSIZ);
|
||||||
|
|
||||||
@ -64,6 +62,17 @@ bool CEXIETHERNET::activate() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ioctl( fd, TUNSETNOCSUM, 1 );
|
ioctl( fd, TUNSETNOCSUM, 1 );
|
||||||
|
/*int flags;
|
||||||
|
if ((flags = fcntl( fd, F_GETFL)) < 0)
|
||||||
|
{
|
||||||
|
DEBUGPRINT("getflags on tun device: %s", strerror (errno));
|
||||||
|
}
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
if (fcntl( fd, F_SETFL, flags ) < 0)
|
||||||
|
{
|
||||||
|
DEBUGPRINT("set tun device flags: %s", strerror (errno));
|
||||||
|
}*/
|
||||||
|
|
||||||
#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("brctl addif pan0 Dolphin");
|
||||||
@ -80,7 +89,7 @@ bool CEXIETHERNET::CheckRecieved()
|
|||||||
int maxfd;
|
int maxfd;
|
||||||
int retval;
|
int retval;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int timeout = 3; // 3 seconds will kill him
|
int timeout = 9999; // 3 seconds will kill him
|
||||||
fd_set mask;
|
fd_set mask;
|
||||||
|
|
||||||
/* Find the largest file descriptor */
|
/* Find the largest file descriptor */
|
||||||
@ -129,28 +138,34 @@ THREAD_RETURN CpuThread(void *pArg)
|
|||||||
if(self->CheckRecieved())
|
if(self->CheckRecieved())
|
||||||
{
|
{
|
||||||
u8 B[1514];
|
u8 B[1514];
|
||||||
if((self->mRecvBufferLength = read(fd, B, 1500)) > 0)
|
self->mRecvBufferLength = read(fd, B, 1500);
|
||||||
|
//DEBUGPRINT("read return of 0x%x\n", self->mRecvBufferLength);
|
||||||
|
if (self->mRecvBufferLength == 0xffffffff)
|
||||||
|
{
|
||||||
|
//Fail Boat
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(self->mRecvBufferLength > 0)
|
||||||
{
|
{
|
||||||
//mRecvBuffer.write(B, BytesRead);
|
//mRecvBuffer.write(B, BytesRead);
|
||||||
//strncat(mRecvBuffer.p(), B, BytesRead);
|
//strncat(mRecvBuffer.p(), B, BytesRead);
|
||||||
memcpy(self->mRecvBuffer, B, self->mRecvBufferLength);
|
memcpy(self->mRecvBuffer, B, self->mRecvBufferLength);
|
||||||
}
|
}
|
||||||
if(IGNOREARP)
|
else if(self->mRecvBufferLength == -1)
|
||||||
{
|
{
|
||||||
if(self->mRecvBuffer[12] == 0x08 && self->mRecvBuffer[13] == 0x06)
|
continue;
|
||||||
{
|
}
|
||||||
DEBUGPRINT("ARP Packet!Skipping!\n");
|
else
|
||||||
memset(self->mRecvBuffer, 0, self->mRecvBufferLength);
|
{
|
||||||
self->mRecvBufferLength = 0;
|
DEBUGPRINT("Unknown read return of 0x%x\n", self->mRecvBufferLength);
|
||||||
continue;
|
exit(0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DEBUGPRINT("Received %d bytes of data\n", self->mRecvBufferLength);
|
DEBUGPRINT("Received %d bytes of data\n", self->mRecvBufferLength);
|
||||||
self->handleRecvdPacket();
|
|
||||||
self->mWaiting = false;
|
self->mWaiting = false;
|
||||||
|
self->handleRecvdPacket();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sleep(1);
|
//sleep(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -184,12 +199,7 @@ bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
|
|||||||
DEBUGPRINT("BBA sendPacket %i only got %i bytes sent!errno: %d\n", size, numBytesWrit, errno);
|
DEBUGPRINT("BBA sendPacket %i only got %i bytes sent!errno: %d\n", size, numBytesWrit, errno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
DEBUGPRINT("Sent out the correct number of bytes: %d\n", size);
|
|
||||||
if(size == 342)
|
|
||||||
hasDHCP = true;
|
|
||||||
recordSendComplete();
|
recordSendComplete();
|
||||||
//exit(0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool CEXIETHERNET::handleRecvdPacket()
|
bool CEXIETHERNET::handleRecvdPacket()
|
||||||
|
@ -51,7 +51,7 @@ void DEBUGPRINT (const char * format, ...)
|
|||||||
#define RISE(flags) ((SwappedData & (flags)) && !(mBbaMem[0x00] & (flags)))
|
#define RISE(flags) ((SwappedData & (flags)) && !(mBbaMem[0x00] & (flags)))
|
||||||
|
|
||||||
int mPacketsSent = 0;
|
int mPacketsSent = 0;
|
||||||
u8 mac_address[6] = {'D', 'O', 'L', 'P', 'H', 'I'}; // Looks Appropriate
|
u8 mac_address[6] = {0x00, 0x1A, 0x4D, 0x5E, 0x64, 0x2B}; // Looks Appropriate
|
||||||
unsigned int Expecting;
|
unsigned int Expecting;
|
||||||
CEXIETHERNET::~CEXIETHERNET()
|
CEXIETHERNET::~CEXIETHERNET()
|
||||||
{
|
{
|
||||||
@ -159,7 +159,6 @@ void CEXIETHERNET::recordSendComplete()
|
|||||||
m_bInterruptSet = true;
|
m_bInterruptSet = true;
|
||||||
//interrupt.raiseEXI("BBA Send");
|
//interrupt.raiseEXI("BBA Send");
|
||||||
}
|
}
|
||||||
startRecv();
|
|
||||||
mPacketsSent++;
|
mPacketsSent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +221,7 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
|||||||
// Whinecube did nothing else as well
|
// Whinecube did nothing else as well
|
||||||
DEBUGPRINT( "\t\t[INFO]BBA Reset\n");
|
DEBUGPRINT( "\t\t[INFO]BBA Reset\n");
|
||||||
}
|
}
|
||||||
if (RISE(BBA_NCRA_SR) && isActivated())
|
if ((SwappedData & BBA_NCRA_SR) && isActivated())
|
||||||
{
|
{
|
||||||
DEBUGPRINT( "\t\t[INFO]BBA Start Recieve\n");
|
DEBUGPRINT( "\t\t[INFO]BBA Start Recieve\n");
|
||||||
//exit(0);
|
//exit(0);
|
||||||
@ -252,6 +251,14 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
|||||||
activate();
|
activate();
|
||||||
mBbaMem[BBA_NWAYS] = (BBA_NWAYS_LS10 | BBA_NWAYS_LPNWAY | BBA_NWAYS_ANCLPT | BBA_NWAYS_10TXF);
|
mBbaMem[BBA_NWAYS] = (BBA_NWAYS_LS10 | BBA_NWAYS_LPNWAY | BBA_NWAYS_ANCLPT | BBA_NWAYS_10TXF);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(_uData != 0x0)
|
||||||
|
{
|
||||||
|
DEBUGPRINT("Not activate!\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BBA_RRP: //RRP - Receive Buffer Read Page Pointer
|
case BBA_RRP: //RRP - Receive Buffer Read Page Pointer
|
||||||
@ -282,7 +289,10 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
|||||||
// Size of 4 untested Though
|
// Size of 4 untested Though
|
||||||
SwappedData = Common::swap32(_uData);
|
SwappedData = Common::swap32(_uData);
|
||||||
if(_uSize == 4)
|
if(_uSize == 4)
|
||||||
|
{
|
||||||
printf("\t\t\tData is 0x%08x\n", SwappedData);
|
printf("\t\t\tData is 0x%08x\n", SwappedData);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( _uSize == 2)
|
else if( _uSize == 2)
|
||||||
{
|
{
|
||||||
@ -303,7 +313,6 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
|||||||
DEBUGPRINT( "\t[INFO]Request Dev ID\n");
|
DEBUGPRINT( "\t[INFO]Request Dev ID\n");
|
||||||
mSpecialImmData = EXI_DEVTYPE_ETHER;
|
mSpecialImmData = EXI_DEVTYPE_ETHER;
|
||||||
mExpectSpecialImmRead = true;
|
mExpectSpecialImmRead = true;
|
||||||
mBbaMem[0x01] = 0x0; // Refuse to use BBA if not 0 on reset?
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((_uSize == 4 && (_uData & 0xC0000000) == 0xC0000000) || (_uSize == 2 && ((u16)Common::swap32(_uData >> 8) & 0x4000) == 0x4000))
|
else if ((_uSize == 4 && (_uData & 0xC0000000) == 0xC0000000) || (_uSize == 2 && ((u16)Common::swap32(_uData >> 8) & 0x4000) == 0x4000))
|
||||||
@ -406,6 +415,7 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
|||||||
case 0x5c: // These two go together
|
case 0x5c: // These two go together
|
||||||
break;
|
break;
|
||||||
case 0x31: // NWAYS - NWAY Status Register
|
case 0x31: // NWAYS - NWAY Status Register
|
||||||
|
// HACK
|
||||||
activate();
|
activate();
|
||||||
mBbaMem[BBA_NWAYS] = (BBA_NWAYS_LS10 | BBA_NWAYS_LPNWAY | BBA_NWAYS_ANCLPT | BBA_NWAYS_10TXF);
|
mBbaMem[BBA_NWAYS] = (BBA_NWAYS_LS10 | BBA_NWAYS_LPNWAY | BBA_NWAYS_ANCLPT | BBA_NWAYS_10TXF);
|
||||||
case 0x09: // IR
|
case 0x09: // IR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user