ZiNc 1.0
Input Plugin Docs
-----------------

This is a brief technical document on how to write a ZiNc controller plugin.
The basic concepts are similar to controller plugins for PSEmuPro/ePSXe,
so you should be able to port those plugins to ZiNc fairly easily.

A ZiNc input plugin is a Win32 .DLL or Linux .so shared object which
exports the following entry points:

ZN_JammaOpen
============

long ZN_JammaOpen(HWND *hwnd, vendor_id_t vendor_ID, game_id_t game_ID, char *cfg_file);

hwnd: the HWND to the window for the renderer (Win32)

vendor_ID: vendor ID for the current game (see game_defines.h).

game_ID: game ID for the current game (see game_defines.h)

char *cfg_file: name of the configuration file

return 0 for success, -1 otherwise.


For Linux, the first parameter is different, but has the same meaning:

long ZN_JammaOpen(void *display, vendor_id_t vendor_ID, game_id_t game_ID, char *cfg_file);

display: X11 Display pointer to the window for the renderer (Linux).

return 0 for success, -1 otherwise.


ZN_JammaClose
============

long ZN_JammaClose(void)

Closes the plugin.


ZN_JammaRead
============

ZN_JammaRead(jamma_t *data)

Reads the inputs (called once per frame).  The jamma_t structure
is defined in controller_defines.h as follows:

typedef struct
{
	unsigned long	controls;
	unsigned long	players[4];
	unsigned long	reserved[10];
} jamma_t;


controls is the coin and other special controls.  These are defined by
the JAMMA_CTRL_* #defines in controller_defines.h

players[4] is an array of inputs, 1 per player.  These inputs are 
defined as follows:

bit 15: START
bits 12-14: additional buttons for player
bit 11: UP
bit 10: DOWN
bit 9: LEFT
bit 8: RIGHT
bits 0-7: first 8 buttons for player

Refer to the example zinckbd.c for details on how these are interpreted
by each of ZiNc's emulated hardware platforms.

The return value of this function is ignored on Win32 but is
important on Linux (see also the sample plugin source on Linux).
Values are as follows:

0 = normal processing
-1 = quit emulator (Esc pressed e.g. or window closed)
Any other value is assumed to be a X keycode to pass to
the GPU plugin, so it's snapshot and other control keys
operate.
