summaryrefslogtreecommitdiff
path: root/apps/plugins/cube.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-23 17:12:26 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-23 17:12:26 +0000
commit93cb949372630d807615f53a8a6379937ed6819f (patch)
tree2dcb5001a9247447a1c64fd0129e64b9d8aba4e6 /apps/plugins/cube.c
parentabdc5935beb7dc3fa63bffeec584921ad2a4c8bd (diff)
downloadrockbox-93cb949372630d807615f53a8a6379937ed6819f.tar.gz
rockbox-93cb949372630d807615f53a8a6379937ed6819f.zip
Revert "Introduce plugin_crt0.c that every plugin links."
Too much errors and no time to fix them now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27863 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/cube.c')
-rw-r--r--apps/plugins/cube.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 7dec822d56..2b1e00d690 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -22,7 +22,6 @@
22***************************************************************************/ 22***************************************************************************/
23#include "plugin.h" 23#include "plugin.h"
24#include "lib/playergfx.h" 24#include "lib/playergfx.h"
25#include "lib/pluginlib_exit.h"
26#if LCD_DEPTH > 1 25#if LCD_DEPTH > 1
27#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */ 26#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
28#include "lib/grey.h" 27#include "lib/grey.h"
@@ -33,6 +32,8 @@
33#include "lib/xlcd.h" 32#include "lib/xlcd.h"
34#include "lib/fixedpoint.h" 33#include "lib/fixedpoint.h"
35 34
35PLUGIN_HEADER
36
36/* Loops that the values are displayed */ 37/* Loops that the values are displayed */
37#define DISP_TIME 30 38#define DISP_TIME 30
38 39
@@ -610,8 +611,10 @@ static void cube_draw(void)
610 } 611 }
611} 612}
612 613
613void cleanup(void) 614void cleanup(void *parameter)
614{ 615{
616 (void)parameter;
617
615#ifdef USEGSLIB 618#ifdef USEGSLIB
616 grey_release(); 619 grey_release();
617#elif defined HAVE_LCD_CHARCELLS 620#elif defined HAVE_LCD_CHARCELLS
@@ -635,7 +638,7 @@ enum plugin_status plugin_start(const void* parameter)
635 bool highspeed = false; 638 bool highspeed = false;
636 bool paused = false; 639 bool paused = false;
637 bool redraw = true; 640 bool redraw = true;
638 bool quit = false; 641 bool exit = false;
639 642
640 (void)(parameter); 643 (void)(parameter);
641 644
@@ -648,7 +651,6 @@ enum plugin_status plugin_start(const void* parameter)
648 rb->splash(HZ, "Couldn't init greyscale display"); 651 rb->splash(HZ, "Couldn't init greyscale display");
649 return PLUGIN_ERROR; 652 return PLUGIN_ERROR;
650 } 653 }
651
652 /* init lcd_ function pointers */ 654 /* init lcd_ function pointers */
653 lcdfuncs.update = rb->lcd_update; 655 lcdfuncs.update = rb->lcd_update;
654 lcdfuncs.clear_display = rb->lcd_clear_display; 656 lcdfuncs.clear_display = rb->lcd_clear_display;
@@ -671,8 +673,7 @@ enum plugin_status plugin_start(const void* parameter)
671 pgfx_display(0, 0); 673 pgfx_display(0, 0);
672#endif 674#endif
673 675
674 atexit(cleanup); 676 while(!exit)
675 while(!quit)
676 { 677 {
677 if (redraw) 678 if (redraw)
678 { 679 {
@@ -829,17 +830,24 @@ enum plugin_status plugin_start(const void* parameter)
829 case CUBE_RC_QUIT: 830 case CUBE_RC_QUIT:
830#endif 831#endif
831 case CUBE_QUIT: 832 case CUBE_QUIT:
832 exit(EXIT_SUCCESS); 833 exit = true;
833 break; 834 break;
834 835
835 default: 836 default:
836 exit_on_usb(button); 837 if (rb->default_event_handler_ex(button, cleanup, NULL)
838 == SYS_USB_CONNECTED)
839 return PLUGIN_USB_CONNECTED;
837 break; 840 break;
838 } 841 }
839 if (button != BUTTON_NONE) 842 if (button != BUTTON_NONE)
840 lastbutton = button; 843 lastbutton = button;
841 } 844 }
842 845
846#ifdef USEGSLIB
847 grey_release();
848#elif defined(HAVE_LCD_CHARCELLS)
849 pgfx_release();
850#endif
843 return PLUGIN_OK; 851 return PLUGIN_OK;
844} 852}
845 853