Chameleon

Chameleon Commit Details

Date:2011-12-22 18:31:20 (12 years 4 months ago)
Author:armel cadet-petit
Commit:1738
Parents: 1737
Message:Added OS dtection to the gui, Updated the default theme
Changes:
A/trunk/artwork/themes/default/device_openbsd.png
A/trunk/artwork/themes/default/device_hfsraid_sl_o.png
A/trunk/artwork/themes/default/menu_ignore_caches.png
A/trunk/artwork/themes/default/menu_boot.png
A/trunk/artwork/themes/default/device_fat.png
A/trunk/artwork/themes/default/device_freebsd.png
A/trunk/artwork/themes/default/device_hfsraid_tiger.png
A/trunk/artwork/themes/default/menu_single_user_disabled.png
A/trunk/artwork/themes/default/font_small.png
A/trunk/artwork/themes/default/device_hfsraid_lion_o.png
A/trunk/artwork/themes/default/device_cdrom_o.png
A/trunk/artwork/themes/default/device_hfsplus.png
A/trunk/artwork/themes/default/menu_video_info.png
A/trunk/artwork/themes/default/device_generic_o.png
A/trunk/artwork/themes/default/device_scroll_next.png
A/trunk/artwork/themes/default/device_hfsraid_o.png
A/trunk/artwork/themes/default/background.png
A/trunk/artwork/themes/default/device_hfsplus_sl_o.png
A/trunk/artwork/themes/default/device_hfsraid_lion.png
A/trunk/artwork/themes/default/device_openbsd_o.png
A/trunk/artwork/themes/default/progress_bar_background.png
A/trunk/artwork/themes/default/device_hfsplus_tiger.png
A/trunk/artwork/themes/default/logo.png
A/trunk/artwork/themes/default/device_hfsplus_lion_o.png
A/trunk/artwork/themes/default/device_fat_o.png
A/trunk/artwork/themes/default/device_freebsd_o.png
A/trunk/artwork/themes/default/device_hfsraid_tiger_o.png
A/trunk/artwork/themes/default/device_scroll_prev.png
A/trunk/artwork/themes/default/device_hfsraid_leo_o.png
A/trunk/artwork/themes/default/menu_verbose_disabled.png
A/trunk/artwork/themes/default/device_hfsplus_o.png
A/trunk/artwork/themes/default/device_hfsplus_lion.png
A/trunk/artwork/themes/default/font_console.png
A/trunk/artwork/themes/default/device_ntfs.png
A/trunk/artwork/themes/default/device_hfsraid_sl.png
A/trunk/artwork/themes/default/device_hfsraid_leo.png
A/trunk/artwork/themes/default/text_scroll_next.png
A/trunk/artwork/themes/default/menu_ignore_caches_disabled.png
A/trunk/artwork/themes/default/device_selection.png
A/trunk/artwork/themes/default/menu_memory_info.png
A/trunk/artwork/themes/default/theme.plist
A/trunk/artwork/themes/default/menu_selection.png
A/trunk/artwork/themes/default/device_hfsplus_tiger_o.png
A/trunk/artwork/themes/default/device_befs_o.png
A/trunk/artwork/themes/default/menu_help.png
A/trunk/artwork/themes/default/thumb.png
A/trunk/artwork/themes/default/device_ext3_o.png
A/trunk/artwork/themes/default/device_hfsplus_leo_o.png
A/trunk/artwork/themes/default/device_cdrom.png
A/trunk/artwork/themes/default/progress_bar.png
A/trunk/artwork/themes/default/menu_verbose.png
A/trunk/artwork/themes/default/device_generic.png
A/trunk/artwork/themes/default/device_befs.png
A/trunk/artwork/themes/default/text_scroll_prev.png
A/trunk/artwork/themes/default/device_hfsraid.png
A/trunk/artwork/themes/default/device_hfsplus_sl.png
A/trunk/artwork/themes/default/device_ext3.png
A/trunk/artwork/themes/default/device_hfsplus_leo.png
A/trunk/artwork/themes/default/menu_single_user.png
A/trunk/artwork/themes/default/boot.png
A/trunk/artwork/themes/default/device_ntfs_o.png
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsaio/disk.c
M/trunk/i386/boot2/gui.h
M/trunk/CHANGES
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/saio_types.h

File differences

trunk/artwork/themes/default/theme.plist
55
66
77
8
9
8
109
1110
12
1311
1412
1513
......
2018
2119
2220
23
2421
2522
2623
2724
28
2925
3026
3127
......
3430
3531
3632
37
3833
3934
4035
......
4944
5045
5146
52
5347
5448
5549
......
6660
6761
6862
69
7063
7164
7265
......
8376
8477
8578
86
8779
8880
8981
......
9688
9789
9890
99
10091
10192
10293
......
10596
10697
10798
108
10999
110100
111101
112102
113
114103
115104
116105
<key>Author</key>
<string>Blackosx</string>
<key>Version</key>
<string>1.0</string>
<string>1.1</string>
<key>Enabled</key>
<string>no</string>
<key>screen_width</key>
<string>1024</string>
<key>screen_height</key>
<string>10</string>
<key>screen_bgcolor</key>
<string>#767f73</string>
<key>background_pos_x</key>
<string>50%</string>
<key>background_pos_y</key>
<string>0</string>
<key>logo_pos_x</key>
<string></string>
<key>logo_pos_y</key>
<string>#000000</string>
<key>logo_transparency</key>
<string>255</string>
<key>devices_pos_x</key>
<string></string>
<key>devices_pos_y</key>
<string>45</string>
<key>devices_layout</key>
<string>horizontal</string>
<key>bootprompt_pos_x</key>
<string></string>
<key>bootprompt_pos_y</key>
<string>#3e3e3e</string>
<key>bootprompt_transparency</key>
<string>1</string>
<key>infobox_pos_x</key>
<string></string>
<key>infobox_pos_y</key>
<string>#3e3e3e</string>
<key>infobox_transparency</key>
<string>35</string>
<key>menu_pos_x</key>
<string></string>
<key>menu_pos_y</key>
<string>#3e3e3e</string>
<key>menu_transparency</key>
<string>1</string>
<key>progressbar_pos_x</key>
<string></string>
<key>progressbar_pos_y</key>
<string>100</string>
<key>progressbar_height</key>
<string>40</string>
<key>countdown_pos_x</key>
<string></string>
<key>countdown_pos_y</key>
<string>-20%</string>
<key>boot_width</key>
<string>1024</string>
<key>boot_height</key>
trunk/i386/libsaio/disk.c
131131
132132
133133
134
134135
135136
136137
......
14271428
14281429
14291430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
14301473
14311474
14321475
......
14791522
14801523
14811524
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1525
1526
1527
1528
14941529
14951530
14961531
unsigned int byteCount, void * buffer ) = NULL;
int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL;
static bool getOSVersion(BVRef bvr, char *str);
extern void spinActivityIndicator(int sectors);
}
}
static bool getOSVersion(BVRef bvr, char *str)
{
bool valid = false;
config_file_t systemVersion;
char dirSpec[512];
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
{
valid = true;
}
else
{
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisServer = true;
valid = true;
}
}
if (valid)
{
const char *val;
int len;
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
*str = '\0';
strncat(str, val, MIN(len, 4));
}
else
valid = false;
}
return valid;
}
//==========================================================================
static void scanFSLevelBVRSettings(BVRef chain)
//
if (bvr->flags & kBVFlagNativeBoot)
{
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no);
strcpy(fileSpec, "SystemVersion.plist");
ret = GetFileInfo(dirSpec, fileSpec, &flags, &time);
if (ret == -1)
{
strcpy(fileSpec, "ServerVersion.plist");
ret = GetFileInfo(dirSpec, fileSpec, &flags, &time);
}
if (!ret)
bvr->flags |= kBVFlagSystemVolume;
if (getOSVersion(bvr,bvr->OSVersion) == true)
{
bvr->flags |= kBVFlagSystemVolume;
}
}
}
trunk/i386/libsaio/saio_types.h
191191
192192
193193
194
195
194196
195197
196198
char altlabel[BVSTRLEN]; /* partition volume label */
bool filtered; /* newFilteredBVChain() will set to TRUE */
bool visible; /* will shown in the device list */
char OSVersion[8];
bool OSisServer; /* 1 = OS X server , 0 = OS X client */
};
enum {
trunk/i386/boot2/boot.c
8181
8282
8383
84
84
8585
8686
8787
......
761761
762762
763763
764
764
765765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
766
794767
795768
796769
BVRefbvr, menuBVR, bvChain;
static boolcheckOSVersion(const char * version);
static boolgetOSVersion();
static voidgetOSVersion();
static unsigned longAdler32(unsigned char *buffer, long length);
//static voidselectBiosDevice(void);
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
}
bool getOSVersion()
static void getOSVersion()
{
boolvalid = false;
const char*val;
intlen;
config_file_tsystemVersion;
if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{
valid = true;
}
else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion))
{
valid = true;
}
if (valid)
{
if(getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
*gMacOSVersion = '\0';
strncat(gMacOSVersion, val, MIN(len, 4));
}
else
valid = false;
}
return valid;
strlcpy(gMacOSVersion,gBootVolume->OSVersion,sizeof(gMacOSVersion)+1);
}
#define BASE 65521L /* largest prime smaller than 65536 */
trunk/i386/boot2/gui.c
4343
4444
4545
46
47
48
49
50
51
52
53
4654
4755
56
57
58
59
60
61
62
63
4864
4965
5066
......
97113
98114
99115
100
116
117
118
119
120
121
122
123
124
125
101126
102127
128
129
130
131
132
133
134
135
103136
104137
105138
......
285318
286319
287320
288
321
289322
290
291
292
293
294
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
295339
296340
297341
......
300344
301345
302346
303
304
347
348
349
350
351
352
305353
306354
307355
......
315363
316364
317365
366
367
368
369
370
371
372
373
374
318375
319376
377
378
379
380
381
382
383
384
320385
321386
322387
......
764829
765830
766831
832
833
834
835
836
767837
768838
769839
......
775845
776846
777847
848
778849
779850
780
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
781895
782
896
897
783898
784
899
785900
786
787
788
901
902
903
789904
790
791
792
905
906
907
793908
794909
795
796
910
911
797912
798913
799
800
914
915
801916
802
803
804
917
918
919
805920
806
807
808
921
922
923
809924
810
925
811926
812927
813928
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_Lion,
iDeviceHFS_Lion_o,
iDeviceHFS_SL,
iDeviceHFS_SL_o,
iDeviceHFS_Leo,
iDeviceHFS_Leo_o,
iDeviceHFS_Tiger,
iDeviceHFS_Tiger_o,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_Lion,
iDeviceHFSRAID_Lion_o,
iDeviceHFSRAID_SL,
iDeviceHFSRAID_SL_o,
iDeviceHFSRAID_Leo,
iDeviceHFSRAID_Leo_o,
iDeviceHFSRAID_Tiger,
iDeviceHFSRAID_Tiger_o,
iDeviceEXT3,
iDeviceEXT3_o,
iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_generic", .image = NULL},
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_lion", .image = NULL},
{.name = "device_hfsplus_lion_o", .image = NULL},
{.name = "device_hfsplus_sl", .image = NULL},
{.name = "device_hfsplus_sl_o", .image = NULL},
{.name = "device_hfsplus_leo", .image = NULL},
{.name = "device_hfsplus_leo_o", .image = NULL},
{.name = "device_hfsplus_tiger", .image = NULL},
{.name = "device_hfsplus_tiger_o", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsplus_raid_lion", .image = NULL},
{.name = "device_hfsplus_raid_lion_o", .image = NULL},
{.name = "device_hfsplus_raid_sl", .image = NULL},
{.name = "device_hfsplus_raid_sl_o", .image = NULL},
{.name = "device_hfsplus_raid_leo", .image = NULL},
{.name = "device_hfsplus_raid_leo_o", .image = NULL},
{.name = "device_hfsplus_raid_tiger", .image = NULL},
{.name = "device_hfsplus_raid_tiger_o", .image = NULL},
{.name = "device_ext3", .image = NULL},
{.name = "device_ext3_o", .image = NULL},
{.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
return 0;
}
#endif
else if (alt_image != IMG_REQUIRED && images[alt_image].image->pixels != NULL)
else if (alt_image != IMG_REQUIRED)
{
// Using the passed alternate image for non-mandatory images.
// We don't clone the already existing pixmap, but using its properties instead!
images[i].image->width = images[alt_image].image->width;
images[i].image->height = images[alt_image].image->height;
images[i].image->pixels = images[alt_image].image->pixels;
if (images[alt_image].image->pixels != NULL) {
// Using the passed alternate image for non-mandatory images.
// We don't clone the already existing pixmap, but using its properties instead!
images[i].image->width = images[alt_image].image->width;
images[i].image->height = images[alt_image].image->height;
images[i].image->pixels = images[alt_image].image->pixels;
} else {
// Unable to load or to find the image, this image not vital anyway, reseting and returning success !!
free(images[i].image);
images[i].image = NULL;
}
return 0;
}
else
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#endif
return 1;
}
free(images[i].image);
images[i].image = NULL;
return 1;
}
}
return 1;
}
LOADPNG(device_generic_o, iDeviceGeneric);
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion);
LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o);
LOADPNG(device_hfsplus_sl, iDeviceHFS_SL);
LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL_o);
LOADPNG(device_hfsplus_leo, iDeviceHFS_Leo);
LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o);
LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger);
LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o);
LOADPNG(device_hfsraid, iDeviceGeneric);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsplus_raid_lion, iDeviceHFSRAID_Lion);
LOADPNG(device_hfsplus_raid_lion_o, iDeviceHFSRAID_Lion_o);
LOADPNG(device_hfsplus_raid_sl, iDeviceHFSRAID_SL);
LOADPNG(device_hfsplus_raid_sl_o, iDeviceHFSRAID_SL_o);
LOADPNG(device_hfsplus_raid_leo, iDeviceHFSRAID_Leo);
LOADPNG(device_hfsplus_raid_leo_o, iDeviceHFSRAID_Leo_o);
LOADPNG(device_hfsplus_raid_tiger, iDeviceHFSRAID_Tiger);
LOADPNG(device_hfsplus_raid_tiger_o, iDeviceHFSRAID_Tiger_o);
LOADPNG(device_ext3, iDeviceGeneric);
LOADPNG(device_ext3_o, iDeviceEXT3);
LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
return 1;
}
bool is_image_loaded(int i)
{
return (images[i].image != NULL) ? true : false;
}
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected)
{
int devicetype;
switch (device->part_type)
{
case kPartitionTypeHFS:
{
// Use HFS or HFSRAID icon depending on bvr flags.
devicetype = (device->flags & kBVFlagBooter) ? iDeviceHFSRAID : iDeviceHFS;
if (device->flags & kBVFlagBooter) {
switch (device->OSVersion[3]) {
case '7':
devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '6':
devicetype = is_image_loaded(iDeviceHFSRAID_SL) ? iDeviceHFSRAID_SL : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '5':
devicetype = is_image_loaded(iDeviceHFSRAID_Leo) ? iDeviceHFSRAID_Leo : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '4':
devicetype = is_image_loaded(iDeviceHFSRAID_Tiger) ? iDeviceHFSRAID_Tiger : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
default:
devicetype = is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
}
}
else
{
switch (device->OSVersion[3]) {
case '7':
devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '6':
devicetype = is_image_loaded(iDeviceHFS_SL) ? iDeviceHFS_SL : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '5':
devicetype = is_image_loaded(iDeviceHFS_Leo) ? iDeviceHFS_Leo : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '4':
devicetype = is_image_loaded(iDeviceHFS_Tiger) ? iDeviceHFS_Tiger : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
default:
devicetype = is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
}
}
break;
}
case kPartitionTypeHPFS:
devicetype = iDeviceNTFS;// Use HPFS / NTFS icon
devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric;// Use HPFS / NTFS icon
break;
case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */
devicetype = iDeviceBEFS;// Use BEFS / Haiku icon
case kPartitionTypeFAT16:
devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric;// Use FAT16 icon
break;
case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = iDeviceFreeBSD; // Use FreeBSD icon
case kPartitionTypeFAT32:
devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric;// Use FAT32 icon
break;
case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = iDeviceOpenBSD; // Use OpenBSD icon
case kPartitionTypeEXT3:
devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric;// Use EXT2/3 icon
break;
case kPartitionTypeFAT16:
devicetype = iDeviceFAT16;// Use FAT16 icon
case kPartitionTypeFreeBSD:
devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric;// Use FreeBSD icon
break;
case kPartitionTypeFAT32:
devicetype = iDeviceFAT32;// Use FAT32 icon
case kPartitionTypeOpenBSD:
devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric;// Use OpenBSD icon
break;
case kPartitionTypeEXT3:
devicetype = iDeviceEXT3;// Use EXT2/3 icon
case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */
devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon
break;
default:
devicetype = iDeviceGeneric;// Use Generic icon
break;
trunk/i386/boot2/gui.h
124124
125125
126126
127
127128
128129
129130
void drawBackground();
void setupDeviceList(config_file_t *theme);
bool is_image_loaded(int i);
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);
trunk/CHANGES
1
2
13
24
35
- cparm : Ported the OS detection to the trunk, updated the default theme to v 1.1 (credit to blackosx)
- Added AtiPorts option to GraphicsEnabler, so users can override the default number of ports. It proved
to be useful when used to limit the number of ports that a framebuffer registers, which seems to be a
requirement on laptops that can only use 2 ports at the same time.

Archive Download the corresponding diff file

Revision: 1738