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
Implemented GC Controller inputs via named pipes. #3170
Conversation
| { | ||
| namespace Pipes | ||
| { | ||
| static std::vector<std::string> s_button_tokens { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Would this have any effect on regular users? Any GUI or configuration process differences? |
| while (newline != std::string::npos) { | ||
| std::string command = m_buf.substr(0, newline); | ||
| ParseCommand(command); | ||
| m_buf.erase(0, newline + 1); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Braces should be on the next line |
| if (value < 0.0) | ||
| value = 0.0; | ||
| if (value > 1.0) | ||
| value = 1.0; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Okay, I made those changes. I'm not sure if I put the big comment in the right spot in Pipes.h. |
| #include <iostream> | ||
| #include <map> | ||
| #include <string> | ||
| #include <sys/stat.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Sorry about the plethora of style issues, by the way. I copied bits and pieces from the evdev and Android interfaces, which have some style issues that I should've noticed and avoided. |
| "R" | ||
| }; | ||
|
|
||
| static const std::vector<std::string> s_axis_tokens |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Currently only works on unix, but can be extended to other systems. Can also be extended to do wiimotes. Searches the Pipes folder for readable named pipes and creates a dolphin input device out of them. Send controller inputs to the game by writing to the file. Commands are described in Pipes.h.
|
@dolphin-emu-bot rebuild This looks good to me. |
Implemented GC Controller inputs via named pipes.
When we look for controllers, Pipes::Init scans the Pipes folder in the user directory for readable, nonblocking files. For those it finds, it creates ciface::Devices out of them. Users can then send controller inputs to the devices by writing to the files. This is much simpler than, e.g. making a uinput device. The commands are described in Pipes.h.
This approach can be extended to wiimotes. You can also pipe data from a socket into the file with netcat or similar.
Only works on unix systems so far, since Windows has a different named pipes interface. Not a big deal to port, but I don't have a Windows box atm. Try it out by making a named pipe in a folder called Pipes in the user directory (mkfifo filename), refresh dolphin controller entries, pick the pipe, and then run