xbox360w.class makes Xbox 360 wireless controllers usable on the Amiga
through the "Xbox 360 Wireless Receiver for Windows" (USB 045E:0719, also
045E:0291) and the Poseidon USB stack.
Up to four pads appear to programs as CD32 game controllers through
lowlevel.library/ReadJoyPort(). Programs and games that read the joystick
with lowlevel.library (CD32 titles running under the OS, SDL ports, many
emulators and newer games) see the pad without any change. The complete pad
state - both analog sticks, analog triggers and every button - is also
published for programs that want more than a CD32 pad can carry.
FEATURES
--------
- Binds automatically to the wireless receiver, four pads per receiver
- Pads show up as CD32 game controllers on lowlevel ports 0-3
- Pad to port mapping, stick dead zone, trigger threshold and left stick
on/off are set in a settings window opened from Trident
- The receiver can be kept out of Poseidon's idle auto-suspend
- Hot plugging of the receiver, pads connecting and disconnecting
- Player LED on the pad shows its slot
- Full pad state in a public semaphore (see Developer/xbox360w.h)
- joyview: test program that shows all lowlevel ports and the full
Xbox pad state (sticks, triggers, all buttons)
BUTTON MAPPING
--------------
Xbox pad CD32 pad (lowlevel.library)
-------------------- ---------------------------
D-pad, left stick directions
A red
B blue
X green
Y yellow
RB, RT forward (right shoulder)
LB, LT reverse (left shoulder)
Start play
Back, Guide, the right stick and the stick buttons have no CD32
equivalent; they are only in the published full state.
REQUIREMENTS
------------
- AmigaOS 3.x, 68020 or better
- Poseidon 6.x from the AROS-lineage backport
(https://github.com/rondoval/poseidon-backport). The class uses the
class interface of that Poseidon (usbGetAttrsA, usbSetAttrsA and
usbDoMethodA only) and does NOT work with Poseidon 4.x/5.x.
- lowlevel.library V40 or newer
- Microsoft "Xbox 360 Wireless Receiver for Windows" and Xbox 360
wireless controllers. Wired Xbox 360 pads are handled by arosx.class.
Tested on an A1200 with PiStorm/Emu68, AmigaOS 3.2.3, Poseidon 6.1/6.2.
INSTALLATION
------------
Automatic: double-click the "Install" icon in the unpacked drawer, or
run the script from a Shell:
CD RAM:xbox360w
Execute Install
It copies the class to SYS:Classes/USB, joyview to SYS:Utilities and asks
whether to register the class in Poseidon and save the Poseidon prefs.
The previous class is kept as xbox360w.class.old and the previous prefs
as ENVARC:Sys/poseidon.prefs.bak.
By hand:
1. Copy Classes/USB/xbox360w.class to SYS:Classes/USB/
2. Start Trident, go to "Classes", press "Add" and select
SYS:Classes/USB/xbox360w.class (or press "Scan")
3. Press "Save" in Trident
4. Plug in the receiver and press the Guide button on the pad until its
ring lights up; the first quarter lights for pad 1
Updating: copy the new class over the old one and reboot.
SETTINGS
--------
In Trident select xbox360w.class in "Classes" and press "Settings":
Pad 1-4 lowlevel port of each pad: Off, Port 0 (mouse port),
Port 1 (joystick port), Port 2, Port 3
Stick dead zone how far the left stick must move to give a
direction (5-90 %)
Trigger threshold how far LT/RT must be pressed to give a shoulder
button (5-95 %)
Left stick moves the left stick also gives directions
Keep receiver awake keep Poseidon from suspending the idle receiver
Save stores the settings in the Poseidon prefs, Use applies them until the
next boot, Cancel restores the previous settings. Changes are applied at
once while the window is open.
Defaults: pad 1 -> port 1, pad 2 -> port 2, pad 3 -> port 3, pad 4 ->
port 0. For CD32 games and SDL ports set pad 2 to port 0: their second
player reads the mouse port. While a pad is mapped to port 0 and
connected, ReadJoyPort(0) returns the pad instead of the mouse; the
Workbench pointer is not affected.
JOYVIEW
-------
joyview shows the four lowlevel ports as pad drawings and, below them,
the full state of an Xbox pad: both sticks, LT/RT values and all buttons.
Keys 1-4 choose the Xbox pad shown, 0 the first connected one, Esc or the
close gadget quits.
LIMITATIONS
-----------
- Only programs that use lowlevel.library see the pad. Games that read
the joystick hardware directly, and anything started through WHDLoad
(which shuts the OS down), cannot see a USB pad. For those a USB to
DB9 joystick adapter is needed.
- Directions from the left stick are digital, like a CD32 pad.
- Vibration, the headset and the chatpad are not supported.
- Two receivers work, but their pads share the same four slots.
- The pads switch themselves off after a while without input; press
Guide to reconnect.
TOOLS
-----
Tools/xbclass adds, removes and lists Poseidon classes at run time and can
save the Poseidon prefs (xbclass ADD <path> | REM <name> | LIST | SAVE |
GUI <class> | GUICLOSE <class>). The installer uses it.
FOR PROGRAMMERS
---------------
Developer/xbox360w.h describes the full pad state the class publishes in
the public semaphore "xbox360w.state": analog sticks (-32768..32767, up is
positive), triggers (0..255), all buttons, connection state and the
lowlevel port of each pad. Read it like this:
Forbid();
if ((st = (struct XB360WState *)FindSemaphore(XB360W_SEMNAME)))
ObtainSemaphoreShared(&st->sem);
Permit();
if (st) {
... copy st->pad[] ...
ReleaseSemaphore(&st->sem);
}
Do not keep the pointer between reads. joyview.c is a complete example.
The full source is in the Source drawer and builds with an m68k-amigaos
gcc cross compiler and the Poseidon SDK headers (see Source/Makefile).
HISTORY
-------
1.3 first public release
LICENSE
-------
MIT, see LICENSE. Use at your own risk.
|