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
GCAdapter: Defer initialization until MainWindow::InitControllers #10502
Conversation
|
I believe this would break GCAdapter for DolphinNoGUI, since GCAdapter::Init is only called from DolphinQt with this change. Edit: This is probably why FifoCI fails. |
254f3aa
to
a99ae4d
Compare
|
Changed by adding a call in Note that this means that |
|
GCAdapter is fully supported on Android. Please add a call inside |
If libusb fails to initialize, an assertion fails, but if that happens before the main window is created, then Dolphin just dies. Now, the panic alert is properly shown and the user can ignore it.
a99ae4d
to
3780647
Compare
Undo this PR dolphin-emu#10502 This way causing Rio to try and read from the GC adapter after closing, which caused exceptions to be thrown.
|
EDIT: Sorry, this post was pretty confusing. I was referring to mainline Dolphin from the beginning. Hi, Shall I file a separate bug report? |
|
If you can reproduce on mainline dolphin, please do file a bug report. (Here's the version with this change, and the version immediately before without this change). I don't know anything about ProjectRio, but it looks like they attempt to revert this commit: ProjectRio/ProjectRio@ef33152 (and have included that for a month). I'm not sure if their reversion is done correctly. If you can't reproduce it on mainline dolphin, this might be an issue with their reversion (or maybe it's fixed in their latest version with that reversion). |
|
I just saw that GitHub message. I have no idea what Project Rio is. This definitely affects mainline dolphin and I already bisected the issue. Running and closing mainline Dolphin with the GCAdapter attached, produces the freeze starting this PR. Doing the same without it attached doesn't. Bug report filed here: |
| #endif | ||
| s_libusb_context.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be moved after the next line? (Reset())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't directly use the libusb context after this point, but I'm not knowledgeable enough about libusb to say whether that would make a difference (and whether s_handle is still valid).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reported "crash" isn't a crash, it's a deadlock:
GCAdapter::Reset() is hung in a join() call for thread 0xe61f56.
thread 0xe61f56 is in poll() (either Read or Write threadfunc). Read/Write wrap libusb_interrupt_transfer.
LibusbUtils::Context::Impl::~Impl will have already killed it's EventThread and called libusb_interrupt_event_handler and libusb_exit. So..i think that's probably the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pizuz can you also try this change? (See my first comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that might have been fixed by one of the recent commits to libusb. so if you compile new PR yourself, make sure to git submodule update to include that part of PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented there. I tried the buildbot build of that PR.
If libusb fails to initialize, an assertion fails, but if that happens before the main window is created, then Dolphin just dies. Now, the panic alert is properly shown and the user can ignore it.
Note that the shutdown still happens in UICommon:
dolphin/Source/Core/UICommon/UICommon.cpp
Lines 118 to 126 in 58c02e6
(Wiimote::Shutdown is called in
MainWindow::ShutdownControllers, butWiimoteReal::Shutdownis in UICommon, so I think it's fine to have it organized like this... though I'm not fully sure.)