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

Implemented GC Controller inputs via named pipes. #3170

Merged
merged 1 commit into from Oct 28, 2015
Merged

Implemented GC Controller inputs via named pipes. #3170

merged 1 commit into from Oct 28, 2015

Conversation

spxtr
Copy link
Member

@spxtr spxtr commented Oct 14, 2015

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

echo "PRESS A" > filename
echo "RELEASE A" > filename

{
namespace Pipes
{
static std::vector<std::string> s_button_tokens {

This comment was marked as off-topic.

@MayImilae
Copy link
Contributor

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.

@lioncash
Copy link
Member

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.

@spxtr
Copy link
Member Author

spxtr commented Oct 14, 2015

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.

@spxtr
Copy link
Member Author

spxtr commented Oct 14, 2015

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.

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.
@phire
Copy link
Member

phire commented Oct 25, 2015

@dolphin-emu-bot rebuild

This looks good to me.

@dolphin-emu-bot
Copy link
Contributor

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

  • fortune-street-white-box on ogl-lin-intel: diff
  • mkdd-efb on ogl-lin-intel: diff
  • sms-bubbles on ogl-lin-intel: diff
  • ssbm-pointsize on ogl-lin-intel: diff

automated-fifoci-reporter

lioncash added a commit that referenced this pull request Oct 28, 2015
Implemented GC Controller inputs via named pipes.
@lioncash lioncash merged commit e76b1f2 into dolphin-emu:master Oct 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants