1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Felix Arends
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include "lcd-charcells.h"
24 #include "lcd-remote.h"
28 #include "backlight.h"
30 #include "sim_tasks.h"
31 #include "button-sdl.h"
32 #include "backlight.h"
36 #ifdef HAVE_TOUCHSCREEN
37 #include "touchscreen.h"
38 static int mouse_coords
= 0;
40 /* how long until repeat kicks in */
41 #define REPEAT_START 6
43 /* the speed repeat starts at */
44 #define REPEAT_INTERVAL_START 4
46 /* speed repeat finishes at */
47 #define REPEAT_INTERVAL_FINISH 2
49 #ifdef HAVE_TOUCHSCREEN
50 #define USB_KEY SDLK_c /* SDLK_u is taken by BUTTON_MIDLEFT */
52 #define USB_KEY SDLK_u
55 #if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES)
56 int _remote_type
=REMOTETYPE_H100_LCD
;
64 struct event_queue button_queue
;
66 static int btn
= 0; /* Hopefully keeps track of currently pressed keys... */
68 #ifdef HAS_BUTTON_HOLD
69 bool hold_button_state
= false;
70 bool button_hold(void) {
71 return hold_button_state
;
75 #ifdef HAS_REMOTE_BUTTON_HOLD
76 bool remote_hold_button_state
= false;
77 bool remote_button_hold(void) {
78 return remote_hold_button_state
;
82 void button_event(int key
, bool pressed
)
85 static bool usb_connected
= false;
86 if (usb_connected
&& key
!= USB_KEY
)
91 #ifdef HAVE_TOUCHSCREEN
92 case BUTTON_TOUCHSCREEN
:
93 switch (touchscreen_get_mode())
95 case TOUCHSCREEN_POINT
:
96 new_btn
= BUTTON_TOUCHSCREEN
;
98 case TOUCHSCREEN_BUTTON
:
100 static int touchscreen_buttons
[3][3] = {
101 {BUTTON_TOPLEFT
, BUTTON_TOPMIDDLE
, BUTTON_TOPRIGHT
},
102 {BUTTON_MIDLEFT
, BUTTON_CENTER
, BUTTON_MIDRIGHT
},
103 {BUTTON_BOTTOMLEFT
, BUTTON_BOTTOMMIDDLE
, BUTTON_BOTTOMRIGHT
},
105 int px_x
= ((mouse_coords
&0xffff0000)>>16);
106 int px_y
= ((mouse_coords
&0x0000ffff));
107 new_btn
= touchscreen_buttons
[px_y
/(LCD_HEIGHT
/3)][px_x
/(LCD_WIDTH
/3)];
114 new_btn
= BUTTON_TOPLEFT
;
119 new_btn
= BUTTON_TOPMIDDLE
;
123 new_btn
= BUTTON_TOPRIGHT
;
128 new_btn
= BUTTON_MIDLEFT
;
132 new_btn
= BUTTON_CENTER
;
137 new_btn
= BUTTON_MIDRIGHT
;
141 new_btn
= BUTTON_BOTTOMLEFT
;
146 new_btn
= BUTTON_BOTTOMMIDDLE
;
150 new_btn
= BUTTON_BOTTOMRIGHT
;
155 touchscreen_set_mode(touchscreen_get_mode() == TOUCHSCREEN_POINT
? TOUCHSCREEN_BUTTON
: TOUCHSCREEN_POINT
);
156 printf("Touchscreen mode: %s\n", touchscreen_get_mode() == TOUCHSCREEN_POINT
? "TOUCHSCREEN_POINT" : "TOUCHSCREEN_BUTTON");
164 usb_connected
= !usb_connected
;
166 queue_post(&button_queue
, SYS_USB_CONNECTED
, 0);
168 queue_post(&button_queue
, SYS_USB_DISCONNECTED
, 0);
172 #ifdef HAS_BUTTON_HOLD
176 hold_button_state
= !hold_button_state
;
177 DEBUGF("Hold button is %s\n", hold_button_state
?"ON":"OFF");
182 #ifdef HAS_REMOTE_BUTTON_HOLD
186 remote_hold_button_state
= !remote_hold_button_state
;
187 DEBUGF("Remote hold button is %s\n",
188 remote_hold_button_state
?"ON":"OFF");
193 #if CONFIG_KEYPAD == GIGABEAT_PAD
196 new_btn
= BUTTON_LEFT
;
200 new_btn
= BUTTON_RIGHT
;
208 new_btn
= BUTTON_DOWN
;
212 new_btn
= BUTTON_POWER
;
215 new_btn
= BUTTON_POWER
;
224 new_btn
= BUTTON_SELECT
;
228 new_btn
= BUTTON_MENU
;
231 new_btn
= BUTTON_VOL_UP
;
234 new_btn
= BUTTON_VOL_DOWN
;
237 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
240 new_btn
= BUTTON_LEFT
;
244 new_btn
= BUTTON_RIGHT
;
252 new_btn
= BUTTON_DOWN
;
256 new_btn
= BUTTON_POWER
;
261 new_btn
= BUTTON_PLAY
;
264 new_btn
= BUTTON_BACK
;
268 new_btn
= BUTTON_SELECT
;
273 new_btn
= BUTTON_MENU
;
276 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
279 new_btn
= BUTTON_LEFT
;
283 new_btn
= BUTTON_RIGHT
;
291 new_btn
= BUTTON_DOWN
;
295 new_btn
= BUTTON_PLAY
;
298 new_btn
= BUTTON_POWER
;
303 new_btn
= BUTTON_POWER
;
307 new_btn
= BUTTON_REC
;
311 new_btn
= BUTTON_SELECT
;
314 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
317 new_btn
= BUTTON_LEFT
;
321 new_btn
= BUTTON_RIGHT
;
325 new_btn
= BUTTON_VOL_UP
;
329 new_btn
= BUTTON_VOL_DOWN
;
333 new_btn
= BUTTON_MODE
;
337 new_btn
= BUTTON_REC
;
341 new_btn
= BUTTON_PLAY
;
344 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \
345 || (CONFIG_KEYPAD == IPOD_4G_PAD)
348 new_btn
= BUTTON_LEFT
;
352 new_btn
= BUTTON_RIGHT
;
356 new_btn
= BUTTON_SCROLL_BACK
;
360 new_btn
= BUTTON_SCROLL_FWD
;
364 new_btn
= BUTTON_PLAY
;
368 new_btn
= BUTTON_SELECT
;
372 new_btn
= BUTTON_MENU
;
375 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
378 new_btn
= BUTTON_LEFT
;
382 new_btn
= BUTTON_RIGHT
;
386 new_btn
= BUTTON_SCROLL_UP
;
390 new_btn
= BUTTON_SCROLL_DOWN
;
394 new_btn
= BUTTON_POWER
;
397 new_btn
= BUTTON_POWER
;
401 new_btn
= BUTTON_REW
;
403 case SDLK_KP_MULTIPLY
:
409 new_btn
= BUTTON_PLAY
;
412 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
417 case REMOTETYPE_UNPLUGGED
:
418 _remote_type
=REMOTETYPE_H100_LCD
;
419 DEBUGF("Changed remote type to H100\n");
421 case REMOTETYPE_H100_LCD
:
422 _remote_type
=REMOTETYPE_H300_LCD
;
423 DEBUGF("Changed remote type to H300\n");
425 case REMOTETYPE_H300_LCD
:
426 _remote_type
=REMOTETYPE_H300_NONLCD
;
427 DEBUGF("Changed remote type to H300 NON-LCD\n");
429 case REMOTETYPE_H300_NONLCD
:
430 _remote_type
=REMOTETYPE_UNPLUGGED
;
431 DEBUGF("Changed remote type to none\n");
437 new_btn
= BUTTON_LEFT
;
441 new_btn
= BUTTON_RIGHT
;
449 new_btn
= BUTTON_DOWN
;
458 new_btn
= BUTTON_OFF
;
462 new_btn
= BUTTON_REC
;
466 new_btn
= BUTTON_SELECT
;
470 new_btn
= BUTTON_MODE
;
473 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
476 new_btn
= BUTTON_LEFT
;
480 new_btn
= BUTTON_RIGHT
;
488 new_btn
= BUTTON_DOWN
;
492 new_btn
= BUTTON_PLAY
;
501 new_btn
= BUTTON_SELECT
;
505 new_btn
= BUTTON_MODE
;
508 #elif CONFIG_KEYPAD == ONDIO_PAD
511 new_btn
= BUTTON_LEFT
;
515 new_btn
= BUTTON_RIGHT
;
523 new_btn
= BUTTON_DOWN
;
528 new_btn
= BUTTON_OFF
;
532 new_btn
= BUTTON_MENU
;
535 #elif CONFIG_KEYPAD == PLAYER_PAD
538 new_btn
= BUTTON_LEFT
;
542 new_btn
= BUTTON_RIGHT
;
546 new_btn
= BUTTON_PLAY
;
550 new_btn
= BUTTON_STOP
;
558 new_btn
= BUTTON_MENU
;
561 #elif CONFIG_KEYPAD == RECORDER_PAD
564 new_btn
= BUTTON_LEFT
;
568 new_btn
= BUTTON_RIGHT
;
576 new_btn
= BUTTON_DOWN
;
585 new_btn
= BUTTON_OFF
;
591 case SDLK_KP_MULTIPLY
:
601 new_btn
= BUTTON_PLAY
;
604 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
607 new_btn
= BUTTON_LEFT
;
611 new_btn
= BUTTON_RIGHT
;
619 new_btn
= BUTTON_DOWN
;
628 new_btn
= BUTTON_OFF
;
634 case SDLK_KP_MULTIPLY
:
644 new_btn
= BUTTON_SELECT
;
647 #elif CONFIG_KEYPAD == SANSA_E200_PAD
650 new_btn
= BUTTON_LEFT
;
654 new_btn
= BUTTON_RIGHT
;
658 new_btn
= BUTTON_SCROLL_BACK
;
662 new_btn
= BUTTON_SCROLL_FWD
;
670 new_btn
= BUTTON_DOWN
;
674 new_btn
= BUTTON_POWER
;
678 new_btn
= BUTTON_REC
;
682 new_btn
= BUTTON_SELECT
;
685 #elif CONFIG_KEYPAD == SANSA_C200_PAD
688 new_btn
= BUTTON_LEFT
;
692 new_btn
= BUTTON_RIGHT
;
700 new_btn
= BUTTON_DOWN
;
703 new_btn
= BUTTON_POWER
;
706 new_btn
= BUTTON_REC
;
711 new_btn
= BUTTON_SELECT
;
714 new_btn
= BUTTON_VOL_DOWN
;
717 new_btn
= BUTTON_VOL_UP
;
720 #elif CONFIG_KEYPAD == MROBE500_PAD
722 new_btn
= BUTTON_RC_HEART
;
725 new_btn
= BUTTON_RC_MODE
;
728 new_btn
= BUTTON_RC_VOL_DOWN
;
731 new_btn
= BUTTON_RC_VOL_UP
;
735 case SDLK_LEFTBRACKET
:
737 new_btn
= BUTTON_LEFT
;
741 case SDLK_RIGHTBRACKET
:
742 case SDLK_KP_MULTIPLY
:
743 new_btn
= BUTTON_RIGHT
;
746 new_btn
= BUTTON_RC_PLAY
;
749 new_btn
= BUTTON_RC_DOWN
;
753 new_btn
= BUTTON_POWER
;
755 #elif CONFIG_KEYPAD == MROBE100_PAD
757 new_btn
= BUTTON_RC_HEART
;
760 new_btn
= BUTTON_RC_MODE
;
763 new_btn
= BUTTON_RC_VOL_DOWN
;
766 new_btn
= BUTTON_RC_VOL_UP
;
769 new_btn
= BUTTON_RC_FF
;
772 new_btn
= BUTTON_RC_REW
;
775 new_btn
= BUTTON_RC_PLAY
;
778 new_btn
= BUTTON_RC_DOWN
;
781 new_btn
= BUTTON_DISPLAY
;
784 new_btn
= BUTTON_MENU
;
787 new_btn
= BUTTON_PLAY
;
790 new_btn
= BUTTON_LEFT
;
793 new_btn
= BUTTON_RIGHT
;
799 new_btn
= BUTTON_DOWN
;
803 new_btn
= BUTTON_SELECT
;
805 case SDLK_KP_MULTIPLY
:
808 new_btn
= BUTTON_POWER
;
811 #elif CONFIG_KEYPAD == COWON_D2_PAD
812 case SDLK_KP_MULTIPLY
:
817 new_btn
= BUTTON_POWER
;
821 new_btn
= BUTTON_PLUS
;
825 new_btn
= BUTTON_MINUS
;
831 new_btn
= BUTTON_MENU
;
833 #elif CONFIG_KEYPAD == IAUDIO67_PAD
835 new_btn
= BUTTON_RIGHT
;
838 new_btn
= BUTTON_LEFT
;
841 new_btn
= BUTTON_STOP
;
846 new_btn
= BUTTON_PLAY
;
849 new_btn
= BUTTON_VOLUP
;
852 new_btn
= BUTTON_VOLDOWN
;
855 new_btn
= BUTTON_MENU
;
858 new_btn
= BUTTON_POWER
;
860 #elif CONFIG_KEYPAD == CREATIVEZVM_PAD
862 new_btn
= BUTTON_BACK
;
865 new_btn
= BUTTON_MENU
;
868 new_btn
= BUTTON_CUSTOM
;
871 new_btn
= BUTTON_PLAY
;
875 new_btn
= BUTTON_LEFT
;
879 new_btn
= BUTTON_RIGHT
;
887 new_btn
= BUTTON_DOWN
;
891 new_btn
= BUTTON_SELECT
;
893 case SDLK_KP_MULTIPLY
:
896 new_btn
= BUTTON_POWER
;
898 #elif CONFIG_KEYPAD == CREATIVEZV_PAD
900 new_btn
= BUTTON_PREV
;
903 new_btn
= BUTTON_NEXT
;
906 new_btn
= BUTTON_BACK
;
909 new_btn
= BUTTON_PLAY
;
912 new_btn
= BUTTON_MENU
;
916 new_btn
= BUTTON_LEFT
;
920 new_btn
= BUTTON_RIGHT
;
928 new_btn
= BUTTON_DOWN
;
932 new_btn
= BUTTON_SELECT
;
934 case SDLK_KP_MULTIPLY
:
937 new_btn
= BUTTON_POWER
;
940 new_btn
= BUTTON_VOL_DOWN
;
943 new_btn
= BUTTON_VOL_UP
;
945 #elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
947 new_btn
= BUTTON_PREV
;
950 new_btn
= BUTTON_NEXT
;
955 new_btn
= BUTTON_PLAY
;
959 new_btn
= BUTTON_MENU
;
967 new_btn
= BUTTON_DOWN
;
971 new_btn
= BUTTON_SELECT
;
973 #elif CONFIG_KEYPAD == SANSA_FUZE_PAD
976 new_btn
= BUTTON_LEFT
;
980 new_btn
= BUTTON_RIGHT
;
984 new_btn
= BUTTON_SCROLL_BACK
;
988 new_btn
= BUTTON_SCROLL_FWD
;
996 new_btn
= BUTTON_DOWN
;
1000 new_btn
= BUTTON_POWER
;
1002 case SDLK_KP_MULTIPLY
:
1003 new_btn
= BUTTON_HOME
;
1009 new_btn
= BUTTON_SELECT
;
1011 #elif CONFIG_KEYPAD == SANSA_CLIP_PAD
1014 new_btn
= BUTTON_LEFT
;
1018 new_btn
= BUTTON_RIGHT
;
1022 new_btn
= BUTTON_UP
;
1026 new_btn
= BUTTON_DOWN
;
1030 case SDLK_KP_MULTIPLY
:
1031 new_btn
= BUTTON_HOME
;
1035 new_btn
= BUTTON_SELECT
;
1039 new_btn
= BUTTON_VOL_DOWN
;
1043 new_btn
= BUTTON_VOL_UP
;
1047 new_btn
= BUTTON_POWER
;
1049 #elif CONFIG_KEYPAD == SANSA_M200_PAD
1052 new_btn
= BUTTON_LEFT
;
1056 new_btn
= BUTTON_RIGHT
;
1060 new_btn
= BUTTON_UP
;
1064 new_btn
= BUTTON_DOWN
;
1067 new_btn
= BUTTON_POWER
;
1070 new_btn
= BUTTON_SELECT
;
1073 new_btn
= BUTTON_VOL_DOWN
;
1076 new_btn
= BUTTON_VOL_UP
;
1078 #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
1081 new_btn
= BUTTON_LEFT
;
1085 new_btn
= BUTTON_RIGHT
;
1089 new_btn
= BUTTON_UP
;
1093 new_btn
= BUTTON_DOWN
;
1096 new_btn
= BUTTON_MENU
;
1100 new_btn
= BUTTON_PLAY
;
1103 new_btn
= BUTTON_PREV
;
1106 new_btn
= BUTTON_NEXT
;
1110 new_btn
= BUTTON_POWER
;
1113 new_btn
= BUTTON_VOL_UP
;
1116 new_btn
= BUTTON_VOL_DOWN
;
1118 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
1121 new_btn
= BUTTON_LEFT
;
1125 new_btn
= BUTTON_RIGHT
;
1129 new_btn
= BUTTON_UP
;
1133 new_btn
= BUTTON_DOWN
;
1137 new_btn
= BUTTON_SELECT
;
1141 new_btn
= BUTTON_POWER
;
1144 new_btn
= BUTTON_PLAYLIST
;
1147 new_btn
= BUTTON_VOL_UP
;
1150 new_btn
= BUTTON_VOL_DOWN
;
1153 new_btn
= BUTTON_MENU
;
1156 new_btn
= BUTTON_VIEW
;
1158 #elif CONFIG_KEYPAD == ONDAVX747_PAD
1160 new_btn
= BUTTON_POWER
;
1165 case SDLK_RIGHTBRACKET
:
1166 case SDLK_KP_MULTIPLY
:
1167 new_btn
= BUTTON_VOL_UP
;
1172 case SDLK_LEFTBRACKET
:
1173 case SDLK_KP_DIVIDE
:
1174 new_btn
= BUTTON_VOL_DOWN
;
1178 new_btn
= BUTTON_MENU
;
1180 #elif CONFIG_KEYPAD == ONDAVX777_PAD
1182 new_btn
= BUTTON_POWER
;
1184 #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
1187 new_btn
= BUTTON_LEFT
;
1191 new_btn
= BUTTON_RIGHT
;
1195 new_btn
= BUTTON_UP
;
1199 new_btn
= BUTTON_DOWN
;
1203 new_btn
= BUTTON_PLAY
;
1207 new_btn
= BUTTON_FFWD
;
1209 #ifdef SAMSUNG_YH820
1215 new_btn
= BUTTON_REW
;
1218 new_btn
= BUTTON_REC
;
1220 #elif CONFIG_KEYPAD == MINI2440_PAD
1222 new_btn
= BUTTON_LEFT
;
1225 new_btn
= BUTTON_RIGHT
;
1228 new_btn
= BUTTON_UP
;
1231 new_btn
= BUTTON_DOWN
;
1235 new_btn
= BUTTON_POWER
;
1243 new_btn
= BUTTON_SELECT
;
1245 case SDLK_KP_PERIOD
:
1247 new_btn
= BUTTON_MENU
;
1250 new_btn
= BUTTON_VOL_UP
;
1253 new_btn
= BUTTON_VOL_DOWN
;
1255 #elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
1258 new_btn
= BUTTON_PREV
;
1262 new_btn
= BUTTON_NEXT
;
1266 new_btn
= BUTTON_UP
;
1270 new_btn
= BUTTON_DOWN
;
1273 new_btn
= BUTTON_MENU
;
1276 new_btn
= BUTTON_PLAY
;
1279 new_btn
= BUTTON_OK
;
1281 case SDLK_KP_DIVIDE
:
1282 new_btn
= BUTTON_CANCEL
;
1285 new_btn
= BUTTON_POWER
;
1287 case SDLK_KP_MULTIPLY
:
1288 new_btn
= BUTTON_REC
;
1291 #error No keymap defined!
1292 #endif /* CONFIG_KEYPAD */
1297 sim_trigger_screendump();
1303 /* Call to make up for scrollwheel target implementation. This is
1304 * not handled in the main button.c driver, but on the target
1305 * implementation (look at button-e200.c for example if you are trying to
1306 * figure out why using button_get_data needed a hack before).
1308 #if defined(BUTTON_SCROLL_FWD) && defined(BUTTON_SCROLL_BACK)
1309 if((new_btn
== BUTTON_SCROLL_FWD
|| new_btn
== BUTTON_SCROLL_BACK
) &&
1312 /* Clear these buttons from the data - adding them to the queue is
1313 * handled in the scrollwheel drivers for the targets. They do not
1314 * store the scroll forward/back buttons in their button data for
1315 * the button_read call.
1317 #ifdef HAVE_BACKLIGHT
1320 #ifdef HAVE_BUTTON_LIGHT
1323 queue_post(&button_queue
, new_btn
, 1<<24);
1324 new_btn
&= ~(BUTTON_SCROLL_FWD
| BUTTON_SCROLL_BACK
);
1333 #if defined(HAVE_BUTTON_DATA) && defined(HAVE_TOUCHSCREEN)
1334 int button_read_device(int* data
)
1336 *data
= mouse_coords
;
1338 int button_read_device(void)
1342 #ifdef HAS_BUTTON_HOLD
1343 int hold_button
= button_hold();
1345 #ifdef HAVE_BACKLIGHT
1346 /* light handling */
1347 static int hold_button_old
= false;
1348 if (hold_button
!= hold_button_old
)
1350 hold_button_old
= hold_button
;
1351 backlight_hold_changed(hold_button
);
1363 #ifdef HAVE_TOUCHSCREEN
1364 extern bool debug_wps
;
1365 void mouse_tick_task(void)
1367 static int last_check
= 0;
1369 if (TIME_BEFORE(current_tick
, last_check
+(HZ
/10)))
1371 last_check
= current_tick
;
1372 if (SDL_GetMouseState(&x
, &y
) & SDL_BUTTON(SDL_BUTTON_LEFT
))
1379 if(x
<0 || y
<0 || x
>SIM_LCD_WIDTH
|| y
>SIM_LCD_HEIGHT
)
1383 mouse_coords
= (x
<<16)|y
;
1384 button_event(BUTTON_TOUCHSCREEN
, true);
1386 printf("Mouse at: (%d, %d)\n", x
, y
);
1391 void button_init_sdl(void)
1393 #ifdef HAVE_TOUCHSCREEN
1394 tick_add_task(mouse_tick_task
);
1398 /* Button maps: simulated key, x, y, radius, name */
1399 /* Run sim with --mapping to get coordinates */
1400 /* or --debugbuttons to check */
1401 /* The First matching button is returned */
1404 struct button_map bm
[] = {
1405 { SDLK_KP8
, 70, 265, 35, "Scroll Back" },
1406 { SDLK_KP9
, 141, 255, 31, "Play" },
1407 { SDLK_KP_MULTIPLY
, 228, 267, 18, "Home" },
1408 { SDLK_LEFT
, 69, 329, 31, "Left" },
1409 { SDLK_SPACE
, 141, 330, 20, "Select" },
1410 { SDLK_RIGHT
, 214, 331, 23, "Right" },
1411 { SDLK_KP3
, 142, 406, 30, "Menu" },
1412 { SDLK_DOWN
, 221, 384, 24, "Scroll Fwd" },
1413 { SDLK_KP_MINUS
, 270, 299, 25, "Power" },
1414 { SDLK_h
, 269, 358, 26, "Hold" },
1415 { 0, 0, 0, 0, "None" }
1417 #elif defined (SANSA_CLIP)
1418 struct button_map bm
[] = {
1419 { SDLK_KP_MULTIPLY
, 165, 158, 17, "Home" },
1420 { SDLK_KP5
, 102, 230, 29, "Select" },
1421 { SDLK_KP8
, 100, 179, 25, "Play" },
1422 { SDLK_KP4
, 53, 231, 21, "Left" },
1423 { SDLK_KP6
, 147, 232, 19, "Right" },
1424 { SDLK_KP2
, 105, 275, 22, "Menu" },
1425 { 0, 0, 0, 0, "None" }
1427 #elif defined (SANSA_C200) || defined(SANSA_C200V2)
1428 struct button_map bm
[] = {
1430 { SDLK_KP7
, 84, 7, 21, "Vol Down" },
1431 { SDLK_KP9
, 158, 7, 20, "Vol Up" },
1432 { SDLK_KP1
, 173, 130, 27, "Record" },
1433 { SDLK_KP5
, 277, 75, 21, "Select" },
1434 { SDLK_KP4
, 233, 75, 24, "Left" },
1435 { SDLK_KP6
, 313, 74, 18, "Right" },
1436 { SDLK_KP8
, 276, 34, 15, "Play" },
1437 { SDLK_KP2
, 277, 119, 17, "Down" },
1438 { SDLK_KP3
, 314, 113, 19, "Menu" },
1439 { 0, 0, 0, 0, "None" }
1441 #elif defined (SANSA_E200V2) || defined(SANSA_E200)
1442 struct button_map bm
[] = {
1443 { SDLK_KP7
, 5, 92, 18, "Record" },
1444 { SDLK_KP9
, 128, 295, 43, "Play" },
1445 { SDLK_KP4
, 42, 380, 33, "Left" },
1446 { SDLK_KP5
, 129, 378, 36, "Select" },
1447 { SDLK_KP6
, 218, 383, 30, "Right" },
1448 { SDLK_KP3
, 129, 461, 29, "Down" },
1449 { SDLK_KP1
, 55, 464, 20, "Menu" },
1450 { SDLK_KP8
, 92, 338, 17, "Scroll Back" },
1451 { SDLK_KP2
, 167, 342, 17, "Scroll Fwd" },
1452 { 0, 0, 0, 0, "None" }
1454 #elif defined (SANSA_M200V4)
1455 struct button_map bm
[] = {
1456 { SDLK_KP_PLUS
, 54, 14, 16, "Power" },
1457 { SDLK_KP7
, 96, 13, 12, "Vol Down" },
1458 { SDLK_KP9
, 139, 14, 14, "Vol Up" },
1459 { SDLK_KP5
, 260, 82, 20, "Select" },
1460 { SDLK_KP8
, 258, 35, 30, "Play" },
1461 { SDLK_KP4
, 214, 84, 25, "Left" },
1462 { SDLK_KP6
, 300, 83, 24, "Right" },
1463 { SDLK_KP2
, 262, 125, 28, "Repeat" },
1464 { SDLK_h
, 113, 151, 21, "Hold" },
1465 { 0, 0, 0, 0, "None" }
1467 #elif defined (IPOD_VIDEO)
1468 struct button_map bm
[] = {
1469 { SDLK_KP_PERIOD
, 174, 350, 35, "Menu" },
1470 { SDLK_KP8
, 110, 380, 33, "Scroll Back" },
1471 { SDLK_KP2
, 234, 377, 34, "Scroll Fwd" },
1472 { SDLK_KP4
, 78, 438, 47, "Left" },
1473 { SDLK_KP5
, 172, 435, 43, "Select" },
1474 { SDLK_KP6
, 262, 438, 52, "Right" },
1475 { SDLK_KP_PLUS
, 172, 519, 43, "Play" },
1476 { 0, 0, 0 , 0, "None" }
1478 #elif defined (IPOD_MINI) || defined(IPOD_MINI2G)
1479 struct button_map bm
[] = {
1480 { SDLK_KP5
, 92, 267, 29, "Select" },
1481 { SDLK_KP4
, 31, 263, 37, "Left" },
1482 { SDLK_KP6
, 150, 268, 33, "Right" },
1483 { SDLK_KP_PERIOD
, 93, 209, 30, "Menu" },
1484 { SDLK_KP_PLUS
, 93, 324, 25, "Play" },
1485 { SDLK_KP8
, 53, 220, 29, "Scroll Back" },
1486 { SDLK_KP2
, 134, 219, 31, "Scroll Fwd" },
1487 { 0, 0, 0 , 0, "None" }
1489 #elif defined (IPOD_3G)
1490 struct button_map bm
[] = {
1491 { SDLK_KP5
, 108, 296, 26, "Select" },
1492 { SDLK_KP8
, 70, 255, 26, "Scroll Back" },
1493 { SDLK_KP2
, 149, 256, 28, "Scroll Fwd" },
1494 { SDLK_KP4
, 27, 186, 22, "Left" },
1495 { SDLK_KP_PERIOD
, 82, 185, 22, "Menu" },
1496 { SDLK_KP_PERIOD
, 133, 185, 21, "Play" },
1497 { SDLK_KP6
, 189, 188, 21, "Right" },
1498 { 0, 0, 0 , 0, "None" }
1500 #elif defined (IPOD_4G)
1501 struct button_map bm
[] = {
1502 { SDLK_KP5
, 96, 269, 27, "Select" },
1503 { SDLK_KP4
, 39, 267, 30, "Left" },
1504 { SDLK_KP6
, 153, 270, 27, "Right" },
1505 { SDLK_KP_PERIOD
, 96, 219, 30, "Menu" },
1506 { SDLK_KP_PLUS
, 95, 326, 27, "Play" },
1507 { SDLK_KP8
, 57, 233, 29, "Scroll Back" },
1508 { SDLK_KP2
, 132, 226, 29, "Scroll Fwd" },
1509 { 0, 0, 0 , 0, "None" }
1511 #elif defined (IPOD_COLOR)
1512 struct button_map bm
[] = {
1513 { SDLK_KP5
, 128, 362, 35, "Select" },
1514 { SDLK_KP4
, 55, 358, 38, "Left" },
1515 { SDLK_KP6
, 203, 359, 39, "Right" },
1516 { SDLK_KP_PERIOD
, 128, 282, 34, "Menu" },
1517 { SDLK_KP_PLUS
, 129, 439, 41, "Play" },
1518 { SDLK_KP8
, 76, 309, 34, "Scroll Back" },
1519 { SDLK_KP2
, 182, 311, 45, "Scroll Fwd" },
1520 { 0, 0, 0 , 0, "None" }
1522 #elif defined (IPOD_1G2G)
1523 struct button_map bm
[] = {
1524 { SDLK_KP5
, 112, 265, 31, "Select" },
1525 { SDLK_KP8
, 74, 224, 28, "Scroll Back" },
1526 { SDLK_KP2
, 146, 228, 28, "Scroll Fwd" },
1527 /* Dummy button to make crescent shape */
1528 { SDLK_y
, 112, 265, 76, "None" },
1529 { SDLK_KP8
, 74, 224, 28, "Scroll Back" },
1530 { SDLK_KP2
, 146, 228, 28, "Scroll Fwd" },
1531 { SDLK_KP6
, 159, 268, 64, "Right" },
1532 { SDLK_KP4
, 62, 266, 62, "Left" },
1533 { SDLK_KP_PERIOD
, 111, 216, 64, "Menu" },
1534 { SDLK_KP_PLUS
, 111, 326, 55, "Down" },
1535 { 0, 0, 0 , 0, "None" }
1537 #elif defined (IPOD_NANO)
1538 struct button_map bm
[] = {
1539 { SDLK_KP5
, 98, 316, 37, "Select" },
1540 { SDLK_KP4
, 37, 312, 28, "Left" },
1541 { SDLK_KP6
, 160, 313, 25, "Right" },
1542 { SDLK_KP_PERIOD
,102, 256, 23, "Menu" },
1543 { SDLK_KP_PLUS
, 99, 378, 28, "Play" },
1544 { SDLK_KP8
, 58, 272, 24, "Scroll Back" },
1545 { SDLK_KP2
, 141, 274, 22, "Scroll Fwd" },
1546 { 0, 0, 0 , 0, "None" }
1548 #elif defined (IPOD_NANO2G)
1549 struct button_map bm
[] = {
1550 { SDLK_KP5
, 118, 346, 37, "Select" },
1551 { SDLK_KP4
, 51, 345, 28, "Left" },
1552 { SDLK_KP6
, 180, 346, 26, "Right" },
1553 { SDLK_KP_PERIOD
, 114, 286, 23, "Menu" },
1554 { SDLK_KP_PLUS
, 115, 412, 27, "Down" },
1555 { SDLK_KP8
, 67, 303, 28, "Scroll Back" },
1556 { SDLK_KP2
, 163, 303, 27, "Scroll Fwd" },
1557 { 0, 0, 0 , 0, "None" }
1559 #elif defined (COWON_D2)
1560 struct button_map bm
[] = {
1561 { SDLK_DELETE
, 51, 14, 17, "Power" },
1562 { SDLK_h
, 138, 14, 16, "Hold" },
1563 { SDLK_MINUS
, 320, 14, 10, "Minus" },
1564 { SDLK_INSERT
, 347, 13, 13, "Menu" },
1565 { SDLK_KP_PLUS
, 374, 14, 12, "Plus" },
1566 { 0, 0, 0, 0, "None" }
1568 #elif defined (IAUDIO_M3)
1569 struct button_map bm
[] = {
1570 { SDLK_KP5
, 256, 72, 29, "Play" },
1571 { SDLK_KP6
, 255, 137, 28, "Right" },
1572 { SDLK_KP4
, 257, 201, 26, "Left" },
1573 { SDLK_KP8
, 338, 31, 27, "Up" },
1574 { SDLK_KP2
, 339, 92, 23, "Down" },
1575 { SDLK_KP_DIVIDE
, 336, 147, 23, "Rec" },
1576 { SDLK_h
, 336, 212, 30, "Hold" },
1577 { 0, 0, 0, 0, "None" }
1579 #elif defined (IAUDIO_M5)
1580 struct button_map bm
[] = {
1581 { SDLK_KP_ENTER
, 333, 41, 17, "Enter" },
1582 { SDLK_h
, 334, 74, 21, "Hold" },
1583 { SDLK_KP_DIVIDE
, 333, 142, 24, "Record" },
1584 { SDLK_KP_PLUS
, 332, 213, 20, "Play" },
1585 { SDLK_KP5
, 250, 291, 19, "Select" },
1586 { SDLK_KP8
, 249, 236, 32, "Up" },
1587 { SDLK_KP4
, 194, 292, 29, "Left" },
1588 { SDLK_KP6
, 297, 290, 27, "Right" },
1589 { SDLK_KP2
, 252, 335, 28, "Down" },
1590 { 0, 0, 0, 0, "None" }
1592 #elif defined (IAUDIO_7)
1593 struct button_map bm
[] = {
1594 { 0, 0, 0, 0, "None" }
1596 #elif defined (IAUDIO_X5)
1597 struct button_map bm
[] = {
1598 { SDLK_KP_ENTER
, 275, 38, 17, "Power" },
1599 { SDLK_h
, 274, 83, 16, "Hold" },
1600 { SDLK_KP_DIVIDE
, 276, 128, 22, "Record" },
1601 { SDLK_KP_PLUS
, 274, 186, 22, "Play" },
1602 { SDLK_KP5
, 200, 247, 16, "Select" },
1603 { SDLK_KP8
, 200, 206, 16, "Up" },
1604 { SDLK_KP4
, 163, 248, 19, "Left" },
1605 { SDLK_KP6
, 225, 247, 24, "Right" },
1606 { SDLK_KP2
, 199, 279, 20, "Down" },
1607 { 0, 0, 0, 0, "None" }
1609 #elif defined (ARCHOS_PLAYER)
1610 struct button_map bm
[] = {
1611 { SDLK_KP_PLUS
, 79, 252, 23, "On" },
1612 { SDLK_KP_PERIOD
, 81, 310, 20, "Menu" },
1613 { SDLK_KP8
, 154, 237, 28, "Play" },
1614 { SDLK_KP4
, 121, 282, 23, "Left" },
1615 { SDLK_KP6
, 187, 282, 22, "Right" },
1616 { SDLK_KP2
, 157, 312, 20, "Down" },
1617 { 0, 0, 0, 0, "None" }
1619 #elif defined (ARCHOS_RECORDER)
1620 struct button_map bm
[] = {
1621 { SDLK_F1
, 94, 205, 22, "F1" },
1622 { SDLK_F2
, 136, 204, 21, "F2" },
1623 { SDLK_F3
, 174, 204, 24, "F3" },
1624 { SDLK_KP_PLUS
, 75, 258, 19, "On" },
1625 { SDLK_KP_ENTER
, 76, 307, 15, "Off" },
1626 { SDLK_KP5
, 151, 290, 20, "Select" },
1627 { SDLK_KP8
, 152, 251, 23, "Up" },
1628 { SDLK_KP4
, 113, 288, 26, "Left" },
1629 { SDLK_KP6
, 189, 291, 23, "Right" },
1630 { SDLK_KP2
, 150, 327, 27, "Down" },
1631 { 0, 0, 0, 0, "None" }
1633 #elif defined (ARCHOS_FMRECORDER) || defined (ARCHOS_RECORDERV2)
1634 struct button_map bm
[] = {
1635 { SDLK_F1
, 88, 210, 28, "F1" },
1636 { SDLK_F2
, 144, 212, 28, "F2" },
1637 { SDLK_F3
, 197, 212, 28, "F3" },
1638 { SDLK_KP5
, 144, 287, 21, "Select" },
1639 { SDLK_KP_PLUS
, 86, 320, 13, "Menu" },
1640 { SDLK_KP_ENTER
, 114, 347, 13, "Stop" },
1641 { SDLK_y
, 144, 288, 31, "None" },
1642 { SDLK_KP8
, 144, 259, 25, "Up" },
1643 { SDLK_KP2
, 144, 316, 31, "Down" },
1644 { SDLK_KP6
, 171, 287, 32, "Right" },
1645 { SDLK_KP4
, 117, 287, 31, "Left" },
1646 { 0, 0, 0, 0, "None" }
1648 #elif defined (ARCHOS_ONDIOSP) || defined (ARCHOS_ONDIOFM)
1649 struct button_map bm
[] = {
1650 { SDLK_KP_ENTER
, 75, 23, 30, "Enter" },
1651 { SDLK_KP8
, 75, 174, 33, "KP8" },
1652 { SDLK_KP4
, 26, 186, 48, "KP4" },
1653 { SDLK_KP6
, 118, 196, 32, "KP6" },
1654 { SDLK_KP2
, 75, 234, 16, "KP2" },
1655 { SDLK_KP_PERIOD
, 54, 250, 24, "Period" },
1656 { 0, 0, 0, 0, "None" }
1658 #elif defined (IRIVER_H10)
1659 struct button_map bm
[] = {
1660 { SDLK_KP_PLUS
, 38, 70, 37, "Power" },
1661 { SDLK_KP4
, 123, 194, 26, "Cancel" },
1662 { SDLK_KP6
, 257, 195, 34, "Select" },
1663 { SDLK_KP8
, 190, 221, 28, "Up" },
1664 { SDLK_KP2
, 192, 320, 27, "Down" },
1665 { SDLK_KP_DIVIDE
, 349, 49, 20, "Rew" },
1666 { SDLK_KP5
, 349, 96, 20, "Play" },
1667 { SDLK_KP_MULTIPLY
, 350, 141, 23, "FF" },
1668 { 0, 0, 0, 0, "None" }
1670 #elif defined (IRIVER_H10_5GB)
1671 struct button_map bm
[] = {
1672 { SDLK_KP_PLUS
, 34, 76, 23, "Power" },
1673 { SDLK_KP4
, 106, 222, 28, "Cancel" },
1674 { SDLK_KP6
, 243, 220, 31, "Select" },
1675 { SDLK_KP8
, 176, 254, 34, "Up" },
1676 { SDLK_KP2
, 175, 371, 35, "Down" },
1677 { SDLK_KP_DIVIDE
, 319, 63, 26, "Rew" },
1678 { SDLK_KP5
, 320, 124, 26, "Play" },
1679 { SDLK_KP_MULTIPLY
, 320, 181, 32, "FF" },
1680 { 0, 0, 0, 0, "None" }
1682 #elif defined (IRIVER_H120) || defined (IRIVER_H100)
1683 struct button_map bm
[] = {
1684 { SDLK_KP_DIVIDE
, 46, 162, 13, "Record" },
1685 { SDLK_KP_PLUS
, 327, 36, 16, "Play" },
1686 { SDLK_KP_ENTER
, 330, 99, 18, "Stop" },
1687 { SDLK_KP_PERIOD
, 330, 163, 18, "AB" },
1688 { SDLK_KP5
, 186, 227, 27, "5" },
1689 { SDLK_KP8
, 187, 185, 19, "8" },
1690 { SDLK_KP4
, 142, 229, 23, "4" },
1691 { SDLK_KP6
, 231, 229, 22, "6" },
1692 { SDLK_KP2
, 189, 272, 28, "2" },
1693 /* Remote Buttons */
1694 { SDLK_KP_ENTER
, 250, 404, 20, "Stop" },
1695 { SDLK_SPACE
, 285, 439, 29, "Space" },
1696 { SDLK_h
, 336, 291, 24, "Hold" },
1697 { 0, 0, 0, 0, "None" }
1699 #elif defined (IRIVER_H300)
1700 struct button_map bm
[] = {
1701 { SDLK_KP_PLUS
, 56, 335, 20, "Play" },
1702 { SDLK_KP8
, 140, 304, 29, "Up" },
1703 { SDLK_KP_DIVIDE
, 233, 331, 23, "Record" },
1704 { SDLK_KP_ENTER
, 54, 381, 24, "Stop" },
1705 { SDLK_KP4
, 100, 353, 17, "Left" },
1706 { SDLK_KP5
, 140, 351, 19, "Navi" },
1707 { SDLK_KP6
, 185, 356, 19, "Right" },
1708 { SDLK_KP_PERIOD
, 230, 380, 20, "AB" },
1709 { SDLK_KP2
, 142, 402, 24, "Down" },
1710 { SDLK_KP_ENTER
, 211, 479, 21, "Stop" },
1711 { SDLK_KP_PLUS
, 248, 513, 29, "Play" },
1712 { 0, 0, 0, 0, "None" }
1714 #elif defined (MROBE_500)
1715 struct button_map bm
[] = {
1716 { SDLK_KP9
, 171, 609, 9, "Play" },
1717 { SDLK_KP4
, 158, 623, 9, "Left" },
1718 { SDLK_KP6
, 184, 622, 9, "Right" },
1719 { SDLK_KP7
, 171, 638, 11, "Menu" },
1720 { 0, 0, 0, 0, "None" }
1722 #elif defined (MROBE_100)
1723 struct button_map bm
[] = {
1724 { SDLK_KP7
, 80, 233, 30, "Menu" },
1725 { SDLK_KP8
, 138, 250, 19, "Up" },
1726 { SDLK_KP9
, 201, 230, 27, "Play" },
1727 { SDLK_KP4
, 63, 305, 25, "Left" },
1728 { SDLK_KP5
, 125, 309, 28, "Select" },
1729 { SDLK_KP6
, 200, 307, 35, "Right" },
1730 { SDLK_KP1
, 52, 380, 32, "Display" },
1731 { SDLK_KP2
, 125, 363, 30, "Down" },
1732 { SDLK_KP9
, 168, 425, 10, "Play" },
1733 { SDLK_KP4
, 156, 440, 11, "Left" },
1734 { SDLK_KP6
, 180, 440, 13, "Right" },
1735 { SDLK_KP7
, 169, 452, 10, "Menu" },
1736 { SDLK_KP_MULTIPLY
, 222, 15, 16, "Power" },
1737 { 0, 0, 0, 0, "None" }
1739 #elif defined (GIGABEAT_F)
1740 struct button_map bm
[] = {
1741 { SDLK_KP_PLUS
, 361, 187, 22, "Power" },
1742 { SDLK_KP_PERIOD
, 361, 270, 17, "Menu" },
1743 { SDLK_KP9
, 365, 345, 26, "Vol Up" },
1744 { SDLK_KP3
, 363, 433, 25, "Vol Down" },
1745 { SDLK_KP_ENTER
, 365, 520, 19, "A" },
1746 { SDLK_KP8
, 167, 458, 35, "Up" },
1747 { SDLK_KP4
, 86, 537, 29, "Left" },
1748 { SDLK_KP5
, 166, 536, 30, "Select" },
1749 { SDLK_KP6
, 248, 536, 30, "Right" },
1750 { SDLK_KP2
, 169, 617, 28, "Down" },
1751 { 0, 0, 0, 0, "None" }
1753 #elif defined (GIGABEAT_S)
1754 struct button_map bm
[] = {
1755 { SDLK_KP_PLUS
, 416, 383, 23, "Play" },
1756 { SDLK_KP7
, 135, 442, 46, "Back" },
1757 { SDLK_KP9
, 288, 447, 35, "Menu" },
1758 { SDLK_KP8
, 214, 480, 32, "Up" },
1759 { SDLK_KP4
, 128, 558, 33, "Left" },
1760 { SDLK_KP5
, 214, 556, 34, "Select" },
1761 { SDLK_KP6
, 293, 558, 35, "Right" },
1762 { SDLK_KP2
, 214, 637, 38, "Down" },
1763 { 0, 0, 0, 0, "None" }
1765 #elif defined (SAMSUNG_YH820)
1766 struct button_map bm
[] = {
1767 { SDLK_KP_PLUS
, 330, 53, 23, "Record" },
1768 { SDLK_KP7
, 132, 208, 21, "Left" },
1769 { SDLK_KP5
, 182, 210, 18, "Play" },
1770 { SDLK_KP9
, 234, 211, 22, "Right" },
1771 { SDLK_KP8
, 182, 260, 15, "Up" },
1772 { SDLK_KP4
, 122, 277, 29, "Menu" },
1773 { SDLK_KP6
, 238, 276, 25, "Select" },
1774 { SDLK_KP2
, 183, 321, 24, "Down" },
1775 { 0, 0, 0, 0, "None" }
1777 #elif defined (SAMSUNG_YH920) || defined (SAMSUNG_YH925)
1778 struct button_map bm
[] = {
1779 { SDLK_KP9
, 370, 32, 15, "FF" },
1780 { SDLK_KP5
, 369, 84, 25, "Play" },
1781 { SDLK_KP5
, 367, 125, 27, "Play" },
1782 { SDLK_KP3
, 369, 188, 17, "Rew" },
1783 { SDLK_KP_PLUS
, 370, 330, 30, "Record" },
1784 { SDLK_KP4
, 146, 252, 32, "Menu" },
1785 { SDLK_KP8
, 204, 226, 27, "Up" },
1786 { SDLK_KP6
, 257, 250, 34, "Select" },
1787 { SDLK_KP2
, 205, 294, 35, "Down" },
1788 { 0, 0, 0, 0, "None" }
1790 #elif defined (ONDA_VX747) || defined (ONDA_VX747P)
1791 struct button_map bm
[] = {
1792 { SDLK_MINUS
, 113, 583, 28, "Minus" },
1793 { SDLK_PLUS
, 227, 580, 28, "Plus" },
1794 { SDLK_RETURN
, 171, 583, 34, "Menu" },
1795 { 0, 0, 0, 0, "None" }
1797 #elif defined (PHILIPS_SA9200)
1798 struct button_map bm
[] = {
1799 { SDLK_KP_ENTER
, 25, 155, 33, "Power" },
1800 { SDLK_PAGEUP
, 210, 98, 31, "Vol Up" },
1801 { SDLK_PAGEDOWN
, 210, 168, 34, "Vol Down" },
1802 { SDLK_KP7
, 40, 249, 26, "Prev" },
1803 { SDLK_KP8
, 110, 247, 22, "Up" },
1804 { SDLK_KP9
, 183, 249, 31, "Next" },
1805 { SDLK_KP4
, 45, 305, 25, "Left" },
1806 { SDLK_KP5
, 111, 304, 24, "Play" },
1807 { SDLK_KP6
, 183, 304, 21, "Right" },
1808 { SDLK_KP1
, 43, 377, 21, "Menu" },
1809 { SDLK_KP2
, 112, 371, 24, "Down" },
1810 { 0, 0, 0, 0, "None" }
1812 #elif defined (CREATIVE_ZVM) || defined (CREATIVE_ZVM60GB) || \
1813 defined (CREATIVE_ZV)
1814 struct button_map bm
[] = {
1815 { SDLK_KP7
, 52, 414, 35, "Custom" },
1816 { SDLK_KP8
, 185, 406, 55, "Up" },
1817 { SDLK_KP9
, 315, 421, 46, "Play" },
1818 { SDLK_KP4
, 122, 500, 41, "Left" },
1819 { SDLK_KP6
, 247, 493, 49, "Right" },
1820 { SDLK_KP1
, 58, 577, 49, "Back" },
1821 { SDLK_KP2
, 186, 585, 46, "Down" },
1822 { SDLK_KP3
, 311, 569, 47, "Menu" },
1823 { 0, 0, 0, 0, "None" }
1826 struct button_map bm
[] = {
1831 int xy2button( int x
, int y
) {
1833 extern bool debug_buttons
;
1835 for ( i
= 0; bm
[i
].button
; i
++ )
1836 /* check distance from center of button < radius */
1837 if ( ( (x
-bm
[i
].x
)*(x
-bm
[i
].x
) ) + ( ( y
-bm
[i
].y
)*(y
-bm
[i
].y
) ) < bm
[i
].radius
*bm
[i
].radius
) {
1839 printf("Button: %s\n", bm
[i
].description
);
1840 return bm
[i
].button
;