blob: 56e7600d58fcec951ed417dda551aad543d6a6c2 [file] [log] [blame]
Dave Chapmanad8b24d2006-03-13 01:42:11 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Pacbox - a Pacman Emulator for Rockbox
11 *
12 * Based on PIE - Pacman Instructional Emulator
13 *
14 * Copyright (c) 1997-2003,2004 Alessandro Scotti
15 * http://www.ascotti.org/
16 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000017 * 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.
Dave Chapmanad8b24d2006-03-13 01:42:11 +000021 *
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
24 *
25 ****************************************************************************/
26
27/* Platform-specific defines - used in both C and ASM files */
28
29#ifndef _PACBOX_H
30#define _PACBOX_H
31
32#include "config.h"
33
34#if CONFIG_KEYPAD == IPOD_4G_PAD
35
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)
43
44#elif CONFIG_KEYPAD == IRIVER_H100_PAD || CONFIG_KEYPAD == IRIVER_H300_PAD
45
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
54
Dave Chapman03627e02006-03-18 09:14:10 +000055#ifdef HAVE_REMOTE_LCD
56
57#define PACMAN_HAS_REMOTE
58
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
67
68#endif
69
Dave Chapmanad8b24d2006-03-13 01:42:11 +000070#elif CONFIG_KEYPAD == GIGABEAT_PAD
71
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
80
Michael Sevakisa74d1502008-05-02 00:38:11 +000081#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
82
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
91
Jens Arnold85a226d2007-03-16 23:02:39 +000092#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
Dave Chapmanad8b24d2006-03-13 01:42:11 +000093
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
102
Barry Wardell24f4a2a2006-10-26 13:38:09 +0000103#elif CONFIG_KEYPAD == SANSA_E200_PAD
104
Dave Chapman1186c182007-05-26 08:48:44 +0000105#define PACMAN_UP BUTTON_UP
106#define PACMAN_DOWN BUTTON_DOWN
107#define PACMAN_LEFT BUTTON_LEFT
108#define PACMAN_RIGHT BUTTON_RIGHT
Daniel Ankers17676672007-01-03 23:53:22 +0000109#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
Barry Wardell24f4a2a2006-10-26 13:38:09 +0000114
Daniel Stenberg1e88be52006-08-03 20:17:25 +0000115#elif CONFIG_KEYPAD == IRIVER_H10_PAD
116
Barry Wardell3beaad82006-10-13 20:23:53 +0000117#if defined(IRIVER_H10_5GB)
118#define PACMAN_UP BUTTON_SCROLL_UP
119#define PACMAN_DOWN BUTTON_SCROLL_DOWN
120#define PACMAN_LEFT BUTTON_LEFT
121#define PACMAN_RIGHT BUTTON_RIGHT
122#else
Daniel Stenberg1e88be52006-08-03 20:17:25 +0000123#define PACMAN_UP BUTTON_RIGHT
124#define PACMAN_DOWN BUTTON_LEFT
125#define PACMAN_LEFT BUTTON_SCROLL_UP
126#define PACMAN_RIGHT BUTTON_SCROLL_DOWN
Barry Wardell3beaad82006-10-13 20:23:53 +0000127#endif
128
Daniel Stenberg1e88be52006-08-03 20:17:25 +0000129#define PACMAN_1UP BUTTON_REW
130#define PACMAN_2UP BUTTON_POWER
131#define PACMAN_COIN BUTTON_FF
132#define PACMAN_MENU BUTTON_PLAY
133
Karl Kurbjun38548c72007-11-02 05:21:34 +0000134#elif CONFIG_KEYPAD == MROBE500_PAD
135
136#define PACMAN_UP BUTTON_RC_PLAY
137#define PACMAN_DOWN BUTTON_RC_DOWN
138#define PACMAN_LEFT BUTTON_RC_REW
139#define PACMAN_RIGHT BUTTON_RC_FF
140#define PACMAN_1UP BUTTON_RC_VOL_DOWN
141#define PACMAN_2UP BUTTON_RC_VOL_UP
142#define PACMAN_COIN_PRE BUTTON_RC_MODE
143#define PACMAN_COIN (BUTTON_RC_MODE | BUTTON_RC_DOWN)
144#define PACMAN_MENU BUTTON_POWER
145
Rob Purchase554d7ed2008-03-22 22:03:34 +0000146#elif CONFIG_KEYPAD == COWOND2_PAD
147
Rob Purchase297e0502008-04-27 15:30:19 +0000148#define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
Rob Purchase554d7ed2008-03-22 22:03:34 +0000149
Karl Kurbjun38548c72007-11-02 05:21:34 +0000150#else
151
152#error Keymap not defined!
153
Dave Chapmanad8b24d2006-03-13 01:42:11 +0000154#endif
155
Rob Purchase297e0502008-04-27 15:30:19 +0000156#ifdef HAVE_TOUCHPAD
157#ifndef PACMAN_UP
Rob Purchase819a39a2008-05-27 08:11:06 +0000158#define PACMAN_UP BUTTON_MIDRIGHT
Rob Purchase297e0502008-04-27 15:30:19 +0000159#endif
160#ifndef PACMAN_DOWN
Rob Purchase819a39a2008-05-27 08:11:06 +0000161#define PACMAN_DOWN BUTTON_MIDLEFT
Rob Purchase297e0502008-04-27 15:30:19 +0000162#endif
163#ifndef PACMAN_LEFT
Rob Purchase819a39a2008-05-27 08:11:06 +0000164#define PACMAN_LEFT BUTTON_TOPMIDDLE
Rob Purchase297e0502008-04-27 15:30:19 +0000165#endif
166#ifndef PACMAN_RIGHT
Rob Purchase819a39a2008-05-27 08:11:06 +0000167#define PACMAN_RIGHT BUTTON_BOTTOMMIDDLE
Rob Purchase297e0502008-04-27 15:30:19 +0000168#endif
169#ifndef PACMAN_1UP
170#define PACMAN_1UP BUTTON_BOTTOMLEFT
171#endif
172#ifndef PACMAN_2UP
173#define PACMAN_2UP BUTTON_BOTTOMRIGHT
174#endif
175#ifndef PACMAN_COIN
Rob Purchase819a39a2008-05-27 08:11:06 +0000176#define PACMAN_COIN BUTTON_CENTER
Rob Purchase297e0502008-04-27 15:30:19 +0000177#endif
178#ifndef PACMAN_MENU
179#define PACMAN_MENU (BUTTON_TOPLEFT|BUTTON_REL)
180#endif
181#endif
182
Dave Chapmanad8b24d2006-03-13 01:42:11 +0000183#if (LCD_HEIGHT >= 288)
184#define XOFS ((LCD_WIDTH-224)/2)
185#define YOFS ((LCD_HEIGHT-288)/2)
186#elif (LCD_WIDTH >= 288)
187#define XOFS ((LCD_WIDTH-288)/2)
188#define YOFS ((LCD_HEIGHT-224)/2)
189#elif (LCD_WIDTH >= 220)
190#define XOFS ((LCD_WIDTH-(288*3/4))/2)
191#define YOFS ((LCD_HEIGHT-(224*3/4))/2)
Dave Chapman1186c182007-05-26 08:48:44 +0000192#elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
193#define XOFS ((LCD_WIDTH-(224*3/4))/2)
194#define YOFS ((LCD_HEIGHT-(288*3/4))/2)
Dave Chapmanad8b24d2006-03-13 01:42:11 +0000195#elif (LCD_WIDTH >= 144)
196#define XOFS ((LCD_WIDTH-288/2)/2)
197#define YOFS ((LCD_HEIGHT-224/2)/2)
Barry Wardell3beaad82006-10-13 20:23:53 +0000198#elif (LCD_WIDTH >= 128)
199#define XOFS ((LCD_WIDTH-224/2)/2)
200#define YCLIP ((288-2*LCD_HEIGHT)/2)
Dave Chapmanad8b24d2006-03-13 01:42:11 +0000201#endif
202
Dave Chapmanbfd2b862006-03-15 02:00:34 +0000203/* How many video frames (out of a possible 60) we display each second.
204 NOTE: pacbox.c assumes this is an integer divisor of 60
205 */
Dave Chapmana6934812007-03-16 09:05:07 +0000206#if defined(IPOD_NANO) || defined (TOSHIBA_GIGABEAT_F)
207/* The Nano and Gigabeat can manage full-speed at 30fps (1 in 2 frames) */
Dave Chapmanbfd2b862006-03-15 02:00:34 +0000208#define FPS 30
209#else
210/* We aim for 20fps on the other targets (1 in 3 frames) */
211#define FPS 20
212#endif
213
Dave Chapmanad8b24d2006-03-13 01:42:11 +0000214#endif