Subject: pkg/36502: emulators/darcnes gets keys wrong
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Magnus Henoch <mange@freemail.hu>
List: pkgsrc-bugs
Date: 06/16/2007 13:50:00
>Number:         36502
>Category:       pkg
>Synopsis:       emulators/darcnes gets keys wrong
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 16 13:50:00 +0000 2007
>Originator:     Magnus Henoch
>Release:        NetBSD 4.99.16
>Organization:
	
>Environment:
	
	
System: NetBSD zemdatav 4.99.16 NetBSD 4.99.16 (IBOOK) #3: Fri Mar 30 12:56:33 CEST 2007 magnus@zemdatav:/media/e/netbsd/obj/sys/arch/macppc/compile/IBOOK macppc
Architecture: powerpc
Machine: macppc
>Description:
	The darcnes game system emulator (version 20010401nb2) doesn't
	properly react to keypresses.  Only some of the game buttons
	are available, and through quite illogical keys; e.g. the
	"down" button on the keyboard seems to push the A button in
	the game.

	I get lots of these warnings; they seem to be a symptom:

sms.c:37: warning: excess elements in array initializer
sms.c:37: warning: (near initialization for 'sms_joypad_template_pause.buttons')

	The joypad_button_template struct in ui.h uses a zero-length
	array as its last field.  My guess is that newer gcc versions
	don't use the "superfluous" elements as older ones used to.

>How-To-Repeat:

>Fix:
	This patch fixes the problem for me.

diff -c /home/magnus/src/darcnes/ui.h\~ /home/magnus/src/darcnes/ui.h
--- /home/magnus/src/darcnes/ui.h~	Thu Jun 29 03:06:05 2000
+++ /home/magnus/src/darcnes/ui.h	Sat Jun 16 15:31:00 2007
@@ -37,7 +37,7 @@
 
 struct joypad_button_template {
     int num_buttons;
-    unsigned long buttons[0];
+    unsigned long buttons[10];	/* shouldn't need more than that */
 };
 
 struct joypad {

Diff finished.  Sat Jun 16 15:35:44 2007

>Unformatted: