Fix Pacbox controls for D2 touchscreen
[Rockbox.git] / apps / plugins / pacbox / pacbox.h
blobdc0017eb352886065d8a6f332b9d9bf797839d97
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Pacbox - a Pacman Emulator for Rockbox
12 * Based on PIE - Pacman Instructional Emulator
14 * Copyright (c) 1997-2003,2004 Alessandro Scotti
15 * http://www.ascotti.org/
17 * All files in this archive are subject to the GNU General Public License.
18 * See the file COPYING in the source tree root for full license agreement.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
25 /* Platform-specific defines - used in both C and ASM files */
27 #ifndef _PACBOX_H
28 #define _PACBOX_H
30 #include "config.h"
32 #if CONFIG_KEYPAD == IPOD_4G_PAD
34 #define PACMAN_UP BUTTON_RIGHT
35 #define PACMAN_DOWN BUTTON_LEFT
36 #define PACMAN_LEFT BUTTON_MENU
37 #define PACMAN_RIGHT BUTTON_PLAY
38 #define PACMAN_1UP BUTTON_SELECT
39 #define PACMAN_COIN BUTTON_SELECT
40 #define PACMAN_MENU (BUTTON_MENU | BUTTON_SELECT)
42 #elif CONFIG_KEYPAD == IRIVER_H100_PAD || CONFIG_KEYPAD == IRIVER_H300_PAD
44 #define PACMAN_UP BUTTON_RIGHT
45 #define PACMAN_DOWN BUTTON_LEFT
46 #define PACMAN_LEFT BUTTON_UP
47 #define PACMAN_RIGHT BUTTON_DOWN
48 #define PACMAN_1UP BUTTON_SELECT
49 #define PACMAN_2UP BUTTON_ON
50 #define PACMAN_COIN BUTTON_REC
51 #define PACMAN_MENU BUTTON_MODE
53 #ifdef HAVE_REMOTE_LCD
55 #define PACMAN_HAS_REMOTE
57 #define PACMAN_RC_UP BUTTON_RC_VOL_UP
58 #define PACMAN_RC_DOWN BUTTON_RC_VOL_DOWN
59 #define PACMAN_RC_LEFT BUTTON_RC_REW
60 #define PACMAN_RC_RIGHT BUTTON_RC_FF
61 #define PACMAN_RC_1UP BUTTON_RC_SOURCE
62 #define PACMAN_RC_2UP BUTTON_RC_BITRATE
63 #define PACMAN_RC_COIN BUTTON_RC_REC
64 #define PACMAN_RC_MENU BUTTON_RC_MODE
66 #endif
68 #elif CONFIG_KEYPAD == GIGABEAT_PAD
70 #define PACMAN_UP BUTTON_UP
71 #define PACMAN_DOWN BUTTON_DOWN
72 #define PACMAN_LEFT BUTTON_LEFT
73 #define PACMAN_RIGHT BUTTON_RIGHT
74 #define PACMAN_1UP BUTTON_SELECT
75 #define PACMAN_2UP BUTTON_POWER
76 #define PACMAN_COIN BUTTON_A
77 #define PACMAN_MENU BUTTON_MENU
79 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
81 #define PACMAN_UP BUTTON_UP
82 #define PACMAN_DOWN BUTTON_DOWN
83 #define PACMAN_LEFT BUTTON_LEFT
84 #define PACMAN_RIGHT BUTTON_RIGHT
85 #define PACMAN_1UP BUTTON_SELECT
86 #define PACMAN_2UP BUTTON_POWER
87 #define PACMAN_COIN BUTTON_PLAY
88 #define PACMAN_MENU BUTTON_MENU
90 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
92 #define PACMAN_UP BUTTON_RIGHT
93 #define PACMAN_DOWN BUTTON_LEFT
94 #define PACMAN_LEFT BUTTON_UP
95 #define PACMAN_RIGHT BUTTON_DOWN
96 #define PACMAN_1UP BUTTON_SELECT
97 #define PACMAN_2UP BUTTON_POWER
98 #define PACMAN_COIN BUTTON_REC
99 #define PACMAN_MENU BUTTON_PLAY
101 #elif CONFIG_KEYPAD == SANSA_E200_PAD
103 #define PACMAN_UP BUTTON_UP
104 #define PACMAN_DOWN BUTTON_DOWN
105 #define PACMAN_LEFT BUTTON_LEFT
106 #define PACMAN_RIGHT BUTTON_RIGHT
107 #define PACMAN_1UP BUTTON_SELECT
108 #define PACMAN_2UP BUTTON_REC
109 #define PACMAN_COIN_PRE BUTTON_SELECT
110 #define PACMAN_COIN (BUTTON_SELECT | BUTTON_DOWN)
111 #define PACMAN_MENU BUTTON_POWER
113 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
115 #if defined(IRIVER_H10_5GB)
116 #define PACMAN_UP BUTTON_SCROLL_UP
117 #define PACMAN_DOWN BUTTON_SCROLL_DOWN
118 #define PACMAN_LEFT BUTTON_LEFT
119 #define PACMAN_RIGHT BUTTON_RIGHT
120 #else
121 #define PACMAN_UP BUTTON_RIGHT
122 #define PACMAN_DOWN BUTTON_LEFT
123 #define PACMAN_LEFT BUTTON_SCROLL_UP
124 #define PACMAN_RIGHT BUTTON_SCROLL_DOWN
125 #endif
127 #define PACMAN_1UP BUTTON_REW
128 #define PACMAN_2UP BUTTON_POWER
129 #define PACMAN_COIN BUTTON_FF
130 #define PACMAN_MENU BUTTON_PLAY
132 #elif CONFIG_KEYPAD == MROBE500_PAD
134 #define PACMAN_UP BUTTON_RC_PLAY
135 #define PACMAN_DOWN BUTTON_RC_DOWN
136 #define PACMAN_LEFT BUTTON_RC_REW
137 #define PACMAN_RIGHT BUTTON_RC_FF
138 #define PACMAN_1UP BUTTON_RC_VOL_DOWN
139 #define PACMAN_2UP BUTTON_RC_VOL_UP
140 #define PACMAN_COIN_PRE BUTTON_RC_MODE
141 #define PACMAN_COIN (BUTTON_RC_MODE | BUTTON_RC_DOWN)
142 #define PACMAN_MENU BUTTON_POWER
144 #elif CONFIG_KEYPAD == COWOND2_PAD
146 #define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
148 #else
150 #error Keymap not defined!
152 #endif
154 #ifdef HAVE_TOUCHPAD
155 #ifndef PACMAN_UP
156 #define PACMAN_UP BUTTON_MIDRIGHT
157 #endif
158 #ifndef PACMAN_DOWN
159 #define PACMAN_DOWN BUTTON_MIDLEFT
160 #endif
161 #ifndef PACMAN_LEFT
162 #define PACMAN_LEFT BUTTON_TOPMIDDLE
163 #endif
164 #ifndef PACMAN_RIGHT
165 #define PACMAN_RIGHT BUTTON_BOTTOMMIDDLE
166 #endif
167 #ifndef PACMAN_1UP
168 #define PACMAN_1UP BUTTON_BOTTOMLEFT
169 #endif
170 #ifndef PACMAN_2UP
171 #define PACMAN_2UP BUTTON_BOTTOMRIGHT
172 #endif
173 #ifndef PACMAN_COIN
174 #define PACMAN_COIN BUTTON_CENTER
175 #endif
176 #ifndef PACMAN_MENU
177 #define PACMAN_MENU (BUTTON_TOPLEFT|BUTTON_REL)
178 #endif
179 #endif
181 #if (LCD_HEIGHT >= 288)
182 #define XOFS ((LCD_WIDTH-224)/2)
183 #define YOFS ((LCD_HEIGHT-288)/2)
184 #elif (LCD_WIDTH >= 288)
185 #define XOFS ((LCD_WIDTH-288)/2)
186 #define YOFS ((LCD_HEIGHT-224)/2)
187 #elif (LCD_WIDTH >= 220)
188 #define XOFS ((LCD_WIDTH-(288*3/4))/2)
189 #define YOFS ((LCD_HEIGHT-(224*3/4))/2)
190 #elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
191 #define XOFS ((LCD_WIDTH-(224*3/4))/2)
192 #define YOFS ((LCD_HEIGHT-(288*3/4))/2)
193 #elif (LCD_WIDTH >= 144)
194 #define XOFS ((LCD_WIDTH-288/2)/2)
195 #define YOFS ((LCD_HEIGHT-224/2)/2)
196 #elif (LCD_WIDTH >= 128)
197 #define XOFS ((LCD_WIDTH-224/2)/2)
198 #define YCLIP ((288-2*LCD_HEIGHT)/2)
199 #endif
201 /* How many video frames (out of a possible 60) we display each second.
202 NOTE: pacbox.c assumes this is an integer divisor of 60
204 #if defined(IPOD_NANO) || defined (TOSHIBA_GIGABEAT_F)
205 /* The Nano and Gigabeat can manage full-speed at 30fps (1 in 2 frames) */
206 #define FPS 30
207 #else
208 /* We aim for 20fps on the other targets (1 in 3 frames) */
209 #define FPS 20
210 #endif
212 #endif