2 /* Adds splash screen and status bar effects for graphical yaboot */
12 unsigned char bar_grad[] = { 228, 237, 246, 254, 207, 254, 246, 237, 228, 206 };
15 void scrSetEntireColorMap(unsigned char *);
16 void scrClear(unsigned char);
17 void pcxDisplay(unsigned char *, unsigned int);
18 void scrFadeColorMap(unsigned char *, unsigned char *, int);
19 unsigned char *pcxColormap(unsigned char *, int);
20 void scrPutPixel(int, int, unsigned char);
22 void fxDisplaySplash(struct boot_fspec_t *filespec)
26 unsigned char *grey_map;
28 struct boot_file_t file;
30 static int been_here = 0;
35 gfx_file = (void *) malloc(1024 * 512);
36 if (gfx_file == NULL) {
37 prom_printf("malloc failed in fxDisplaySplash()\n");
43 result = open_file(filespec, &file);
45 if(result != FILE_ERR_OK)
47 prom_printf("Error loading splash screen\n");
51 gfx_len = file.fs->read(&file, 1024 * 512 - 765, gfx_file);
52 file.fs->close(&file);
53 grey_map = gfx_file + gfx_len;
54 memset(grey_map, 0/*128*/, 765);
57 scrSetEntireColorMap(grey_map);
60 start_time = prom_getms();
61 while(prom_getms() < start_time + 2000);
63 pcxDisplay(gfx_file, gfx_len);
64 scrFadeColorMap(grey_map, pcxColormap( gfx_file, gfx_len ), 2);
68 void fxUpdateSB(unsigned number, unsigned total)
72 for(x = SB_XSTART; x < SB_XSTART + (SB_XEND - SB_XSTART) * number / total; ++x)
74 for(y = 0; y < 10; ++y)
75 scrPutPixel(x, SB_YSTART + y, bar_grad[y]);
80 #define BLOCK_INDEX (1024 * 64)
82 int fxReadImage(struct boot_file_t *file, unsigned int filesize, void *base)
84 unsigned int count, result = 0;
86 for(count = 0; count < filesize; count += result)
88 result = ((filesize - count) < BLOCK_INDEX) ? (filesize - count) : BLOCK_INDEX;
89 if ((result = file->fs->read(file, result, base + count)) != BLOCK_INDEX)
91 fxUpdateSB(count + result, filesize);
93 fxUpdateSB(count + result, filesize);
94 return(count + result);