2002-10-15 07:17:50 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Damien Teney
|
|
|
|
* modified to use int instead of float math by Andreas Zwirtes
|
2005-07-13 20:40:46 +00:00
|
|
|
* heavily extended by Jens Arnold
|
2002-10-15 07:17:50 +00:00
|
|
|
*
|
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.
|
2002-10-15 07:17:50 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
2003-06-29 16:33:04 +00:00
|
|
|
***************************************************************************/
|
|
|
|
#include "plugin.h"
|
2013-04-16 21:47:58 +00:00
|
|
|
#include "fixedpoint.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/playergfx.h"
|
2010-08-24 14:30:46 +00:00
|
|
|
#include "lib/pluginlib_exit.h"
|
2010-06-04 13:22:50 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
|
|
|
|
#include "lib/grey.h"
|
|
|
|
#else
|
|
|
|
#include "lib/grey.h"
|
|
|
|
#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */
|
|
|
|
#endif
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/xlcd.h"
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
/* Loops that the values are displayed */
|
|
|
|
#define DISP_TIME 30
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_QUIT BUTTON_OFF
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_F1
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_ON
|
2004-10-17 00:54:09 +00:00
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_OFF
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_F1
|
2007-01-14 13:48:09 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_ON
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_QUIT BUTTON_STOP
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_INC BUTTON_RIGHT
|
|
|
|
#define CUBE_DEC BUTTON_LEFT
|
|
|
|
#define CUBE_NEXT (BUTTON_ON | BUTTON_RIGHT)
|
|
|
|
#define CUBE_PREV (BUTTON_ON | BUTTON_LEFT)
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED_PRE BUTTON_ON
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_ON | BUTTON_REL)
|
2005-02-10 21:28:21 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_QUIT BUTTON_OFF
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_MODE_PRE BUTTON_MENU
|
|
|
|
#define CUBE_MODE (BUTTON_MENU | BUTTON_REL)
|
|
|
|
#define CUBE_PAUSE (BUTTON_MENU | BUTTON_LEFT)
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_MENU | BUTTON_RIGHT)
|
2004-10-17 00:54:09 +00:00
|
|
|
|
2005-06-29 12:47:24 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_QUIT BUTTON_OFF
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_MODE BUTTON_MODE
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_ON
|
2005-07-13 20:40:46 +00:00
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
2005-02-04 12:41:09 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define CUBE_RC_QUIT BUTTON_RC_STOP
|
2007-07-27 09:57:27 +00:00
|
|
|
|
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)
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_SCROLL_FWD
|
|
|
|
#define CUBE_DEC BUTTON_SCROLL_BACK
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED_PRE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_SELECT | BUTTON_REL)
|
2005-12-14 01:31:37 +00:00
|
|
|
|
2006-01-12 00:35:50 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_PLAY
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MODE
|
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_EQ
|
2006-01-12 00:35:50 +00:00
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
2006-01-18 11:09:06 +00:00
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_REC
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
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 CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
2006-02-24 15:42:52 +00:00
|
|
|
#define CUBE_MODE BUTTON_MENU
|
2007-05-19 23:38:09 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_A
|
2006-02-24 15:42:52 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
2006-10-26 13:38:09 +00:00
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_SCROLL_FWD
|
|
|
|
#define CUBE_DEC BUTTON_SCROLL_BACK
|
|
|
|
#define CUBE_MODE BUTTON_DOWN
|
|
|
|
#define CUBE_PAUSE BUTTON_UP
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define CUBE_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_SCROLL_FWD
|
|
|
|
#define CUBE_DEC BUTTON_SCROLL_BACK
|
|
|
|
#define CUBE_MODE BUTTON_DOWN
|
|
|
|
#define CUBE_PAUSE BUTTON_UP
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
2007-09-20 10:49:48 +00:00
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_VOL_UP
|
|
|
|
#define CUBE_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_DOWN
|
|
|
|
#define CUBE_PAUSE BUTTON_UP
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
2007-09-20 10:49:48 +00:00
|
|
|
|
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_SCROLL_UP
|
|
|
|
#define CUBE_DEC BUTTON_SCROLL_DOWN
|
2006-08-03 20:17:25 +00:00
|
|
|
#define CUBE_MODE BUTTON_REW
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_FF
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2007-10-23 15:40:51 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_BACK
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
2008-02-17 12:23:02 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
2008-03-01 22:55:09 +00:00
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_RC_REC
|
2008-09-23 01:45:50 +00:00
|
|
|
#define CUBE_NEXT BUTTON_RC_FF
|
|
|
|
#define CUBE_PREV BUTTON_RC_REW
|
|
|
|
#define CUBE_INC BUTTON_RC_VOL_UP
|
|
|
|
#define CUBE_DEC BUTTON_RC_VOL_DOWN
|
2008-03-22 10:24:28 +00:00
|
|
|
#define CUBE_MODE BUTTON_RC_MODE
|
|
|
|
#define CUBE_PAUSE BUTTON_RC_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_RC_MENU
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_VOLUP
|
|
|
|
#define CUBE_DEC BUTTON_VOLDOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_STOP
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_BACK
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_UP
|
|
|
|
#define CUBE_PREV BUTTON_DOWN
|
|
|
|
#define CUBE_INC BUTTON_VOL_UP
|
|
|
|
#define CUBE_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE (BUTTON_PLAY|BUTTON_REL)
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_BACK
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_VIEW
|
2009-04-07 23:41:44 +00:00
|
|
|
|
2010-11-02 10:58:08 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_NEXT
|
|
|
|
#define CUBE_PREV BUTTON_PREV
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_RIGHT
|
|
|
|
|
2009-12-02 01:56:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_NEXT
|
|
|
|
#define CUBE_PREV BUTTON_PREV
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
2009-12-10 01:23:51 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
2009-12-02 01:56:39 +00:00
|
|
|
#define CUBE_HIGHSPEED BUTTON_RIGHT
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
2009-04-07 23:41:44 +00:00
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_REC
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_REW
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_FFWD
|
|
|
|
|
2010-02-11 22:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_REC
|
|
|
|
#define CUBE_NEXT BUTTON_NEXT
|
|
|
|
#define CUBE_PREV BUTTON_PREV
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED 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 CUBE_QUIT (BUTTON_REC | BUTTON_PLAY)
|
2010-11-02 10:44:34 +00:00
|
|
|
#define CUBE_NEXT BUTTON_FF
|
|
|
|
#define CUBE_PREV BUTTON_REW
|
2010-04-26 21:40:00 +00:00
|
|
|
#define CUBE_INC BUTTON_VOL_UP
|
|
|
|
#define CUBE_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_REC
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
2010-11-02 10:44:34 +00:00
|
|
|
#define CUBE_HIGHSPEED BUTTON_FUNC
|
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 CUBE_QUIT (BUTTON_MENU | BUTTON_REPEAT)
|
2010-11-30 10:52:14 +00:00
|
|
|
#define CUBE_NEXT BUTTON_FF
|
|
|
|
#define CUBE_PREV BUTTON_REW
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAY
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_ENTER
|
|
|
|
|
2011-10-02 15:39:33 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_SELECT
|
|
|
|
#define CUBE_PAUSE BUTTON_PLAYPAUSE
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_BACK
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_NEXT
|
|
|
|
#define CUBE_PREV BUTTON_PREV
|
|
|
|
#define CUBE_INC BUTTON_VOL_UP
|
|
|
|
#define CUBE_DEC BUTTON_VOL_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_SELECT
|
|
|
|
#define CUBE_PAUSE BUTTON_DOWN
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_LEFT
|
|
|
|
|
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 CUBE_QUIT BUTTON_BACK
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_MENU
|
|
|
|
#define CUBE_PAUSE BUTTON_USER
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_SELECT
|
|
|
|
|
2012-03-23 18:32:50 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE (BUTTON_SELECT|BUTTON_POWER)
|
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_UP|BUTTON_POWER)
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM801_PAD)
|
|
|
|
#define CUBE_QUIT BUTTON_POWER
|
|
|
|
#define CUBE_NEXT BUTTON_RIGHT
|
|
|
|
#define CUBE_PREV BUTTON_LEFT
|
|
|
|
#define CUBE_INC BUTTON_UP
|
|
|
|
#define CUBE_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_MODE BUTTON_PREV
|
|
|
|
#define CUBE_PAUSE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_NEXT
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-17 00:54:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-09-23 02:03:48 +00:00
|
|
|
#ifndef CUBE_QUIT
|
|
|
|
#define CUBE_QUIT BUTTON_TOPLEFT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2008-09-23 02:03:48 +00:00
|
|
|
#ifndef CUBE_NEXT
|
|
|
|
#define CUBE_NEXT BUTTON_MIDRIGHT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2008-09-23 02:03:48 +00:00
|
|
|
#ifndef CUBE_PREV
|
|
|
|
#define CUBE_PREV BUTTON_MIDLEFT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2008-09-23 02:03:48 +00:00
|
|
|
#ifndef CUBE_INC
|
|
|
|
#define CUBE_INC BUTTON_TOPMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2008-09-23 02:03:48 +00:00
|
|
|
#ifndef CUBE_DEC
|
|
|
|
#define CUBE_DEC BUTTON_BOTTOMMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef CUBE_MODE
|
|
|
|
#define CUBE_MODE BUTTON_TOPRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef CUBE_PAUSE
|
2008-09-23 02:03:48 +00:00
|
|
|
#define CUBE_PAUSE BUTTON_CENTER
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#ifndef CUBE_HIGHSPEED
|
2008-09-23 02:03:48 +00:00
|
|
|
#define CUBE_HIGHSPEED BUTTON_BOTTOMRIGHT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-01-23 22:53:56 +00:00
|
|
|
|
2006-05-22 16:28:19 +00:00
|
|
|
#define DIST (10 * MIN(LCD_HEIGHT, LCD_WIDTH) / 16)
|
2005-02-08 22:48:53 +00:00
|
|
|
static int x_off = LCD_WIDTH/2;
|
|
|
|
static int y_off = LCD_HEIGHT/2;
|
2006-01-23 22:53:56 +00:00
|
|
|
|
2006-02-26 13:37:42 +00:00
|
|
|
#if LCD_DEPTH == 1
|
2010-01-18 20:53:59 +00:00
|
|
|
#define USEGSLIB
|
2008-01-13 00:11:43 +00:00
|
|
|
GREY_INFO_STRUCT
|
2006-01-23 22:53:56 +00:00
|
|
|
struct my_lcd {
|
|
|
|
void (*update)(void);
|
|
|
|
void (*clear_display)(void);
|
|
|
|
void (*drawline)(int x1, int y1, int x2, int y2);
|
|
|
|
void (*putsxy)(int x, int y, const unsigned char *string);
|
|
|
|
};
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
static struct my_lcd greyfuncs = {
|
|
|
|
grey_update, grey_clear_display, grey_drawline, grey_putsxy
|
2006-01-23 22:53:56 +00:00
|
|
|
};
|
|
|
|
static struct my_lcd lcdfuncs; /* initialised at runtime */
|
2008-01-04 23:42:38 +00:00
|
|
|
static struct my_lcd *mylcd = &greyfuncs;
|
2006-01-23 22:53:56 +00:00
|
|
|
|
|
|
|
#define MYLCD(fn) mylcd->fn
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define MYLCD(fn) rb->lcd_ ## fn
|
|
|
|
#endif
|
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
#if CONFIG_LCD == LCD_SSD1815
|
|
|
|
#define ASPECT 320 /* = 1.25 (fixed point 24.8) */
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
2005-07-12 21:15:37 +00:00
|
|
|
#define ASPECT 256 /* = 1.00 */
|
|
|
|
#endif
|
2006-01-23 22:53:56 +00:00
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
#else /* !LCD_BITMAP */
|
2006-01-23 22:53:56 +00:00
|
|
|
|
2005-07-01 16:22:15 +00:00
|
|
|
#define MYLCD(fn) pgfx_ ## fn
|
|
|
|
#define DIST 9
|
2005-02-10 21:28:21 +00:00
|
|
|
static int x_off = 10;
|
|
|
|
static int y_off = 7;
|
2005-07-12 21:15:37 +00:00
|
|
|
#define ASPECT 300 /* = 1.175 */
|
2006-01-23 22:53:56 +00:00
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
#endif /* !LCD_BITMAP */
|
2005-07-01 16:22:15 +00:00
|
|
|
|
2005-07-12 23:57:06 +00:00
|
|
|
struct point_3D {
|
|
|
|
long x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct point_2D {
|
|
|
|
long x, y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct line {
|
|
|
|
int start, end;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct face {
|
2005-07-13 20:40:46 +00:00
|
|
|
int corner[4];
|
|
|
|
int line[4];
|
2005-07-12 23:57:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* initial, unrotated cube corners */
|
|
|
|
static const struct point_3D sommet[8] =
|
|
|
|
{
|
|
|
|
{-DIST, -DIST, -DIST},
|
|
|
|
{ DIST, -DIST, -DIST},
|
|
|
|
{ DIST, DIST, -DIST},
|
|
|
|
{-DIST, DIST, -DIST},
|
|
|
|
{-DIST, -DIST, DIST},
|
|
|
|
{ DIST, -DIST, DIST},
|
|
|
|
{ DIST, DIST, DIST},
|
|
|
|
{-DIST, DIST, DIST}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The 12 lines forming the edges */
|
|
|
|
static const struct line lines[12] =
|
|
|
|
{
|
|
|
|
{0, 1}, {1, 2}, {2, 3}, {3, 0},
|
2005-07-13 20:40:46 +00:00
|
|
|
{4, 7}, {7, 6}, {6, 5}, {5, 4},
|
2005-07-12 23:57:06 +00:00
|
|
|
{0, 4}, {1, 5}, {2, 6}, {3, 7}
|
|
|
|
};
|
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
static bool lines_drawn[12];
|
|
|
|
|
|
|
|
/* The 6 faces of the cube; points are in clockwise order when viewed
|
|
|
|
from the outside */
|
2005-07-12 23:57:06 +00:00
|
|
|
static const struct face faces[6] =
|
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
{{0, 1, 2, 3}, {0, 1, 2, 3}},
|
|
|
|
{{4, 7, 6, 5}, {4, 5, 6, 7}},
|
|
|
|
{{0, 4, 5, 1}, {8, 7, 9, 0}},
|
|
|
|
{{2, 6, 7, 3}, {10, 5, 11, 2}},
|
|
|
|
{{0, 3, 7, 4}, {3, 11, 4, 8}},
|
|
|
|
{{1, 5, 6, 2}, {9, 6, 10, 1}}
|
2005-07-12 23:57:06 +00:00
|
|
|
};
|
|
|
|
|
2010-01-18 20:53:59 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(USEGSLIB)
|
2005-11-16 21:09:23 +00:00
|
|
|
static const unsigned face_colors[6] =
|
2005-07-19 10:33:41 +00:00
|
|
|
{
|
2005-11-16 21:09:23 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(0, 255, 0),
|
|
|
|
LCD_RGBPACK(0, 255, 0), LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(0, 0, 255)
|
2010-01-18 20:53:59 +00:00
|
|
|
#elif defined(USEGSLIB)
|
2008-04-07 22:09:14 +00:00
|
|
|
#ifdef MROBE_100
|
|
|
|
GREY_LIGHTGRAY, GREY_LIGHTGRAY, GREY_DARKGRAY,
|
|
|
|
GREY_DARKGRAY, GREY_WHITE, GREY_WHITE
|
|
|
|
#else
|
2008-01-04 23:42:38 +00:00
|
|
|
GREY_LIGHTGRAY, GREY_LIGHTGRAY, GREY_DARKGRAY,
|
|
|
|
GREY_DARKGRAY, GREY_BLACK, GREY_BLACK
|
2008-04-07 22:09:14 +00:00
|
|
|
#endif
|
2005-07-19 10:33:41 +00:00
|
|
|
#else
|
2005-11-16 21:09:23 +00:00
|
|
|
LCD_LIGHTGRAY, LCD_LIGHTGRAY, LCD_DARKGRAY,
|
2006-01-23 22:53:56 +00:00
|
|
|
LCD_DARKGRAY, LCD_BLACK, LCD_BLACK
|
2005-07-12 23:57:06 +00:00
|
|
|
#endif
|
2005-11-16 21:09:23 +00:00
|
|
|
};
|
2005-07-19 10:33:41 +00:00
|
|
|
#endif
|
2005-07-12 23:57:06 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
enum {
|
2010-01-18 20:53:59 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(USEGSLIB)
|
2005-07-13 20:40:46 +00:00
|
|
|
SOLID,
|
|
|
|
#endif
|
|
|
|
HIDDEN_LINES,
|
|
|
|
WIREFRAME,
|
|
|
|
NUM_MODES
|
|
|
|
};
|
|
|
|
|
|
|
|
static int mode = 0;
|
|
|
|
|
2008-09-23 01:45:50 +00:00
|
|
|
struct counter {
|
|
|
|
const char *label;
|
|
|
|
short speed;
|
|
|
|
short angle;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct counter axes[] = {
|
|
|
|
{"x-axis", 1, 0},
|
|
|
|
{"y-axis", 3, 0},
|
|
|
|
{"z-axis", 2, 0}
|
|
|
|
};
|
|
|
|
|
2005-07-12 23:57:06 +00:00
|
|
|
static struct point_3D point3D[8];
|
|
|
|
static struct point_2D point2D[8];
|
|
|
|
static long matrice[3][3];
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
static const int nb_points = 8;
|
2005-07-12 21:15:37 +00:00
|
|
|
static long z_off = 600;
|
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static void cube_rotate(int xa, int ya, int za)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
/* Just to prevent unnecessary lookups */
|
2005-07-12 21:15:37 +00:00
|
|
|
long sxa, cxa, sya, cya, sza, cza;
|
|
|
|
|
2009-07-05 18:06:07 +00:00
|
|
|
sxa = fp14_sin(xa);
|
|
|
|
cxa = fp14_cos(xa);
|
|
|
|
sya = fp14_sin(ya);
|
|
|
|
cya = fp14_cos(ya);
|
|
|
|
sza = fp14_sin(za);
|
|
|
|
cza = fp14_cos(za);
|
2002-10-15 07:17:50 +00:00
|
|
|
|
|
|
|
/* calculate overall translation matrix */
|
2005-07-12 21:15:37 +00:00
|
|
|
matrice[0][0] = (cza * cya) >> 14;
|
|
|
|
matrice[1][0] = (sza * cya) >> 14;
|
2002-10-15 07:17:50 +00:00
|
|
|
matrice[2][0] = -sya;
|
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
matrice[0][1] = (((cza * sya) >> 14) * sxa - sza * cxa) >> 14;
|
|
|
|
matrice[1][1] = (((sza * sya) >> 14) * sxa + cxa * cza) >> 14;
|
|
|
|
matrice[2][1] = (sxa * cya) >> 14;
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
matrice[0][2] = (((cza * sya) >> 14) * cxa + sza * sxa) >> 14;
|
|
|
|
matrice[1][2] = (((sza * sya) >> 14) * cxa - cza * sxa) >> 14;
|
|
|
|
matrice[2][2] = (cxa * cya) >> 14;
|
2002-10-15 07:17:50 +00:00
|
|
|
|
|
|
|
/* apply translation matrix to all points */
|
2005-07-12 21:15:37 +00:00
|
|
|
for (i = 0; i < nb_points; i++)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2005-07-12 21:15:37 +00:00
|
|
|
point3D[i].x = matrice[0][0] * sommet[i].x + matrice[1][0] * sommet[i].y
|
|
|
|
+ matrice[2][0] * sommet[i].z;
|
2006-02-22 23:26:54 +00:00
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
point3D[i].y = matrice[0][1] * sommet[i].x + matrice[1][1] * sommet[i].y
|
|
|
|
+ matrice[2][1] * sommet[i].z;
|
2006-02-22 23:26:54 +00:00
|
|
|
|
2005-07-12 21:15:37 +00:00
|
|
|
point3D[i].z = matrice[0][2] * sommet[i].x + matrice[1][2] * sommet[i].y
|
|
|
|
+ matrice[2][2] * sommet[i].z;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cube_viewport(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Do viewport transformation for all points */
|
2005-07-12 21:15:37 +00:00
|
|
|
for (i = 0; i < nb_points; i++)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2005-07-12 21:15:37 +00:00
|
|
|
#if ASPECT != 256
|
|
|
|
point2D[i].x = (point3D[i].x * ASPECT) / (point3D[i].z + (z_off << 14))
|
|
|
|
+ x_off;
|
|
|
|
#else
|
|
|
|
point2D[i].x = (point3D[i].x << 8) / (point3D[i].z + (z_off << 14))
|
|
|
|
+ x_off;
|
|
|
|
#endif
|
|
|
|
point2D[i].y = (point3D[i].y << 8) / (point3D[i].z + (z_off << 14))
|
|
|
|
+ y_off;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cube_draw(void)
|
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
int i, j, line;
|
2010-01-18 20:53:59 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(USEGSLIB)
|
2006-11-26 18:41:09 +00:00
|
|
|
unsigned old_foreground;
|
|
|
|
#endif
|
2005-07-12 23:57:06 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
switch (mode)
|
2005-07-12 23:57:06 +00:00
|
|
|
{
|
2010-01-18 20:53:59 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(USEGSLIB)
|
2005-07-13 20:40:46 +00:00
|
|
|
case SOLID:
|
2006-11-26 18:41:09 +00:00
|
|
|
|
2010-06-04 13:22:50 +00:00
|
|
|
old_foreground = mylcd_get_foreground();
|
2005-07-13 06:07:11 +00:00
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
/* backface culling; if the shape winds counter-clockwise, we are
|
|
|
|
* looking at the backface, and the (simplified) cross product
|
|
|
|
* is < 0. Do not draw it. */
|
|
|
|
if (0 >= (point2D[faces[i].corner[1]].x - point2D[faces[i].corner[0]].x)
|
|
|
|
* (point2D[faces[i].corner[2]].y - point2D[faces[i].corner[1]].y)
|
|
|
|
- (point2D[faces[i].corner[1]].y - point2D[faces[i].corner[0]].y)
|
|
|
|
* (point2D[faces[i].corner[2]].x - point2D[faces[i].corner[1]].x))
|
|
|
|
continue;
|
|
|
|
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_foreground(face_colors[i]);
|
|
|
|
mylcd_filltriangle(point2D[faces[i].corner[0]].x,
|
|
|
|
point2D[faces[i].corner[0]].y,
|
|
|
|
point2D[faces[i].corner[1]].x,
|
|
|
|
point2D[faces[i].corner[1]].y,
|
|
|
|
point2D[faces[i].corner[2]].x,
|
|
|
|
point2D[faces[i].corner[2]].y);
|
|
|
|
mylcd_filltriangle(point2D[faces[i].corner[0]].x,
|
|
|
|
point2D[faces[i].corner[0]].y,
|
|
|
|
point2D[faces[i].corner[2]].x,
|
|
|
|
point2D[faces[i].corner[2]].y,
|
|
|
|
point2D[faces[i].corner[3]].x,
|
|
|
|
point2D[faces[i].corner[3]].y);
|
2005-07-13 20:40:46 +00:00
|
|
|
|
2005-07-12 23:57:06 +00:00
|
|
|
}
|
2010-06-04 13:22:50 +00:00
|
|
|
mylcd_set_foreground(old_foreground);
|
2005-07-13 20:40:46 +00:00
|
|
|
break;
|
2006-01-23 22:53:56 +00:00
|
|
|
#endif /* (LCD_DEPTH > 1) || GSLIB */
|
2005-07-12 23:57:06 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
case HIDDEN_LINES:
|
2005-07-12 23:57:06 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
rb->memset(lines_drawn, 0, sizeof(lines_drawn));
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
/* backface culling; if the shape winds counter-clockwise, we are
|
|
|
|
* looking at the backface, and the (simplified) cross product
|
|
|
|
* is < 0. Do not draw it. */
|
|
|
|
if (0 >= (point2D[faces[i].corner[1]].x - point2D[faces[i].corner[0]].x)
|
|
|
|
* (point2D[faces[i].corner[2]].y - point2D[faces[i].corner[1]].y)
|
|
|
|
- (point2D[faces[i].corner[1]].y - point2D[faces[i].corner[0]].y)
|
|
|
|
* (point2D[faces[i].corner[2]].x - point2D[faces[i].corner[1]].x))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (j = 0; j < 4; j++)
|
2005-07-12 23:57:06 +00:00
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
line = faces[i].line[j];
|
|
|
|
if (!lines_drawn[line])
|
|
|
|
{
|
|
|
|
lines_drawn[line] = true;
|
|
|
|
MYLCD(drawline)(point2D[lines[line].start].x,
|
|
|
|
point2D[lines[line].start].y,
|
|
|
|
point2D[lines[line].end].x,
|
|
|
|
point2D[lines[line].end].y);
|
|
|
|
}
|
2005-07-13 06:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-13 20:40:46 +00:00
|
|
|
break;
|
2006-02-22 23:26:54 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
case WIREFRAME:
|
|
|
|
|
2005-07-12 23:57:06 +00:00
|
|
|
for (i = 0; i < 12; i++)
|
|
|
|
MYLCD(drawline)(point2D[lines[i].start].x,
|
|
|
|
point2D[lines[i].start].y,
|
|
|
|
point2D[lines[i].end].x,
|
|
|
|
point2D[lines[i].end].y);
|
2005-07-13 20:40:46 +00:00
|
|
|
break;
|
2005-07-12 23:57:06 +00:00
|
|
|
}
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
|
2011-09-17 17:20:27 +00:00
|
|
|
static void cleanup(void)
|
2006-01-23 23:53:22 +00:00
|
|
|
{
|
2010-01-18 20:53:59 +00:00
|
|
|
#ifdef USEGSLIB
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_release();
|
2006-01-23 23:53:22 +00:00
|
|
|
#elif defined HAVE_LCD_CHARCELLS
|
|
|
|
pgfx_release();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
int t_disp = 0;
|
2010-01-18 20:53:59 +00:00
|
|
|
#ifdef USEGSLIB
|
2006-01-23 22:53:56 +00:00
|
|
|
unsigned char *gbuf;
|
2007-04-21 18:38:25 +00:00
|
|
|
size_t gbuf_size = 0;
|
2006-01-23 22:53:56 +00:00
|
|
|
bool mode_switch = true;
|
|
|
|
#endif
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
int button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(CUBE_MODE_PRE) || \
|
|
|
|
defined(CUBE_PAUSE_PRE) || \
|
|
|
|
defined(CUBE_HIGHSPEED_PRE)
|
2005-07-13 20:40:46 +00:00
|
|
|
int lastbutton = BUTTON_NONE;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2008-09-23 01:45:50 +00:00
|
|
|
int curr = 0;
|
2005-07-13 20:40:46 +00:00
|
|
|
bool highspeed = false;
|
|
|
|
bool paused = false;
|
|
|
|
bool redraw = true;
|
2010-08-24 14:30:46 +00:00
|
|
|
bool quit = false;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
(void)(parameter);
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2010-01-18 20:53:59 +00:00
|
|
|
#if defined(USEGSLIB)
|
2006-01-23 22:53:56 +00:00
|
|
|
gbuf = (unsigned char *)rb->plugin_get_buffer(&gbuf_size);
|
2009-01-16 10:34:40 +00:00
|
|
|
if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED,
|
2008-03-02 23:31:09 +00:00
|
|
|
LCD_WIDTH, LCD_HEIGHT, NULL))
|
2006-01-23 22:53:56 +00:00
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
rb->splash(HZ, "Couldn't init greyscale display");
|
2006-01-23 22:53:56 +00:00
|
|
|
return PLUGIN_ERROR;
|
|
|
|
}
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-23 22:53:56 +00:00
|
|
|
/* init lcd_ function pointers */
|
|
|
|
lcdfuncs.update = rb->lcd_update;
|
|
|
|
lcdfuncs.clear_display = rb->lcd_clear_display;
|
|
|
|
lcdfuncs.drawline = rb->lcd_drawline;
|
|
|
|
lcdfuncs.putsxy = rb->lcd_putsxy;
|
|
|
|
|
2008-04-07 22:09:14 +00:00
|
|
|
#ifdef MROBE_100
|
|
|
|
grey_set_background(GREY_BLACK);
|
|
|
|
#endif
|
|
|
|
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_setfont(FONT_SYSFIXED);
|
2005-07-12 23:57:06 +00:00
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-01-23 22:53:56 +00:00
|
|
|
#else /* LCD_CHARCELLS */
|
2009-01-16 10:34:40 +00:00
|
|
|
if (!pgfx_init(4, 2))
|
2005-02-10 21:28:21 +00:00
|
|
|
{
|
2007-03-16 21:56:08 +00:00
|
|
|
rb->splash(HZ*2, "Old LCD :(");
|
2005-02-10 21:28:21 +00:00
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2008-09-23 01:45:50 +00:00
|
|
|
pgfx_display(0, 0);
|
2005-02-10 21:28:21 +00:00
|
|
|
#endif
|
2002-10-29 10:45:29 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
atexit(cleanup);
|
|
|
|
while(!quit)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2005-07-13 20:40:46 +00:00
|
|
|
if (redraw)
|
|
|
|
{
|
|
|
|
MYLCD(clear_display)();
|
2008-09-23 01:45:50 +00:00
|
|
|
cube_rotate(axes[0].angle, axes[1].angle, axes[2].angle);
|
2005-07-13 20:40:46 +00:00
|
|
|
cube_viewport();
|
|
|
|
cube_draw();
|
|
|
|
redraw = false;
|
|
|
|
}
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-07-13 20:40:46 +00:00
|
|
|
if (t_disp > 0)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2010-08-28 21:55:47 +00:00
|
|
|
char buffer[30];
|
2002-10-15 07:17:50 +00:00
|
|
|
t_disp--;
|
2008-09-23 01:45:50 +00:00
|
|
|
rb->snprintf(buffer, sizeof(buffer), "%s: %d %s",
|
|
|
|
axes[curr].label,
|
|
|
|
paused ? axes[curr].angle : axes[curr].speed,
|
|
|
|
highspeed ? "(hs)" : "");
|
2006-01-23 22:53:56 +00:00
|
|
|
MYLCD(putsxy)(0, LCD_HEIGHT-8, buffer);
|
2005-07-13 20:40:46 +00:00
|
|
|
if (t_disp == 0)
|
|
|
|
redraw = true;
|
2002-10-29 10:45:29 +00:00
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
2005-07-13 20:40:46 +00:00
|
|
|
if (t_disp > 0)
|
2005-02-10 21:28:21 +00:00
|
|
|
{
|
2005-02-10 21:45:21 +00:00
|
|
|
if (t_disp == DISP_TIME)
|
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
rb->lcd_puts(5, 0, axes[curr].label);
|
2010-08-28 21:46:45 +00:00
|
|
|
rb->lcd_putsf(5, 1, "%d %c",
|
2008-09-23 01:45:50 +00:00
|
|
|
paused ? axes[curr].angle : axes[curr].speed,
|
|
|
|
highspeed ? 'H' : ' ');
|
2005-02-10 21:45:21 +00:00
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
t_disp--;
|
2005-02-10 21:45:21 +00:00
|
|
|
if (t_disp == 0)
|
|
|
|
{
|
2005-02-11 19:38:14 +00:00
|
|
|
rb->lcd_clear_display();
|
2008-09-23 01:45:50 +00:00
|
|
|
pgfx_display(0, 0);
|
2005-02-10 21:45:21 +00:00
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
}
|
2006-01-23 22:53:56 +00:00
|
|
|
#endif
|
2010-01-18 20:53:59 +00:00
|
|
|
#ifdef USEGSLIB
|
2006-01-23 22:53:56 +00:00
|
|
|
if (mode_switch)
|
|
|
|
{
|
2008-01-04 23:42:38 +00:00
|
|
|
grey_show(mode == SOLID);
|
2006-01-23 22:53:56 +00:00
|
|
|
mode_switch = false;
|
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
#endif
|
2005-07-01 16:22:15 +00:00
|
|
|
MYLCD(update)();
|
2005-02-09 00:36:55 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
if (!paused)
|
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
axes[i].angle += axes[i].speed;
|
|
|
|
if (axes[i].angle > 359)
|
|
|
|
axes[i].angle -= 360;
|
|
|
|
else if (axes[i].angle < 0)
|
|
|
|
axes[i].angle += 360;
|
|
|
|
}
|
2005-07-13 20:40:46 +00:00
|
|
|
redraw = true;
|
2008-09-23 01:45:50 +00:00
|
|
|
|
|
|
|
if (highspeed)
|
|
|
|
rb->yield();
|
|
|
|
else
|
|
|
|
rb->sleep(HZ/25);
|
|
|
|
button = rb->button_get(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
button = rb->button_get_w_tmo(HZ/25);
|
2005-07-13 20:40:46 +00:00
|
|
|
}
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2005-07-13 20:40:46 +00:00
|
|
|
switch (button)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
case CUBE_INC:
|
|
|
|
case CUBE_INC|BUTTON_REPEAT:
|
|
|
|
if (!paused)
|
2005-10-07 23:01:31 +00:00
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
if (axes[curr].speed < 10)
|
|
|
|
axes[curr].speed++;
|
2005-10-07 23:01:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
if (++axes[curr].angle > 359)
|
|
|
|
axes[curr].angle -= 360;
|
2005-10-07 23:01:31 +00:00
|
|
|
}
|
2005-07-13 20:40:46 +00:00
|
|
|
t_disp = DISP_TIME;
|
2005-10-07 23:01:31 +00:00
|
|
|
redraw = true;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2005-07-13 20:40:46 +00:00
|
|
|
|
2008-09-23 01:45:50 +00:00
|
|
|
case CUBE_DEC:
|
|
|
|
case CUBE_DEC|BUTTON_REPEAT:
|
|
|
|
if (!paused)
|
2005-10-07 23:01:31 +00:00
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
if (axes[curr].speed > -10)
|
|
|
|
axes[curr].speed--;
|
2005-10-07 23:01:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-23 01:45:50 +00:00
|
|
|
if (--axes[curr].angle < 0)
|
|
|
|
axes[curr].angle += 360;
|
2005-10-07 23:01:31 +00:00
|
|
|
}
|
2005-07-13 20:40:46 +00:00
|
|
|
t_disp = DISP_TIME;
|
2005-10-07 23:01:31 +00:00
|
|
|
redraw = true;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2008-09-23 01:45:50 +00:00
|
|
|
|
|
|
|
case CUBE_NEXT:
|
|
|
|
if (++curr > 2)
|
|
|
|
curr = 0;
|
2005-07-13 20:40:46 +00:00
|
|
|
t_disp = DISP_TIME;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2005-07-13 20:40:46 +00:00
|
|
|
|
2008-09-23 01:45:50 +00:00
|
|
|
case CUBE_PREV:
|
|
|
|
if (--curr < 0)
|
|
|
|
curr = 2;
|
2005-07-13 20:40:46 +00:00
|
|
|
t_disp = DISP_TIME;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2005-07-13 20:40:46 +00:00
|
|
|
|
2005-07-12 23:57:06 +00:00
|
|
|
case CUBE_MODE:
|
2005-07-13 20:40:46 +00:00
|
|
|
#ifdef CUBE_MODE_PRE
|
|
|
|
if (lastbutton != CUBE_MODE_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
if (++mode >= NUM_MODES)
|
|
|
|
mode = 0;
|
2010-01-18 20:53:59 +00:00
|
|
|
#ifdef USEGSLIB
|
2008-01-04 23:42:38 +00:00
|
|
|
mylcd = (mode == SOLID) ? &greyfuncs : &lcdfuncs;
|
2006-01-23 22:53:56 +00:00
|
|
|
mode_switch = true;
|
|
|
|
#endif
|
2005-07-13 20:40:46 +00:00
|
|
|
redraw = true;
|
2005-07-12 23:57:06 +00:00
|
|
|
break;
|
2005-07-13 20:40:46 +00:00
|
|
|
|
|
|
|
case CUBE_PAUSE:
|
|
|
|
#ifdef CUBE_PAUSE_PRE
|
|
|
|
if (lastbutton != CUBE_PAUSE_PRE)
|
|
|
|
break;
|
2005-07-12 23:57:06 +00:00
|
|
|
#endif
|
2005-07-13 20:40:46 +00:00
|
|
|
paused = !paused;
|
|
|
|
break;
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_HIGHSPEED:
|
|
|
|
#ifdef CUBE_HIGHSPEED_PRE
|
2005-07-13 20:40:46 +00:00
|
|
|
if (lastbutton != CUBE_HIGHSPEED_PRE)
|
2004-10-17 00:54:09 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2005-07-13 20:40:46 +00:00
|
|
|
highspeed = !highspeed;
|
|
|
|
t_disp = DISP_TIME;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2005-07-13 20:40:46 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef CUBE_RC_QUIT
|
|
|
|
case CUBE_RC_QUIT:
|
|
|
|
#endif
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_QUIT:
|
2013-07-24 09:56:10 +00:00
|
|
|
quit = true;
|
2002-10-15 07:17:50 +00:00
|
|
|
break;
|
2002-10-22 20:13:40 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
default:
|
2010-08-24 14:30:46 +00:00
|
|
|
exit_on_usb(button);
|
2004-10-17 00:54:09 +00:00
|
|
|
break;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(CUBE_MODE_PRE) || \
|
|
|
|
defined(CUBE_PAUSE_PRE) || \
|
|
|
|
defined(CUBE_HIGHSPEED_PRE)
|
2005-07-13 20:40:46 +00:00
|
|
|
if (button != BUTTON_NONE)
|
|
|
|
lastbutton = button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2006-01-23 23:53:22 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
return PLUGIN_OK;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
|
2008-04-27 15:30:19 +00:00
|
|
|
|