4 #include "maple/controller.h"
6 void controller_attach( maple_device_t dev );
7 void controller_detach( maple_device_t dev );
8 int controller_get_cond( maple_device_t dev, int function, char *outbuf,
11 static struct maple_device base_controller = {
12 MAPLE_DEVICE_TAG, CONTROLLER_IDENT, CONTROLLER_VERSION, NULL, NULL,
13 controller_get_cond, NULL, NULL, NULL,
14 controller_attach, controller_detach };
16 typedef struct controller_device {
17 struct maple_device dev;
18 uint32_t condition[2];
19 } *controller_device_t;
23 maple_device_t controller_new( )
25 controller_device_t dev = malloc( sizeof(struct controller_device) );
26 memcpy( dev, &base_controller, sizeof(base_controller) );
27 memset( dev->condition, 0, 8 );
28 dev->condition[0] = 0x0000FFFF;
29 return MAPLE_DEVICE(dev);
33 void controller_attach( maple_device_t dev )
38 void controller_detach( maple_device_t dev )
44 int controller_get_cond( maple_device_t mdev, int function, char *outbuf,
47 controller_device_t dev = (controller_device_t)mdev;
48 if( function == MAPLE_FUNC_CONTROLLER ) {
50 memcpy( outbuf, dev->condition, 8 );
53 return MAPLE_ERR_FUNC_UNSUP;
.