diff --git a/plugins/dev9ghzdrk/DEV9.cpp b/plugins/dev9ghzdrk/DEV9.cpp index ff5bd62849..a7bc12da1d 100644 --- a/plugins/dev9ghzdrk/DEV9.cpp +++ b/plugins/dev9ghzdrk/DEV9.cpp @@ -56,7 +56,7 @@ u32 *iopPC; const unsigned char version = PS2E_DEV9_VERSION; const unsigned char revision = 0; -const unsigned char build = 3; // increase that with each version +const unsigned char build = 4; // increase that with each version static char *libraryName = "GiGaHeRz's DEV9 Driver" diff --git a/plugins/dev9ghzdrk/Win32/pcap_io.h b/plugins/dev9ghzdrk/Win32/pcap_io.h index ea938b233f..bc8e4d8250 100644 --- a/plugins/dev9ghzdrk/Win32/pcap_io.h +++ b/plugins/dev9ghzdrk/Win32/pcap_io.h @@ -143,7 +143,7 @@ typedef struct _full_arp_packet extern mac_address virtual_mac; extern mac_address broadcast_mac; - +extern mac_address gateway_mac; extern ip_address virtual_ip; #define mac_compare(a,b) (memcmp(&(a),&(b),6)) diff --git a/plugins/dev9ghzdrk/Win32/socket_io.cpp b/plugins/dev9ghzdrk/Win32/socket_io.cpp index 59b6677364..f135f8be31 100644 --- a/plugins/dev9ghzdrk/Win32/socket_io.cpp +++ b/plugins/dev9ghzdrk/Win32/socket_io.cpp @@ -29,10 +29,10 @@ extern "C" { #include //extern "C" int emu_printf(const char *fmt, ...); - -mac_address gateway_mac = { 0x76, 0x6D, 0x61, 0x63, 0x30, 0x32 }; -mac_address virtual_mac = { 0x76, 0x6D, 0x61, 0x63, 0x30, 0x31 }; -mac_address broadcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +/* +mac_address gateway_mac = { 0x76, 0x6D, 0x61, 0x63, 0x31, 0x32 }; +mac_address virtual_mac = { 0x76, 0x6D, 0x61, 0x63, 0x31, 0x31 }; +mac_address broadcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };*/ //mac_address host_mac = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/plugins/dev9ghzdrk/pcap_io.cpp b/plugins/dev9ghzdrk/pcap_io.cpp index 3854952087..8f2ee32c42 100644 --- a/plugins/dev9ghzdrk/pcap_io.cpp +++ b/plugins/dev9ghzdrk/pcap_io.cpp @@ -32,12 +32,13 @@ pcap_m_e pcap_mode=switched; mac_address virtual_mac = { 0x76, 0x6D, 0x61, 0x63, 0x30, 0x31 }; //mac_address virtual_mac = { 0x6D, 0x76, 0x63, 0x61, 0x31, 0x30 }; mac_address broadcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +mac_address gateway_mac = { 0x76, 0x6D, 0x61, 0x63, 0x31, 0x32 }; ip_address virtual_ip = { 192, 168, 1, 4}; pcap_t *adhandle; int pcap_io_running=0; - +extern u8 eeprom[]; char errbuf[PCAP_ERRBUF_SIZE]; char namebuff[256]; @@ -82,14 +83,25 @@ int pcap_io_init(char *adapter) int dlt; char *dlt_name; emu_printf("Opening adapter '%s'...",adapter); - + u16 checksum; GetMACAddress(adapter,&host_mac); - //Lets take the hosts first 3 bytes to bytes to make it unique - virtual_mac.bytes[0] = host_mac.bytes[0]; - virtual_mac.bytes[1] = host_mac.bytes[1]; - virtual_mac.bytes[2] = host_mac.bytes[2]; - + //Near copy of the host mac, butchered slightly, should be pretty good! + eeprom[0] = host_mac.bytes[0]; + eeprom[1] = host_mac.bytes[1]; + eeprom[2] = host_mac.bytes[2]; + eeprom[3] = host_mac.bytes[2]; + eeprom[4] = host_mac.bytes[5]; + eeprom[5] = host_mac.bytes[4]; + + //The checksum seems to be all the values of the mac added up in 16bit chunks + checksum = dev9.eeprom[0] + dev9.eeprom[1] + dev9.eeprom[2] & 0xffff; + + dev9.eeprom[3] = checksum; + + //emu_printf("eeprom Mac set to %x %x %x %x %x %x", eeprom[0], eeprom[1], eeprom[2], eeprom[3], eeprom[4], eeprom[5]); + //emu_printf("Checksum %x %x", eeprom[6], eeprom[7]); + /* Open the adapter */ if ((adhandle= pcap_open_live(adapter, // name of the device 65536, // portion of the packet to capture.