Search
lxdream.org :: lxdream/src/maple/maple.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/maple.c
changeset 850:28782ebbd01d
prev838:9abb2fa58934
next1034:7044e01148f0
author nkeynes
date Mon Sep 08 07:56:33 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Add lightgun support
file annotate diff log raw
1.1 --- a/src/maple/maple.c Tue Sep 02 00:42:43 2008 +0000
1.2 +++ b/src/maple/maple.c Mon Sep 08 07:56:33 2008 +0000
1.3 @@ -30,7 +30,7 @@
1.4 NULL, NULL, NULL };
1.5
1.6 struct maple_device_class *maple_device_classes[] = {
1.7 - &controller_class, &keyboard_class, &mouse_class, NULL };
1.8 + &controller_class, &keyboard_class, &lightgun_class, &mouse_class, NULL };
1.9
1.10 void maple_init( void )
1.11 {
1.12 @@ -115,6 +115,7 @@
1.13 unsigned int cmd, recv_addr, send_addr;
1.14 uint32_t return_addr;
1.15 unsigned char *return_buf;
1.16 + maple_device_t dev;
1.17
1.18 last = GETBYTE(3) & 0x80; /* indicates last packet */
1.19 port = GETBYTE(2) & 0x03;
1.20 @@ -122,9 +123,19 @@
1.21 length = GETBYTE(0) & 0xFF;
1.22 return_addr = GETWORD(4);
1.23
1.24 - if( mode == 0x07 ) {
1.25 + switch( mode ) {
1.26 + case 2: /* lightgun */
1.27 + dev = maple_devices[port][0];
1.28 + if( dev != NULL && dev->start_gun != NULL ) {
1.29 + dev->start_gun(dev);
1.30 + return; // Pending
1.31 + } else {
1.32 + asic_event( EVENT_MAPLE_DMA );
1.33 + return;
1.34 + }
1.35 + case 7: /* skip */
1.36 buf += 4;
1.37 - address +=4; /* skip? */
1.38 + address +=4;
1.39 continue;
1.40 }
1.41 if( (return_addr & 0x1C000000) != 0x0C000000 ) {
1.42 @@ -159,7 +170,7 @@
1.43 }
1.44 }
1.45
1.46 - maple_device_t dev = maple_devices[port][periph];
1.47 + dev = maple_devices[port][periph];
1.48 if( dev == NULL ) {
1.49 /* no device attached */
1.50 *((uint32_t *)return_buf) = -1;
.