The 3DO operating system solves this problem with the event broker, a task that monitors activity exclusively on the control port. Control port activities, or events, include the pressing of any buttons and manipulation of controls on peripherals, as well as connection and disconnection of peripherals in a daisy chain.
The event broker task starts at system bootup and stands as a kind of gatekeeper between user tasks and interactive devices on the control port. To work with interactive peripheral devices, a user task connects to the event broker and registers itself as a listener. A listener, then, is a task connected to the event broker to receive event notification from peripherals, or to pass data to peripherals.
For more information, see Chapter 9 "Understanding Devices and I/O" in 3DO System Programmer's Guide.
BS_ConnectBroker();
BS_WatchPad();
BS_WatchJoyStick();
BS_WatchMouse();
BS_WatchLGun();
Ignore
and Watch
calls with any of the
following:
BS_IgnoreCPad()
BS_IgnoreLGun()
BS_IgnoreMouse()
BS_IgnoreJoyStick()
BS_NiceWaitEvent();
BS_NiceWaitEvent()
returns a mask indicating which
devices have received data.If you receive signals other than event broker message signals, get the signals you received with:
BS_GetOtherSignals();
BS_PORT_CHANGE
indicates there has been a change
on the control port device daisy chain.
BS_GetPeripheralCount();
BS_ProcessJoyStickData();
BS_ProcessCPadData();
BS_ProcessMouseData();
BS_ProcessLGunData();
BS_DisconnectBroker();
For sample code that shows how to incorporate a light gun peripheral into a title, see the 3DO:examples:Eventbroker:Lightgun folder that is provided with this release. Sample code for other types of peripherals is also included in the 3DO:examples:Eventbroker folder.
Note: Sample code is provided to illustrate functionality and is not always the best solution to a problem.