-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Connect to DreamConn only once registered #1828
Connect to DreamConn only once registered #1828
Conversation
Fix confirmed |
Can you do this call in the DreamConnGamepad constructor instead? |
actually you certainly want |
I think it would make sense to prevent multiple |
…onfig" This reverts commit 113af61.
…CONTROLLER config
I pushed some suggested changes. Let me know if this seems more reasonable. I feel the itch to more generalize things around dreamconn so parent class naming isn't specific to DreamConn and to allow for more Dreamcast-specific devices in the future (with some sort of factory). Would that be overstepping? |
Sorry guys. There is probably some misunderstanding since I wasn't asking for such drastic changes. But I'm probably missing part of the story so I'm fine with the previous PR, which is much simpler. |
Yes, that is all correct. I'm sorry for not laying all of this out - what I was also trying to avoid is the case where the controller defaults to A, connects to A, and then the configuration changes it to B right away. I don't want it to connect multiple times in succession which would cause issues in the current implementation (@kosekmi and I spoke about fixing that in the future). I do like the current changes since it's more explicit about only connecting once during this initialization sequence. |
All right, let's go for it then. Note that this will not prevent the maple port to change rapidly since it can be done in the UI and has immediate effect. I'm not sure it makes sense on the hardware side of things but if changing maple port takes too much time/effort, you might want to think about decoupling the emulator's maple port from the hardware maple port. You'd need to change the the bus id in the maple packet before sending them but it shouldn't be too hard. |
Yes, totally! It would make sense to have the connection to the serial device happen by default, and then handle the maple port ID separately. I don't think the flycast-specified ID has much merit to this connection now that you mention it 😅 🤦 A little side discussion: I've personally been trying to decide how to proceed which has caused me some implementation paralysis (and the above confusion). I'm going to brain dump here. Maybe you and @kosekmi can comment.
|
The DreamConn maple port is special in that regard since it is set externally (by the DreamConn utility), and each port is accessible on a known network port. So when the maple port is changed, Flycast closes the current socket and opens a new one to the new network port (which may fail). SDL exposes the HID API so you can use it directly ( |
Not sure if this is the same idea as the following which I originally had in mind before stumbling over the serial device: We could mimic the behaviour of DreamConn utility on the pico by exposing an ethernet device with a defined IP instead of a serial device, spinnig up a TCP socket for every controller analogue to DreamConn utility. This would certainly simplify things in Flycast. See https://github.com/maxnet/pico-webserver for an example of a Pi Pico Ethernet device with lwip TCP sockets. |
Yes, this is what I was thinking. That's an interesting project! I didn't realize that Windows only supported RNDIS. I friggen hate how Windows implemented USB. |
😮 That may be useful. I'll check that out. Thanks! |
This is regarding discussion #1825
Problem: When no config is present, then a DreamConn connection isn't being made.
DreamConnGamepad::set_maple_port() needs to be called in order to establish connection to the device. It should always be called in
GamepadDevice::Register()
, even whencfgLoadInt()
returns the default result. This is essentially just setting it to the same defaulted index it was already set to if it isn't in the config.