Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev9ghzdrk: Add networking capability for Linux #2586

Merged
merged 1 commit into from
Oct 3, 2018
Merged

Dev9ghzdrk: Add networking capability for Linux #2586

merged 1 commit into from
Oct 3, 2018

Conversation

lowlyocean
Copy link
Contributor

The existing dev9ghzdrk plugin was designed to run on Windows only. I've implemented the Linux equivalent. This includes configuration dialog in GTK+, configuration storage and retrieval using LibXML2, and network adapter enumeration using LibPCAP.

I've moved some files from the Win32 sub-directory up one level and made slight capitalization changes to their #include statements so that a Linux build can also locate the headers.

I've updated the appropriate CMake files to conditionally include the plugin on Linux if necessary libraries are detected. I've also embedded post-install commands to copy necessary UI layout and device configuration files to user's .config directory, as well as to grant necessary privileges to PCSX2 executable. The exact commands are printed to install_log.txt toward completion of the build.

The networking code has been slightly modified; the MAC address of the virtual PS2 network adapter contains real Sony MAC address prefix followed by last two bytes of real adapter's MAC address. This allows detection of virtual PS2 console by the XLink Kai LAN-over-internet service while also allowing each user to appear unique on that service.

@lightningterror
Copy link
Contributor

The formatting is all over the place in some files between spaces and tabs, please keep it consistent, also there are many lines that shouldn't have been changed.

@mirh
Copy link

mirh commented Sep 10, 2018

@TheLastRar see anything you like

@TheLastRar
Copy link
Contributor

TheLastRar commented Sep 10, 2018

I don't know specifically why you decided to get rid of bridged mode. While I never had luck with it I do recall that what worked varied user to user for some reason.

A lot of the functional changes made seems to be specifically for removing all the code for bridged mode,

Edit: I misread the PR, It was bridged mode that was removed not switched, I've amended the above.

I don't know if WinPcap defines PCAP_NETMASK_UNKNOWN, someone would need to check that.
Edit: That define was added in pcap 1.1, WinPcap (and Win10Pcap?) is stuck on 1.0.

XLink Kai will accept packets from the MAC address that the plugin already has, CLR_DEV9 uses the same prefix and changes just the last two bytes (on both WinPcap and tap).

On linux testing I did in the past, I didn't need to run any specific commands to allow pcap to work, either they aren't needed for switched mode, or mono/wine runs them on install.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 11, 2018

Switched mode doesn't make much sense for this plugin; plugin only needs to provide Layer 2 processing and should let the PS2 CPU process Layer 3 natively at the OS and application layers. Performing layer 3 operations in the plugin is intrusive and may lead to unintended consequences. Looks like the code I removed was dealing with the complexity of having added switched mode in the first place.

I take care of WinPCap absence of PCAP_NETMASK_UNKNOWN by simply defining it if it isn't already defined.

I believe Mono runtime was granted access to network adapter promiscuous mode during installation, explaining why Pcap doesn't fail trying to open the devices.

I'll address whitespace consistency.
Edit: Uploaded. For your sanity, don't review in GitHub's web interface.

@arcum42
Copy link
Contributor

arcum42 commented Sep 12, 2018

Hmm... First impression is that it could use some work.

I tried to build it, throwing on the gtk 3 flag to make things interesting, noted that I needed dev versions of pcap and libxml2 installed, installed them,and built it a second time. Seems like a fair number of warnings on building, though a fair amount were similar and probably won't be too difficult to clean up.

On going in the bin directory, I remembered that the inis folder that the *.ui file was being copied to doesn't exist until you run pcsx2 (maybe the plugin directory would work better?). I ran it and looked to see if the plugin was there anyways. Didn't show up in the list, but it was in the plugins directory.

I ran the build again, and it didn't copy it the second time, either. I manually copied it from the source. Still not showing.

I'm now doing a clean gtk 2 build, since I probably should've tried the normal version of gtk first. I do notice that while it found PCAP, it didn't find pcap_get_pfring_id, so there might also be a dependency issue it didn't catch...
Edit: No luck with the clean gtk2 build either...

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 12, 2018

Regarding copying of ui and cfg files, the destination directories are created if not found. The INSTALL( CODE commands in CMakelists.txt are conditioned on the OS being reported as Linux. This is the desired behavior, but I've noticed the condition is not a reliable indicator of the OS actually being Linux. On some machines, the condition evaluates false when it should evaluate true. Can someone take a look and suggest a reliable solution?

To understand correctly- "Didn't show up in the list" means PCSX2 doesn't recognize the library even though it's in the plugins directory?

@TheLastRar
Copy link
Contributor

Ah, I had gotten confused with the relation between switch/bridged and promiscuous/non-promiscuous
Your earlier code was removing bridged mode, not switched mode as I previously stated, apologies for the confusion.
(your latest comment is true of bridged mode (non-promiscuous) and not switched (promiscuous))

I don't know the reason why there is an option for non-promiscuous mode, given that it looks like it would be rather disruptive to unrelated network processes (possibly why I never got it to work, although it seemed to work for others). I can only assume it was for compatibility with drivers that didn't work with promiscuous mode, given the plugin also supports using tap this probably is less of a concern.

The PS2 will read the mac address from eeprom, if you set that then you should be able to avoid replacing the mac address for every packet in and out.

I note that you removed the code for re-sending broadcast packets to the host machine, was this causing duplicate responses for you?

You've included a memory card file, assuming this contains a network config save, I was under the impression that network configs are tied to the BIOS of the system they where created on, is this not the case?

@lowlyocean
Copy link
Contributor Author

The IP address, netmask, gateway are configured by the Network Disc DVD that shipped with the network adapter hardware. Or could be configured within certain games like SOCOM. Layer 3 addresses. However, layer 2 MAC addresses were presumably tied to what the network adapter reported to the BIOS. No need to re-send broadcast packets because the host machine gets them anyway. Memory card contains network config but this will be overwritten by users trying to connect to XLink.

@arcum42
Copy link
Contributor

arcum42 commented Sep 13, 2018

Regarding copying of ui and cfg files, the destination directories are created if not found. The INSTALL( CODE commands in CMakelists.txt are conditioned on the OS being reported as Linux. This is the desired behavior, but I've noticed the condition is not a reliable indicator of the OS actually being Linux. On some machines, the condition evaluates false when it should evaluate true. Can someone take a look and suggest a reliable solution?

To understand correctly- "Didn't show up in the list" means PCSX2 doesn't recognize the library even though it's in the plugins directory?

Yes. It isn't in the list, and prints that the file is not a PCSX2 plugin on the console.

I will note that the CMake files are not used in windows, so any tests would mostly be if it was Linux, OS X, BSD, etc. I modified the CMakelists.txt file to print out the variable you were checking, and it was listed as Linux for me, though.

However, looking closer, it's copying to ~/.config/pcsx2/inis, and I'm actually running directly from bin, with the inis and memcard folders directly in there. I also didn't note that it had a cfg file and memcard that needed to be copied in. Copying them in directly doesn't seem to have helped with it not being a valid plugin, though...

@lowlyocean lowlyocean closed this Sep 13, 2018
@lowlyocean lowlyocean reopened this Sep 13, 2018
@TheLastRar
Copy link
Contributor

TheLastRar commented Sep 13, 2018

No need to re-send broadcast packets because the host machine gets them anyway

Packets sent via winpcap are treated as outgoing by the OS. The code for duplicating the packet is presumably to allow the broadcast packet to bounce back so the host treats it as incoming, since a router might not send the broadcast packet back to its source.

I tried to test this by connecting a PC running PCSX2 to a laptop, but neither the broadcasts packets or the duplicated to-host packets got returned, so it seems to have failed to achieve what it was attempting to do, The results may differ if you are using an actual router, but based on my results, I'm not going to argue against its removal.

Xkink Kai won't care as it uses pcap, which can capture both incoming and outgoing packets.

Memory card contains network config

I wasn't able to use the memory card file you provided (it showed up as 7MB, but did not show up in the BIOS browser menu after it was inserted),

However, layer 2 MAC addresses were presumably tied to what the network adapter reported to the BIOS

Correct, this information is retrieved from eeprom and was updated in pcap_io_init(), however, you seem to have removed that code.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 14, 2018

To understand correctly- "Didn't show up in the list" means PCSX2 doesn't recognize the library even though it's in the plugins directory?

Yes. It isn't in the list, and prints that the file is not a PCSX2 plugin on the console.

Pushed changes to address this, please confirm that you can see the plugin and configure it to point to bridge: adapter from the dialog's Ethernet drop-down.

I will note that the CMake files are not used in windows, so any tests would mostly be if it was Linux, OS X, BSD, etc. I modified the CMakelists.txt file to print out the variable you were checking, and it was listed as Linux for me, though.

I have removed the conditions in my latest upload.

However, looking closer, it's copying to ~/.config/pcsx2/inis,

I did development against v1.3.1, where ~/.config/pcsx2 seemed to be the right path to place config files. Nowadays it seems the config directory is ~/PCSX2 so I've pushed changes to reflect this. Seems to work OK now.

Memory card contains network config

I wasn't able to use the memory card file you provided (it showed up as 7MB, but did not show up in the BIOS browser menu after it was inserted),

Not entirely sure why this is the case. Then again, the memory card file is a convenience that probably doesn't serve anyone except me. Might be worth removing altogether, as long as someone can verify that they can setup network onto their own memcards

However, layer 2 MAC addresses were presumably tied to what the network adapter reported to the BIOS

Correct, this information is retrieved from eeprom and was updated in pcap_io_init(), however, you seem to have removed that code.

I would like to restore that logic. Will revisit down the road

@lowlyocean
Copy link
Contributor Author

Can someone please help move this forward?

@arcum42
Copy link
Contributor

arcum42 commented Sep 18, 2018

It's also possible for pcsx2 to be running in portable mode, in which case the ini and plugin folders and such are directly in the bin directory. In cmake, there's a variable named "PLUGINS_DIRECTORY" that points to the plugins directory. I didn't see one of the ini directory, but presumably it's in the same folder as the PLUGINS directory.

I'll also note that if you happen to do sudo sh build.sh instead of sh build.sh, the way you've got it written, no one will be able to run pcsx2 except root. You probably shouldn't be doing that, but it could happen...

It did create the two directories in question and seemed to read out of them, showed up in the list, and had all the network devices available to configure, and let me pick out my ethernet port, pcap bridge: enp3s0.

On then trying to run an iso, it gave me the following:
"Opening adapter 'enp3s0'...enp3s0: You don't have permission to capture on that device (socket: Operation not permitted)
Unable to open the adapter. enp3s0 is not supported by WinPcap"
Then crashed a moment later with:
"(PCSX2:2527): GLib-CRITICAL **: 20:40:53.221: Source ID 2137 was not found when attempting to remove it"

Though, oddly, which the first error came up every time, the second crash didn't always happen.

Just to note, I'm not sure if I actually have any games that use the network side of things. I'm just trying to make sure it compiles and doesn't crash.

--arcum42

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 18, 2018

enp3s0 is not supported by WinPcap

What is your environment? Are you cross-compiling in Windows with Cygwin? Have you tried this from a pure Linux environment? It looks like CMake linked against WinPcap instead of libpcap0.8

"(PCSX2:2527): GLib-CRITICAL **: 20:40:53.221: Source ID 2137 was not found when attempting to remove it"

This error message is a bit cryptic. Do you only get it if you open the plugin configuration dialog? I don't get it when I run locally, so I need a way to reproduce it.

@arcum42
Copy link
Contributor

arcum42 commented Sep 18, 2018

It's a completely pure Linux environment, actually. It's the most recent 32 bit copy of Mint Cinnamon (so no cross compiling whatsoever, including the usual 64 bit to 32 bit cross compiling), installed on a computer without any other operating system on it, and it does, in fact, have libpcap-0.8 and libpcap-0.8-dev installed.

The second error message happened moments after the first, and was what it printed when pcsx2 crashed.

@TheLastRar
Copy link
Contributor

TheLastRar commented Sep 18, 2018

I'll add my test findings

The plugin will crash is the configuration file is not found, when trying to enter the plugin's config menu (showing a popup that can't be closed), or when starting emulation (just crashes), Ideally we should be creating a new config file in such a situation.

The config file is loaded from ~/PCSX2/inis, while it should be loading from ~/.config/PCSX2/inis (by default, can be changed) the correct directory should be passed to the plugin via a call to DEV9setSettingsDir(). I'm unsure how the .ui file should be handled.

It fails to open the selected adapter for me, giving the same error message.
It then crashes with a similar GLib-CRITICAL message, although sometimes a popup box is shown before the crash.

On windows the plugin will show a popup informing you if it can't open the selected adapter, presumably your linux port is trying to do the same thing and runs into issues.

)) == NULL)
{
fprintf(stderr, errbuf);
fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n", adapter);

This comment was marked as spam.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 18, 2018

Thanks, I thought that message was being printed by the library itself- I'll fix the misleading WinPCap reference. I think you're right about the "failure to load adapter" error dialog producing the GLib-CRITICAL message, will look into that. I'll also use DEV9setSettingsDir()... hadn't noticed it back in 2014 when I actually did most of this so I set it to what seemed to be the default at the time. Could you guys please run "sudo getcap path_of_PCSX2_binary" to confirm that the CMake install set the right networking capabilities? If those cqpabilities are set I don't expect the message (socket: Operation not permitted)

@TheLastRar
Copy link
Contributor

Shows nothing for me when I run it on the plugin file.

When building I don't see a message that states "Enabling networking capability on Linux..." but I do see the message about copying the MC and ui files.

Also, something I forgot to mention in my last post, The config panel still lists bridged mode adapters, if you are removing bridged mode you should also remove these entries.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 18, 2018 via email

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 19, 2018

I've pushed changes:

  • Use Dev9setSettingsDir() to determine where to write load & save cfg file
  • Install ui file to same directory as PCSX2 executable, no need to provide directory
  • Install should set proper networking capabilities for pcap to open adapter even if PACKAGE_MODE=False
  • Remove misleading reference to WinPCap in error message
  • Remove "switch" entries from the dropdown menu in the config dialog
  • Add include directories for LibXML2 and LibPcap in CMakelists.txt... on some systems the headers aren't implicitly available

Could you please try now? Thanks for continued feedback

@arcum42
Copy link
Contributor

arcum42 commented Sep 19, 2018

np. I figure I might not be actually using the plugin, and I'm not sure how far I can test it, but I can at least try to get it to the point where it installs and doesn't crash or give me error messages. ^_^

This time I basically wiped the directory and redownloaded from git. It copied the .ui file into the bin directory. The .cfg file didn't seem like it copied anywhere, and since it crashes without it, I had to copy that myself. Having the plugin write that file if it isn't there instead of crashing would be nice, since it looks pretty minimal. (I'm also curious if that ui file works in gtk3, but I just compiled using gtk2 this time.)

On the good side, while I had to futz around copying things to get it not to crash, this time running an iso (Dark Cloud) didn't crash (and I opened it 2-3 times), and presumably it initialised correctly. I saw the following (ignore the ALSA messages).

Opening adapter 'enp3s0'...ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
Device uses DLT 1: EN10MB
Ok.

So we definitely have some progress, anyways.

--arcum42

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 19, 2018

I had meant to add a check for existence of the cfg file before trying to load it. I've added the check now, so that if there is an existing config it's loaded. Otherwise it gets created soon after anyway.

@TheLastRar
Copy link
Contributor

I thought we where keeping switch and removing bridge?

The plugin currently looks for the .ui file in the working directory
When using the PCSX2 Daily Builds PPA, this seems to be the home directory (and not where PCSX2 executable is located) I'm assuming this is unintentional.

The error message is now miss-leading on windows.

For some reason, the plugin crashes when used with the PCSX2 Daily Builds PPA (note, I've manually run the set networking caps so that shouldn't be the issue), When using a build of PCSX2 created from your branch the plugin works fine, unsure what is going on there.

The plugin doesn't seem to be able to read the settings it has saved, closing and reopening the emulator appears to reset the settings.

If I open, close, then reopen the dev9 config panel, I get duplicate Expansion and PC Card entries in the Type dropdown box

I'm able to connect Xlink Kai, I was also able to connect to both the RE:Outbreak resurrection server or the .Hack//fragment Netslum server (after some difficulty), so it seems to be working correctly.


I've also tested this on windows. I was aiming to check if the filtering works on the windows side, however, I ran into an issue specific to your branch,

It builds correctly but will crash PCSX2 when it searches for plugins. I'm not entirely sure what change you did that is causing the issue.

Attaching a debugger on a debug build gives me the following message

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

From here;

int version = m_GetLibVersion2( info.typemask );

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Sep 20, 2018

this seems to be the home directory (and
not where PCSX2 executable is located)
I'm assuming this is unintentional.

I can probably re-use the cfg directory to know where to read UI at runtime but that info isn't available at compile time, when installing the file, is it? I could copy to that directory upon first launch but it's hacky. I am trying my best to integrate with the project but could use a hand with details like variables specifying directory structures. Don't want to waste time with the guess-and-check approach. Please feel free to commit if you see easily fixable directory-related issues that will work across build environments.

I will just make the message say pcap instead of WinPCap or libpcap. Another easy fix.

The failure to load on Windows must be due to the extern "C" EXPORT that I placed in front of the functions that need to be visible from the main executable. I added an #ifdef to mimic the normal Windows mechanism or Linux mechanism. I'll need to fix that for Windows case. Apparently there's a need to change calling convention. Or maybe I just need to use _Win32 on line 55 of PS2Edefs.h. Or, remove lines 57 and 58 since I just realized there's a .def file

I know nothing about that Daily Build PPA or how it modifies the build environment. Why does the PPA not build the way a developer does? The results should be identical, except perhaps recent commits from master that have not been pulled into the branch. It would be a freak coincidence if the plugin API changed since this pull request was created, but it's possible.

Is failure to save plugin cfg related to file permissions? Do you know if the cfg file is being written? What do the contents look like when you see doubles?

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Oct 5, 2018

@mirh If you're getting a message about eth0 on Windows then we need information about your build environment. Also please try to build 67d8c8f and tell us if you get an error still

@mirh
Copy link

mirh commented Oct 5, 2018

I'm not sure what my "build" environment would have to be.
Windows 7.. winpcap is installed (but I didn't even try to use this new feature).. then what?

And that commit didn't seem to fix the problem.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Oct 5, 2018

@mirh I meant you're using Visual Studio? As opposed to MinGW or Cygwin or WSL.

I don't understand where adapter named "eth0" could be coming from in a Windows environment. The only thing I can think of is if you are building in Cygwin or WSL. Do you see where the eth0 is being sourced from?

Are you using the latest version of WinPCap from winpcap.org/install?

Have you been using a Tap adapter? If not, does the name of your network adapter begin with T?

@RedPanda4552
Copy link
Sponsor Contributor

The other user that was getting it was using one of the precompiled Windows builds from the build bot. Not building on their own. It therefore would have been with VS 2015.

@mirh
Copy link

mirh commented Oct 5, 2018

Yes, vs2015.
And I really only downloaded last build from orphis bot, and started it.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Oct 5, 2018

Can you answer the questions above? I cannot recreate the error on my end so I need information to do anything about it. Were you using the networking plugin before? Are you even trying to use networking at all? Have you tried opening the dev9 plugin settings, picking your adapter, and clicking OK?

@mirh
Copy link

mirh commented Oct 5, 2018

No at all.
I'm not sure how further I can underline it was default pcsx2.
The only thing I touched was literally setting sse4 gsdx.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Oct 5, 2018

So apparently you are not using the networking feature but seeing that error when you launch the game. That wasn't made clear before. I know it sounds like you're saying something simple but the details matter. I'll look at the code but without more information about what you have installed or configured I can only help so much. Is any dev able to see the same issue? What do I need to do to reproduce it?

@willkuer
Copy link
Contributor

willkuer commented Oct 5, 2018

Well when opening the plugin selector all dlls in the ini are loaded at least once (that’s why we get those ‘some kinda plugin error’ for higher gsdx instruction sets when the supported set is lower. I assume during load it is just checked what kind of plugin this dll generates to put it into the appropriate section.

So you could look into the plugin loader from pcsx2 core to check what happens upon loading all plugins from the plugins folder. However dll loading is a nasty thing (and I am not sure how it behaves in the unmanaged world) but typically all linked assemblies and their dependencies are loaded as well (even if they are not explicitly referenced during the load process). So your code might not even be the issue but it could be. And the issue could basically occur everywhere. So I guess there is no easy way around than asking mirh to attach a debugger.

You could possibly run dependency walker on the dll to check whether that one shows some linking errors.

@mirh
Copy link

mirh commented Oct 5, 2018

EE Core	DEV9ghzdrk (2).dll!SysMessage	
 	user32.dll!_NtUserWaitMessage@0�()	 
 	user32.dll!_DialogBox2@16�()	 
 	user32.dll!_InternalDialogBox@24�()	 
 	 user32.dll!_SoftModalMessageBox@4�()	 
 	 user32.dll!_MessageBoxWorker@4�()	 
 	user32.dll!_MessageBoxTimeoutW@24�()	 
 	user32.dll!_MessageBoxTimeoutA@24�()	 
 	user32.dll!_MessageBoxExA@20�()	 
 	user32.dll!_MessageBoxA@16�()	 
 	 DEV9ghzdrk (2).dll!SysMessage(const char * fmt, ...) line 313	 
 	DEV9ghzdrk (2).dll!GetNetAdapter() line 178	 
 	DEV9ghzdrk (2).dll!DEV9open(void * pDsp) line 266	 
 	pcsx2.exe!014d62f5()

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Oct 6, 2018

@mirh So after a bit of digging, it turns out @TheLastRar added the logic to copy "eth0" into config.eth by default in commit dcd477f , which explains the mystery of how on Windows you get a message about a Linux adapter name. It looks like the changes to Win32/Config.ccp that he made circa 2015 were attempting to use INI files for storing settings instead of the registry.

I know that before that commit 5f068ec, this plugin was working without error on Windows. I know this because I started developing the Linux version before then.

I was considering just backing out Win32/Config.cpp to commit 86895cb to get it working again ASAP. Instead I've just made it the Windows equivalent of Linux/Config.cpp. See whatever commit is currently mentioned at #2619 , which should remove the unwelcome pop-up box you get even if not trying to use networking

@mirh
Copy link

mirh commented Oct 6, 2018

Yes, fixed. Thank you.
(I'm not sure what automagically made my network devices start to appear in the plugin drop down menu, even with the original dev9)

@TheLastRar
Copy link
Contributor

I believe that eth0 was the default setting before, although I can't remember at this point.
The expectation was that the user would configure the plugin before tying to use it. admittedly it isn't the most sane default for windows.

While annoying, you can dismiss the popup and emulation should continue, was it crashing for you? @mirh

That being said, making it not be pop up if you've specificity disable Ethernet emulation is a good idea.

The plugin will only be able to detect your network devices if the winpcap service is running (by default it should be), you may also need to restart for winpcap pickup any changes you made to them (i.e. installing drivers, enabling/disabling adapters). That might be what your issue was.

@mirh
Copy link

mirh commented Oct 6, 2018

No it was just a popup. And there's no problem now for people that don't care.
And the other thing yes, I just found out it happens when "NetGroup Packet Filter Driver" (not service, ftr) is not running.
That should be taken into account or something I guess, if you are interested.

@lowlyocean
Copy link
Contributor Author

The only thing I would do for that case is pop up "have you enabled NetGroup Packet Filter Driver" or something similar in the plugin configuration dialog when there are no devices detected

@mirh
Copy link

mirh commented Oct 6, 2018

I mean.. it shouldn't be rocket science to distinguish between "driver on, no devices" and "driver off, end"

lightningterror pushed a commit that referenced this pull request Oct 9, 2018
Follow up from #2586 which ensures that MAC address is unique on Xlink Kai when using Windows.
Previous build was returning last two bytes as 00:00 rather than last two bytes of host adapter's MAC.
@lightningterror lightningterror changed the title Add networking capability for Linux Dev9ghzdrk: Add networking capability for Linux Oct 9, 2018
@orbea

This comment has been minimized.

@orbea

This comment has been minimized.

@prafullpcsx2
Copy link
Contributor

@lowlyocean @TheLastRar @arcum42

Sorry to say but we need both switch and bridge mode to get games properly working online. From my tests LAN mode games work properly only with bridge mode while games with actual Online mode work with Switch mode. I request you to please fix this and bring back option to choose between bridge and switch mode. Also CLR Dev9 isn't compatible enough yet to completely replace dev9ghz so this definitely needs to be fixed.

@TheLastRar
Copy link
Contributor

Care to elaborate what issues LAN games encountered with switched mode that bridged mode resolves?

Regarding CLR DEV9, I assume you are referring to the forum post you made yesterday (I don't check the thread as often as I should) I think I know the cause of that and should have a fix soon(tm)

@lowlyocean
Copy link
Contributor Author

games with actual Online mode work with Switch mode.

Does this mean there are games that have original servers still running? I was under the impression that most PS2 games are played "online" nowadays are really just using LAN mode over a VPN.

Can someone explain why Switched mode is actually needed? When using bridged mode, the PS2 BIOS thinks your actual PC's network hardware is its own. It just calls it by a different MAC address than your PC does. Everything that happens at Layer 2 on your actual PC's hardware can be seen by the PS2 BIOS if you use bridged mode. This allows Link Layer broadcasting that's used for discovery in LAN. The BIOS/game performs any Layer 3 / IP configuration natively. If you use switched mode, you introduce another level of Layer 3 management by an external tool (the plugin), you lose ability to handle MAC broadcasts for LAN, and it's not clear what benefit you can get.

@prafullpcsx2
Copy link
Contributor

prafullpcsx2 commented Jan 1, 2020

@lowlyocean There are private servers running for most of the games now and online play has been revived.

@TheLastRar The main issue happens when trying to join a game. The games can be discovered/created but you are unable to join.

Believe me I have thoroughly tested this, both modes are needed.

Also if someone is trying to fix clrdev9 then try lan mode in Splinter Cell games.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented Jan 1, 2020

Believe me I have thoroughly tested this, both modes are needed.

Would be helpful if you can provide details of the testing you've done [like exact steps you take, then the difference in behavior at the final step for A vs B] because it's still not clear why switched mode is needed.

@prafullpcsx2
Copy link
Contributor

prafullpcsx2 commented May 11, 2020

Tested this again today using Socom 2 game lan mode. The created game is never visible using the new plugin (which has only one option after this commit). It works perfectly fine if using bridged mode in old plugin (the plugin had both bridge and switch mode). The old bridge mode works perfectly with all lan games while old switch mode works perfectly with online games. I guess this either needs a revert or a proper fix.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented May 11, 2020

This plugin uses bridged mode. Switched mode is considered obsolete and was removed to simplify the code. Anything that doesn't work for you in the new plugin would be a bug and we'd need evidence in the form of annotated packet captures to fix. Bridged mode was tested with Socom 2 LAN in the new plugin over XLink. Are you using XLink to host/join LAN games? Again, packet captures are worth a thousand words here

@prafullpcsx2
Copy link
Contributor

prafullpcsx2 commented May 11, 2020

No, I am not using Xlink. I am using real lan network at my home. Also used virtual lan network through hamachi. Infact even used two pcsx2 running on same pc. They all work with old plugin bridge mode. They also work with clr plugin. As I said earlier this plugin has problem in LAN mode. I have been playing PCSX2 online/lan since the first day this plugin was created and I know what I am talking about. Even @TheLastRar was confused earlier whether you deleted bridge mode or switch mode. I think some code of bridge mode has definitely been compromised here.

@lowlyocean
Copy link
Contributor Author

lowlyocean commented May 11, 2020

I think some code of bridge mode has definitely been compromised here.
This is possible, of course. Again, if you can provide a packet capture [bridged mode, old plugin, working] vs [new plugin, not working] we can investigate. Otherwise we have little to work with as far as finding out where the bug might be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.