diff options
Diffstat (limited to 'uisimulator/buttonmap/ipod.c')
-rw-r--r-- | uisimulator/buttonmap/ipod.c | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/uisimulator/buttonmap/ipod.c b/uisimulator/buttonmap/ipod.c new file mode 100644 index 0000000000..504b77b8dd --- /dev/null +++ b/uisimulator/buttonmap/ipod.c | |||
@@ -0,0 +1,136 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <SDL.h> | ||
24 | #include "button.h" | ||
25 | #include "config.h" | ||
26 | #include "buttonmap.h" | ||
27 | |||
28 | int key_to_button(int keyboard_button) | ||
29 | { | ||
30 | int new_btn = BUTTON_NONE; | ||
31 | switch (keyboard_button) | ||
32 | { | ||
33 | case SDLK_KP4: | ||
34 | case SDLK_LEFT: | ||
35 | new_btn = BUTTON_LEFT; | ||
36 | break; | ||
37 | case SDLK_KP6: | ||
38 | case SDLK_RIGHT: | ||
39 | new_btn = BUTTON_RIGHT; | ||
40 | break; | ||
41 | case SDLK_KP8: | ||
42 | case SDLK_UP: | ||
43 | new_btn = BUTTON_SCROLL_BACK; | ||
44 | break; | ||
45 | case SDLK_KP2: | ||
46 | case SDLK_DOWN: | ||
47 | new_btn = BUTTON_SCROLL_FWD; | ||
48 | break; | ||
49 | case SDLK_KP_PLUS: | ||
50 | case SDLK_F8: | ||
51 | new_btn = BUTTON_PLAY; | ||
52 | break; | ||
53 | case SDLK_KP5: | ||
54 | case SDLK_SPACE: | ||
55 | new_btn = BUTTON_SELECT; | ||
56 | break; | ||
57 | case SDLK_KP_PERIOD: | ||
58 | case SDLK_INSERT: | ||
59 | new_btn = BUTTON_MENU; | ||
60 | break; | ||
61 | } | ||
62 | return new_btn; | ||
63 | } | ||
64 | |||
65 | struct button_map bm[] = { | ||
66 | #if defined (IPOD_VIDEO) | ||
67 | { SDLK_KP_PERIOD, 174, 350, 35, "Menu" }, | ||
68 | { SDLK_KP8, 110, 380, 33, "Scroll Back" }, | ||
69 | { SDLK_KP2, 234, 377, 34, "Scroll Fwd" }, | ||
70 | { SDLK_KP4, 78, 438, 47, "Left" }, | ||
71 | { SDLK_KP5, 172, 435, 43, "Select" }, | ||
72 | { SDLK_KP6, 262, 438, 52, "Right" }, | ||
73 | { SDLK_KP_PLUS, 172, 519, 43, "Play" }, | ||
74 | #elif defined (IPOD_MINI) || defined(IPOD_MINI2G) | ||
75 | { SDLK_KP5, 92, 267, 29, "Select" }, | ||
76 | { SDLK_KP4, 31, 263, 37, "Left" }, | ||
77 | { SDLK_KP6, 150, 268, 33, "Right" }, | ||
78 | { SDLK_KP_PERIOD, 93, 209, 30, "Menu" }, | ||
79 | { SDLK_KP_PLUS, 93, 324, 25, "Play" }, | ||
80 | { SDLK_KP8, 53, 220, 29, "Scroll Back" }, | ||
81 | { SDLK_KP2, 134, 219, 31, "Scroll Fwd" }, | ||
82 | #elif defined (IPOD_3G) | ||
83 | { SDLK_KP5, 108, 296, 26, "Select" }, | ||
84 | { SDLK_KP8, 70, 255, 26, "Scroll Back" }, | ||
85 | { SDLK_KP2, 149, 256, 28, "Scroll Fwd" }, | ||
86 | { SDLK_KP4, 27, 186, 22, "Left" }, | ||
87 | { SDLK_KP_PERIOD, 82, 185, 22, "Menu" }, | ||
88 | { SDLK_KP_PERIOD, 133, 185, 21, "Play" }, | ||
89 | { SDLK_KP6, 189, 188, 21, "Right" }, | ||
90 | #elif defined (IPOD_4G) | ||
91 | { SDLK_KP5, 96, 269, 27, "Select" }, | ||
92 | { SDLK_KP4, 39, 267, 30, "Left" }, | ||
93 | { SDLK_KP6, 153, 270, 27, "Right" }, | ||
94 | { SDLK_KP_PERIOD, 96, 219, 30, "Menu" }, | ||
95 | { SDLK_KP_PLUS, 95, 326, 27, "Play" }, | ||
96 | { SDLK_KP8, 57, 233, 29, "Scroll Back" }, | ||
97 | { SDLK_KP2, 132, 226, 29, "Scroll Fwd" }, | ||
98 | #elif defined (IPOD_COLOR) | ||
99 | { SDLK_KP5, 128, 362, 35, "Select" }, | ||
100 | { SDLK_KP4, 55, 358, 38, "Left" }, | ||
101 | { SDLK_KP6, 203, 359, 39, "Right" }, | ||
102 | { SDLK_KP_PERIOD, 128, 282, 34, "Menu" }, | ||
103 | { SDLK_KP_PLUS, 129, 439, 41, "Play" }, | ||
104 | { SDLK_KP8, 76, 309, 34, "Scroll Back" }, | ||
105 | { SDLK_KP2, 182, 311, 45, "Scroll Fwd" }, | ||
106 | #elif defined (IPOD_1G2G) | ||
107 | { SDLK_KP5, 112, 265, 31, "Select" }, | ||
108 | { SDLK_KP8, 74, 224, 28, "Scroll Back" }, | ||
109 | { SDLK_KP2, 146, 228, 28, "Scroll Fwd" }, | ||
110 | /* Dummy button to make crescent shape */ | ||
111 | { SDLK_y, 112, 265, 76, "None" }, | ||
112 | { SDLK_KP8, 74, 224, 28, "Scroll Back" }, | ||
113 | { SDLK_KP2, 146, 228, 28, "Scroll Fwd" }, | ||
114 | { SDLK_KP6, 159, 268, 64, "Right" }, | ||
115 | { SDLK_KP4, 62, 266, 62, "Left" }, | ||
116 | { SDLK_KP_PERIOD, 111, 216, 64, "Menu" }, | ||
117 | { SDLK_KP_PLUS, 111, 326, 55, "Down" }, | ||
118 | #elif defined (IPOD_NANO) | ||
119 | { SDLK_KP5, 98, 316, 37, "Select" }, | ||
120 | { SDLK_KP4, 37, 312, 28, "Left" }, | ||
121 | { SDLK_KP6, 160, 313, 25, "Right" }, | ||
122 | { SDLK_KP_PERIOD,102, 256, 23, "Menu" }, | ||
123 | { SDLK_KP_PLUS, 99, 378, 28, "Play" }, | ||
124 | { SDLK_KP8, 58, 272, 24, "Scroll Back" }, | ||
125 | { SDLK_KP2, 141, 274, 22, "Scroll Fwd" }, | ||
126 | #elif defined (IPOD_NANO2G) | ||
127 | { SDLK_KP5, 118, 346, 37, "Select" }, | ||
128 | { SDLK_KP4, 51, 345, 28, "Left" }, | ||
129 | { SDLK_KP6, 180, 346, 26, "Right" }, | ||
130 | { SDLK_KP_PERIOD, 114, 286, 23, "Menu" }, | ||
131 | { SDLK_KP_PLUS, 115, 412, 27, "Down" }, | ||
132 | { SDLK_KP8, 67, 303, 28, "Scroll Back" }, | ||
133 | { SDLK_KP2, 163, 303, 27, "Scroll Fwd" }, | ||
134 | #endif | ||
135 | { 0, 0, 0 , 0, "None" } | ||
136 | }; | ||