Chameleon

Chameleon Commit Details

Date:2010-08-19 00:32:43 (4 years 30 days ago)
Author:Azimutz
Commit:387
Parents: 386
Message:Trunk it, revs 369 through 377, keeping my changes on the "arch" keys.
Changes:
M/branches/azimutz/CleanCut/i386/boot2/options.c
M/branches/azimutz/CleanCut/doc/BootHelp.txt
M/branches/azimutz/CleanCut/i386/boot2/graphics.c
M/branches/azimutz/CleanCut/i386/libsaio/msdos.c
M/branches/azimutz/CleanCut/i386/boot2/boot.c
M/branches/azimutz/CleanCut/i386/boot2/gui.c
M/branches/azimutz/CleanCut/i386/boot2/boot.h
M/branches/azimutz/CleanCut/i386/boot2/gui.h

File differences

branches/azimutz/CleanCut/doc/BootHelp.txt
1414
1515
1616
17
18
17
18
1919
2020
2121
kernel: kernel name (e.g. "mach_kernel" - must be in "/" )
flags: -v (verbose) -s (single user mode),
-x (safe mode) -F (ignore boot configuration file)
flags: -v (verbose) -s (single user mode) -x (safe mode)
-F (ignore "Kernel Flags" specified in boot configuration file)
32 (i386 arch) -legacy (no 64 bit apps - kernel flag)
64 (x86_64 arch)
branches/azimutz/CleanCut/i386/libsaio/msdos.c
5454
5555
5656
57
57
5858
5959
6060
#include "msdos.h"
#define LABEL_LENGTH11
#define MSDOS_CACHE_BLOCKSIZE BPS * 2
#define MSDOS_CACHE_BLOCKSIZE BPS
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
branches/azimutz/CleanCut/i386/boot2/graphics.c
11931193
11941194
11951195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
12111214
12121215
12131216
return;
}
if (gVerboseMode) {
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS) {
return;
} else {
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE) {
if (currentIndicator >= sizeof(indicator)) {
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
}
}
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS)
{
return;
}
else
{
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE)
{
if (currentIndicator >= sizeof(indicator))
{
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
}
}
void
branches/azimutz/CleanCut/i386/boot2/boot.c
362362
363363
364364
365
366
367
368
369
370
365
366
367
368
369
370
371
371372
372373
373374
......
387388
388389
389390
391
390392
391393
392394
......
572574
573575
574576
575
576
577
578
579
580
577
578
581579
582580
583581
//Azi: doing this earlier to get the verbose from loadOverrideConfig.
// Draw background, turn off any GUI elements and update VRAM.
if ( bootArgs->Video.v_display == GRAPHICS_MODE )
{
drawBackground(); // order matters!!
gui.devicelist.draw = false; // Needed when the verbose "flips" the screen.
gui.bootprompt.draw = false; // ?
gui.menu.draw = false; // ?
gui.infobox.draw = false; // Enter doesn't work with this drawn; most probably it's not needed!?
{
gui.devicelist.draw = false;
gui.bootprompt.draw = false;
gui.menu.draw = false;
gui.infobox.draw = false;
gui.logo.draw = false;
drawBackground();
updateVRAM();
}
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig);
}
continue;
}
if (ret <= 0) {
printf("Can't find %s\n", bootFile);
if(gui.initialised) {
sleep(1);
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
}
sleep(1);
if (gBootFileType == kNetworkDeviceType) {
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = false;
branches/azimutz/CleanCut/i386/boot2/boot.h
101101
102102
103103
104
105104
106105
107106
*/
#define kVerboseModeFlag"-v"// options.c
#define kSafeModeFlag"-x"// options.c
#define kOldSafeModeFlag"-f"// options.c
#define kIgnoreBootFileFlag"-F"// options.c
#define kSingleUserModeFlag"-s"// options.c
#define kArchI386Flag"32"// boot.c
branches/azimutz/CleanCut/i386/boot2/gui.c
418418
419419
420420
421
422
423
424
425
426
427
428
429
430
431
432
421433
422434
423435
......
440452
441453
442454
443
455
456
457
458
444459
445460
446461
447462
448
463
449464
450
451
452465
453466
454467
455468
456469
457470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
458536
459537
460538
......
506584
507585
508586
509
510
587
511588
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558589
559590
560591
......
690721
691722
692723
693
724
694725
695726
696727
return 0;
}
int freeWindowBuffer( window_t *window )
{
if (window->pixmap && window->pixmap->pixels)
{
free(window->pixmap->pixels);
free(window->pixmap);
return 0;
}
return 1;
}
void fillPixmapWithColor(pixmap_t *pm, uint32_t color)
{
int x,y;
blend( images[iBackground].image, gui.screen.pixmap, gui.background.pos );
// draw logo.png into background buffer
blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);
if (gui.logo.draw)
{
blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);
}
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
}
void loadThemeValues(config_file_t *theme, bool overide)
void setupDeviceList(config_file_t *theme)
{
unsigned int screen_width = gui.screen.width;
unsigned int screen_height = gui.screen.height;
unsigned int pixel;
intalpha;// transparency level 0 (obligue) - 255 (transparent)
uint32_t color;// color value formatted RRGGBB
int val, len;
const char *string;
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
// check layout for horizontal or vertical
gui.layout = HorizontalLayout;
if(getValueForKey( "devices_layout", &string, &len, theme)) {
if (!strcmp (string, "vertical")) {
gui.layout = VerticalLayout;
}
}
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
gui.devicelist.pos.x = pixel;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )
gui.devicelist.pos.y = pixel;
break;
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.devicelist.pos.x = pixel;
else
gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )
gui.devicelist.pos.y = pixel;
else
gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;
break;
}
if(getColorForKey("devices_bgcolor", &color, theme))
gui.devicelist.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("devices_transparency", &alpha, theme))
gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);
if (gui.devicelist.pixmap)
{
freeWindowBuffer(&gui.devicelist);
createWindowBuffer(&gui.devicelist);
}
}
void loadThemeValues(config_file_t *theme)
{
unsigned int screen_width = gui.screen.width;
unsigned int screen_height = gui.screen.height;
unsigned int pixel;
intalpha;// transparency level 0 (obligue) - 255 (transparent)
uint32_t color;// color value formatted RRGGBB
int val;
/*
* Parse screen parameters
*/
/*
* Parse devicelist parameters
*/
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
setupDeviceList(theme);
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
// check layout for horizontal or vertical
gui.layout = HorizontalLayout;
if(getValueForKey( "devices_layout", &string, &len, theme)) {
if (!strcmp (string, "vertical")) {
gui.layout = VerticalLayout;
}
}
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
gui.devicelist.pos.x = pixel;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )
gui.devicelist.pos.y = pixel;
break;
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.devicelist.pos.x = pixel;
else
gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )
gui.devicelist.pos.y = pixel;
else
gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;
break;
}
if(getColorForKey("devices_bgcolor", &color, theme))
gui.devicelist.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("devices_transparency", &alpha, theme))
gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);
/*
* Parse infobox parameters
*/
// load graphics otherwise fail and return
if (loadGraphics() == 0) {
loadThemeValues(&bootInfo->themeConfig, true);
loadThemeValues(&bootInfo->themeConfig);
colorFont(&font_small, gui.screen.font_small_color);
colorFont(&font_console, gui.screen.font_console_color);
branches/azimutz/CleanCut/i386/boot2/gui.h
134134
135135
136136
137
137138
138139
139140
int initGUI();
void drawBackground();
void setupDeviceList(config_file_t *theme);
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);
void drawDeviceList(int start, int end, int selection);
void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);
branches/azimutz/CleanCut/i386/boot2/options.c
444444
445445
446446
447
447
448448
449449
450450
......
868868
869869
870870
871
871872
872873
873874
......
13231324
13241325
13251326
1326
1327
1328
1327
1328
1329
13291330
1330
1331
1331
1332
1333
13321334
1333
1334
1335
1336
1337
1338
1339
1340
1341
1335
1336
1337
1338
13421339
13431340
13441341
gVerboseMode = false;
gBootMode = kBootModeNormal;
*gBootArgsPtr++ = '-';
*gBootArgsPtr++ = 'f';
*gBootArgsPtr++ = 'x';
break;
case BOOT_SINGLEUSER:
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
// redraw the background buffer
gui.logo.draw = true;
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
argP[cnt+userCnt] = '\0';
if(!shouldboot)
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
kBootModeSafe : kBootModeNormal;
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
kBootModeSafe : kBootModeNormal;
}
if ( getValueForKey( kOldSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) {
gBootMode = kBootModeSafe;
}
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) ) {
strlcpy(gMKextName, val, cnt + 1);
}
}
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) )
{
strlcpy(gMKextName, val, cnt + 1);
}
free(configKernelFlags);
free(valueBuffer);

Archive Download the corresponding diff file

Revision: 387