summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lib/keymaps.h222
-rw-r--r--apps/plugins/puzzles/rockbox.c2
-rw-r--r--apps/plugins/xworld/sys.c2
3 files changed, 224 insertions, 2 deletions
diff --git a/apps/plugins/lib/keymaps.h b/apps/plugins/lib/keymaps.h
new file mode 100644
index 0000000000..84041cacd7
--- /dev/null
+++ b/apps/plugins/lib/keymaps.h
@@ -0,0 +1,222 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2017 Franklin Wei
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22/* The purpose of this file is to provide a supplement to the
23 * functionality provided by PLA (pluginlib_actions), not to replace
24 * it. Using PLA benefits both the plugin author, who no longer needs
25 * to manually create keymaps, as well as the author of a new port,
26 * who can easily adjust a centralized keymap. However, it lacks
27 * flexibility for plugin authors in multiple aspects, namely the lack
28 * of release detection and simultaneous button presses, leading some
29 * plugins to rely upon individual keymaps, which complicates a new port.
30 *
31 * This file aims to remedy this by providing a centralized keymap of
32 * the most basic keys: 4 directions, "fire" or select, and a
33 * menu/pause/meta key.
34 *
35 * If you are writing a new plugin, *please* consider using these
36 * keymaps instead of rolling your own!
37 */
38
39#ifndef __PLUGINLIB_KEYMAPS_H__
40#define __PLUGINLIB_KEYMAPS_H__
41
42#if (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \
43 (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) || \
44 (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
45 (CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD) || \
46 (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD) || \
47 (CONFIG_KEYPAD == SANSA_CONNECT_PAD) || \
48 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
49 (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
50 (CONFIG_KEYPAD == SANSA_E200_PAD) || \
51 (CONFIG_KEYPAD == SANSA_FUZE_PAD) || \
52 (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) || \
53 (CONFIG_KEYPAD == GIGABEAT_PAD) || \
54 (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
55 (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD) || \
56 (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
57 (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || \
58 (CONFIG_KEYPAD == CREATIVE_ZEN_PAD) || \
59 (CONFIG_KEYPAD == SONY_NWZ_PAD) || \
60 (CONFIG_KEYPAD == CREATIVEZVM_PAD) || \
61 (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD) || \
62 (CONFIG_KEYPAD == IRIVER_H300_PAD) || \
63 (CONFIG_KEYPAD == HM801_PAD) || \
64 (CONFIG_KEYPAD == HM60X_PAD)
65#define BTN_UP BUTTON_UP
66#define BTN_DOWN BUTTON_DOWN
67#define BTN_LEFT BUTTON_LEFT
68#define BTN_RIGHT BUTTON_RIGHT
69
70#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
71#define BTN_UP_LEFT BUTTON_BACK
72#define BTN_UP_RIGHT BUTTON_PLAYPAUSE
73#define BTN_DOWN_LEFT BUTTON_BOTTOMLEFT
74#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
75#endif
76
77#if (CONFIG_KEYPAD == HM60X_PAD)
78#define BTN_FIRE BUTTON_POWER
79#define BTN_PAUSE BUTTON_SELECT
80#endif
81
82#if (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \
83 (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) || \
84 (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
85 (CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD) || \
86 (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD) || \
87 (CONFIG_KEYPAD == SANSA_CONNECT_PAD) || \
88 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
89 (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) || \
90 (CONFIG_KEYPAD == ONDAVX747_PAD)
91#define BTN_FIRE BUTTON_VOL_UP
92#define BTN_PAUSE BUTTON_VOL_DOWN
93
94#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
95#define BTN_FIRE BUTTON_HOME
96#define BTN_PAUSE BUTTON_SELECT
97
98#elif (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
99#define BTN_FIRE BUTTON_FFWD
100#define BTN_PAUSE BUTTON_REW
101
102#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
103#define BTN_FIRE BUTTON_REC
104#define BTN_PAUSE BUTTON_POWER
105
106#elif (CONFIG_KEYPAD == SANSA_CLIP_PAD)
107#define BTN_FIRE BUTTON_SELECT
108#define BTN_PAUSE BUTTON_POWER
109
110#elif (CONFIG_KEYPAD == CREATIVE_ZEN_PAD)
111#define BTN_FIRE BUTTON_SELECT
112#define BTN_PAUSE BUTTON_BACK
113
114#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
115#define BTN_FIRE BUTTON_PLAY
116#define BTN_PAUSE BUTTON_MENU
117
118#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
119#define BTN_FIRE BUTTON_USER
120#define BTN_PAUSE BUTTON_MENU
121
122#elif (CONFIG_KEYPAD == SONY_NWZ_PAD)
123#define BTN_FIRE BUTTON_PLAY
124#define BTN_PAUSE BUTTON_BACK
125
126#elif (CONFIG_KEYPAD == IRIVER_H300_PAD)
127#define BTN_FIRE BUTTON_REC
128#define BTN_PAUSE BUTTON_MODE
129
130#elif (CONFIG_KEYPAD == HM801_PAD)
131#define BTN_FIRE BUTTON_PREV
132#define BTN_PAUSE BUTTON_NEXT
133
134#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
135 (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
136#define BTN_FIRE BUTTON_REC
137#define BTN_PAUSE BUTTON_PLAY
138
139#elif (CONFIG_KEYPAD == GIGABEAT_PAD) || \
140 (CONFIG_KEYPAD == GIGABEAT_S_PAD)
141#define BTN_FIRE BUTTON_VOL_UP
142#define BTN_PAUSE BUTTON_MENU
143/* #if CONFIG_KEYPAD == PHILIPS_HDD1630_PAD */
144#endif
145
146/* ... and now for the bad ones that don't have
147 * standard names for the directional buttons */
148#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
149#define BTN_UP BUTTON_OK
150#define BTN_DOWN BUTTON_CANCEL
151#define BTN_LEFT BUTTON_MENU
152#define BTN_RIGHT BUTTON_PLAY
153#define BTN_FIRE BUTTON_POWER
154#define BTN_PAUSE BUTTON_REC
155
156#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
157#define BTN_UP BUTTON_SCROLL_UP
158#define BTN_DOWN BUTTON_SCROLL_DOWN
159#define BTN_LEFT BUTTON_LEFT
160#define BTN_RIGHT BUTTON_RIGHT
161#define BTN_FIRE BUTTON_REW
162#define BTN_PAUSE BUTTON_PLAY
163
164#elif (CONFIG_KEYPAD == MROBE500_PAD)
165#define BTN_FIRE BUTTON_POWER
166
167#elif (CONFIG_KEYPAD == MROBE_REMOTE)
168#define BTN_UP BUTTON_RC_PLAY
169#define BTN_DOWN BUTTON_RC_DOWN
170#define BTN_LEFT BUTTON_RC_REW
171#define BTN_RIGHT BUTTON_RC_FF
172
173#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
174 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
175 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
176#define BTN_UP BUTTON_MENU
177#define BTN_DOWN BUTTON_PLAY
178#define BTN_LEFT BUTTON_LEFT
179#define BTN_RIGHT BUTTON_RIGHT
180#define BTN_FIRE BUTTON_SELECT
181#define BTN_PAUSE (BUTTON_MENU | BUTTON_SELECT)
182
183#elif (CONFIG_KEYPAD == ONDAVX777_PAD)
184#define BTN_FIRE BUTTON_POWER
185
186#elif (CONFIG_KEYPAD == COWON_D2_PAD)
187#define BTN_FIRE BUTTON_PLUS
188#define BTN_PAUSE BUTTON_MINUS
189
190#elif (CONFIG_KEYPAD == ONDAVX747_PAD) || \
191 (CONFIG_KEYPAD == DX50_PAD)
192#define BTN_LEFT BUTTON_LEFT
193#define BTN_RIGHT BUTTON_RIGHT
194#define BTN_FIRE BUTTON_BOTTOMLEFT
195#define BTN_PAUSE BUTTON_TOPLEFT
196
197#else
198#error Unsupported keypad
199#endif
200
201#ifdef HAVE_TOUCHSCREEN
202#define BTN_UP BUTTON_TOPMIDDLE
203#define BTN_DOWN BUTTON_BOTTOMMIDDLE
204#define BTN_LEFT BUTTON_LEFT
205#define BTN_RIGHT BUTTON_RIGHT
206
207#if (CONFIG_KEYPAD == MROBE500_PAD) || \
208 (CONFIG_KEYPAD == ONDAVX777_PAD)
209#define BTN_PAUSE BUTTON_BOTTOMLEFT
210
211#elif (CONFIG_KEYPAD != COWON_D2_PAD) && \
212 (CONFIG_KEYPAD != DX50_PAD) && \
213 (CONFIG_KEYPAD != ONDAVX777_PAD)
214#define BTN_FIRE BUTTON_BOTTOMLEFT
215#define BTN_PAUSE BUTTON_TOPLEFT
216#endif
217
218/* HAVE_TOUCHSCREEN */
219#endif
220
221/* __PLUGINLIB_KEYMAPS_H__ */
222#endif
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 65d491cc38..d6a47a4202 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -24,11 +24,11 @@
24#include "plugin.h" 24#include "plugin.h"
25 25
26#include "help.h" 26#include "help.h"
27#include "keymaps.h"
28#include "lz4tiny.h" 27#include "lz4tiny.h"
29 28
30#include "src/puzzles.h" 29#include "src/puzzles.h"
31 30
31#include "lib/keymaps.h"
32#include "lib/playback_control.h" 32#include "lib/playback_control.h"
33#include "lib/simple_viewer.h" 33#include "lib/simple_viewer.h"
34#include "lib/xlcd.h" 34#include "lib/xlcd.h"
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index eac47e66f0..1a3d47d307 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -33,11 +33,11 @@
33#include "lib/pluginlib_actions.h" 33#include "lib/pluginlib_actions.h"
34#include "lib/pluginlib_bmp.h" 34#include "lib/pluginlib_bmp.h"
35#include "lib/pluginlib_exit.h" 35#include "lib/pluginlib_exit.h"
36#include "lib/keymaps.h"
36 37
37#include "sys.h" 38#include "sys.h"
38#include "parts.h" 39#include "parts.h"
39#include "engine.h" 40#include "engine.h"
40#include "keymaps.h"
41 41
42static struct System* save_sys; 42static struct System* save_sys;
43 43