2003-06-29 20:10:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2006-10-16 01:27:08 +00:00
|
|
|
* $Id$
|
2003-06-29 20:10:46 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Vicentini Martin
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-06-29 20:10:46 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "plugin.h"
|
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
/* variable button definitions */
|
2020-07-15 23:40:55 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
2005-06-29 12:47:24 +00:00
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_OFF
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MODE
|
|
|
|
#define FLIPIT_SOLVE BUTTON_ON
|
2005-02-04 12:41:09 +00:00
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_REC
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_TOGGLE_PRE BUTTON_SELECT
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL)
|
2005-02-04 12:41:09 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define FLIPIT_RC_QUIT BUTTON_RC_STOP
|
|
|
|
|
2006-02-24 20:54:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
2007-07-27 09:57:27 +00:00
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2005-12-14 01:31:37 +00:00
|
|
|
|
2008-04-24 14:12:57 +00:00
|
|
|
#define FLIPIT_SCROLLWHEEL
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_UP BUTTON_MENU
|
|
|
|
#define FLIPIT_DOWN BUTTON_PLAY
|
2008-04-24 14:12:57 +00:00
|
|
|
#define FLIPIT_NEXT BUTTON_SCROLL_FWD
|
|
|
|
#define FLIPIT_PREV BUTTON_SCROLL_BACK
|
2006-03-18 19:11:18 +00:00
|
|
|
#define FLIPIT_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_SELECT | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_TOGGLE_PRE BUTTON_SELECT
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL)
|
2005-12-14 01:31:37 +00:00
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-01-18 11:09:06 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
2006-10-16 01:27:08 +00:00
|
|
|
#define FLIPIT_SHUFFLE BUTTON_REC
|
|
|
|
#define FLIPIT_SOLVE_PRE BUTTON_PLAY
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_STEP_PRE BUTTON_PLAY
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_REL)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
2006-01-18 11:09:06 +00:00
|
|
|
|
2006-10-16 01:27:08 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
2006-02-24 15:42:52 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
2007-05-19 23:38:09 +00:00
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_VOL_UP
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
2006-02-24 15:42:52 +00:00
|
|
|
|
2008-04-24 14:12:57 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_E200_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_SCROLLWHEEL
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_NEXT BUTTON_SCROLL_FWD
|
|
|
|
#define FLIPIT_PREV BUTTON_SCROLL_BACK
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_REC | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_REC | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_REC | BUTTON_SELECT)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2009-01-04 23:33:15 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
|
|
|
|
#define FLIPIT_SCROLLWHEEL
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_NEXT BUTTON_SCROLL_FWD
|
|
|
|
#define FLIPIT_PREV BUTTON_SCROLL_BACK
|
2009-04-10 17:28:26 +00:00
|
|
|
#define FLIPIT_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
2009-01-04 23:33:15 +00:00
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_SELECT | BUTTON_DOWN)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_TOGGLE_PRE BUTTON_SELECT
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
|
2008-04-24 14:12:57 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_C200_PAD
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-26 13:38:09 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_REC | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_REC | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_REC | BUTTON_SELECT)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2008-11-28 00:37:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CLIP_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_SELECT)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_M200_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_SELECT | BUTTON_UP)
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT (BUTTON_BACK|BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_BACK
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_POWER
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_BACK
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_SHORTCUT
|
|
|
|
#define FLIPIT_SOLVE BUTTON_PLAYPAUSE
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_MENU
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2006-10-16 01:27:08 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_UP BUTTON_SCROLL_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT)
|
2006-08-03 20:17:25 +00:00
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_SCROLL_UP)
|
2006-10-16 00:40:40 +00:00
|
|
|
#define FLIPIT_TOGGLE_PRE BUTTON_REW
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_REW | BUTTON_REL)
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2008-02-17 12:23:02 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_BACK
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_VOL_UP
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE100_PAD
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
2008-03-01 22:55:09 +00:00
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_PLAY
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_DISPLAY
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_RC_REW
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RC_FF
|
|
|
|
#define FLIPIT_UP BUTTON_RC_VOL_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_RC_REC
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_RC_MODE
|
|
|
|
#define FLIPIT_SOLVE_PRE BUTTON_RC_MENU
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_RC_MENU|BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_STEP_PRE BUTTON_RC_MENU
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_RC_MENU|BUTTON_REL)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_RC_PLAY
|
|
|
|
|
|
|
|
#define FLIPIT_RC_QUIT BUTTON_REC
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_BACK
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_CUSTOM
|
2008-12-08 09:51:42 +00:00
|
|
|
#define FLIPIT_SOLVE BUTTON_PLAY
|
2008-12-04 21:28:56 +00:00
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_MENU
|
2008-12-08 09:51:42 +00:00
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
2008-12-04 21:28:56 +00:00
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
#define FLIPIT_LEFT BUTTON_BACK
|
|
|
|
#define FLIPIT_RIGHT BUTTON_MENU
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_NEXT BUTTON_VOL_UP
|
|
|
|
#define FLIPIT_PREV BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_BACK)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_DOWN)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_MENU)
|
|
|
|
#define FLIPIT_TOGGLE_PRE BUTTON_PLAY
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_PLAY | BUTTON_REL)
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_VIEW
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_PLAYLIST
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2010-11-03 02:45:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_VIEW
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_NEXT
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2009-12-03 23:13:45 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_PREV
|
|
|
|
#define FLIPIT_RIGHT BUTTON_NEXT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_RIGHT
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_LEFT
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2009-04-21 04:24:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD || CONFIG_KEYPAD == MROBE500_PAD
|
2009-04-07 23:41:44 +00:00
|
|
|
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2009-08-04 03:08:32 +00:00
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
2015-07-19 23:50:26 +00:00
|
|
|
#define FLIPIT_QUIT (BUTTON_REW|BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_REW|BUTTON_REL)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_FFWD|BUTTON_REPEAT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_FFWD|BUTTON_REL)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-11 22:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_PREV
|
|
|
|
#define FLIPIT_RIGHT BUTTON_NEXT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_REC
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_PLAY
|
|
|
|
#define FLIPIT_SOLVE BUTTON_MENU
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_CANCEL
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_OK
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_RIGHT BUTTON_VOL_UP
|
2010-11-02 10:44:34 +00:00
|
|
|
#define FLIPIT_UP BUTTON_REW
|
|
|
|
#define FLIPIT_DOWN BUTTON_FF
|
2010-04-26 21:40:00 +00:00
|
|
|
#define FLIPIT_QUIT (BUTTON_REC|BUTTON_PLAY)
|
2010-11-02 10:44:34 +00:00
|
|
|
#define FLIPIT_SHUFFLE BUTTON_FUNC
|
2010-04-26 21:40:00 +00:00
|
|
|
#define FLIPIT_SOLVE BUTTON_REC
|
2010-11-02 10:44:34 +00:00
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_PLAY|BUTTON_REW)
|
|
|
|
#define FLIPIT_TOGGLE (BUTTON_PLAY|BUTTON_FF)
|
2010-04-26 21:40:00 +00:00
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_REW
|
|
|
|
#define FLIPIT_RIGHT BUTTON_FF
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
2012-02-02 13:42:42 +00:00
|
|
|
#define FLIPIT_QUIT (BUTTON_MENU|BUTTON_REPEAT)
|
2010-11-30 10:52:14 +00:00
|
|
|
#define FLIPIT_SHUFFLE BUTTON_PLAY
|
|
|
|
#define FLIPIT_SOLVE BUTTON_MENU
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_REC
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_ENTER
|
|
|
|
|
2011-10-02 15:50:58 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_PLAYPAUSE
|
|
|
|
#define FLIPIT_SOLVE BUTTON_BACK
|
2012-03-01 22:23:29 +00:00
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_BOTTOMLEFT
|
2011-10-02 15:50:58 +00:00
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_VOL_UP
|
|
|
|
#define FLIPIT_SOLVE BUTTON_PREV
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_NEXT
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_BACK
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_MENU
|
|
|
|
#define FLIPIT_SOLVE BUTTON_USER
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_POWER
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2012-03-23 18:32:50 +00:00
|
|
|
#elif CONFIG_KEYPAD == HM60X_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_UP|BUTTON_POWER)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_DOWN|BUTTON_POWER)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_LEFT|BUTTON_POWER)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif CONFIG_KEYPAD == HM801_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_PREV
|
|
|
|
#define FLIPIT_SOLVE BUTTON_NEXT
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_PLAY
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == DX50_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_VOL_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_QUIT (BUTTON_POWER|BUTTON_REL)
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_VOL_UP|BUTTON_POWER)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_VOL_DOWN|BUTTON_POWER)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_LEFT|BUTTON_POWER)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2018-02-22 22:42:29 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_MENU
|
|
|
|
|
2018-03-02 20:53:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_LEFT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_RIGHT
|
|
|
|
#define FLIPIT_UP BUTTON_UP
|
|
|
|
#define FLIPIT_DOWN BUTTON_DOWN
|
|
|
|
#define FLIPIT_QUIT (BUTTON_POWER|BUTTON_REL)
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_VOLDOWN)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_SELECT|BUTTON_VOLUP)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_LEFT|BUTTON_VOLUP)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_SELECT
|
|
|
|
|
2018-06-28 10:24:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_PREV
|
|
|
|
#define FLIPIT_RIGHT BUTTON_NEXT
|
|
|
|
#define FLIPIT_UP BUTTON_HOME
|
|
|
|
#define FLIPIT_DOWN BUTTON_OPTION
|
2018-11-05 12:01:55 +00:00
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_PREV)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_NEXT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3II_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_PREV
|
|
|
|
#define FLIPIT_RIGHT BUTTON_NEXT
|
|
|
|
#define FLIPIT_UP BUTTON_HOME
|
|
|
|
#define FLIPIT_DOWN BUTTON_OPTION
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_PREV)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_NEXT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X20_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_PREV
|
|
|
|
#define FLIPIT_RIGHT BUTTON_NEXT
|
|
|
|
#define FLIPIT_UP BUTTON_HOME
|
|
|
|
#define FLIPIT_DOWN BUTTON_OPTION
|
2018-06-28 10:24:26 +00:00
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_PREV)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_NEXT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2018-06-29 20:09:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_HOME
|
|
|
|
#define FLIPIT_RIGHT BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_UP BUTTON_PREV
|
|
|
|
#define FLIPIT_DOWN BUTTON_NEXT
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_POWER | BUTTON_PREV)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_POWER | BUTTON_NEXT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_POWER | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IHIFI_800_PAD
|
|
|
|
|
|
|
|
#define FLIPIT_LEFT BUTTON_HOME
|
|
|
|
#define FLIPIT_RIGHT BUTTON_VOL_DOWN
|
|
|
|
#define FLIPIT_UP BUTTON_PREV
|
|
|
|
#define FLIPIT_DOWN BUTTON_NEXT
|
|
|
|
#define FLIPIT_QUIT BUTTON_POWER
|
|
|
|
#define FLIPIT_SHUFFLE (BUTTON_POWER | BUTTON_PREV)
|
|
|
|
#define FLIPIT_SOLVE (BUTTON_POWER | BUTTON_NEXT)
|
|
|
|
#define FLIPIT_STEP_BY_STEP (BUTTON_POWER | BUTTON_PLAY)
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_PLAY
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-18 21:45:00 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef FLIPIT_LEFT
|
|
|
|
#define FLIPIT_LEFT BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_RIGHT
|
|
|
|
#define FLIPIT_RIGHT BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_UP
|
|
|
|
#define FLIPIT_UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_DOWN
|
|
|
|
#define FLIPIT_DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_QUIT
|
|
|
|
#define FLIPIT_QUIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_SHUFFLE
|
|
|
|
#define FLIPIT_SHUFFLE BUTTON_TOPRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_SOLVE
|
|
|
|
#define FLIPIT_SOLVE BUTTON_BOTTOMLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_STEP_BY_STEP
|
|
|
|
#define FLIPIT_STEP_BY_STEP BUTTON_BOTTOMRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef FLIPIT_TOGGLE
|
|
|
|
#define FLIPIT_TOGGLE BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
static int spots[20];
|
|
|
|
static int toggle[20];
|
|
|
|
static int cursor_pos, moves;
|
2006-06-10 20:37:53 +00:00
|
|
|
|
2008-11-03 14:37:50 +00:00
|
|
|
#include "pluginbitmaps/flipit_cursor.h"
|
|
|
|
#include "pluginbitmaps/flipit_tokens.h"
|
2005-05-21 13:37:30 +00:00
|
|
|
|
2006-10-15 22:31:09 +00:00
|
|
|
#define PANEL_HEIGHT 12
|
|
|
|
#define TK_WIDTH BMPWIDTH_flipit_cursor
|
|
|
|
#define TK_HEIGHT BMPHEIGHT_flipit_cursor
|
|
|
|
#define TK_SPACE MAX(0, MIN((LCD_WIDTH - 5*TK_WIDTH)/4, \
|
|
|
|
(LCD_HEIGHT - PANEL_HEIGHT - 4*TK_HEIGHT)/4))
|
|
|
|
#define GRID_WIDTH (5*TK_WIDTH + 4*TK_SPACE)
|
|
|
|
#define GRID_LEFT ((LCD_WIDTH - GRID_WIDTH)/2)
|
|
|
|
#define GRID_HEIGHT (4*TK_HEIGHT + 4*TK_SPACE) /* includes grid-panel space */
|
|
|
|
#define GRID_TOP MAX(0, ((LCD_HEIGHT - PANEL_HEIGHT - GRID_HEIGHT)/2))
|
2003-06-29 20:10:46 +00:00
|
|
|
|
|
|
|
/* draw a spot at the coordinates (x,y), range of p is 0-19 */
|
2008-03-22 10:24:28 +00:00
|
|
|
static void draw_spot(int p)
|
2006-10-15 22:31:09 +00:00
|
|
|
{
|
2009-08-31 04:21:21 +00:00
|
|
|
rb->lcd_bitmap_part( flipit_tokens, 0, spots[p] * TK_HEIGHT,
|
2009-09-04 00:46:24 +00:00
|
|
|
STRIDE(SCREEN_MAIN, BMPWIDTH_flipit_tokens,
|
|
|
|
BMPHEIGHT_flipit_tokens),
|
2006-10-15 22:31:09 +00:00
|
|
|
GRID_LEFT + (p%5) * (TK_WIDTH+TK_SPACE),
|
|
|
|
GRID_TOP + (p/5) * (TK_HEIGHT+TK_SPACE),
|
|
|
|
TK_WIDTH, TK_HEIGHT );
|
2003-06-29 20:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw the cursor at the current cursor position */
|
2006-10-15 22:31:09 +00:00
|
|
|
static void draw_cursor(void)
|
|
|
|
{
|
2006-06-10 22:43:38 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-10-15 22:31:09 +00:00
|
|
|
rb->lcd_bitmap_transparent( flipit_cursor,
|
|
|
|
GRID_LEFT + (cursor_pos%5) * (TK_WIDTH+TK_SPACE),
|
|
|
|
GRID_TOP + (cursor_pos/5) * (TK_HEIGHT+TK_SPACE),
|
|
|
|
TK_WIDTH, TK_HEIGHT );
|
2006-06-10 20:37:53 +00:00
|
|
|
#else
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-10-15 22:31:09 +00:00
|
|
|
rb->lcd_mono_bitmap( flipit_cursor,
|
|
|
|
GRID_LEFT + (cursor_pos%5) * (TK_WIDTH+TK_SPACE),
|
|
|
|
GRID_TOP + (cursor_pos/5) * (TK_HEIGHT+TK_SPACE),
|
|
|
|
TK_WIDTH, TK_HEIGHT );
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2006-06-10 20:37:53 +00:00
|
|
|
#endif
|
2003-06-29 20:10:46 +00:00
|
|
|
}
|
|
|
|
|
2006-06-10 20:37:53 +00:00
|
|
|
/* draw the info panel ... duh */
|
|
|
|
static void draw_info_panel(void)
|
|
|
|
{
|
2006-10-15 22:31:09 +00:00
|
|
|
char s[32];
|
|
|
|
|
2006-06-10 20:37:53 +00:00
|
|
|
rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID );
|
2006-10-15 22:31:09 +00:00
|
|
|
rb->lcd_fillrect( GRID_LEFT, GRID_TOP + 4*(TK_HEIGHT+TK_SPACE),
|
|
|
|
GRID_WIDTH, PANEL_HEIGHT );
|
2006-06-10 20:37:53 +00:00
|
|
|
rb->lcd_set_drawmode( DRMODE_SOLID );
|
2006-10-15 22:31:09 +00:00
|
|
|
rb->lcd_drawrect( GRID_LEFT, GRID_TOP + 4*(TK_HEIGHT+TK_SPACE),
|
|
|
|
GRID_WIDTH, PANEL_HEIGHT );
|
|
|
|
|
|
|
|
rb->snprintf( s, sizeof(s), "Flips: %d", moves );
|
|
|
|
rb->lcd_putsxy( (LCD_WIDTH - rb->lcd_getstringsize(s, NULL, NULL)) / 2,
|
|
|
|
GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s );
|
2003-06-29 20:10:46 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 00:40:40 +00:00
|
|
|
/* clear the cursor where it is */
|
|
|
|
static inline void clear_cursor(void)
|
|
|
|
{
|
|
|
|
draw_spot( cursor_pos );
|
|
|
|
}
|
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
/* check if the puzzle is finished */
|
2006-10-15 22:31:09 +00:00
|
|
|
static bool flipit_finished(void)
|
|
|
|
{
|
2003-06-29 20:10:46 +00:00
|
|
|
int i;
|
|
|
|
for (i=0; i<20; i++)
|
|
|
|
if (!spots[i])
|
|
|
|
return false;
|
|
|
|
clear_cursor();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* draws the toggled spots */
|
2006-10-15 22:31:09 +00:00
|
|
|
static void flipit_toggle(void)
|
|
|
|
{
|
2003-06-29 20:10:46 +00:00
|
|
|
spots[cursor_pos] = 1-spots[cursor_pos];
|
|
|
|
toggle[cursor_pos] = 1-toggle[cursor_pos];
|
|
|
|
draw_spot(cursor_pos);
|
|
|
|
if (cursor_pos%5 > 0) {
|
|
|
|
spots[cursor_pos-1] = 1-spots[cursor_pos-1];
|
|
|
|
draw_spot(cursor_pos-1);
|
|
|
|
}
|
|
|
|
if (cursor_pos%5 < 4) {
|
|
|
|
spots[cursor_pos+1] = 1-spots[cursor_pos+1];
|
|
|
|
draw_spot(cursor_pos+1);
|
|
|
|
}
|
|
|
|
if (cursor_pos/5 > 0) {
|
|
|
|
spots[cursor_pos-5] = 1-spots[cursor_pos-5];
|
|
|
|
draw_spot(cursor_pos-5);
|
|
|
|
}
|
|
|
|
if (cursor_pos/5 < 3) {
|
|
|
|
spots[cursor_pos+5] = 1-spots[cursor_pos+5];
|
|
|
|
draw_spot(cursor_pos+5);
|
|
|
|
}
|
|
|
|
moves++;
|
2006-06-10 20:37:53 +00:00
|
|
|
|
|
|
|
draw_info_panel();
|
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
if (flipit_finished())
|
|
|
|
clear_cursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move the cursor in any direction */
|
2006-10-15 22:31:09 +00:00
|
|
|
static void move_cursor(int x, int y)
|
|
|
|
{
|
2003-06-29 20:10:46 +00:00
|
|
|
if (!(flipit_finished())) {
|
|
|
|
clear_cursor();
|
2006-06-10 20:37:53 +00:00
|
|
|
cursor_pos = ( x + 5 + cursor_pos%5 )%5
|
|
|
|
+ ( ( y + 4 + cursor_pos/5 )%4 )*5;
|
2003-06-29 20:10:46 +00:00
|
|
|
draw_cursor();
|
|
|
|
}
|
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the board */
|
2006-10-15 22:31:09 +00:00
|
|
|
static void flipit_init(void)
|
|
|
|
{
|
2003-06-29 20:10:46 +00:00
|
|
|
int i;
|
2006-10-16 00:40:40 +00:00
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
for (i=0; i<20; i++) {
|
|
|
|
spots[i]=1;
|
|
|
|
toggle[i]=1;
|
|
|
|
draw_spot(i);
|
|
|
|
}
|
|
|
|
rb->lcd_update();
|
2007-04-06 22:55:00 +00:00
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
for (i=0; i<20; i++) {
|
|
|
|
cursor_pos = (rb->rand() % 20);
|
|
|
|
flipit_toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
cursor_pos = 0;
|
|
|
|
draw_cursor();
|
|
|
|
moves = 0;
|
2006-06-10 20:37:53 +00:00
|
|
|
draw_info_panel();
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the main game loop */
|
2006-10-15 22:31:09 +00:00
|
|
|
static bool flipit_loop(void)
|
|
|
|
{
|
2003-06-29 20:10:46 +00:00
|
|
|
int i;
|
2004-10-18 21:45:00 +00:00
|
|
|
int button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(FLIPIT_SOLVE_PRE) || defined(FLIPIT_STEP_PRE) || \
|
|
|
|
defined(FLIPIT_TOGGLE_PRE) || defined(FLIPIT_UP_PRE)
|
2004-10-18 21:45:00 +00:00
|
|
|
int lastbutton = BUTTON_NONE;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2004-10-18 21:45:00 +00:00
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
flipit_init();
|
|
|
|
while(true) {
|
2004-10-18 21:45:00 +00:00
|
|
|
button = rb->button_get(true);
|
|
|
|
switch (button) {
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef FLIPIT_RC_QUIT
|
|
|
|
case FLIPIT_RC_QUIT:
|
|
|
|
#endif
|
2004-10-18 21:45:00 +00:00
|
|
|
case FLIPIT_QUIT:
|
2003-06-29 20:10:46 +00:00
|
|
|
/* get out of here */
|
|
|
|
return PLUGIN_OK;
|
2006-06-10 20:37:53 +00:00
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
case FLIPIT_SHUFFLE:
|
2003-06-29 20:10:46 +00:00
|
|
|
/* mix up the pieces */
|
|
|
|
flipit_init();
|
|
|
|
break;
|
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
case FLIPIT_SOLVE:
|
2006-10-16 01:27:08 +00:00
|
|
|
#ifdef FLIPIT_SOLVE_PRE
|
|
|
|
if (lastbutton != FLIPIT_SOLVE_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2003-06-29 20:10:46 +00:00
|
|
|
/* solve the puzzle */
|
|
|
|
if (!flipit_finished()) {
|
|
|
|
for (i=0; i<20; i++)
|
|
|
|
if (!toggle[i]) {
|
|
|
|
clear_cursor();
|
|
|
|
cursor_pos = i;
|
|
|
|
flipit_toggle();
|
2006-06-10 20:37:53 +00:00
|
|
|
draw_cursor();
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(HZ*2/3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
case FLIPIT_STEP_BY_STEP:
|
2006-10-16 01:27:08 +00:00
|
|
|
#ifdef FLIPIT_STEP_PRE
|
|
|
|
if (lastbutton != FLIPIT_STEP_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2003-06-29 20:10:46 +00:00
|
|
|
if (!flipit_finished()) {
|
|
|
|
for (i=0; i<20; i++)
|
|
|
|
if (!toggle[i]) {
|
|
|
|
clear_cursor();
|
|
|
|
cursor_pos = i;
|
|
|
|
flipit_toggle();
|
2006-06-10 20:37:53 +00:00
|
|
|
draw_cursor();
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
case FLIPIT_TOGGLE:
|
|
|
|
#ifdef FLIPIT_TOGGLE_PRE
|
|
|
|
if (lastbutton != FLIPIT_TOGGLE_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2003-06-29 20:10:46 +00:00
|
|
|
/* toggle the pieces */
|
|
|
|
if (!flipit_finished()) {
|
|
|
|
flipit_toggle();
|
2006-06-10 20:37:53 +00:00
|
|
|
draw_cursor();
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
case FLIPIT_LEFT:
|
2006-06-10 20:37:53 +00:00
|
|
|
move_cursor(-1, 0);
|
2003-06-29 20:10:46 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
case FLIPIT_RIGHT:
|
2006-06-10 20:37:53 +00:00
|
|
|
move_cursor(1, 0);
|
2003-06-29 20:10:46 +00:00
|
|
|
break;
|
2008-04-24 14:12:57 +00:00
|
|
|
/*move cursor though the entire field*/
|
|
|
|
#ifdef FLIPIT_SCROLLWHEEL
|
|
|
|
case FLIPIT_PREV:
|
|
|
|
case FLIPIT_PREV|BUTTON_REPEAT:
|
|
|
|
if ((cursor_pos)%5 == 0) {
|
|
|
|
move_cursor(-1, -1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
move_cursor(-1, 0);
|
|
|
|
}
|
|
|
|
break;
|
2003-06-29 20:10:46 +00:00
|
|
|
|
2008-04-24 14:12:57 +00:00
|
|
|
case FLIPIT_NEXT:
|
|
|
|
case FLIPIT_NEXT|BUTTON_REPEAT:
|
|
|
|
if ((cursor_pos+1)%5 == 0) {
|
|
|
|
move_cursor(1, 1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
move_cursor(1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
2005-12-14 01:31:37 +00:00
|
|
|
case FLIPIT_UP:
|
2006-10-16 00:40:40 +00:00
|
|
|
#ifdef FLIPIT_UP_PRE
|
|
|
|
if (lastbutton != FLIPIT_UP_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2006-06-10 20:37:53 +00:00
|
|
|
move_cursor(0, -1);
|
2003-06-29 20:10:46 +00:00
|
|
|
break;
|
|
|
|
|
2005-12-14 01:31:37 +00:00
|
|
|
case FLIPIT_DOWN:
|
2006-06-10 20:37:53 +00:00
|
|
|
move_cursor(0, 1);
|
2003-06-29 20:10:46 +00:00
|
|
|
break;
|
|
|
|
|
2004-10-18 21:45:00 +00:00
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
break;
|
2003-06-29 20:10:46 +00:00
|
|
|
}
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(FLIPIT_SOLVE_PRE) || defined(FLIPIT_STEP_PRE) || \
|
|
|
|
defined(FLIPIT_TOGGLE_PRE) || defined(FLIPIT_UP_PRE)
|
2004-10-18 21:45:00 +00:00
|
|
|
if (button != BUTTON_NONE)
|
|
|
|
lastbutton = button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2003-06-29 20:10:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called function from outside */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2003-06-29 20:10:46 +00:00
|
|
|
{
|
2006-10-16 00:40:40 +00:00
|
|
|
int i, rc;
|
2003-06-29 20:10:46 +00:00
|
|
|
|
|
|
|
(void)parameter;
|
|
|
|
|
2006-06-10 20:37:53 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_background(LCD_WHITE);
|
2006-10-21 00:39:42 +00:00
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
2006-06-10 20:37:53 +00:00
|
|
|
#endif
|
|
|
|
|
2006-11-15 06:46:35 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-11-15 06:14:27 +00:00
|
|
|
rb->lcd_set_backdrop(NULL);
|
2006-11-15 06:46:35 +00:00
|
|
|
#endif
|
2006-11-15 06:14:27 +00:00
|
|
|
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ, "FlipIt!");
|
2003-06-29 20:10:46 +00:00
|
|
|
|
|
|
|
/* print instructions */
|
|
|
|
rb->lcd_clear_display();
|
2003-11-20 01:05:47 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2020-07-15 23:40:55 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2005-05-22 20:31:31 +00:00
|
|
|
rb->lcd_putsxy(2, 8, "[STOP] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[MODE] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[PLAY] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[REC] step by step");
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-03-18 19:11:18 +00:00
|
|
|
rb->lcd_putsxy(2, 8, "[S-MENU] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[S-LEFT] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[S-PLAY] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[S-RIGHT] step by step");
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-10-16 01:27:08 +00:00
|
|
|
rb->lcd_putsxy(2, 8, "[POWER] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[REC] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[PLAY..] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[PLAY] step by step");
|
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
2007-05-19 23:38:09 +00:00
|
|
|
rb->lcd_putsxy(2, 8, "[POWER] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[MENU] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[VOL+] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[VOL-] step by step");
|
2006-10-16 01:27:08 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
rb->lcd_putsxy(2, 8, "[POWER] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[REW] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[PL-LEFT] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[PL-RIGHT] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[PL-UP] step by step");
|
2009-03-29 10:41:31 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
rb->lcd_putsxy(2, 8, "[BACK] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[MENU] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[VOL+] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[VOL-] step by step");
|
2007-10-22 13:53:16 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD)
|
|
|
|
rb->lcd_putsxy(2, 8, "[POWER] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[REC-LEFT] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[REC-RIGHT] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[REC-SEL] step by step");
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
rb->lcd_putsxy(2, 8, "[REC] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[PLAY] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[MODE] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[MENU..] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[MENU] step by step");
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
rb->lcd_putsxy(2, 8, "[POWER] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[SELECT] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[VOL+] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[PREV] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[NEXT] step by step");
|
2016-01-23 14:54:08 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD) || \
|
2015-07-19 23:50:26 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH820_PAD)
|
|
|
|
rb->lcd_putsxy(2, 8, "Long [REW] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[PLAY] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[REW] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "Long [FFWD] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[FFWD] step by step");
|
2004-10-18 21:45:00 +00:00
|
|
|
#endif
|
2008-04-27 15:30:19 +00:00
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
rb->lcd_putsxy(2, 8, "[BOTTOMLEFT] to stop");
|
|
|
|
rb->lcd_putsxy(2, 18, "[CENTRE] toggle");
|
|
|
|
rb->lcd_putsxy(2, 28, "[TOPRIGHT] shuffle");
|
|
|
|
rb->lcd_putsxy(2, 38, "[BOTTOMLEFT] solution");
|
|
|
|
rb->lcd_putsxy(2, 48, "[BOTTOMRIGHT] step by step");
|
|
|
|
#endif
|
|
|
|
|
2003-06-29 20:10:46 +00:00
|
|
|
rb->lcd_update();
|
2020-07-17 14:31:31 +00:00
|
|
|
|
2006-03-18 19:11:18 +00:00
|
|
|
rb->button_get_w_tmo(HZ*3);
|
2003-06-29 20:10:46 +00:00
|
|
|
|
|
|
|
rb->lcd_clear_display();
|
2006-06-10 20:37:53 +00:00
|
|
|
draw_info_panel();
|
2003-06-29 20:10:46 +00:00
|
|
|
for (i=0; i<20; i++) {
|
|
|
|
spots[i]=1;
|
|
|
|
draw_spot(i);
|
|
|
|
}
|
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(HZ*3/2);
|
|
|
|
rb->srand(*rb->current_tick);
|
|
|
|
|
2006-10-16 00:40:40 +00:00
|
|
|
rc = flipit_loop();
|
|
|
|
return rc;
|
|
|
|
}
|