2003-06-29 21:10:27 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Frederic Dang Ngoc
|
|
|
|
*
|
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 21:10:27 +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-25 19:00:58 +00:00
|
|
|
|
2009-07-14 13:03:17 +00:00
|
|
|
#include "lib/display_text.h"
|
2009-08-05 14:29:29 +00:00
|
|
|
#include "lib/playback_control.h"
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/* size of a level in file */
|
|
|
|
#define STAR_LEVEL_SIZE ((STAR_WIDTH + 1) * STAR_HEIGHT + 1)
|
|
|
|
|
|
|
|
/* size of the game board */
|
|
|
|
#define STAR_WIDTH 16
|
|
|
|
#define STAR_HEIGHT 9
|
|
|
|
|
|
|
|
/* number of level */
|
|
|
|
#define STAR_LEVEL_COUNT 20
|
|
|
|
|
|
|
|
/* values of object in the board */
|
2006-06-03 19:24:10 +00:00
|
|
|
#define STAR_VOID '.'
|
|
|
|
#define STAR_WALL '*'
|
|
|
|
#define STAR_STAR 'o'
|
|
|
|
#define STAR_BALL 'X'
|
|
|
|
#define STAR_BLOCK 'x'
|
2003-06-29 21:10:27 +00:00
|
|
|
|
|
|
|
/* sleep time between two frames */
|
2007-03-28 07:33:18 +00:00
|
|
|
#if (LCD_HEIGHT * LCD_WIDTH >= 70000) && defined(IPOD_ARCH)
|
|
|
|
/* iPod 5G LCD is *slow* */
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_SLEEP rb->yield();
|
|
|
|
#elif (LCD_HEIGHT * LCD_WIDTH >= 30000)
|
2006-08-10 20:56:09 +00:00
|
|
|
#define STAR_SLEEP rb->sleep(0);
|
2006-06-11 13:25:44 +00:00
|
|
|
#else
|
2006-08-10 20:56:09 +00:00
|
|
|
#define STAR_SLEEP rb->sleep(1);
|
2006-06-11 13:25:44 +00:00
|
|
|
#endif
|
2003-06-29 21:10:27 +00:00
|
|
|
|
|
|
|
/* value of ball and block control */
|
|
|
|
#define STAR_CONTROL_BALL 0
|
|
|
|
#define STAR_CONTROL_BLOCK 1
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
/* variable button definitions */
|
2020-07-15 23:40:55 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_QUIT BUTTON_OFF
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2006-08-10 17:21:01 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_MODE
|
|
|
|
#define STAR_TOGGLE_CONTROL2 BUTTON_SELECT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_LEVEL_UP (BUTTON_ON | BUTTON_RIGHT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_ON | BUTTON_LEFT)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_ON | BUTTON_SELECT)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "MODE/SELECT"
|
|
|
|
#define STAR_QUIT_NAME "OFF"
|
|
|
|
#define STAR_LEVEL_UP_NAME "ON + RIGHT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "ON + LEFT"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "ON + NAVI"
|
2005-12-14 01:31:37 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define STAR_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
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_UP BUTTON_MENU
|
|
|
|
#define STAR_DOWN BUTTON_PLAY
|
2006-06-03 19:24:10 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_PRE BUTTON_SELECT
|
|
|
|
#define STAR_TOGGLE_CONTROL (BUTTON_SELECT | BUTTON_REL)
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_LEVEL_UP (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_SELECT | BUTTON_PLAY)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "S + MENU"
|
|
|
|
#define STAR_LEVEL_UP_NAME "S >"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "S <"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "S + PLAY"
|
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
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP_PRE BUTTON_REC
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_REC|BUTTON_REL)
|
|
|
|
#define STAR_LEVEL_DOWN_PRE BUTTON_REC
|
2006-10-21 00:38:45 +00:00
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_REC|BUTTON_REPEAT)
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_PLAY
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "REC"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "REC.."
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY"
|
2006-01-18 11:09:06 +00:00
|
|
|
|
2006-02-24 15:42:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
|
|
|
|
2007-05-19 23:38:09 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2007-05-19 23:38:09 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_A
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "A"
|
2009-04-10 17:28:26 +00:00
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
2008-12-12 19:50:49 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
2009-04-10 17:28:26 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
|
|
|
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2009-04-10 17:28:26 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_SELECT | BUTTON_DOWN)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "SELECT + RIGHT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "SELECT + LEFT"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "SELECT + DOWN"
|
2009-04-10 17:28:26 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2009-01-04 23:33:15 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2007-01-03 23:53:22 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
2009-01-04 23:33:15 +00:00
|
|
|
#define STAR_LEVEL_UP (BUTTON_SELECT | BUTTON_RIGHT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_SELECT | BUTTON_LEFT)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_SELECT | BUTTON_DOWN)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "HOME"
|
|
|
|
#define STAR_LEVEL_UP_NAME "SELECT + RIGHT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "SELECT + LEFT"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "SELECT + DOWN"
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2006-10-21 00:24:54 +00:00
|
|
|
#define STAR_UP BUTTON_SCROLL_UP
|
|
|
|
#define STAR_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_REW
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_SCROLL_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_SCROLL_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_RIGHT)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "REW"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY+UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY+DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY+RIGHT"
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_BACK
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2008-02-17 12:23:02 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_MENU
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "BACK"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "MENU"
|
2008-02-17 12:23:02 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2008-03-22 10:24:28 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
2008-03-01 22:55:09 +00:00
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_MENU
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_DISPLAY
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "MENU"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "DISPLAY"
|
2008-03-01 22:55:09 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_RC_REC
|
|
|
|
#define STAR_LEFT BUTTON_RC_REW
|
|
|
|
#define STAR_RIGHT BUTTON_RC_FF
|
|
|
|
#define STAR_UP BUTTON_RC_VOL_UP
|
|
|
|
#define STAR_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_RC_MODE
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_RC_PLAY|BUTTON_RC_VOL_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_RC_PLAY|BUTTON_RC_VOL_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_RC_PLAY|BUTTON_RC_MENU)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "MODE"
|
|
|
|
#define STAR_QUIT_NAME "REC"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY+VOL+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY+VOL-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY+MENU"
|
2008-03-22 10:24:28 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
|
2008-03-22 22:03:34 +00:00
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_QUIT_NAME "POWER"
|
2008-03-22 22:03:34 +00:00
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_BACK
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_CUSTOM | BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_CUSTOM | BUTTON_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_CUSTOM | BUTTON_RIGHT)
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "BACK"
|
|
|
|
#define STAR_LEVEL_UP_NAME "CUSTOM+UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "CUSTOM+DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "CUSTOM+RIGHT"
|
2008-12-04 21:28:56 +00:00
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_BACK
|
|
|
|
#define STAR_RIGHT BUTTON_MENU
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_REPEAT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "Hold PLAY button"
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_VIEW
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "VIEW"
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2010-11-02 20:09:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_NEXT
|
2010-11-03 03:23:14 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
2010-11-02 20:09:02 +00:00
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL +"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL -"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "NEXT"
|
|
|
|
|
2009-12-03 23:13:45 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_PREV
|
|
|
|
#define STAR_RIGHT BUTTON_NEXT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_RIGHT
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "RIGHT"
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif (CONFIG_KEYPAD == ONDAVX747_PAD)
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_QUIT_NAME "POWER"
|
2009-04-07 23:41:44 +00:00
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif (CONFIG_KEYPAD == ONDAVX777_PAD)
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
|
2009-04-21 04:24:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_QUIT_NAME "POWER"
|
2009-04-21 04:24:16 +00:00
|
|
|
|
2015-07-19 23:50:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH820_PAD
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2015-07-19 23:50:26 +00:00
|
|
|
#define STAR_QUIT (BUTTON_REW|BUTTON_REPEAT)
|
2009-08-04 03:08:32 +00:00
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2015-07-19 23:50:26 +00:00
|
|
|
#define STAR_LEVEL_UP (BUTTON_REC|BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_REC|BUTTON_DOWN)
|
2014-10-15 12:25:28 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
2015-07-19 23:50:26 +00:00
|
|
|
#define STAR_LEVEL_REPEAT_PRE BUTTON_FFWD
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_FFWD|BUTTON_REPEAT)
|
2009-08-04 03:08:32 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
2015-07-19 23:50:26 +00:00
|
|
|
#define STAR_QUIT_NAME "LONG REW"
|
|
|
|
#define STAR_LEVEL_UP_NAME "REC+UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "REC+DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "LONG FFWD"
|
|
|
|
|
2016-01-23 14:54:08 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH92X_PAD
|
2015-07-19 23:50:26 +00:00
|
|
|
|
|
|
|
#define STAR_QUIT (BUTTON_REW|BUTTON_REPEAT)
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_FFWD|BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_FFWD|BUTTON_DOWN)
|
|
|
|
#define STAR_TOGGLE_CONTROL (BUTTON_PLAY|BUTTON_REL)
|
|
|
|
#define STAR_LEVEL_REPEAT_PRE (BUTTON_FFWD|BUTTON_REPEAT)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_FFWD|BUTTON_REL)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "LONG REW"
|
|
|
|
#define STAR_LEVEL_UP_NAME "FFWD+UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "FFWD+DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "LONG FFWD"
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-13 15:46:34 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_REC
|
|
|
|
#define STAR_LEFT BUTTON_PREV
|
|
|
|
#define STAR_RIGHT BUTTON_NEXT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP BUTTON_OK
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_CANCEL
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_MENU
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "REC"
|
|
|
|
#define STAR_LEVEL_UP_NAME "OK"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "CANCEL"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "MENU"
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT (BUTTON_REC | BUTTON_PLAY)
|
|
|
|
#define STAR_LEFT BUTTON_VOL_DOWN
|
|
|
|
#define STAR_RIGHT BUTTON_VOL_UP
|
2010-11-02 10:44:34 +00:00
|
|
|
#define STAR_UP BUTTON_REW
|
|
|
|
#define STAR_DOWN BUTTON_FF
|
|
|
|
#define STAR_TOGGLE_CONTROL_PRE BUTTON_FUNC
|
|
|
|
#define STAR_TOGGLE_CONTROL (BUTTON_FUNC | BUTTON_REL)
|
2010-04-26 21:40:00 +00:00
|
|
|
#define STAR_LEVEL_UP BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_REC
|
2010-11-02 10:44:34 +00:00
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_FUNC | BUTTON_REPEAT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "FUNC"
|
2010-04-26 21:40:00 +00:00
|
|
|
#define STAR_QUIT_NAME "REC + PLAY"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "REC"
|
2010-11-02 10:44:34 +00:00
|
|
|
#define STAR_LEVEL_REPEAT_NAME "FUNC LONG"
|
2010-04-26 21:40:00 +00:00
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
|
2012-02-02 13:42:42 +00:00
|
|
|
#define STAR_QUIT (BUTTON_MENU | BUTTON_REPEAT)
|
2010-11-30 10:52:14 +00:00
|
|
|
#define STAR_LEFT BUTTON_REW
|
|
|
|
#define STAR_RIGHT BUTTON_FF
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2012-02-02 13:42:42 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_PRE BUTTON_ENTER
|
|
|
|
#define STAR_TOGGLE_CONTROL (BUTTON_ENTER | BUTTON_REL)
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_FF)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_REW)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_REPEAT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "ENTER"
|
|
|
|
#define STAR_QUIT_NAME "LONG MENU"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY + FF"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY + REW"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "LONG PLAY"
|
2010-11-30 10:52:14 +00:00
|
|
|
|
2011-10-02 16:51:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
2012-03-01 22:23:29 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAYPAUSE
|
2011-10-02 16:51:17 +00:00
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_BACK | BUTTON_REPEAT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "Vol+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Vol-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "BACK LONG"
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PREV | BUTTON_REPEAT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "Vol+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Vol-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PREV LONG"
|
|
|
|
|
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 STAR_QUIT BUTTON_BACK
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_MENU
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_POWER
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_USER
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "Select"
|
|
|
|
#define STAR_QUIT_NAME "Back"
|
|
|
|
#define STAR_LEVEL_UP_NAME "Menu"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Power"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "User"
|
|
|
|
|
2012-03-23 18:32:50 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD)
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_POWER | BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_POWER | BUTTON_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_POWER | BUTTON_SELECT)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "POWER + UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "POWER + DOWN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "POWER + SELECT"
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM801_PAD)
|
|
|
|
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_NEXT
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_PREV
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_PLAY
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "SELECT"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "NEXT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PREV"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY"
|
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define STAR_QUIT BUTTON_BACK
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_POWER|BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_POWER|BUTTON_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_POWER|BUTTON_PLAY)
|
|
|
|
#define STAR_LEVEL_UP_NAME "Option+Up"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Option+Down"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "Option+Play"
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "Play"
|
|
|
|
#define STAR_QUIT_NAME "Back"
|
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
|
|
|
#define STAR_QUIT BUTTON_BACK
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP BUTTON_MENU
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_PLAYPAUSE
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_SHORTCUT
|
|
|
|
#define STAR_LEVEL_UP_NAME "Menu"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Play/pause"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "Shortcut"
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "Select"
|
|
|
|
#define STAR_QUIT_NAME "Back"
|
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif (CONFIG_KEYPAD == DX50_PAD)
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_QUIT_NAME "Power"
|
|
|
|
|
2018-02-22 22:42:29 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_MENU
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "MENU"
|
|
|
|
|
2018-03-02 20:53:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_VOLUP|BUTTON_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_VOLUP|BUTTON_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_VOLUP|BUTTON_SELECT)
|
|
|
|
#define STAR_LEVEL_UP_NAME "Option+Up"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "Option+Down"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "Option+Play"
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "Play"
|
|
|
|
#define STAR_QUIT_NAME "Back"
|
|
|
|
|
2018-06-28 10:24:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_PREV
|
|
|
|
#define STAR_RIGHT BUTTON_NEXT
|
|
|
|
#define STAR_UP BUTTON_HOME
|
|
|
|
#define STAR_DOWN BUTTON_OPTION
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_NEXT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_PREV)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_OPTION)
|
2018-11-05 12:01:55 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY + NEXT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY + PREV"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION"
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3II_PAD || CONFIG_KEYPAD == XDUOO_X20_PAD
|
2018-11-05 12:01:55 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_PREV
|
|
|
|
#define STAR_RIGHT BUTTON_NEXT
|
|
|
|
#define STAR_UP BUTTON_HOME
|
|
|
|
#define STAR_DOWN BUTTON_OPTION
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_NEXT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_PREV)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_OPTION)
|
2020-10-03 22:17:11 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY + NEXT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY + PREV"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION"
|
|
|
|
|
2021-02-27 22:07:37 +00:00
|
|
|
#elif CONFIG_KEYPAD == FIIO_M3K_LINUX_PAD
|
2020-10-03 22:17:11 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_PREV
|
|
|
|
#define STAR_RIGHT BUTTON_NEXT
|
|
|
|
#define STAR_UP BUTTON_HOME
|
|
|
|
#define STAR_DOWN BUTTON_OPTION
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_NEXT)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_PREV)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_OPTION)
|
2018-06-28 10:24:26 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "PLAY + NEXT"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "PLAY + PREV"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION"
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD || CONFIG_KEYPAD == IHIFI_800_PAD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_HOME
|
|
|
|
#define STAR_RIGHT BUTTON_VOL_DOWN
|
|
|
|
#define STAR_UP BUTTON_PREV
|
|
|
|
#define STAR_DOWN BUTTON_NEXT
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP (BUTTON_POWER | BUTTON_VOL_UP)
|
|
|
|
#define STAR_LEVEL_DOWN (BUTTON_POWER | BUTTON_VOL_DOWN)
|
|
|
|
#define STAR_LEVEL_REPEAT (BUTTON_POWER | BUTTON_HOME)
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "POWER + VOL+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "POWER + VOL-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "POWER + HOME"
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == EROSQ_PAD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define STAR_QUIT BUTTON_POWER
|
2020-10-08 13:47:40 +00:00
|
|
|
#define STAR_LEFT BUTTON_SCROLL_BACK
|
|
|
|
#define STAR_RIGHT BUTTON_SCROLL_FWD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define STAR_UP BUTTON_PREV
|
|
|
|
#define STAR_DOWN BUTTON_NEXT
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
2020-10-08 13:47:40 +00:00
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_BACK
|
2018-06-29 20:09:28 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
2020-10-08 13:47:40 +00:00
|
|
|
#define STAR_LEVEL_UP_NAME "VOL UP"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL DN"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "BACK"
|
2018-06-29 20:09:28 +00:00
|
|
|
|
2021-02-27 22:08:58 +00:00
|
|
|
#elif CONFIG_KEYPAD == FIIO_M3K_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_LEFT BUTTON_LEFT
|
|
|
|
#define STAR_RIGHT BUTTON_RIGHT
|
|
|
|
#define STAR_UP BUTTON_UP
|
|
|
|
#define STAR_DOWN BUTTON_DOWN
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_PLAY
|
|
|
|
#define STAR_LEVEL_UP BUTTON_VOL_UP
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_BACK
|
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "PLAY"
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
#define STAR_LEVEL_UP_NAME "VOL+"
|
|
|
|
#define STAR_LEVEL_DOWN_NAME "VOL-"
|
|
|
|
#define STAR_LEVEL_REPEAT_NAME "BACK"
|
|
|
|
|
2021-05-23 16:30:58 +00:00
|
|
|
#elif CONFIG_KEYPAD == SHANLING_Q1_PAD
|
|
|
|
#define STAR_QUIT BUTTON_POWER
|
|
|
|
#define STAR_QUIT_NAME "POWER"
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-22 00:22:07 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
//#ifndef STAR_QUIT
|
|
|
|
//#define STAR_QUIT BUTTON_TOPLEFT
|
2009-07-14 13:03:17 +00:00
|
|
|
//#define STAR_QUIT_NAME "TOPLEFT"
|
2008-04-27 15:30:19 +00:00
|
|
|
//#endif
|
|
|
|
#ifndef STAR_LEFT
|
|
|
|
#define STAR_LEFT BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef STAR_RIGHT
|
|
|
|
#define STAR_RIGHT BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef STAR_UP
|
|
|
|
#define STAR_UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef STAR_DOWN
|
|
|
|
#define STAR_DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef STAR_TOGGLE_CONTROL
|
|
|
|
#define STAR_TOGGLE_CONTROL BUTTON_CENTER
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_TOGGLE_CONTROL_NAME "CENTER"
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef STAR_LEVEL_UP
|
|
|
|
#define STAR_LEVEL_UP BUTTON_TOPLEFT
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_LEVEL_UP_NAME "TOPLEFT"
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef STAR_LEVEL_DOWN
|
|
|
|
#define STAR_LEVEL_DOWN BUTTON_BOTTOMLEFT
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_LEVEL_DOWN_NAME "BOTTOMLEFT"
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef STAR_LEVEL_REPEAT
|
|
|
|
#define STAR_LEVEL_REPEAT BUTTON_BOTTOMRIGHT
|
2009-07-14 13:03:17 +00:00
|
|
|
#define STAR_LEVEL_REPEAT_NAME "BOTTOMRIGHT"
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
/* function returns because of USB? */
|
|
|
|
static bool usb_detected = false;
|
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/* position of the ball */
|
|
|
|
static int ball_x, ball_y;
|
|
|
|
|
|
|
|
/* position of the block */
|
|
|
|
static int block_x, block_y;
|
|
|
|
|
|
|
|
/* number of stars to get to finish the level */
|
|
|
|
static int star_count;
|
|
|
|
|
|
|
|
/* the object we control : ball or block */
|
|
|
|
static int control;
|
|
|
|
|
|
|
|
/* the current board */
|
|
|
|
static char board[STAR_HEIGHT][STAR_WIDTH];
|
|
|
|
|
2008-11-03 14:37:50 +00:00
|
|
|
#include "pluginbitmaps/star_tiles.h"
|
2006-06-10 20:39:33 +00:00
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
#define TILE_WIDTH BMPWIDTH_star_tiles
|
|
|
|
#define TILE_HEIGHT (BMPHEIGHT_star_tiles/5)
|
|
|
|
#define STAR_OFFSET_X ((LCD_WIDTH - STAR_WIDTH * TILE_WIDTH) / 2)
|
|
|
|
#define STAR_OFFSET_Y ((LCD_HEIGHT - STAR_HEIGHT * TILE_HEIGHT - MAX(TILE_HEIGHT, 8)) / 2)
|
2006-06-10 20:39:33 +00:00
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
#define WALL 0
|
|
|
|
#define SPACE 1
|
|
|
|
#define BLOCK 2
|
|
|
|
#define STAR 3
|
|
|
|
#define BALL 4
|
2006-06-10 20:39:33 +00:00
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/* char font size */
|
|
|
|
static int char_width = -1;
|
|
|
|
static int char_height = -1;
|
|
|
|
|
|
|
|
/* this arrays contains a group of levels loaded into memory */
|
2006-06-03 19:24:10 +00:00
|
|
|
static unsigned char* levels =
|
2003-06-29 21:10:27 +00:00
|
|
|
"****************\n"
|
|
|
|
"*X**........o*x*\n"
|
|
|
|
"*..........o.***\n"
|
|
|
|
"*.......**o....*\n"
|
|
|
|
"*...**.o......**\n"
|
|
|
|
"**.o..o.....o..*\n"
|
|
|
|
"*.o......o**.o.*\n"
|
|
|
|
"*.....**o.....o*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
".*..*.*.*...*.**\n"
|
|
|
|
"*...o.........X*\n"
|
|
|
|
"...*o..*o...o...\n"
|
|
|
|
"*.*.o.....o..*.*\n"
|
|
|
|
"......*...o...*.\n"
|
|
|
|
"*....*x*..o....*\n"
|
|
|
|
"...*..*.*...*oo*\n"
|
|
|
|
"*.............*.\n"
|
|
|
|
".*..*........*..\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*...........o*x*\n"
|
|
|
|
"*...**......**X*\n"
|
|
|
|
"*...*o.........*\n"
|
|
|
|
"*.o.....o**...o*\n"
|
|
|
|
"*.*o..o..o*..o**\n"
|
|
|
|
"*.**o.*o..o.o***\n"
|
|
|
|
"*o....**o......*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*............*x*\n"
|
|
|
|
"*.....*........*\n"
|
|
|
|
"**o*o.o*o*o*o*o*\n"
|
|
|
|
"*.*.*o.o*.*.*.**\n"
|
|
|
|
"**o*o*o.o*o*o*o*\n"
|
|
|
|
"*.....*........*\n"
|
|
|
|
"*...*.......*X.*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
".**************.\n"
|
|
|
|
"*X..*...*..*...*\n"
|
|
|
|
"*..*o.*.o..o.*.*\n"
|
|
|
|
"**......*..*...*\n"
|
|
|
|
"*o.*o*........**\n"
|
|
|
|
"**.....*.o.*...*\n"
|
|
|
|
"*o*..*.*.*...*x*\n"
|
|
|
|
"*...*....o*..*o*\n"
|
|
|
|
".**************.\n"
|
|
|
|
"\n"
|
|
|
|
"....************\n"
|
|
|
|
"...*...o...*o.o*\n"
|
|
|
|
"..*....o....*.**\n"
|
|
|
|
".*.....o.......*\n"
|
|
|
|
"*X.....o.......*\n"
|
|
|
|
"**.....o..*...**\n"
|
|
|
|
"*......o....*..*\n"
|
|
|
|
"*x.*...o..**o..*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*..............*\n"
|
|
|
|
".**.***..*o.**o*\n"
|
|
|
|
".*o..*o.*.*.*.*.\n"
|
|
|
|
"..*..*..***.**..\n"
|
|
|
|
".**..*..*o*.*o**\n"
|
|
|
|
"*..............*\n"
|
|
|
|
"*..X*o....x..*o*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"***************.\n"
|
|
|
|
"*..o**.........*\n"
|
|
|
|
"*..*o..**.o....*\n"
|
|
|
|
"*..o**.*.*o....*\n"
|
|
|
|
"**.....**..*o*.*\n"
|
|
|
|
"**.*.......o*o.*\n"
|
|
|
|
"*oxo*...o..*X*.*\n"
|
|
|
|
"**.............*\n"
|
|
|
|
".***************\n"
|
|
|
|
"\n"
|
|
|
|
"..*.***********.\n"
|
|
|
|
".*o*o......*..X*\n"
|
|
|
|
"*o.o*....o....*.\n"
|
|
|
|
".*.*..o**..o*..*\n"
|
|
|
|
"*..*o.*oxo....o*\n"
|
|
|
|
"*.....o**.....*.\n"
|
|
|
|
"*o*o.........*..\n"
|
|
|
|
"*...........*...\n"
|
|
|
|
".***********....\n"
|
|
|
|
"\n"
|
|
|
|
"....***********.\n"
|
|
|
|
"*****.o........*\n"
|
|
|
|
"*...x.***o.o*.o*\n"
|
|
|
|
"*.o...*o.*o...*.\n"
|
|
|
|
"*.....*..o..*.o*\n"
|
|
|
|
"*o*o..*.o*..*X*.\n"
|
|
|
|
".*o...***..***..\n"
|
|
|
|
"*.........*.*.*.\n"
|
|
|
|
".*********..*..*\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*......*......X*\n"
|
|
|
|
"*..*oo.....oo.**\n"
|
|
|
|
"**...o...**...o*\n"
|
|
|
|
"*o....*o*oo..***\n"
|
|
|
|
"**.**....**....*\n"
|
|
|
|
"*o..o*.o....x.o*\n"
|
|
|
|
"**o***....*...**\n"
|
|
|
|
"***************.\n"
|
|
|
|
"\n"
|
|
|
|
"**.....**..****.\n"
|
|
|
|
"*X*****o.***.o**\n"
|
|
|
|
"*....oo.....o..*\n"
|
|
|
|
"*.**..**o..*o*.*\n"
|
|
|
|
"*.*.o.*.*o.**..*\n"
|
|
|
|
"*.**..**...*x*.*\n"
|
|
|
|
"*.....o........*\n"
|
|
|
|
"*........o.....*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
".**************.\n"
|
|
|
|
"*.X*........o.**\n"
|
|
|
|
"*.*...*o...o**.*\n"
|
|
|
|
"*.......o....*.*\n"
|
|
|
|
"*.o..........*o*\n"
|
|
|
|
"*.*......o.....*\n"
|
|
|
|
"**......o.o..*o*\n"
|
|
|
|
"*x..*....o.*.*.*\n"
|
|
|
|
".**************.\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*o*o........o*o*\n"
|
|
|
|
"*.o*X......**..*\n"
|
|
|
|
"*.x........o...*\n"
|
|
|
|
"*........o*....*\n"
|
|
|
|
"*......o.......*\n"
|
|
|
|
"*.o*........*..*\n"
|
|
|
|
"*o*o........o*o*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
".******.********\n"
|
|
|
|
"*.....o*.....o.*\n"
|
|
|
|
"*.*.o.*..*...o.*\n"
|
|
|
|
"*..X*...*oo.*o.*\n"
|
|
|
|
".*.*...*.o..x*.*\n"
|
|
|
|
"*o.......*..*o.*\n"
|
|
|
|
".*......o.....*.\n"
|
|
|
|
"*o............o*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"**.x*o.o......o*\n"
|
|
|
|
"*o.Xo*o.......**\n"
|
|
|
|
"**.***........**\n"
|
|
|
|
"**.....o*o*....*\n"
|
|
|
|
"*oo.......o*o..*\n"
|
|
|
|
"**.o....****o..*\n"
|
|
|
|
"**o*..*........*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*.o*........*X.*\n"
|
|
|
|
"*.*..o*oo*o..*.*\n"
|
|
|
|
"*....*o**o*.o..*\n"
|
|
|
|
"*.o*.......o*..*\n"
|
|
|
|
"*..o*o....o*...*\n"
|
|
|
|
"*.*..*.**o*..*.*\n"
|
|
|
|
"*....o.*o...x..*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*.o....o..x*...*\n"
|
|
|
|
"*..*o*o...*o...*\n"
|
|
|
|
"*...*o*....*o..*\n"
|
|
|
|
"*...o..*...o*o.*\n"
|
|
|
|
"*.*o*...*.o*...*\n"
|
|
|
|
"*.o*o.*.o.*....*\n"
|
|
|
|
"*o*X..*.....*..*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*o...**.....**o*\n"
|
|
|
|
"*.*..*......*o.*\n"
|
|
|
|
"*.o*...o**..o..*\n"
|
|
|
|
"*.*....*o......*\n"
|
|
|
|
"*....*...o*....*\n"
|
|
|
|
"*.**.o*.**o..*x*\n"
|
|
|
|
"*.o*.*o.....**X*\n"
|
|
|
|
"****************\n"
|
|
|
|
"\n"
|
|
|
|
"****************\n"
|
|
|
|
"*...o*o........*\n"
|
|
|
|
"**o..o*.**o...**\n"
|
|
|
|
"*.*.*.o...*..*.*\n"
|
|
|
|
"*.x.*..**..*.Xo*\n"
|
|
|
|
"*.*..*...o.*.*.*\n"
|
|
|
|
"**...o**.*o..o**\n"
|
|
|
|
"*........o*o...*\n"
|
|
|
|
"****************";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Do a pretty transition from one level to another.
|
|
|
|
*/
|
|
|
|
static void star_transition_update(void)
|
2006-06-03 19:24:10 +00:00
|
|
|
{
|
2007-06-06 21:10:48 +00:00
|
|
|
const int center_x = LCD_WIDTH / 2;
|
|
|
|
const int center_y = LCD_HEIGHT / 2;
|
2006-10-21 00:24:54 +00:00
|
|
|
int x = 0;
|
2003-06-29 21:10:27 +00:00
|
|
|
int y = 0;
|
2006-10-21 00:24:54 +00:00
|
|
|
#if LCD_WIDTH >= LCD_HEIGHT
|
2007-06-06 21:10:48 +00:00
|
|
|
#if defined(IPOD_VIDEO)
|
|
|
|
const int step = 4;
|
|
|
|
#else
|
|
|
|
const int step = 1;
|
|
|
|
#endif
|
|
|
|
const int lcd_demi_width = LCD_WIDTH / 2;
|
2003-06-29 21:10:27 +00:00
|
|
|
int var_y = 0;
|
|
|
|
|
2007-06-06 21:10:48 +00:00
|
|
|
for (; x < lcd_demi_width ; x+=step)
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
|
|
|
var_y += LCD_HEIGHT;
|
|
|
|
if (var_y > LCD_WIDTH)
|
|
|
|
{
|
|
|
|
var_y -= LCD_WIDTH;
|
2007-06-06 21:10:48 +00:00
|
|
|
y+=step;
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
2007-10-15 21:00:57 +00:00
|
|
|
if( x )
|
|
|
|
{
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y - y, x*2, step);
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y + y - step, x*2, step);
|
|
|
|
}
|
|
|
|
if( y )
|
|
|
|
{
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y - y, step, y*2);
|
|
|
|
rb->lcd_update_rect(center_x + x - step, center_y - y, step, y*2);
|
|
|
|
}
|
2006-10-21 00:24:54 +00:00
|
|
|
STAR_SLEEP
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
int lcd_demi_height = LCD_HEIGHT / 2;
|
|
|
|
int var_x = 0;
|
|
|
|
|
|
|
|
for (; y < lcd_demi_height ; y++)
|
|
|
|
{
|
|
|
|
var_x += LCD_WIDTH;
|
|
|
|
if (var_x > LCD_HEIGHT)
|
|
|
|
{
|
|
|
|
var_x -= LCD_HEIGHT;
|
|
|
|
x++;
|
|
|
|
}
|
2007-10-15 21:00:57 +00:00
|
|
|
if( x )
|
|
|
|
{
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y - y, x * 2, 1);
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y + y - 1, x * 2, 1);
|
|
|
|
}
|
|
|
|
if( y )
|
|
|
|
{
|
|
|
|
rb->lcd_update_rect(center_x - x, center_y - y, 1, y * 2);
|
|
|
|
rb->lcd_update_rect(center_x + x - 1, center_y - y, 1, y * 2);
|
|
|
|
}
|
2006-06-11 13:25:44 +00:00
|
|
|
STAR_SLEEP
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
2006-10-21 00:24:54 +00:00
|
|
|
#endif
|
2003-06-29 21:10:27 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display information board of the current level.
|
|
|
|
*/
|
2007-03-28 07:33:18 +00:00
|
|
|
static void star_display_board_info(int current_level)
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
2006-10-21 00:24:54 +00:00
|
|
|
int label_pos_y, tile_pos_y;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
if (TILE_HEIGHT > char_height)
|
|
|
|
{
|
|
|
|
tile_pos_y = LCD_HEIGHT - TILE_HEIGHT;
|
|
|
|
label_pos_y = tile_pos_y + (TILE_HEIGHT - char_height) / 2;
|
|
|
|
}
|
2003-06-29 21:10:27 +00:00
|
|
|
else
|
2006-10-21 00:24:54 +00:00
|
|
|
{
|
|
|
|
label_pos_y = LCD_HEIGHT - char_height;
|
|
|
|
tile_pos_y = label_pos_y + (char_height - TILE_HEIGHT) / 2;
|
|
|
|
}
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2010-08-28 21:46:45 +00:00
|
|
|
rb->lcd_putsxyf(STAR_OFFSET_X, label_pos_y, "L:%02d", current_level + 1);
|
|
|
|
rb->lcd_putsxyf(LCD_WIDTH/2 - 2 * char_width, label_pos_y, "S:%02d",
|
|
|
|
star_count);
|
2006-10-21 00:24:54 +00:00
|
|
|
rb->lcd_putsxy(STAR_OFFSET_X + (STAR_WIDTH-1) * TILE_WIDTH - 2 * char_width,
|
|
|
|
label_pos_y, "C:");
|
|
|
|
|
|
|
|
rb->lcd_bitmap_part(star_tiles, 0, control == STAR_CONTROL_BALL ?
|
2020-10-08 13:47:40 +00:00
|
|
|
BALL*TILE_HEIGHT : BLOCK*TILE_HEIGHT,
|
|
|
|
STRIDE( SCREEN_MAIN,
|
2009-09-04 00:46:24 +00:00
|
|
|
BMPWIDTH_star_tiles, BMPHEIGHT_star_tiles),
|
2006-10-21 00:24:54 +00:00
|
|
|
STAR_OFFSET_X + (STAR_WIDTH-1) * TILE_WIDTH,
|
|
|
|
tile_pos_y, TILE_WIDTH, TILE_HEIGHT);
|
|
|
|
|
|
|
|
rb->lcd_update_rect(0, MIN(label_pos_y, tile_pos_y), LCD_WIDTH,
|
|
|
|
MAX(TILE_HEIGHT, char_height));
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load a level into board array.
|
|
|
|
*/
|
|
|
|
static int star_load_level(int current_level)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
char *ptr_tab;
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2007-03-28 07:33:18 +00:00
|
|
|
if (current_level < 0)
|
|
|
|
current_level = 0;
|
|
|
|
else if (current_level > STAR_LEVEL_COUNT-1)
|
|
|
|
current_level = STAR_LEVEL_COUNT-1;
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
|
|
|
|
ptr_tab = levels + current_level * STAR_LEVEL_SIZE;
|
|
|
|
control = STAR_CONTROL_BALL;
|
|
|
|
star_count = 0;
|
|
|
|
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
|
|
|
|
for (y = 0 ; y < STAR_HEIGHT ; y++)
|
|
|
|
{
|
|
|
|
for (x = 0 ; x < STAR_WIDTH ; x++)
|
|
|
|
{
|
|
|
|
board[y][x] = *ptr_tab;
|
|
|
|
switch (*ptr_tab)
|
|
|
|
{
|
2009-09-01 02:44:11 +00:00
|
|
|
# define DRAW_TILE( a ) \
|
|
|
|
rb->lcd_bitmap_part( star_tiles, 0, \
|
|
|
|
a*TILE_HEIGHT, \
|
2009-09-04 00:46:24 +00:00
|
|
|
STRIDE( SCREEN_MAIN, \
|
|
|
|
BMPWIDTH_star_tiles, \
|
2009-09-01 02:44:11 +00:00
|
|
|
BMPHEIGHT_star_tiles), \
|
|
|
|
STAR_OFFSET_X + x * TILE_WIDTH, \
|
|
|
|
STAR_OFFSET_Y + y * TILE_HEIGHT, \
|
|
|
|
TILE_WIDTH, TILE_HEIGHT);
|
2020-10-08 13:47:40 +00:00
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
case STAR_VOID:
|
2006-10-21 00:24:54 +00:00
|
|
|
DRAW_TILE( SPACE );
|
2003-06-29 21:10:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STAR_WALL:
|
2006-10-21 00:24:54 +00:00
|
|
|
DRAW_TILE( WALL );
|
2003-06-29 21:10:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STAR_STAR:
|
2006-10-21 00:24:54 +00:00
|
|
|
DRAW_TILE( STAR );
|
2003-06-29 21:10:27 +00:00
|
|
|
star_count++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STAR_BALL:
|
|
|
|
ball_x = x;
|
|
|
|
ball_y = y;
|
2006-10-21 00:24:54 +00:00
|
|
|
DRAW_TILE( BALL );
|
2003-06-29 21:10:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case STAR_BLOCK:
|
|
|
|
block_x = x;
|
|
|
|
block_y = y;
|
2006-10-21 00:24:54 +00:00
|
|
|
DRAW_TILE( BLOCK );
|
2003-06-29 21:10:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
ptr_tab++;
|
|
|
|
}
|
|
|
|
ptr_tab++;
|
|
|
|
}
|
2007-03-28 07:33:18 +00:00
|
|
|
star_display_board_info(current_level);
|
2003-06-29 21:10:27 +00:00
|
|
|
star_transition_update();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
static void star_animate_tile(int tile_no, int start_x, int start_y,
|
|
|
|
int delta_x, int delta_y)
|
|
|
|
{
|
|
|
|
int i;
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2006-10-21 00:24:54 +00:00
|
|
|
if (delta_x != 0) /* horizontal */
|
|
|
|
{
|
|
|
|
for (i = 1 ; i <= TILE_WIDTH ; i++)
|
|
|
|
{
|
|
|
|
STAR_SLEEP
|
2020-10-08 13:47:40 +00:00
|
|
|
rb->lcd_bitmap_part(star_tiles, 0, SPACE * TILE_HEIGHT,
|
|
|
|
STRIDE( SCREEN_MAIN,
|
2009-09-04 00:46:24 +00:00
|
|
|
BMPWIDTH_star_tiles, BMPHEIGHT_star_tiles),
|
2006-10-21 00:24:54 +00:00
|
|
|
start_x, start_y, TILE_WIDTH, TILE_HEIGHT);
|
2009-09-01 02:44:11 +00:00
|
|
|
rb->lcd_bitmap_part(star_tiles, 0, tile_no * TILE_HEIGHT,
|
2020-10-08 13:47:40 +00:00
|
|
|
STRIDE( SCREEN_MAIN,
|
2009-09-04 00:46:24 +00:00
|
|
|
BMPWIDTH_star_tiles, BMPHEIGHT_star_tiles),
|
2006-10-21 00:24:54 +00:00
|
|
|
start_x + delta_x * i, start_y, TILE_WIDTH, TILE_HEIGHT);
|
|
|
|
rb->lcd_update_rect(start_x + delta_x * i - (delta_x>0?1:0),
|
|
|
|
start_y, TILE_WIDTH + 1, TILE_HEIGHT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* vertical */
|
|
|
|
{
|
|
|
|
for (i = 1 ; i <= TILE_HEIGHT ; i++)
|
|
|
|
{
|
|
|
|
STAR_SLEEP
|
2020-10-08 13:47:40 +00:00
|
|
|
rb->lcd_bitmap_part(star_tiles, 0, SPACE * TILE_HEIGHT,
|
|
|
|
STRIDE( SCREEN_MAIN,
|
2009-09-04 00:46:24 +00:00
|
|
|
BMPWIDTH_star_tiles, BMPHEIGHT_star_tiles),
|
2006-10-21 00:24:54 +00:00
|
|
|
start_x, start_y, TILE_WIDTH, TILE_HEIGHT);
|
2020-10-08 13:47:40 +00:00
|
|
|
rb->lcd_bitmap_part(star_tiles, 0, tile_no * TILE_HEIGHT,
|
|
|
|
STRIDE( SCREEN_MAIN,
|
2009-09-04 00:46:24 +00:00
|
|
|
BMPWIDTH_star_tiles, BMPHEIGHT_star_tiles),
|
2006-10-21 00:24:54 +00:00
|
|
|
start_x, start_y + delta_y * i, TILE_WIDTH, TILE_HEIGHT);
|
|
|
|
rb->lcd_update_rect(start_x, start_y + delta_y * i - (delta_y>0?1:0),
|
|
|
|
TILE_WIDTH, TILE_HEIGHT + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/**
|
|
|
|
* Run the game.
|
|
|
|
*/
|
2007-03-28 07:33:18 +00:00
|
|
|
static int star_run_game(int current_level)
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
|
|
|
int move_x = 0;
|
|
|
|
int move_y = 0;
|
2004-10-22 00:22:07 +00:00
|
|
|
int key;
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(STAR_LEVEL_DOWN_PRE) || \
|
|
|
|
defined(STAR_LEVEL_UP_PRE) || \
|
2020-10-08 13:47:40 +00:00
|
|
|
defined(STAR_TOGGLE_CONTROL_PRE)
|
2004-10-22 00:22:07 +00:00
|
|
|
int lastkey = BUTTON_NONE;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2003-06-29 21:10:27 +00:00
|
|
|
|
|
|
|
if (!star_load_level(current_level))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
move_x = 0;
|
|
|
|
move_y = 0;
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
while ((move_x == 0) && (move_y == 0))
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
2004-10-22 00:22:07 +00:00
|
|
|
key = rb->button_get(true);
|
|
|
|
switch (key)
|
|
|
|
{
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef STAR_RC_QUIT
|
|
|
|
case STAR_RC_QUIT:
|
|
|
|
#endif
|
2004-10-22 00:22:07 +00:00
|
|
|
case STAR_QUIT:
|
2006-08-10 17:21:01 +00:00
|
|
|
return -1;
|
2006-06-03 19:24:10 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
case STAR_LEFT:
|
2004-10-22 00:22:07 +00:00
|
|
|
move_x = -1;
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
case STAR_RIGHT:
|
2004-10-22 00:22:07 +00:00
|
|
|
move_x = 1;
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2005-12-14 01:31:37 +00:00
|
|
|
case STAR_UP:
|
2004-10-22 00:22:07 +00:00
|
|
|
move_y = -1;
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2005-12-14 01:31:37 +00:00
|
|
|
case STAR_DOWN:
|
2004-10-22 00:22:07 +00:00
|
|
|
move_y = 1;
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case STAR_LEVEL_DOWN:
|
2006-10-21 00:24:54 +00:00
|
|
|
#ifdef STAR_LEVEL_DOWN_PRE
|
|
|
|
if (lastkey != STAR_LEVEL_DOWN_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2004-10-22 00:22:07 +00:00
|
|
|
if (current_level > 0)
|
|
|
|
{
|
|
|
|
current_level--;
|
|
|
|
star_load_level(current_level);
|
|
|
|
}
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case STAR_LEVEL_REPEAT:
|
2003-06-29 21:10:27 +00:00
|
|
|
star_load_level(current_level);
|
2004-10-22 00:22:07 +00:00
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case STAR_LEVEL_UP:
|
2006-10-21 00:24:54 +00:00
|
|
|
#ifdef STAR_LEVEL_UP_PRE
|
|
|
|
if (lastkey != STAR_LEVEL_UP_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2004-10-22 00:22:07 +00:00
|
|
|
if (current_level < STAR_LEVEL_COUNT - 1)
|
|
|
|
{
|
|
|
|
current_level++;
|
|
|
|
star_load_level(current_level);
|
|
|
|
}
|
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case STAR_TOGGLE_CONTROL:
|
|
|
|
#ifdef STAR_TOGGLE_CONTROL_PRE
|
|
|
|
if (lastkey != STAR_TOGGLE_CONTROL_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef STAR_TOGGLE_CONTROL2
|
|
|
|
case STAR_TOGGLE_CONTROL2:
|
|
|
|
#endif
|
|
|
|
if (control == STAR_CONTROL_BALL)
|
|
|
|
control = STAR_CONTROL_BLOCK;
|
|
|
|
else
|
|
|
|
control = STAR_CONTROL_BALL;
|
2007-03-28 07:33:18 +00:00
|
|
|
star_display_board_info(current_level);
|
2004-10-22 00:22:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(key) == SYS_USB_CONNECTED)
|
|
|
|
{
|
|
|
|
usb_detected = true;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(STAR_LEVEL_DOWN_PRE) || \
|
|
|
|
defined(STAR_LEVEL_UP_PRE) || \
|
2020-10-08 13:47:40 +00:00
|
|
|
defined(STAR_TOGGLE_CONTROL_PRE)
|
2004-10-22 00:22:07 +00:00
|
|
|
if (key != BUTTON_NONE)
|
|
|
|
lastkey = key;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (control == STAR_CONTROL_BALL)
|
|
|
|
{
|
|
|
|
board[ball_y][ball_x] = STAR_VOID;
|
|
|
|
while ((board[ball_y + move_y][ball_x + move_x] == STAR_VOID
|
|
|
|
|| board[ball_y + move_y][ball_x + move_x] == STAR_STAR))
|
|
|
|
|
|
|
|
{
|
2006-10-21 00:24:54 +00:00
|
|
|
star_animate_tile(BALL, STAR_OFFSET_X + ball_x * TILE_WIDTH,
|
|
|
|
STAR_OFFSET_Y + ball_y * TILE_HEIGHT,
|
|
|
|
move_x, move_y);
|
2003-06-29 21:10:27 +00:00
|
|
|
ball_x += move_x;
|
|
|
|
ball_y += move_y;
|
|
|
|
|
|
|
|
if (board[ball_y][ball_x] == STAR_STAR)
|
|
|
|
{
|
|
|
|
board[ball_y][ball_x] = STAR_VOID;
|
|
|
|
star_count--;
|
|
|
|
|
2007-03-28 07:33:18 +00:00
|
|
|
star_display_board_info(current_level);
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
board[ball_y][ball_x] = STAR_BALL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
board[block_y][block_x] = STAR_VOID;
|
|
|
|
while (board[block_y + move_y][block_x + move_x] == STAR_VOID)
|
|
|
|
{
|
2006-10-21 00:24:54 +00:00
|
|
|
star_animate_tile(BLOCK, STAR_OFFSET_X + block_x * TILE_WIDTH,
|
|
|
|
STAR_OFFSET_Y + block_y * TILE_HEIGHT,
|
|
|
|
move_x, move_y);
|
2003-06-29 21:10:27 +00:00
|
|
|
block_x += move_x;
|
|
|
|
block_y += move_y;
|
|
|
|
}
|
|
|
|
board[block_y][block_x] = STAR_BLOCK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (star_count == 0)
|
|
|
|
{
|
|
|
|
current_level++;
|
|
|
|
if (current_level == STAR_LEVEL_COUNT)
|
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2009-07-14 13:03:17 +00:00
|
|
|
rb->splash(HZ*2, "Congratulations!");
|
2003-06-29 21:10:27 +00:00
|
|
|
rb->lcd_update();
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2006-10-06 16:20:57 +00:00
|
|
|
/* There is no such level as STAR_LEVEL_COUNT so it can't be the
|
|
|
|
* current_level */
|
|
|
|
current_level--;
|
2003-06-29 21:10:27 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
star_load_level(current_level);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-14 13:03:17 +00:00
|
|
|
/**
|
|
|
|
* Display help text.
|
|
|
|
*/
|
|
|
|
static bool star_help(void)
|
|
|
|
{
|
|
|
|
static char* help_text[] = {
|
|
|
|
"Star", "", "Aim", "",
|
|
|
|
"Take", "all", "the", "stars", "to", "go", "to", "the", "next", "level.",
|
|
|
|
"You", "can", "toggle", "control", "with", "the", "block", "to", "use",
|
|
|
|
"it", "as", "a", "mobile", "wall.", "The", "block", "cannot", "take",
|
|
|
|
"stars.", "", "",
|
|
|
|
"Controls", "",
|
2009-07-23 17:45:33 +00:00
|
|
|
STAR_TOGGLE_CONTROL_NAME":", "Toggle", "control", "",
|
|
|
|
STAR_QUIT_NAME":", "Exit", "",
|
2009-07-14 13:03:17 +00:00
|
|
|
STAR_LEVEL_DOWN_NAME":", "Prev.", "level", "",
|
|
|
|
STAR_LEVEL_REPEAT_NAME":", "Reset", "level", "",
|
|
|
|
STAR_LEVEL_UP_NAME":", "Next", "level"
|
|
|
|
};
|
|
|
|
static struct style_text formation[]={
|
|
|
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
|
|
|
{ 2, C_RED },
|
|
|
|
{ 35, C_RED },
|
2010-02-22 07:17:15 +00:00
|
|
|
LAST_STYLE_ITEM
|
2009-07-14 13:03:17 +00:00
|
|
|
};
|
2010-02-22 07:17:15 +00:00
|
|
|
#if LCD_DEPTH > 1 && !defined(HAVE_LCD_COLOR)
|
|
|
|
rb->lcd_set_background(LCD_WHITE);
|
|
|
|
rb->lcd_set_foreground(LCD_BLACK);
|
2009-07-27 17:15:53 +00:00
|
|
|
#endif
|
2010-02-22 07:17:15 +00:00
|
|
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
2009-07-14 13:03:17 +00:00
|
|
|
return true;
|
2010-02-22 07:17:15 +00:00
|
|
|
#if LCD_DEPTH > 1 && !defined(HAVE_LCD_COLOR)
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
2009-07-27 16:55:37 +00:00
|
|
|
#endif
|
2009-07-14 13:03:17 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/**
|
|
|
|
* Display the choice menu.
|
|
|
|
*/
|
|
|
|
static int star_menu(void)
|
|
|
|
{
|
2007-03-28 07:33:18 +00:00
|
|
|
int selection, level=1;
|
|
|
|
bool menu_quit = false;
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2009-08-05 14:29:29 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
|
|
|
|
"Start Game","Choose Level",
|
|
|
|
"Help", "Playback Control", "Quit");
|
2009-06-20 21:51:18 +00:00
|
|
|
|
2007-03-28 07:33:18 +00:00
|
|
|
while(!menu_quit)
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
2009-06-20 21:51:18 +00:00
|
|
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
2007-03-28 07:33:18 +00:00
|
|
|
case 0:
|
2009-08-05 14:29:29 +00:00
|
|
|
/* use system font and get the size of char */
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
|
|
|
rb->lcd_getstringsize("a", &char_width, &char_height);
|
|
|
|
star_run_game(level-1);
|
|
|
|
rb->lcd_setfont(FONT_UI);
|
2006-06-03 19:24:10 +00:00
|
|
|
break;
|
2007-03-28 07:33:18 +00:00
|
|
|
case 1:
|
2007-06-06 21:10:48 +00:00
|
|
|
rb->set_int("Level", "", UNIT_INT, &level,
|
2007-03-28 07:33:18 +00:00
|
|
|
NULL, 1, 1, STAR_LEVEL_COUNT, NULL );
|
2006-06-03 19:24:10 +00:00
|
|
|
break;
|
2007-03-28 07:33:18 +00:00
|
|
|
case 2:
|
2009-07-14 13:03:17 +00:00
|
|
|
if(star_help())
|
|
|
|
usb_detected = true;
|
2006-06-03 19:24:10 +00:00
|
|
|
break;
|
2009-08-05 14:29:29 +00:00
|
|
|
case 3:
|
|
|
|
playback_control(NULL);
|
|
|
|
break;
|
|
|
|
case 4:
|
2007-03-28 07:33:18 +00:00
|
|
|
menu_quit = true;
|
2004-10-22 00:22:07 +00:00
|
|
|
break;
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
2009-08-05 14:29:29 +00:00
|
|
|
if(usb_detected)
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
2007-06-06 21:10:48 +00:00
|
|
|
|
2007-03-28 07:33:18 +00:00
|
|
|
return PLUGIN_OK;
|
2003-06-29 21:10:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main entry point
|
|
|
|
*/
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2003-06-29 21:10:27 +00:00
|
|
|
{
|
|
|
|
(void)parameter;
|
|
|
|
|
2006-07-27 22:04:07 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-11-15 06:14:27 +00:00
|
|
|
rb->lcd_set_backdrop(NULL);
|
2006-06-10 20:39:33 +00:00
|
|
|
rb->lcd_set_background( LCD_BLACK );
|
|
|
|
rb->lcd_set_foreground( LCD_WHITE );
|
|
|
|
#endif
|
|
|
|
|
2003-06-29 21:10:27 +00:00
|
|
|
/* display choice menu */
|
|
|
|
return star_menu();
|
|
|
|
}
|