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_SA9200_PAD
197 #define PACMAN_UP BUTTON_UP
198 #define PACMAN_DOWN BUTTON_DOWN
199 #define PACMAN_LEFT BUTTON_PREV
200 #define PACMAN_RIGHT BUTTON_NEXT
201 #define PACMAN_1UP BUTTON_VOL_UP
202 #define PACMAN_2UP BUTTON_VOL_DOWN
203 #define PACMAN_COIN BUTTON_RIGHT
204 #define PACMAN_MENU BUTTON_MENU
206 #elif CONFIG_KEYPAD == ONDAVX747_PAD
208 #define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
210 #elif CONFIG_KEYPAD == ONDAVX777_PAD
211 #define PACMAN_MENU BUTTON_POWER
213 #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
215 #define PACMAN_UP BUTTON_UP
216 #define PACMAN_DOWN BUTTON_DOWN
217 #define PACMAN_LEFT BUTTON_LEFT
218 #define PACMAN_RIGHT BUTTON_RIGHT
219 #define PACMAN_1UP BUTTON_REC
220 #define PACMAN_2UP BUTTON_REW
221 #define PACMAN_COIN BUTTON_FFWD
222 #define PACMAN_MENU BUTTON_PLAY
224 #elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
226 #define PACMAN_UP BUTTON_UP
227 #define PACMAN_DOWN BUTTON_DOWN
228 #define PACMAN_LEFT BUTTON_PREV
229 #define PACMAN_RIGHT BUTTON_NEXT
230 #define PACMAN_1UP BUTTON_PLAY
231 #define PACMAN_2UP BUTTON_REC
232 #define PACMAN_COIN BUTTON_OK
233 #define PACMAN_MENU BUTTON_MENU
237 #error Keymap not defined!
241 #ifdef HAVE_TOUCHSCREEN
243 #define PACMAN_UP BUTTON_MIDRIGHT
246 #define PACMAN_DOWN BUTTON_MIDLEFT
249 #define PACMAN_LEFT BUTTON_TOPMIDDLE
252 #define PACMAN_RIGHT BUTTON_BOTTOMMIDDLE
255 #define PACMAN_1UP BUTTON_BOTTOMLEFT
258 #define PACMAN_2UP BUTTON_BOTTOMRIGHT
261 #define PACMAN_COIN BUTTON_CENTER
264 #define PACMAN_MENU (BUTTON_TOPLEFT|BUTTON_REL)
268 #if (LCD_HEIGHT >= 288)
269 #define XOFS ((LCD_WIDTH-224)/2)
270 #define YOFS ((LCD_HEIGHT-288)/2)
271 #elif (LCD_WIDTH >= 288)
272 #define XOFS ((LCD_WIDTH-288)/2)
273 #define YOFS ((LCD_HEIGHT-224)/2)
274 #elif (LCD_WIDTH >= 220)
275 #define XOFS ((LCD_WIDTH-(288*3/4))/2)
276 #define YOFS ((LCD_HEIGHT-(224*3/4))/2)
277 #elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
278 #define XOFS ((LCD_WIDTH-(224*3/4))/2)
279 #define YOFS ((LCD_HEIGHT-(288*3/4))/2)
280 #elif (LCD_WIDTH >= 144)
281 #define XOFS ((LCD_WIDTH-288/2)/2)
282 #define YOFS ((LCD_HEIGHT-224/2)/2)
283 #elif (LCD_WIDTH >= 128)
284 #define XOFS ((LCD_WIDTH-224/2)/2)
285 #define YCLIP ((288-2*LCD_HEIGHT)/2)
288 /* How many video frames (out of a possible 60) we display each second.
289 NOTE: pacbox.c assumes this is an integer divisor of 60
291 #if defined(IPOD_NANO) || defined (TOSHIBA_GIGABEAT_F)
292 /* The Nano and Gigabeat can manage full-speed at 30fps (1 in 2 frames) */
295 /* We aim for 20fps on the other targets (1 in 3 frames) */