mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Quick commit while I look at the Windows side
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3209 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f16d0d1998
commit
ecfe86efe3
@ -18,6 +18,8 @@
|
||||
#include "../Memmap.h"
|
||||
#include "../EXI_Device.h"
|
||||
#include "../EXI_DeviceEthernet.h"
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
bool CEXIETHERNET::deactivate()
|
||||
{
|
||||
return true;
|
||||
@ -36,3 +38,43 @@ bool CEXIETHERNET::activate() {
|
||||
return false;
|
||||
//TODO: Activate Device!
|
||||
}
|
||||
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
|
||||
{
|
||||
DEBUGPRINT( "Packet: 0x");
|
||||
for(int a = 0; a < size; ++a)
|
||||
{
|
||||
DEBUGPRINT( "%02X", etherpckt[a]);
|
||||
}
|
||||
DEBUGPRINT( " : Size: %d\n", size);
|
||||
int raw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);
|
||||
DEBUGPRINT("Raw socket is : %d\n", raw_socket);
|
||||
int sm=1;
|
||||
const int *val=&sm;
|
||||
int result = setsockopt(raw_socket, IPPROTO_IP, IP_HDRINCL, val, sizeof(sm));
|
||||
DEBUGPRINT("Result is : %d\n", result);
|
||||
int numBytesWrit = write(raw_socket, etherpckt, size);
|
||||
if(numBytesWrit != size)
|
||||
{
|
||||
DEBUGPRINT("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
|
||||
return false;
|
||||
}
|
||||
//fwrite(etherpckt, size, size, raw_socket);
|
||||
/*DWORD numBytesWrit;
|
||||
OVERLAPPED overlap;
|
||||
ZERO_OBJECT(overlap);
|
||||
//overlap.hEvent = mHRecvEvent;
|
||||
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
|
||||
if(numBytesWrit != size)
|
||||
{
|
||||
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
|
||||
FAIL(UE_BBA_ERROR);
|
||||
}*/
|
||||
recordSendComplete();
|
||||
//exit(0);
|
||||
return true;
|
||||
}
|
||||
bool CEXIETHERNET::handleRecvdPacket()
|
||||
{
|
||||
DEBUGPRINT(" Handle received Packet!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
@ -37,3 +37,31 @@ bool CEXIETHERNET::activate() {
|
||||
return false;
|
||||
//TODO: Activate Device!
|
||||
}
|
||||
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
|
||||
{
|
||||
DEBUGPRINT( "Packet: 0x");
|
||||
for(int a = 0; a < size; ++a)
|
||||
{
|
||||
DEBUGPRINT( "%02X", etherpckt[a]);
|
||||
}
|
||||
DEBUGPRINT( " : Size: %d\n", size);
|
||||
//fwrite(etherpckt, size, size, raw_socket);
|
||||
/*DWORD numBytesWrit;
|
||||
OVERLAPPED overlap;
|
||||
ZERO_OBJECT(overlap);
|
||||
//overlap.hEvent = mHRecvEvent;
|
||||
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
|
||||
if(numBytesWrit != size)
|
||||
{
|
||||
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
|
||||
FAIL(UE_BBA_ERROR);
|
||||
}*/
|
||||
recordSendComplete();
|
||||
//exit(0);
|
||||
return true;
|
||||
}
|
||||
bool CEXIETHERNET::handleRecvdPacket()
|
||||
{
|
||||
DEBUGPRINT(" Handle received Packet!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
@ -133,33 +133,6 @@ void CEXIETHERNET::recordSendComplete()
|
||||
mPacketsSent++;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
|
||||
{
|
||||
DEBUGPRINT( "Packet: 0x");
|
||||
for(int a = 0; a < size; ++a)
|
||||
{
|
||||
DEBUGPRINT( "%02X", etherpckt[a]);
|
||||
}
|
||||
DEBUGPRINT( " : Size: %d\n", size);
|
||||
/*DWORD numBytesWrit;
|
||||
OVERLAPPED overlap;
|
||||
ZERO_OBJECT(overlap);
|
||||
//overlap.hEvent = mHRecvEvent;
|
||||
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
|
||||
if(numBytesWrit != size)
|
||||
{
|
||||
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
|
||||
FAIL(UE_BBA_ERROR);
|
||||
}*/
|
||||
recordSendComplete();
|
||||
//exit(0);
|
||||
return true;
|
||||
}
|
||||
bool CEXIETHERNET::handleRecvdPacket()
|
||||
{
|
||||
DEBUGPRINT(" Handle received Packet!\n");
|
||||
exit(0);
|
||||
}
|
||||
bool CEXIETHERNET::checkRecvBuffer()
|
||||
{
|
||||
if(mRecvBufferLength != 0)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef _EXIDEVICE_ETHERNET_H
|
||||
#define _EXIDEVICE_ETHERNET_H
|
||||
|
||||
void DEBUGPRINT (const char * format, ...);
|
||||
class WriteBuffer {
|
||||
public:
|
||||
WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;}
|
||||
|
Loading…
Reference in New Issue
Block a user