1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
25 ****************************************************************************/
27 /* Platform-specific defines - used in both C and ASM files */
34 #if CONFIG_KEYPAD == IPOD_4G_PAD
36 #define PACMAN_UP BUTTON_RIGHT
37 #define PACMAN_DOWN BUTTON_LEFT
38 #define PACMAN_LEFT BUTTON_MENU
39 #define PACMAN_RIGHT BUTTON_PLAY
40 #define PACMAN_1UP BUTTON_SELECT
41 #define PACMAN_COIN BUTTON_SELECT
42 #define PACMAN_MENU (BUTTON_MENU | BUTTON_SELECT)
44 #elif CONFIG_KEYPAD == IRIVER_H100_PAD || CONFIG_KEYPAD == IRIVER_H300_PAD
46 #define PACMAN_UP BUTTON_RIGHT
47 #define PACMAN_DOWN BUTTON_LEFT
48 #define PACMAN_LEFT BUTTON_UP
49 #define PACMAN_RIGHT BUTTON_DOWN
50 #define PACMAN_1UP BUTTON_SELECT
51 #define PACMAN_2UP BUTTON_ON
52 #define PACMAN_COIN BUTTON_REC
53 #define PACMAN_MENU BUTTON_MODE
55 #ifdef HAVE_REMOTE_LCD
57 #define PACMAN_HAS_REMOTE
59 #define PACMAN_RC_UP BUTTON_RC_VOL_UP
60 #define PACMAN_RC_DOWN BUTTON_RC_VOL_DOWN
61 #define PACMAN_RC_LEFT BUTTON_RC_REW
62 #define PACMAN_RC_RIGHT BUTTON_RC_FF
63 #define PACMAN_RC_1UP BUTTON_RC_SOURCE
64 #define PACMAN_RC_2UP BUTTON_RC_BITRATE
65 #define PACMAN_RC_COIN BUTTON_RC_REC
66 #define PACMAN_RC_MENU BUTTON_RC_MODE
70 #elif CONFIG_KEYPAD == GIGABEAT_PAD
72 #define PACMAN_UP BUTTON_UP
73 #define PACMAN_DOWN BUTTON_DOWN
74 #define PACMAN_LEFT BUTTON_LEFT
75 #define PACMAN_RIGHT BUTTON_RIGHT
76 #define PACMAN_1UP BUTTON_SELECT
77 #define PACMAN_2UP BUTTON_POWER
78 #define PACMAN_COIN BUTTON_A
79 #define PACMAN_MENU BUTTON_MENU
81 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
83 #define PACMAN_UP BUTTON_UP
84 #define PACMAN_DOWN BUTTON_DOWN
85 #define PACMAN_LEFT BUTTON_LEFT
86 #define PACMAN_RIGHT BUTTON_RIGHT
87 #define PACMAN_1UP BUTTON_SELECT
88 #define PACMAN_2UP BUTTON_POWER
89 #define PACMAN_COIN BUTTON_PLAY
90 #define PACMAN_MENU BUTTON_MENU
92 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
94 #define PACMAN_UP BUTTON_RIGHT
95 #define PACMAN_DOWN BUTTON_LEFT
96 #define PACMAN_LEFT BUTTON_UP
97 #define PACMAN_RIGHT BUTTON_DOWN
98 #define PACMAN_1UP BUTTON_SELECT
99 #define PACMAN_2UP BUTTON_POWER
100 #define PACMAN_COIN BUTTON_REC
101 #define PACMAN_MENU BUTTON_PLAY
103 #elif CONFIG_KEYPAD == SANSA_E200_PAD
105 #define PACMAN_UP BUTTON_UP
106 #define PACMAN_DOWN BUTTON_DOWN
107 #define PACMAN_LEFT BUTTON_LEFT
108 #define PACMAN_RIGHT BUTTON_RIGHT
109 #define PACMAN_1UP BUTTON_SELECT
110 #define PACMAN_2UP BUTTON_REC
111 #define PACMAN_COIN_PRE BUTTON_SELECT
112 #define PACMAN_COIN (BUTTON_SELECT | BUTTON_DOWN)
113 #define PACMAN_MENU BUTTON_POWER
115 #elif CONFIG_KEYPAD == SANSA_FUZE_PAD
117 #define PACMAN_UP BUTTON_RIGHT
118 #define PACMAN_DOWN BUTTON_LEFT
119 #define PACMAN_LEFT BUTTON_UP
120 #define PACMAN_RIGHT BUTTON_DOWN
121 #define PACMAN_1UP BUTTON_SELECT
122 #define PACMAN_COIN_PRE BUTTON_SELECT
123 #define PACMAN_COIN (BUTTON_SELECT | BUTTON_DOWN)
124 #define PACMAN_MENU BUTTON_HOME
126 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
128 #if defined(IRIVER_H10_5GB)
129 #define PACMAN_UP BUTTON_SCROLL_UP
130 #define PACMAN_DOWN BUTTON_SCROLL_DOWN
131 #define PACMAN_LEFT BUTTON_LEFT
132 #define PACMAN_RIGHT BUTTON_RIGHT
134 #define PACMAN_UP BUTTON_RIGHT
135 #define PACMAN_DOWN BUTTON_LEFT
136 #define PACMAN_LEFT BUTTON_SCROLL_UP
137 #define PACMAN_RIGHT BUTTON_SCROLL_DOWN
140 #define PACMAN_1UP BUTTON_REW
141 #define PACMAN_2UP BUTTON_POWER
142 #define PACMAN_COIN BUTTON_FF
143 #define PACMAN_MENU BUTTON_PLAY
145 #elif CONFIG_KEYPAD == MROBE500_PAD
147 #define PACMAN_UP BUTTON_RC_PLAY
148 #define PACMAN_DOWN BUTTON_RC_DOWN
149 #define PACMAN_LEFT BUTTON_RC_REW
150 #define PACMAN_RIGHT BUTTON_RC_FF
151 #define PACMAN_1UP BUTTON_RC_VOL_DOWN
152 #define PACMAN_2UP BUTTON_RC_VOL_UP
153 #define PACMAN_COIN_PRE BUTTON_RC_MODE
154 #define PACMAN_COIN (BUTTON_RC_MODE | BUTTON_RC_DOWN)
155 #define PACMAN_MENU BUTTON_POWER
157 #elif CONFIG_KEYPAD == COWON_D2_PAD
159 #define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
161 #elif CONFIG_KEYPAD == IAUDIO67_PAD
163 #define PACMAN_UP BUTTON_STOP
164 #define PACMAN_DOWN BUTTON_PLAY
165 #define PACMAN_LEFT BUTTON_LEFT
166 #define PACMAN_RIGHT BUTTON_RIGHT
167 #define PACMAN_1UP BUTTON_VOLDOWN
168 #define PACMAN_2UP BUTTON_VOLUP
169 #define PACMAN_COIN_PRE BUTTON_MENU
170 #define PACMAN_COIN (BUTTON_MENU | BUTTON_PLAY)
171 #define PACMAN_MENU BUTTON_POWER
173 #elif CONFIG_KEYPAD == CREATIVEZVM_PAD
175 #define PACMAN_UP BUTTON_UP
176 #define PACMAN_DOWN BUTTON_DOWN
177 #define PACMAN_LEFT BUTTON_LEFT
178 #define PACMAN_RIGHT BUTTON_RIGHT
179 #define PACMAN_1UP BUTTON_CUSTOM
180 #define PACMAN_2UP BUTTON_PLAY
181 #define PACMAN_COIN BUTTON_SELECT
182 #define PACMAN_MENU BUTTON_MENU
184 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
186 #define PACMAN_UP BUTTON_UP
187 #define PACMAN_DOWN BUTTON_DOWN
188 #define PACMAN_LEFT BUTTON_LEFT
189 #define PACMAN_RIGHT BUTTON_RIGHT
190 #define PACMAN_1UP BUTTON_VOL_UP
191 #define PACMAN_2UP BUTTON_VOL_DOWN
192 #define PACMAN_COIN BUTTON_VIEW
193 #define PACMAN_MENU BUTTON_MENU
195 #elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
197 #define PACMAN_UP BUTTON_NEXT
198 #define PACMAN_DOWN BUTTON_PREV
199 #define PACMAN_LEFT BUTTON_UP
200 #define PACMAN_RIGHT BUTTON_DOWN
201 #define PACMAN_1UP BUTTON_VOL_UP
202 #define PACMAN_2UP BUTTON_DOWN
203 #define PACMAN_COIN BUTTON_RIGHT
204 #define PACMAN_MENU BUTTON_MENU
206 #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
208 #define PACMAN_UP BUTTON_UP
209 #define PACMAN_DOWN BUTTON_DOWN
210 #define PACMAN_LEFT BUTTON_PREV
211 #define PACMAN_RIGHT BUTTON_NEXT
212 #define PACMAN_1UP BUTTON_VOL_UP
213 #define PACMAN_2UP BUTTON_VOL_DOWN
214 #define PACMAN_COIN BUTTON_MENU
215 #define PACMAN_MENU BUTTON_POWER
217 #elif CONFIG_KEYPAD == ONDAVX747_PAD
219 #define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
221 #elif CONFIG_KEYPAD == ONDAVX777_PAD
222 #define PACMAN_MENU BUTTON_POWER
224 #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
226 #define PACMAN_UP BUTTON_UP
227 #define PACMAN_DOWN BUTTON_DOWN
228 #define PACMAN_LEFT BUTTON_LEFT
229 #define PACMAN_RIGHT BUTTON_RIGHT
230 #define PACMAN_1UP BUTTON_REC
231 #define PACMAN_2UP BUTTON_REW
232 #define PACMAN_COIN BUTTON_FFWD
233 #define PACMAN_MENU BUTTON_PLAY
235 #elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
237 #define PACMAN_UP BUTTON_UP
238 #define PACMAN_DOWN BUTTON_DOWN
239 #define PACMAN_LEFT BUTTON_PREV
240 #define PACMAN_RIGHT BUTTON_NEXT
241 #define PACMAN_1UP BUTTON_PLAY
242 #define PACMAN_2UP BUTTON_REC
243 #define PACMAN_COIN BUTTON_OK
244 #define PACMAN_MENU BUTTON_MENU
246 #elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
248 #define PACMAN_UP BUTTON_UP
249 #define PACMAN_DOWN BUTTON_DOWN
250 #define PACMAN_LEFT BUTTON_LEFT
251 #define PACMAN_RIGHT BUTTON_RIGHT
252 #define PACMAN_1UP BUTTON_SELECT
253 #define PACMAN_2UP BUTTON_BACK
254 #define PACMAN_COIN BUTTON_PLAYPAUSE
255 #define PACMAN_MENU BUTTON_POWER
257 #elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
259 #define PACMAN_UP BUTTON_UP
260 #define PACMAN_DOWN BUTTON_DOWN
261 #define PACMAN_LEFT BUTTON_LEFT
262 #define PACMAN_RIGHT BUTTON_RIGHT
263 #define PACMAN_1UP BUTTON_SELECT
264 #define PACMAN_2UP BUTTON_NEXT
265 #define PACMAN_COIN BUTTON_VOL_DOWN
266 #define PACMAN_MENU BUTTON_POWER
268 #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
270 #define PACMAN_UP BUTTON_UP
271 #define PACMAN_DOWN BUTTON_DOWN
272 #define PACMAN_LEFT BUTTON_LEFT
273 #define PACMAN_RIGHT BUTTON_RIGHT
274 #define PACMAN_1UP BUTTON_SELECT
275 #define PACMAN_2UP BUTTON_POWER
276 #define PACMAN_COIN BUTTON_USER
277 #define PACMAN_MENU BUTTON_MENU
281 #error Keymap not defined!
285 #ifdef HAVE_TOUCHSCREEN
287 #define PACMAN_UP BUTTON_MIDRIGHT
290 #define PACMAN_DOWN BUTTON_MIDLEFT
293 #define PACMAN_LEFT BUTTON_TOPMIDDLE
296 #define PACMAN_RIGHT BUTTON_BOTTOMMIDDLE
299 #define PACMAN_1UP BUTTON_BOTTOMLEFT
302 #define PACMAN_2UP BUTTON_BOTTOMRIGHT
305 #define PACMAN_COIN BUTTON_CENTER
308 #define PACMAN_MENU (BUTTON_TOPLEFT|BUTTON_REL)
312 #if (LCD_HEIGHT >= 288)
313 #define XOFS ((LCD_WIDTH-224)/2)
314 #define YOFS ((LCD_HEIGHT-288)/2)
315 #elif (LCD_WIDTH >= 288)
316 #define XOFS ((LCD_WIDTH-288)/2)
317 #define YOFS ((LCD_HEIGHT-224)/2)
318 #elif (LCD_WIDTH >= 220)
319 #define XOFS ((LCD_WIDTH-(288*3/4))/2)
320 #define YOFS ((LCD_HEIGHT-(224*3/4))/2)
321 #elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
322 #define XOFS ((LCD_WIDTH-(224*3/4))/2)
323 #define YOFS ((LCD_HEIGHT-(288*3/4))/2)
324 #elif (LCD_WIDTH >= 144)
325 #define XOFS ((LCD_WIDTH-288/2)/2)
326 #define YOFS ((LCD_HEIGHT-224/2)/2)
327 #elif (LCD_WIDTH >= 128)
328 #define XOFS ((LCD_WIDTH-224/2)/2)
330 #define YCLIP ((288-2*LCD_HEIGHT)/2)
334 #define YOFS ((LCD_HEIGHT-288/2)/2)
338 /* How many video frames (out of a possible 60) we display each second.
339 NOTE: pacbox.c assumes this is an integer divisor of 60
341 #if defined(TOSHIBA_GIGABEAT_S) || defined (TOSHIBA_GIGABEAT_F)
342 /* Gigabeat S,F can manage the full framerate (1 in 1 frames) */
344 #elif defined(IPOD_NANO)
345 /* The Nano can manage full-speed at 30fps (1 in 2 frames) */
348 /* We aim for 20fps on the other targets (1 in 3 frames) */
352 /* 16kHz sounds pretty good - use it if available */
353 #define PREFERRED_SAMPLING_RATE SAMPR_16