summaryrefslogtreecommitdiff
path: root/apps/plugins/spacerocks.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2007-08-16 23:01:18 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2007-08-16 23:01:18 +0000
commit767c0ec5894f1acaad5e0def12d628c6f21bcf87 (patch)
treea2fbd9ac23adc395d4587a6c9cb85ba4cc001cb8 /apps/plugins/spacerocks.c
parent735ab889d2bd41fdc8a5bf22d7ce5ed724d58474 (diff)
downloadrockbox-767c0ec5894f1acaad5e0def12d628c6f21bcf87.tar.gz
rockbox-767c0ec5894f1acaad5e0def12d628c6f21bcf87.zip
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
Diffstat (limited to 'apps/plugins/spacerocks.c')
-rw-r--r--apps/plugins/spacerocks.c18
1 files changed, 11 insertions, 7 deletions
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)
490 rb->memset(phscore, 0, sizeof(phscore)); 490 rb->memset(phscore, 0, sizeof(phscore));
491 491
492 fd = rb->open(HISCORE_FILE,O_RDWR | O_CREAT); 492 fd = rb->open(HISCORE_FILE,O_RDWR | O_CREAT);
493 493 if(fd < 0)
494 {
495 rb->splash(HZ, "Highscore file read error");
496 return;
497 }
498
494 /* highscore used to %d, is now %d\n 499 /* highscore used to %d, is now %d\n
495 Deal with no file or bad file */ 500 Deal with no file or bad file */
496 rb->read(fd,phscore, sizeof(phscore)); 501 rb->read(fd,phscore, sizeof(phscore));
497 502
498 compare = rb->atoi(phscore); 503 compare = rb->atoi(phscore);
499 504
500 if(high_score > compare){ 505 if(high_score > compare)
506 {
501 rb->lseek(fd,0,SEEK_SET); 507 rb->lseek(fd,0,SEEK_SET);
502 rb->fdprintf(fd, "%d\n", high_score); 508 rb->fdprintf(fd, "%d\n", high_score);
503 } 509 }
@@ -1926,25 +1932,23 @@ enum plugin_status start_game(void)
1926enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 1932enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1927{ 1933{
1928 enum plugin_status retval; 1934 enum plugin_status retval;
1929
1930 (void)(parameter); 1935 (void)(parameter);
1931 rb = api; 1936 rb = api;
1932 1937
1933 game_state = ATTRACT_MODE; 1938 game_state = ATTRACT_MODE;
1934 1939
1935 /* universal font */
1936#if LCD_DEPTH > 1 1940#if LCD_DEPTH > 1
1937 rb->lcd_set_backdrop(NULL); 1941 rb->lcd_set_backdrop(NULL);
1938#endif 1942#endif
1943 /* universal font */
1939 rb->lcd_setfont(FONT_SYSFIXED); 1944 rb->lcd_setfont(FONT_SYSFIXED);
1940 /* Turn off backlight timeout */ 1945 /* Turn off backlight timeout */
1941 backlight_force_on(); /* backlight control in lib/helper.c */ 1946 backlight_force_on(rb); /* backlight control in lib/helper.c */
1942 iohiscore(); 1947 iohiscore();
1943 retval = start_game(); 1948 retval = start_game();
1944 iohiscore(); 1949 iohiscore();
1945 rb->lcd_setfont(FONT_UI); 1950 rb->lcd_setfont(FONT_UI);
1946 /* Turn on backlight timeout (revert to settings) */ 1951 /* Turn on backlight timeout (revert to settings) */
1947 backlight_use_settings(); /* backlight control in lib/helper.c */ 1952 backlight_use_settings(rb); /* backlight control in lib/helper.c */
1948
1949 return retval; 1953 return retval;
1950} 1954}