Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 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 Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 21 | * |
| 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 Chapman | 03627e0 | 2006-03-18 09:14:10 +0000 | [diff] [blame] | 55 | #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 Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 70 | #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 Sevakis | a74d150 | 2008-05-02 00:38:11 +0000 | [diff] [blame] | 81 | #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 Arnold | 85a226d | 2007-03-16 23:02:39 +0000 | [diff] [blame] | 92 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD |
Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 93 | |
| 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 Wardell | 24f4a2a | 2006-10-26 13:38:09 +0000 | [diff] [blame] | 103 | #elif CONFIG_KEYPAD == SANSA_E200_PAD |
| 104 | |
Dave Chapman | 1186c18 | 2007-05-26 08:48:44 +0000 | [diff] [blame] | 105 | #define PACMAN_UP BUTTON_UP |
| 106 | #define PACMAN_DOWN BUTTON_DOWN |
| 107 | #define PACMAN_LEFT BUTTON_LEFT |
| 108 | #define PACMAN_RIGHT BUTTON_RIGHT |
Daniel Ankers | 1767667 | 2007-01-03 23:53:22 +0000 | [diff] [blame] | 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 |
Barry Wardell | 24f4a2a | 2006-10-26 13:38:09 +0000 | [diff] [blame] | 114 | |
Daniel Stenberg | 1e88be5 | 2006-08-03 20:17:25 +0000 | [diff] [blame] | 115 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD |
| 116 | |
Barry Wardell | 3beaad8 | 2006-10-13 20:23:53 +0000 | [diff] [blame] | 117 | #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 Stenberg | 1e88be5 | 2006-08-03 20:17:25 +0000 | [diff] [blame] | 123 | #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 Wardell | 3beaad8 | 2006-10-13 20:23:53 +0000 | [diff] [blame] | 127 | #endif |
| 128 | |
Daniel Stenberg | 1e88be5 | 2006-08-03 20:17:25 +0000 | [diff] [blame] | 129 | #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 Kurbjun | 38548c7 | 2007-11-02 05:21:34 +0000 | [diff] [blame] | 134 | #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 Purchase | 554d7ed | 2008-03-22 22:03:34 +0000 | [diff] [blame] | 146 | #elif CONFIG_KEYPAD == COWOND2_PAD |
| 147 | |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 148 | #define PACMAN_MENU (BUTTON_MENU|BUTTON_REL) |
Rob Purchase | 554d7ed | 2008-03-22 22:03:34 +0000 | [diff] [blame] | 149 | |
Karl Kurbjun | 38548c7 | 2007-11-02 05:21:34 +0000 | [diff] [blame] | 150 | #else |
| 151 | |
| 152 | #error Keymap not defined! |
| 153 | |
Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 154 | #endif |
| 155 | |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 156 | #ifdef HAVE_TOUCHPAD |
| 157 | #ifndef PACMAN_UP |
Rob Purchase | 819a39a | 2008-05-27 08:11:06 +0000 | [diff] [blame] | 158 | #define PACMAN_UP BUTTON_MIDRIGHT |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 159 | #endif |
| 160 | #ifndef PACMAN_DOWN |
Rob Purchase | 819a39a | 2008-05-27 08:11:06 +0000 | [diff] [blame] | 161 | #define PACMAN_DOWN BUTTON_MIDLEFT |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 162 | #endif |
| 163 | #ifndef PACMAN_LEFT |
Rob Purchase | 819a39a | 2008-05-27 08:11:06 +0000 | [diff] [blame] | 164 | #define PACMAN_LEFT BUTTON_TOPMIDDLE |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 165 | #endif |
| 166 | #ifndef PACMAN_RIGHT |
Rob Purchase | 819a39a | 2008-05-27 08:11:06 +0000 | [diff] [blame] | 167 | #define PACMAN_RIGHT BUTTON_BOTTOMMIDDLE |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 168 | #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 Purchase | 819a39a | 2008-05-27 08:11:06 +0000 | [diff] [blame] | 176 | #define PACMAN_COIN BUTTON_CENTER |
Rob Purchase | 297e050 | 2008-04-27 15:30:19 +0000 | [diff] [blame] | 177 | #endif |
| 178 | #ifndef PACMAN_MENU |
| 179 | #define PACMAN_MENU (BUTTON_TOPLEFT|BUTTON_REL) |
| 180 | #endif |
| 181 | #endif |
| 182 | |
Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 183 | #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 Chapman | 1186c18 | 2007-05-26 08:48:44 +0000 | [diff] [blame] | 192 | #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 Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 195 | #elif (LCD_WIDTH >= 144) |
| 196 | #define XOFS ((LCD_WIDTH-288/2)/2) |
| 197 | #define YOFS ((LCD_HEIGHT-224/2)/2) |
Barry Wardell | 3beaad8 | 2006-10-13 20:23:53 +0000 | [diff] [blame] | 198 | #elif (LCD_WIDTH >= 128) |
| 199 | #define XOFS ((LCD_WIDTH-224/2)/2) |
| 200 | #define YCLIP ((288-2*LCD_HEIGHT)/2) |
Dave Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 201 | #endif |
| 202 | |
Dave Chapman | bfd2b86 | 2006-03-15 02:00:34 +0000 | [diff] [blame] | 203 | /* 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 Chapman | a693481 | 2007-03-16 09:05:07 +0000 | [diff] [blame] | 206 | #if defined(IPOD_NANO) || defined (TOSHIBA_GIGABEAT_F) |
| 207 | /* The Nano and Gigabeat can manage full-speed at 30fps (1 in 2 frames) */ |
Dave Chapman | bfd2b86 | 2006-03-15 02:00:34 +0000 | [diff] [blame] | 208 | #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 Chapman | ad8b24d | 2006-03-13 01:42:11 +0000 | [diff] [blame] | 214 | #endif |