Page 1 of 3

Building GIMX on Mac

Posted: Sun Feb 21, 2016 5:24 pm
by awesome
Hi Matlo,

First of all I can't find your email so I'm starting a post here.

I've tried this on Ubuntu and found that because Razer drivers don't work on Ubuntu, my high DPS mouse is useless on ubuntu. Same for Pi.
I've tried GIMX on Pi, ubuntu laptop, windows pc with both bluetooth and usb adapters.
On windows, I found that my computer crashes when I try to install USBDK, and now the USB ports do not work under windows at all, so I've thrown the useless junk windows computer out the window. :roll:

Anyway, as a mac user, I'm tired of these operating systems and want to try and install this natively lovely Mac, as I've tried emulators and can't get USB passthrough to work.
I've got both the physical DIY connector and the CSR bluetooth chip. Any way to support this on Mac? what would I need to build this myself? (I'm a developer myself).

Thanks man, your work is great.

Re: Building GIMX on Mac

Posted: Mon Feb 22, 2016 8:21 am
by Matlo

I moved your topic to the development section.

The fastest way to get GIMX work on MAC OS is to use a DIY USB adapter as the bluetooth-related code is Linux-specific.
The USB-related source code uses libusb, which is also available for MAC OS.
It should also be possible to use libSDL for input devices. It's already used in Windows for joysticks and "Window events", and it should be easy to port this code to MAC OS.

My email can be found in the source code.

Re: Building GIMX on Mac

Posted: Fri Mar 25, 2016 12:26 am
by Lythinari
Hi Matt,
I've been lurking for awhile on these forums, I've tried a few solutions to work in a VM which none worked.
The closest I got was with lubuntu using the .deb file however I couldnt launch gimx-launcher because it was compiled with a different compiler.. or something. I believe the actual GIMX binary worked though. :]

Anyway, thats for another thread.
What I wanted to get to, was ask whether OP/awesome has been in contact with you about the development of this OSX version and whether he has been successful?

I have been poking around your code on github, and have been looking at possibly writing a golang version for OSX (My C isnt very good.

I only decided to post now, because I found a libusb library (which I havent used yet), and a serial library which will allow me to communicate on the non standard baudrate.
That and managed to achieve a small first step, being able to talk to the adapter with the initial command to get the adapter type. I got a set of bytes of 0x01, 0x05, and 0x11. I may have left out one or two bytes
Which from my understanding
1 is the end byte or start byte?
5 is the adapter type from the hex installed on the adapter(PS4 DS4?)
11 is the response type

Assuming OP hasnt progressed at all with an OSX version, I was wondering whether email or this forum is the best way to talk and ask development questions?

I really appreciate the work you've done, it certainly is amazing feat.
I hope to eventually get my G25 working with GIMX - but mouse and keyboard for now :]

thanks in advance,

Re: Building GIMX on Mac

Posted: Fri Mar 25, 2016 4:28 pm
by Matlo

The issue with the .deb package was probably due to using a wrong Ubuntu version (only the 14.04 one is supported).

Sadly I'm not aware of any work done toward an OSX port.

I don't know much about golang.
I think it may be hard to reach the same performance level with another language.
GIMX is event-driven and all IOs are non-blocking and managed by a single thread.

The packets from the adapter are handled here: ... ter.c#L374
The packet format is described here: ... protocol.h
The adapter types are here: ... defs.h#L25

A valid packet is 0x11 (packet type = controller type), 0x01 (1 byte), and 0x05 (controller type = dualshock 4).

Re: Building GIMX on Mac

Posted: Tue Apr 05, 2016 4:20 am
by Lythinari
Thanks for the info. Im setup with the PS4 if you havent caught on by now.
Im using DIY adapter to OSX to DS4 at the moment and hoping to pick up commands from the laptop keyboard at least.
Im aiming for a simple test case where I can push one of the WSAD keys on the laptop keyboard.

I can connect to the adapter(via dey/tty), and I have claimed the interface for the DS4 controller through libusb and can see the endpoints.

The next part is looking at the GIMX Event library you've written? Is that what handles the inputs from the keyboard & mouse?
Where is the authentication from the DS4 happening? I can see the xbox is occuring in the usb_init script, but I cant find the DS4 controller authentication.
Where do you actually translate and send the packets to the adapter? Is it possible that I could just hook up a loop that sends a basic "move forward" packet to the adapter?

Re: Building GIMX on Mac

Posted: Wed Apr 06, 2016 3:52 am
by Matlo
I suggest you to base your work on the refactoring branch:
Most of the porting work has to be done in the shared/gasync/src directory.
Some of the Linux or Windows source code may be reused.
There are some testing programs in the shared/gasync/test directory that may help testing and debugging the code.

Re: Building GIMX on Mac

Posted: Tue Apr 12, 2016 11:36 am
by awesome
Hi, I've tried to compile this on OSX but failed due to the linux only libraries. Other than that I hadn't done any digging but I'm guessing this would be the best route to take.

If you have any updates please update here... thanks :D

Re: Building GIMX on Mac

Posted: Thu Apr 14, 2016 12:31 pm
by Matlo
I did some work to make the SDL source code usable in OSes other than Windows.
I don't have a mac, so I'm trying to cross-compile on GNU/Linux using the osxcross toolchain.

Re: Building GIMX on Mac

Posted: Fri May 06, 2016 7:02 am
by 0x1

Nice to see this project is still going strong — congratz!

I must admit It's been quite some time since I've used GIMX (last time was a very early version on Linux). I'm willing to help out on the OS X version as time permits; it might be a good idea to discuss a plan of attack. Porting Matlo's code shouldn't be that difficult actually — most of the libraries used are accessible if installed via MacPorts or Homebrew (I personally prefer MacPorts).

I spent around ten minutes trying to get re-acclimated and some of what I learned way back starting looking familiar. I even managed to find my old USB 2.0 bluetooth adapter (unfortunately I can't remember how to reset it back to default atm) I'm guessing it's possible to use USB 3.0 by now perhaps? :)

Anyway, here's what I've done so far:

- successfully compiled/installed the libusb-1.0 library
- successfully built the ds4tool
- successfully compiled/installed the hidapi-master libs
- successfully compiled/installed the Fox-Toolkit

ds4tool, hidtest, hidapi-testgui all worked fine:


I wasn't able to get much further today (short on time), I'm still not certain which library -lbluetooth refers to, although I thought it was the hidapi, but perhaps not. That seems to be the next thing on the list, so any further info would be helpful.

Matlo, please let me know how you prefer handling the porting since you're the boss (eg. pull requests, etc.)

~ regards

Re: Building GIMX on Mac

Posted: Fri May 06, 2016 5:01 pm
by awesome
Hi what did you need to install in macports?