Direct N64 controller access plugins for mupen64plus and Project64



What is it for?

Everything shown works!

Everything shown works!

These mupen64plus and Project 64 plugins use the direct controller access feature offered by my N64 to USB adapters (versions 3 and up) to let the emulated game communicate with the controllers directly.

So, what does this do for you? Many things! Here are the key advantages:
[1] I cannot test accessories I do not own yet. But the nice thing about this plugin is that it probably already works. Please contact me if you get the chance to test.

Warning: This project is experimental and still in development. While it is already usable, some of the features above, especially the ones that are unconfirmed, may be found not to work at all. There can (and will) be bugs, and there are still many missing features such as multi adapter support. Your help and patience in testing as well as your constructive feedback are welcomed.

goto top Up


Screenshots

Here are a few screenshots taken with a memory card present in the N64 controller. The Mario Kart 64 built-in mempak manager (hold the START before running the emulator) is usable despite a few visual glitches. Then once in the game, we can see ghost data exists (saved in a previous session. The emulator had been restarted since). Later (and on a different machine, in this screenshot on a Linux system) the data written by MK64 can be accessed with the adapter management tool.
MK64 built-in manager

MK64 built-in manager

Ghost

Ghost

Ghost

Ghost

Adapter manager

Adapter manager



Note: For now at least, it is better not to run the adapter manager and a game (with this plugin) at the same time.
Contributions:
Controller, Transfer and Tremor paks

Controller, Transfer and Tremor paks

MaMaLuigi9001 tested the Transfer Pak and a Tremor Pak Plus (Third party Rumble Pak equivalent) and reports it works fine. The games he tested with the Transfer Pak are Pokemon Statium and Pokemon Statium 2, using Project 64 version 2.3.0.216 under Windows 10. He mentions however that the emulator crashes with a blank screen when he goes to the Gameboy Tower...

Here are a few screenshots of the Pokemon games:

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium

Pokemon Stadium 2

Pokemon Stadium 2

Pokemon Stadium 2

Pokemon Stadium 2

Pokemon Stadium 2

Pokemon Stadium 2


goto top Up


Supported adapters

This plugin is for third generation raphnet GC/N64 to USB adapters. If you are not sure which generation yours are, there is a very quick way to tell: If it has a removable USB cable, it is a third generation unit.

PhotoModel(s)Supported?
GC/N64 to USB ADAP-GCN64-USB_V3: N64 or Gamecube controller to USB adapter (V3, Black Edition)
ADAP-GCN64-USB-V_V3: N64 or Gamecube controller to USB adapter (V3, Violet Edition)


Prototype units (ADAP-USB-GCN64-V3-PROTO) and pre-release units (ADAP-USB-GCN64-V3-PR) are also supported!
Yes
N64 to USB ADAP-N64-USB_V3: N64 controller to USB adapter (V3, Black Edition) Yes
Dual N64 to USB ADAP-2XN64-USB: Dual N64 controller to USB adapter Yes
Old GC/N64 to USB ADAP-GCN64-USB: N64 or Gamecube controller to USB adapter (no longer manufactured) No
Old N64 to USB ADAP-N64-USB: N64 controller to USB adapter (no longer manufactured) No
Note: It's not that I do not want to support old versions. It's just that direct controller communication is not possible with those.

goto top Up


How it works

Here is a diagram outlining the main differences between the usual architecture (input-sdl) and this plugin.




The normal event chain is more or less the following: (written with mupen64plus in mind, but also applies to project64)
  1. The adapter polls the controller and stores the answer containing button and axis status data in RAM.
  2. The host PC polls the adapter over USB and receives the most recently read data.
  3. This newly received data makes its way through a few software layers including the HID driver, the DirectX (DirectInput) or joystick driver and the SDL library. (The data is in fact stored in a buffer somewhere)
  4. When the game being emulated requests a controller status update, an answer is built using the most recent data returned by the SDL library.
ProsCons
  • The emulator does not need to wait. Relatively fresh data is always available immediately (the SDL library returns it without delay) so the emulator only needs to reformat the data to make it look like what a real controller would answer.
  • This approach works with almost all controllers and adapters usable through SDL.
  • The exact axis value are often lost (calibration, dead-zone, assumptions on the exact axis range from the part of the emulator that are not met by the adapter-driver stack, etc) and restoring the original feel can require a lot of subjective tweaking.
  • The emulator needs to know what kind of pack to emulate (i.e. mempak or rumble a pack?). This means the user must configure this depending on the game. While rumble packs can work mostly as intended (through HID PID) mempack emulation is almost always virtual (i.e. file-backed).


The "direct access" event chain is more or less the following:
  1. The emulated game requests a controller status update.
  2. The plugin forwards the request as-is to the adapter through USB.
  3. The adapter in turn forwards it to the actual controller (or other peripheral).
  4. The controller (or peripheral) answers the request.
  5. The adapter receives the answer and retransmits it through USB.
  6. The input plugin receives it and serves it unmodified to the game.
ProsCons
  • The game actually communicates with the controller. Accessoires such as memory packs and rumble packs (and potentially others) are therefore supported natively.
  • The answer from the controller does not undergo any transformation. The axis values received by the game are exactly what they would be on a non-emulated setup. No unknowns and no tweaking!
  • Since the request has to do a round-trip to the controller, the action of reading the controller status takes a bit more time. When there are a lot of exchanges (especially when writing and reading mempacks) this can cause a temporary slow down of the emulator.
  • Only possible on adapters offering a way to communicate with the controllers directly. (For me of course that's a pro)

goto top Up


Download

Question: Which file do I need? What is the differente between the .zip and .tar.gz files?
Answer: The .zip files contain ready to use plugin files (.DLL) for Windows. The .tar.gz files contain the source code. If using Linux, this is what you need.

RSS feed for this table
File(s)DateDescription
mupen64plus-input-raphnetraw-0.9.4.tar.gz (29.8 KB)
mupen64plus-input-raphnetraw-windows-0.9.4.zip (161 KB)
pj64raphnetraw-0.9.4.tar.gz (19.6 KB)
pj64raphnetraw-0.9.4.zip (72.8 KB)
December 3, 2016 (Saturday) Maintenance release:
  • Improved structure and separation for easier maintenance of the code shared between the Project 64 and mupen64plus versions of this plugin.
  • Support for the upcoming 3.4.x adapter firmware (will provide even lower latency/overhead)
mupen64plus-input-raphnetraw-0.9.3.tar.gz (26.8 KB)
mupen64plus-input-raphnetraw-windows-0.9.3.zip (158.4 KB)
pj64raphnetraw-0.9.3.tar.gz (16.1 KB)
pj64raphnetraw-0.9.3.zip (71.6 KB)
November 26, 2016 (Saturday) Optimisation and bug fix:
  • Only handle channels supported by the adapter. This increases performance (reduces lag) by preventing meaningless attempts to communicate with controllers connected to non-existing ports on the adapter. It also fixes issues where games would see more controllers than actually present (on single-player adapters).
mupen64plus-input-raphnetraw-0.9.2.tar.gz (26.3 KB)
mupen64plus-input-raphnetraw-windows-0.9.2.zip (155.7 KB)
pj64raphnetraw-0.9.2.tar.gz (15.9 KB)
pj64raphnetraw-0.9.2.zip (69.4 KB)
November 24, 2016 (Thursday) Reliability fix:
  • Protect against invalid commands received from emulator. This fixes some games that failed to start. (The issue was present in PJ64 and mupen64plus)
mupen64plus-input-raphnetraw-0.9.1.tar.gz (25.8 KB)
mupen64plus-input-raphnetraw-windows-0.9.1.zip (155.6 KB)
pj64raphnetraw-0.9.1.tar.gz (15.2 KB)
pj64raphnetraw-0.9.1.zip (69.3 KB)
November 23, 2016 (Wednesday) Changes specific to the Project64 version:
  • Changed the plugin specification version (Now using v1.0 instead of v1.1) in order to be usable with old Project 64 releases (v1.4 - v1.6).
Changes common to both plugins:
  • Controller polling is now disabled only while a ROM is open. (In the previous version, after using the plugin, to use the adapter normally (eg: Through DirectInput) one had to disconnect and reconnect it.
pj64raphnetraw-0.9.tar.gz (13.8 KB)
pj64raphnetraw-0.9.zip (69.3 KB)
November 22, 2016 (Tuesday) First release for project64
mupen64plus-input-raphnetraw-0.9.tar.gz (25.7 KB)
mupen64plus-input-raphnetraw-windows-0.9.zip (155.4 KB)
November 20, 2016 (Sunday) First release version (mupen64plus)
This project is also available on GitHub!
To request features, report issues or contribute, you may send me an email or use the GitHub repository:
https://github.com/raphnet/mupen64plus-input-raphnetraw
This project is also available on GitHub!
To request features, report issues or contribute, you may send me an email or use the GitHub repository:
https://github.com/raphnet/pj64raphnetraw

goto top Up


Usage (Project64 under Windows)

To install and use the PJ64 plugin, there are two files to place at specific locations.

1: Copy the following file to "your PJ64 installation directory"/Plugin/Input: (for older PJ64 versions (such as v1.4), place the file directly in the Plugin directory as there are no subdirectories per plugin type).

2: You must also copy the following file to your PJ64 installation base directory (i.e. The directory where the .EXE is): Then in the settings dialog, select "raphnetraw for Project64 version xx.xx" in the Input plugin list.

Installing the plugin (pj64raphnetraw.dll)

Installing the plugin (pj64raphnetraw.dll)

Installing the support file (libhidapi-0.dll)

Installing the support file (libhidapi-0.dll)

Input plugin selection (PJ64 v2.3)

Input plugin selection (PJ64 v2.3)


Note: The current version of the plugin will create a log file named raphnetraw.log in your home directory.

goto top Up


Usage (mupen64plus under Windows)

The .zip version of the plugin available from the downloads section above contain the 32 and 64 bit versions of the plugin files. The .zip contents will look like this:
mupen64plus-input-raphnetraw-windows-0.9/
mupen64plus-input-raphnetraw-windows-0.9/README.md
mupen64plus-input-raphnetraw-windows-0.9/dist_win64/
mupen64plus-input-raphnetraw-windows-0.9/dist_win64/libhidapi-0.dll
mupen64plus-input-raphnetraw-windows-0.9/dist_win64/mupen64plus-input-raphnetraw.dll
mupen64plus-input-raphnetraw-windows-0.9/dist_win32/
mupen64plus-input-raphnetraw-windows-0.9/dist_win32/libhidapi-0.dll
mupen64plus-input-raphnetraw-windows-0.9/dist_win32/mupen64plus-input-raphnetraw.dll
If you use a 64-bit version of mupen64plus, copy the files from the dist_win64 directory. For the 32-bit version, copy the files from the dist_win32 directory.

Copy the appropriate plugin (.dll files) to the directory your mupen64plus installation uses for plugins (eg: Along with the main executable and other plugin .DLL files). Then run the emulator like this:
$ mupen64plus --input mupen64plus-input-raphnetraw
(of course you will add other arguments such as the rom file...)

goto top Up


Usage (mupen64plus under Linux)

Copy the plugin (.so file) to the directory your mupen64plus installation uses for plugins. Then run the emulator like this:
$ mupen64plus --input mupen64plus-input-raphnetraw
(of course you will add other arguments such as the rom file...)

goto top Up


Confirming that it works (mupen64plus)

If you are not sure if you were able to enable, have a look to the emulator output:

goto top Up


Disclaimer

I cannot be held responsible for any damages that could occur to you or your equipment while following the procedures present on this page. Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability of the informations on this page. Please note, however, that the procedures above have worked in my case without any damages or problems.

Now you cannot say that I did not warn you :)

goto top Up


Trademarks used in this site are the property of their respectives owners.
Copyright © 2002-2017, Raphaël Assénat
Website coded withWebsite coded with vimLast update: December 18, 2016 (Sunday)