From 767c0ec5894f1acaad5e0def12d628c6f21bcf87 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Thu, 16 Aug 2007 23:01:18 +0000 Subject: Pass plugin api pointer to funtion directly, fixes crashes when doing incremental builds. Fix incorrect backlight changes in rockblox introduced recently. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14373 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/spacerocks.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'apps/plugins/spacerocks.c') diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 5d285a4ada..1278a611ce 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -490,14 +490,20 @@ void iohiscore(void) rb->memset(phscore, 0, sizeof(phscore)); fd = rb->open(HISCORE_FILE,O_RDWR | O_CREAT); - + if(fd < 0) + { + rb->splash(HZ, "Highscore file read error"); + return; + } + /* highscore used to %d, is now %d\n Deal with no file or bad file */ rb->read(fd,phscore, sizeof(phscore)); compare = rb->atoi(phscore); - if(high_score > compare){ + if(high_score > compare) + { rb->lseek(fd,0,SEEK_SET); rb->fdprintf(fd, "%d\n", high_score); } @@ -1926,25 +1932,23 @@ enum plugin_status start_game(void) enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status retval; - (void)(parameter); rb = api; game_state = ATTRACT_MODE; - /* universal font */ #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif + /* universal font */ rb->lcd_setfont(FONT_SYSFIXED); /* Turn off backlight timeout */ - backlight_force_on(); /* backlight control in lib/helper.c */ + backlight_force_on(rb); /* backlight control in lib/helper.c */ iohiscore(); retval = start_game(); iohiscore(); rb->lcd_setfont(FONT_UI); /* Turn on backlight timeout (revert to settings) */ - backlight_use_settings(); /* backlight control in lib/helper.c */ - + backlight_use_settings(rb); /* backlight control in lib/helper.c */ return retval; } -- cgit v1.2.3