From 0f9214bce5cb98fddfaa225db7063ad3241f0477 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Wed, 13 May 2009 03:49:13 +0000 Subject: [PATCH] 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 --- Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp | 23 +++++++++++++++---- .../Core/Core/Src/HW/EXI_DeviceEthernet.cpp | 15 ++++++++---- .../TestSuite/PAD/source/dolphintest_pad.cpp | 1 - 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp index 5818d9034f..f123abf2a6 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp @@ -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 diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp index 7850e68ea1..04f3418390 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp @@ -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 diff --git a/Source/TestSuite/PAD/source/dolphintest_pad.cpp b/Source/TestSuite/PAD/source/dolphintest_pad.cpp index 91e679c011..f96fab51f7 100644 --- a/Source/TestSuite/PAD/source/dolphintest_pad.cpp +++ b/Source/TestSuite/PAD/source/dolphintest_pad.cpp @@ -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 ++)