bvbohnen / x4-projects

Parent repo for other X4 projects, with shared code for documentation and release generation.
MIT License
42 stars 12 forks source link

Why exactly is the named-pipe API Windows only? #10

Closed roflcopter4 closed 3 years ago

roflcopter4 commented 3 years ago

Note: I don't mean this to be an impudent question. What part of this project has been difficult to port to Un*x? I can't imagine that it's anything to do with the actual IPC. If the code just hasn't been written I'd be happy to do it. On the other hand, if it has something to do with monitoring the keyboard then that might make more sense.

Just curious is all. I could, obviously, just scour the source code, but if there's something already known to be difficult to port that would be helpful to know in advance.

bvbohnen commented 3 years ago

There are no specific difficulties, as far as I know. A user named beko on the egosoft forums was working on a linux port, but I haven't heard anything in a while. I don't personally use linux (outside of work stuff), and so haven't worked on the port.

bekopharm commented 1 year ago

Uh hi. Kinda missed that. Nobody poked me =)

I came back to this and I have the X4 side more or less under control. Just have to adapt the socket initialization because I kinda made it exactly the other way around: X4 starts the socket and I connect to it from another process.

This is basically made possible by installing lua-socket (5.1, linux only) and sideloading that.

While this lib is simply available on e.g. Fedora (and probably most others) it has some annoying issues. It's e.g. not really possible to receive data in a non-blocking way so the connecting process has to spam newlines or the game freezes. Tried to work around this for hours but in the end it's probably not the best library to use :shrug:

As for the python server: No idea. Still trying to wrap my head around this. The pipe is win32 but nothing of the rest looked system depending.

Edit: After checking some live implementations by others I'm pretty sure that I don't need the Python part on Linux at all. It's only job seems to be to provide the socket in the first place - what I'm doing from X4 directly. This does of course not care for permissions file and stuff but I really doubt that's an issue. On Linux we do permissions by files so if someone has write access to a socket it's probably intended. Not sure about the Keys API though. I'm not really going to use that part but may check it out for the sake of completeness.

If you're still interested in this @roflcopter4 you may find me [also] on the X4 Discord where I started to pick other people's brains on the topic :D

(I'm even considering to use UDP for it's non blocking design)