Dolphin connects to the virtual NIC device now, but for some reason it can't send out it's packet. 350 bytes, yet 0 get out >>

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3214 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2009-05-13 03:49:13 +00:00
parent dcad8a779d
commit 0f9214bce5
3 changed files with 29 additions and 10 deletions

View File

@ -23,13 +23,19 @@
bool CEXIETHERNET::deactivate()
{
DEBUGPRINT("Deactivating BBA...\n");
if(!isActivated())
return true;
CloseHandle(mHRecvEvent);
mHRecvEvent = INVALID_HANDLE_VALUE;
CloseHandle(mHAdapter);
mHAdapter = INVALID_HANDLE_VALUE;
DEBUGPRINT("Success!\n");
return true;
// TODO: Actually deactivate
}
bool CEXIETHERNET::isActivated()
{
return false;
//TODO: Never Activated Yet!
return mHAdapter != INVALID_HANDLE_VALUE;
}
bool CEXIETHERNET::activate() {
@ -54,12 +60,14 @@ if(isActivated())
#endif //0
mHAdapter = CreateFile (/*device_path*/
USERMODEDEVICEDIR "{1B1F9D70-50B7-4F45-AA4A-ABD17451E736}" TAPSUFFIX,
//{E0277714-28A6-4EB6-8AA2-7DF4870C04F6}
USERMODEDEVICEDIR "{E0277714-28A6-4EB6-8AA2-7DF4870C04F6}" TAPSUFFIX,
GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
DEBUGPRINT("TAP-WIN32 device opened: %s\n",
USERMODEDEVICEDIR "{1B1F9D70-50B7-4F45-AA4A-ABD17451E736}" TAPSUFFIX);
USERMODEDEVICEDIR "{E0277714-28A6-4EB6-8AA2-7DF4870C04F6}" TAPSUFFIX);
if(mHAdapter == INVALID_HANDLE_VALUE) {
DEBUGPRINT("mHAdapter is invalid\n");
return false;
}
@ -88,6 +96,7 @@ if(isActivated())
if(!DeviceIoControl(mHAdapter, TAP_IOCTL_GET_MTU,
&mMtu, sizeof (mMtu), &mMtu, sizeof (mMtu), &len, NULL))
{
DEBUGPRINT("Couldn't get device MTU");
return false;
}
DEBUGPRINT("TAP-Win32 MTU=%d (ignored)\n", mMtu);
@ -102,6 +111,10 @@ if(isActivated())
DEBUGPRINT("WARNING: The TAP-Win32 driver rejected a TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.\n");
return false;
}
else
{
DEBUGPRINT("TAP-WIN32 status as Connected\n");
}
}
//set up recv event

View File

@ -23,7 +23,7 @@
#include "EXI_Device.h"
#include "EXI_DeviceEthernet.h"
#define SONICDEBUG
//#define SONICDEBUG
void DEBUGPRINT (const char * format, ...)
{
@ -79,9 +79,15 @@ CEXIETHERNET::CEXIETHERNET() :
ID = 0x04020200;
mWriteP = INVALID_P;
mReadP = INVALID_P;
mWaiting = false;
mReadyToSend = false;
Activated = false;
m_bInterruptSet = false;
#ifdef _WIN32
mHAdapter = INVALID_HANDLE_VALUE;
mHRecvEvent = INVALID_HANDLE_VALUE;
mHReadWait = INVALID_HANDLE_VALUE;
#endif
mRecvBufferLength = 0;
@ -199,9 +205,9 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
if (RISE(BBA_NCRA_SR) && isActivated())
{
DEBUGPRINT( "\t[INFO]BBA Start Recieve\n");
exit(0);
//exit(0);
// TODO: Need to make our virtual network device start receiving
//HWGLE(startRecv());
startRecv();
}
if (RISE(BBA_NCRA_ST1))
{
@ -222,8 +228,9 @@ void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
break;
case BBA_NWAYC:
DEBUGPRINT( "\t[INFO]BBA_NWAYCn");
if(_uData & (BBA_NWAYC_ANE | BBA_NWAYC_ANS_RA))
if(Common::swap32(_uData) & (BBA_NWAYC_ANE | BBA_NWAYC_ANS_RA))
{
DEBUGPRINT("ACTIVATING!\n");
activate();
//say we've successfully negotiated for 10 Mbit full duplex
//should placate libogc

View File

@ -28,7 +28,6 @@ int main()
while(1)
{
VIDEO_ClearFrameBuffer(rmode, xfb, 0);
std::cout<<"\x1b[0;0H"; // Position the cursor (at 0, 0)
PAD_Read(pad);
for(int a = 0; a < 4;a ++)