OSX Joymap (https://sourceforge.net/p/osxjoymap)

This package provides joystick mapping support for a limited
set of applications in Mac OS X.

The intention is to provide an equivalent interface to
joymap for linux (http://linuxjoymap.sourceforge.net/).

The best way to do this is probably with kernel extensions
(.kext). Developments in Mac OS X makes this approach
less desirable (to me), since maintaining a signed kext could limit
the applicability of this work.

Instead, joymap for OSX uses DYLD_INSERT_LIBRARIES
to replace the IOKit implementation for an application,
and simulate a joystick in the library layer.

The program assumes a HOTAS kind of layout, where each product
occurs only once in the system (a current limitation).

The IOKit replacement library communicates with the joymap
process using a unix socket.


Make the package with:

This creates two dylib files which you can place wherever you wish:
  * joymap_iokit.dylib
  * joymap_boxer.dylib

There are also two CLI applications that are built:
  * joymap
  * jsinfo

jsinfo can be used to examine the existing joystick devices, or
the programmed virtual joystick.
  ./jsinfo (shows a list of devices with vendor and product)
  ./jsinfo -v (shows additional element information)
  ./jsinfo vendor product (Continuosly display button and axes values)

The program loadmap is used to load a joystick configuration as specified
the doc subfolder, including a joystick program to allow more advanced
programming of joystick actions. The loadmap program opens a socket in
$HOME/.joymap to publish virtual joystick information to any program
which includes joymap_iokit.dylib or joymap_boxer.dylib.

Some example programs are included in the doc subfolder.

To benefit from the virtual joystick you need to launch
the application with DYLD_INSERT_LIBRARIES. For example:

  DYLD_INSERT_LIBRARIES=$HOME/joymap/joymap_boxer.dylib open /Applications/Boxer.app

You can use the joymap_boxer.dylib for Boxer (available from http://boxerapp.com/)
(which does not use the newer IOKIT libraries) and joymap_iokit.dylib for
applications that do use the newer IOKIT libraries. For example wine (https://www.winehq.org/).

The libraries *only* simulate a joystick, not a keyboard or mouse.
The loadmap program simulates the keyboard and mouse directly, so it
can be used to simulate keyboard and mouse events using the joystick
for any program.


This is a work in development. Although I find it usable in the current state,
the implementation is incomplete.
  * Queues aren't implemented.
  * Anything that falls back to using mach_port in some way will not work.
  * For the latter case I have resorted to custom built libraries (such as the boxer dylib).

Use of the software is entirely at your own risk.


In addition to the examples in the documentation folder, a more complicated example for X-Wing
is available at the end of this page.

Source code is available at


Alexandre Hardy,
May 11, 2015, 11:29 AM
Alexandre Hardy,
May 11, 2015, 11:29 AM