AmigaInput - The new Gaming-API for AmigaOS
From the viewpoint of a game programmer there is
one area of the AmigaOS API, which has been behind the development of other
operating systems since quite a while. I am talking about the area of the Input/Gaming
APIs. In Windows there is DirectInput, in MacOS 9 there is InputSprockets -
on AmigaOS we have a bunch of different APIs which are not compatible to each
other and some hardware supports this API, some other hardware that API (lowlevel.library,
gameport.device, psxport.device and several devices are even supported only
by "direct hardware access").
For a game programmer that up to now meant either to only support
some of the available input devices, or to write a lot of input handling code.
When a new input device or adapter gets released it means that support for this
needs to be explicitly added to the game instead of the user installing a new
driver. This situation was of course unacceptable. So on the planning stages
of OS 4 Hyperion Entertainment decided, that we need a Gaming-API for the Amiga.
AmigaInput and its API have been designed and developed by Sven Ottemann, Hans-Joerg
Frieden and myself, with additional work by Thomas Frieden. Christopher Kossa
and myself have developed the Preferences GUI.
AmigaInput is a driver system consisting of a main-library and a
set of drivers, which are actually AmigaOS 4 shared libraries. Every driver
can implement a number of modules (for example the PSX Port driver implements
the modules Classic_PSX, Classic_PSX_Digital, Classic_PSX_Wheel, Classic_PSX_Gun
and Classic_PSX_Mouse). The naming scheme of these modules is as follows:
Classic_xxxxxx |
This driver only works on the Classic Amiga |
Generic_xxxxxx |
This driver works on all Amigas running
OS 4 (including the AmigaOne) |
PCI_xxxxxx |
This driver runs on all Amigas running OS
4 which have PCI |
AmigaOne_xxxxxx |
This driver only works on the AmigaOne |
|
|
AmigaInput supports gamepads, mice and keyboards. Of course each type can be
categorized into subtypes like Flightstick, Wheel, Joystick, and a lot of other
subtypes.
A game, which would need to use an input device, would ask AmigaInput
for a list of suitable devices. Providing a so-called enumeration-function to
AmigaInput does this. This enumeration-function is provided by the developer
of the game and specifies the requirements for the game (for example "Minimum
number of buttons/axes" or "Needed device-type"). What data is
available (axes, hats, buttons, coordinates,.) of course depends on the type
of controller (a Joystick has different data available to a Mouse for example).
The core idea of AmigaInput is that a game does not need to know
what sort of input devices are attached to the Amiga.
All sorts of devices would work with the game, and not a single line of code
would need to be changed, in case a new input device becomes available. The
only thing, which needs to be ensured, is that an AmigaInput-driver for the
new device is developed. AmigaInput drivers contain very little code (the driver
for analog-joysticks for example is sized only 7 KB) the main program logic
is sitting in the main-library.
Screenshot 1 - AmigaInput Preferences
To give you a general idea of the system, screenshot 1 shows the
Preferences-GUI of AmigaInput running. The drivers that are currently in development
(most of them already fully completed) are:
Driver |
Hardware |
AI_Generic_Mouse.library |
Generic Mouse Driver |
AI_Generic_Keyboard.library |
Generic Keyboard Driver |
AI_Classic_PSX.library |
PSX Port Driver |
AI_Classic_PC.library |
PC Analog Stick, using Interface to Classic
Joystick Port |
AI_Classic_CD32.library |
CD32 Pad in Classic-Amiga |
AI_Classic_AJoystick.library |
Amiga-Joystick in Classic-Amiga |
AI_Classic_Sega3.library |
Sega Genesis Joypad without X/Y/Z/Mode Buttons
using Interface to Classic Amiga Joystick Port |
AI_Classic_Sega6.library |
Sega Genesis Joypad with X/Y/Z/Mode Buttons
using Interface to Classic Amiga Joystick Port |
AI_Classic_Play4.library |
Support for the good old 4-Player-Adapter |
AI_Generic_USB.library |
Generic USB Gamepad driver for a certain
range of Gamepads |
AI_PCI_Catweasel.library |
Support for Joysticks plugged into Catweasel
MK3 |
|
|
All drivers are done fully in C-Code. It should be noted that the PSX Port
driver is currently for Amiga Classic only, but we are investigating if it is
possible to use the hardware (possibly with minor adaptations) in an AmigaOne
and if there might be an AI_AmigaOne_PSX.library at one point. Thanks go to
Joe Fenton who provided us with the full source-code of psxport.device, so that
we could implement PPC Native PSX Port support for AmigaInput. I'd also like
to thank Dreamworlds Development for information about the programming of the
Amiga 4-Player-Adapter.
We might release further drivers - like for example for N64 or SNES
or TurboGraphX gamepads using special adapters - at a later point, after the
OS 4.0 release. People who are working on special adapters for certain kinds
of controllers should be free to contact me at SteffenH@hyperion-entertainment.com,
so that AmigaInput support for their hardware can be guaranteed.
Concerning mice and keyboards, these drivers support all mice and
keyboards, which are supported by OS 4's input and keyboard.device.
Obviously as important as a good gaming API is that there is enough
software, which actually uses this API. Of course all future PPC native Hyperion
Entertainment titles will use AmigaInput for gamepad/mouse/keyboard support.
At one point we will also release updates for our old titles, which will update
them to OS 4 native binaries, which will also add AmigaInput support.
Screenshot 2
But of course there are old - mostly 68k - titles which might not
get an OS 4 or even PPC version, especially games from the old Commodore times.
In order to allow users to play these games on an AmigaOne (which after all
does not have an AmigaClassic-style joystick-port) we developed a new version
of the lowlevel.library, which internally uses AmigaInput. Screenshot 2 shows
the Preferences GUI for the new lowlevel.library. Here you can set up lowlevel.library
to use specific AmigaInput drivers. Obviously games, which directly "hit
the hardware", won't work on an AmigaOne (though they still might work
on an A4000 or A1200 running OS 4).
One immediate question users unfamiliar with OS 4 technology might
have is "Wait a moment, isn't AmigaInput PPC Native, but those old games
using lowlevel.library are 68k?" The trick is that the OS 4 Operating System
will "detect" when a 68k program calls lowlevel.library and will ensure
that the code "switches" into PPC Mode, calling the PPC Native lowlevel.library
(and in effect the PPC Native AmigaInput). Generally AmigaInput will only work
on Amiga's running Amiga OS 4. For OS 4 native Programs we actually recommend
to no longer use lowlevel.library, but using AmigaInput directly, so that gaming
controllers with analog mode or "more buttons" can be supported to
their full capabilities instead of being limited to the capabilities of a CD32-Pad.
Steffen Haeuser
Hyperion Entertainment
|