TheLastRar/CLR-DEV9

NullReferenceException: DEV9write16

kylemiller3 opened this issue · 9 comments

inetctl: (ID=1) display_name=ifc_mem + dev_mem
inetctl: (ID=1) DETACHED --Attach-> STARTING
inetctl: Waiting I/F Event
Object reference not set to an instance of an object
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DataLib.WriteByteArray (System.Byte[] buffer, System.Int32& offset, System.Byte[] value) [0x00001] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.NetLib.WriteByteArray (System.Byte[] buffer, System.Int32& offset, System.Byte[] value) [0x00001] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DHCP.DHCPopRouter.GetBytes () [0x00048] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DHCP.DHCP.GetBytes (System.UInt16 MaxLen) [0x00104] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Sessions.UDP_DHCPSession.Send (CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPayload payload) [0x008f2] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.SendUDP (CLRDEV9.DEV9.SMAP.Winsock.ConnectionKey Key, CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPacket ipPkt) [0x0004e] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.SendIP (CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPacket ipPkt) [0x000f0] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.Send (CLRDEV9.DEV9.SMAP.Data.NetPacket pkt) [0x000f4] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.AdapterManager.TxPut (CLRDEV9.DEV9.SMAP.Data.NetPacket& pkt) [0x0000e] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.TxProcess () [0x00237] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.EMAC3_Write (System.UInt32 addr) [0x000f8] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.SMAP_Write16 (System.UInt32 addr, System.UInt16 value) [0x004a8] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.DEV9_State.DEV9_Write16 (System.UInt32 addr, System.UInt16 value) [0x00044] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.CLR_DEV9.DEV9write16 (System.UInt32 addr, System.UInt16 value) [0x00002] in <a99a713f8b1a4767877ad7cd14b4b50d>:0 

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DataLib.WriteByteArray (System.Byte[] buffer, System.Int32& offset, System.Byte[] value) <0xe2f761c0 + 0x0000e> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.NetLib.WriteByteArray (System.Byte[] buffer, System.Int32& offset, System.Byte[] value) <0xe2f76190 + 0x0001f> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DHCP.DHCPopRouter.GetBytes () <0xe2f7e720 + 0x000d7> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.PacketReader.DHCP.DHCP.GetBytes (System.UInt16 MaxLen) <0xe2f7b5a0 + 0x00213> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Sessions.UDP_DHCPSession.Send (CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPayload payload) <0xe2f76f38 + 0x019a7> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.SendUDP (CLRDEV9.DEV9.SMAP.Winsock.ConnectionKey Key, CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPacket ipPkt) <0xe2f76548 + 0x000a6> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.SendIP (CLRDEV9.DEV9.SMAP.Winsock.PacketReader.IP.IPPacket ipPkt) <0xe2f75a50 + 0x002bf> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.Winsock.Winsock.Send (CLRDEV9.DEV9.SMAP.Data.NetPacket pkt) <0xe2f71f78 + 0x002b3> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.AdapterManager.TxPut (CLRDEV9.DEV9.SMAP.Data.NetPacket& pkt) <0xe2f71f40 + 0x00031> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.TxProcess () <0xe2f71390 + 0x006e3> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.EMAC3_Write (System.UInt32 addr) <0xe2f70370 + 0x001b3> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.DEV9.SMAP.SMAP_State.SMAP_Write16 (System.UInt32 addr, System.UInt16 value) <0xe2f6eb18 + 0x0053f> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
  at CLRDEV9.DEV9.DEV9_State.DEV9_Write16 (System.UInt32 addr, System.UInt16 value) <0xe2f6e8f0 + 0x000a3> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at CLRDEV9.CLR_DEV9.DEV9write16 (System.UInt32 addr, System.UInt16 value) <0xe2f6e820 + 0x0002f> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at PSE.CLR_PSE_DEV9.DEV9write16 (System.UInt32 addr, System.UInt16 value) <0xe2f6e7f0 + 0x0001b> in <a99a713f8b1a4767877ad7cd14b4b50d>:0 
  at (wrapper native-to-managed) PSE.CLR_PSE_DEV9.DEV9write16(uint,uint16,System.Exception&)
terminate called without an active exception
/proc/self/maps:
0e800000-0f800000 rwxp 00000000 00:00 0 
20000000-20001000 r-xp 00000000 00:00 0 
20001000-20002000 rwxp 00000000 00:00 0 
20002000-20008000 r-xp 00000000 00:00 0 
20008000-2000c000 rwxp 00000000 00:00 0 
2000c000-20012000 r-xp 00000000 00:00 0 
20012000-20013000 rwxp 00000000 00:00 0 
20013000-20015000 r-xp 00000000 00:00 0 
20015000-20083000 rwxp 00000000 00:00 0 
20083000-20084000 r-xp 00000000 00:00 0 
20084000-20085000 rwxp 00000000 00:00 0 
20085000-20086000 r-xp 00000000 00:00 0 
20086000-20100000 rwxp 00000000 00:00 0 
20100000-20102000 r-xp 00000000 00:00 0 
20102000-20103000 rwxp 00000000 00:00 0 
20103000-2010b000 r-xp 00000000 00:00 0 

=================================================================
	Basic Fault Adddress Reporting
=================================================================
2010b000-2010f000 rwxp 00000000 00:00 0 
2010f000-20110000 r-xp 00000000 00:00 0 
20110000-20115000 rwxp 00000000 00:00 0 
20115000-2011b000 r-xp 00000000 00:00 0 
2011b000-20129000 rwxp 00000000 00:00 0 
20129000-2012b000 r-xp 00000000 00:00 0 
2012b000-2012c000 rwxp 00000000 00:00 0 
2012c000-2012e000 r-xp 00000000 00:00 0 
2012e000-2012f000 rwxp 00000000 00:00 0 
Memory around native instruction pointer (0xf7f1e059):0xf7f1e049  90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80  .......QRU...4..
0xf7f1e059  5d 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90  ]ZY.............
0xf7f1e069  90 90 90 90 90 90 90 58 b8 77 00 00 00 cd 80 90  .......X.w......
0xf7f1e079  8d b4 26 00 00 00 00 b8 ad 00 00 00 cd 80 90 78  ..&............x

=================================================================
	Native stacktrace:
=================================================================
	0xe53ae93f - /usr/lib/games/PCSX2/mono_i386/usr/lib/libmonosgen-2.0.so.1 : (null)
	0xe53aed54 - /usr/lib/games/PCSX2/mono_i386/usr/lib/libmonosgen-2.0.so.1 : (null)
	0xe535147c - /usr/lib/games/PCSX2/mono_i386/usr/lib/libmonosgen-2.0.so.1 : (null)
	0xe53adeb4 - /usr/lib/games/PCSX2/mono_i386/usr/lib/libmonosgen-2.0.so.1 : (null)
	0xf7f1e080 - linux-gate.so.1 : __kernel_rt_sigreturn
	0xf7f1e059 - linux-gate.so.1 : __kernel_vsyscall
	0xf6a5c832 - /lib/i386-linux-gnu/libc.so.6 : gsignal
	0xf6a5dcc1 - /lib/i386-linux-gnu/libc.so.6 : abort
	0xf6dba91d - /usr/lib/i386-linux-gnu/libstdc++.so.6 : (null)
	0xf6dc20d4 - /usr/lib/i386-linux-gnu/libstdc++.so.6 : (null)
	0xf6dc213d - /usr/lib/i386-linux-gnu/libstdc++.so.6 : (null)
	0xf6dc24b0 - /usr/lib/i386-linux-gnu/libstdc++.so.6 : __cxa_rethrow
	0xe577d431 - /usr/lib/games/PCSX2/libclrdev9mono.so : DEV9write16
	0x566cf96a - PCSX2 : (null)
	0x345d97de - Unknown

=================================================================
	Telemetry Dumper:
=================================================================
Pkilling 0xb56ffb40 from 0xe1b30b40
Pkilling 0xf5ce0440 from 0xe1b30b40
Pkilling 0xe51cbb40 from 0xe1b30b40
Entering thread summarizer pause from 0xe1b30b40
Finished thread summarizer pause from 0xe1b30b40.

Waiting for dumping threads to resume

Debug info from gdb:


=================================

ldd of all libs:

k@k-desktop:/usr/lib/games/PCSX2/mono_i386/usr/lib$ ldd ./* | grep 'not found'
ldd: ./mono: not regular file
ldd: ./pkgconfig: not regular file
k@k-desktop:/usr/lib/games/PCSX2$ ldd ./libclrdev9mono.so | grep 'not found'

It seems like Auto mode is failing to pick a valid adapter (or is unable to acquire the information it needs)

Can you go into Config->Dev9->Plugin Settings->Ootions (Next to Ethernet)
And manually select an adapter to see if you can bypass the error?

Thanks that solved the issue. Might want to catch that exception though for a nicer message.

Auto is normally pretty reliable on windows, but I guess the selection code appears to have issues on Linux.

A better error message is a good idea, given the resulting exception isn't clear as to the issue.

If it helps the adapter it should have found was a WiFi adapter. Maybe that was causing the auto find issue?

It should scan WiFi adapters already.

The code have been searching for an adapter that had an IP address and a DNS address. It will pick the 1st adapter that meets those 2 requirements. It then assumes the adapter it connected to the internet and proceeds onwards.

The code erred out when trying to get the Gateway IP, so it seems my assumption of DNS IP==Internet access must have been wrong.

This is unrelated but any idea how to set up LAN with a Linux computer and Windows computer hooked up via ethernet cable? I've also tried both via WiFi on same LAN and they are just simply not seeing each other. They both connected to the internet successfully.

I'm assuming computer is hosting and the other is trying to join
This is a little awkward in this plug-in because of how it works by default

There are 2 methods you can get this to work;

Method 1 (Host using sockets)
When a game is searching for a host, you will see the message something like this in the PCSX2 console
CLR_DEV9:Winsock Information: 8 : Creating New UDP Connection with Dest Port XXXX

Note the Dest Port number, go to the host and in
Dev9->Plugin Settings->Options (Next to Ethernet)->Options (located bottom right)

Add a new entry and specify the port using the Dest Port you got before.
Note, this only works for UDP connections at this point.

The host should also have PC IP enabled (this is the default), those joining might also need this enabled.

Method 2 (Host using Pcap)
With Pcap installed, on the computer that is hosting
Dev9->Plugin Settings->Options (Next to Ethernet)
Change the connection method to Pcap (Switched if there is an option) and select your adapter
Verify that you can still connect to the internet, if not then you may need to manually specify your network settings

If your are using Method 1, then you may need to allow PCSX2 to accept incoming connections though your firewall.

Tried both of them still not seeing anything. I'll open an issue.