Chameleon

Chameleon Commit Details

Date:2011-12-22 18:28:24 (8 years 5 months ago)
Author:armel cadet-petit
Commit:1737
Parents: 1736
Message:Updated the gui, LointoLion and the default theme
Changes:
A/branches/cparm/artwork/themes/default/menu_boot.png
A/branches/cparm/artwork/themes/default/device_fat.png
A/branches/cparm/artwork/themes/default/device_freebsd.png
A/branches/cparm/artwork/themes/default/device_hfsraid_tiger.png
A/branches/cparm/artwork/themes/default/menu_single_user_disabled.png
A/branches/cparm/artwork/themes/default/font_small.png
A/branches/cparm/artwork/themes/default/device_hfsraid_lion_o.png
A/branches/cparm/artwork/themes/default/device_cdrom_o.png
A/branches/cparm/artwork/themes/default/device_hfsplus.png
A/branches/cparm/artwork/themes/default/menu_video_info.png
A/branches/cparm/artwork/themes/default/device_generic_o.png
A/branches/cparm/artwork/themes/default/device_scroll_next.png
A/branches/cparm/artwork/themes/default/device_hfsraid_o.png
A/branches/cparm/artwork/themes/default/background.png
A/branches/cparm/artwork/themes/default/device_hfsplus_sl_o.png
A/branches/cparm/artwork/themes/default/device_hfsraid_lion.png
A/branches/cparm/artwork/themes/LoginToLion/device_befs_o.png
A/branches/cparm/artwork/themes/LoginToLion/device_befs_o_alt.png
A/branches/cparm/artwork/themes/default/device_openbsd_o.png
A/branches/cparm/artwork/themes/default/progress_bar_background.png
A/branches/cparm/artwork/themes/default/device_hfsplus_tiger.png
A/branches/cparm/artwork/themes/default/logo.png
A/branches/cparm/artwork/themes/default/device_hfsplus_lion_o.png
A/branches/cparm/artwork/themes/default/device_fat_o.png
A/branches/cparm/artwork/themes/default/device_hfsraid_tiger_o.png
A/branches/cparm/artwork/themes/default/device_freebsd_o.png
A/branches/cparm/artwork/themes/default/device_scroll_prev.png
A/branches/cparm/artwork/themes/default/device_hfsraid_leo_o.png
A/branches/cparm/artwork/themes/default/menu_verbose_disabled.png
A/branches/cparm/artwork/themes/default/device_hfsplus_o.png
A/branches/cparm/artwork/themes/default/device_hfsplus_lion.png
A/branches/cparm/artwork/themes/default/font_console.png
A/branches/cparm/artwork/themes/default/device_ntfs.png
A/branches/cparm/artwork/themes/default/device_hfsraid_sl.png
A/branches/cparm/artwork/themes/default/device_hfsraid_leo.png
A/branches/cparm/artwork/themes/default/text_scroll_next.png
A/branches/cparm/artwork/themes/default/menu_ignore_caches_disabled.png
A/branches/cparm/artwork/themes/default/device_selection.png
A/branches/cparm/artwork/themes/default/menu_memory_info.png
A/branches/cparm/artwork/themes/default/theme.plist
A/branches/cparm/artwork/themes/default/menu_selection.png
A/branches/cparm/artwork/themes/default/device_hfsplus_tiger_o.png
A/branches/cparm/artwork/themes/default/device_befs_o.png
A/branches/cparm/artwork/themes/default/menu_help.png
A/branches/cparm/artwork/themes/default/thumb.png
A/branches/cparm/artwork/themes/default/device_ext3_o.png
A/branches/cparm/artwork/themes/default/device_hfsplus_leo_o.png
A/branches/cparm/artwork/themes/default/device_cdrom.png
A/branches/cparm/artwork/themes/default/progress_bar.png
A/branches/cparm/artwork/themes/default/menu_verbose.png
A/branches/cparm/artwork/themes/default/device_generic.png
A/branches/cparm/artwork/themes/default/device_befs.png
A/branches/cparm/artwork/themes/default/text_scroll_prev.png
A/branches/cparm/artwork/themes/default/device_hfsraid.png
A/branches/cparm/artwork/themes/default/device_hfsplus_sl.png
A/branches/cparm/artwork/themes/default/device_ext3.png
A/branches/cparm/artwork/themes/default/device_hfsplus_leo.png
A/branches/cparm/artwork/themes/default/menu_single_user.png
A/branches/cparm/artwork/themes/default/boot.png
A/branches/cparm/artwork/themes/LoginToLion/device_befs.png
A/branches/cparm/artwork/themes/LoginToLion/device_befs_alt.png
A/branches/cparm/artwork/themes/default/device_ntfs_o.png
A/branches/cparm/artwork/themes/default/device_openbsd.png
A/branches/cparm/artwork/themes/default/device_hfsraid_sl_o.png
A/branches/cparm/artwork/themes/default/menu_ignore_caches.png
M/branches/cparm/i386/libsaio/stringTable.c
M/branches/cparm/i386/libsaio/disk.c
M/branches/cparm/CHANGES
M/branches/cparm/i386/libsaio/fake_efi.c
M/branches/cparm/i386/libsaio/saio_types.h
M/branches/cparm/i386/modules/GUI/gui.c

File differences

branches/cparm/CHANGES
1
2
3
14
25
36
- Updated the default theme to v 1.1 (credit to blackosx)
- Updated LogintoLion with he haiku device logo (credit to blackosx)
- Updated for the gui
- Chameleon can now boot the Lion Auto-Installer partition (additionally, on a GPT disk this enable the option "Localize my Mac" of iCloud)
- Added a first version of amlsgn (NOTE: This tool can can sign an aml file for your machine (with the UUID) or for your machine model, this can be useful
with multiple machines w/o an identical model, combined with acpicodec and the option "LoadSignedAmlOnly", you can make sure that Chameleon will load the
branches/cparm/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>
branches/cparm/i386/libsaio/disk.c
15461546
15471547
15481548
1549
1549
1550
15501551
15511552
15521553
sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (GetFileInfo(dirSpec, "Mac OS X Install Data", &flags, &time) == 0)
{
{
/*** DIRTY HACK (would be better to have a plist) ***/
*str = '\0';
strncat(str, "10.7", 4);
return true;
branches/cparm/i386/libsaio/stringTable.c
597597
598598
599599
600
601
602
600
601
602
603603
604604
605
605
606
606607
607608
608609
......
683684
684685
685686
686
687
687
688
688689
689
690
690
691
691692
692693
693694
int loadBooterConfig(config_file_t *config)
{
char *dirspec[] = {
"rd(0,0)/Extra/com.apple.Boot.plist",
"/Extra/com.apple.Boot.plist",
"bt(0,0)/Extra/com.apple.Boot.plist",
"rd(0,0)/Extra/com.apple.Boot.plist",
"/Extra/com.apple.Boot.plist",
"bt(0,0)/Extra/com.apple.Boot.plist",
"rd(0,0)/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk
"/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk
"bt(0,0)/Extra/org.chameleon.Boot.plist" // Add compatibility with the trunk
"bt(0,0)/Extra/org.chameleon.Boot.plist" // Add compatibility with the trunk
};
int i,fd, count, ret=-1;
int loadSystemConfig(config_file_t *config)
{
char *dirspec[] = {
"rd(0,0)/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"rd(0,0)/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"bt(0,0)/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"rd(0,0)/Mac OS X Install Data/com.apple.Boot.plist",
"/Mac OS X Install Data/com.apple.Boot.plist",
"rd(0,0)/Mac OS X Install Data/com.apple.Boot.plist",
"/Mac OS X Install Data/com.apple.Boot.plist",
"bt(0,0)/Mac OS X Install Data/com.apple.Boot.plist"
};
int i,fd, count, ret=-1;
branches/cparm/i386/libsaio/saio_types.h
208208
209209
210210
211
211
212212
213213
214214
bool filtered; /* newFilteredBVChain() will set to TRUE */
bool visible; /* will shown in the device list */
char OSVersion[8];
bool OSisServer; /* Basically mean that OS X server is installed on this partition, not to be confused with Platform->CPU.isServer which means it tries to emulate an xserve in the smbios */
bool OSisServer; /* 1 = OS X server , 0 = OS X client, not to be confused with Platform->CPU.isServer which means it tries to emulate an xserve in the smbios */
};
enum {
branches/cparm/i386/libsaio/fake_efi.c
9999
100100
101101
102
103
102
103
104104
105105
106106
/* Info About the current Firmware */
#define FIRMWARE_MAINTENER "cparm, armelcadetpetit@gmail.com"
static EFI_CHAR16 const FIRMWARE_NAME[] = {'S','a','d','D','a','r','w','i','n', 0}; // hummm, damn, Unfortunately, that day has come, ..... One more thing ???
static EFI_UINT32 const FIRMWARE_REVISION = 0x00010500; //1.5
static EFI_CHAR16 const FIRMWARE_NAME[] = {'S','a','v','a','n','n','a', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 0x00010700; //1.7
static EFI_UINT32 const DEVICE_SUPPORTED = 0x00000001;
/* Default platform system_id (fix by IntVar) */
branches/cparm/i386/modules/GUI/gui.c
2222
2323
2424
25
26
27
2528
29
30
31
32
33
34
35
36
2637
2738
2839
......
5465
5566
5667
57
68
5869
5970
6071
......
345356
346357
347358
348
359
360
361
362
349363
350364
351365
......
354368
355369
356370
371
372
373
357374
358375
359376
......
368385
369386
370387
388
389
390
371391
372392
373393
......
399419
400420
401421
422
402423
424
425
426
403427
404428
405429
......
408432
409433
410434
411
435
412436
413437
438
439
440
441
414442
443
415444
416445
417446
418447
419448
420449
421
450
451
452
453
454
455
422456
423457
424458
425459
426460
461
462
427463
428464
429465
......
496532
497533
498534
499
535
536
537
500538
501539
540
541
502542
503543
504544
......
566606
567607
568608
609
610
569611
612
570613
571614
572615
573616
574617
575618
619
576620
577621
578622
......
586630
587631
588632
633
634
589635
636
590637
591638
592639
593640
594641
595642
643
596644
597645
598646
......
925973
926974
927975
976
977
978
979
928980
929981
930982
931983
984
932985
986
987
933988
934989
935990
936991
992
937993
938
939
940
941
942
943
994
995
996
997
998
999
9441000
945
1001
9461002
9471003
948
1004
9491005
950
1006
9511007
9521008
953
954
1009
1010
1011
1012
1013
1014
1015
1016
9551017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
9561044
957
958
959
1045
1046
9601047
961
962
963
964
965
966
1048
1049
9671050
9681051
9691052
970
971
1053
9721054
973
9741055
9751056
9761057
977
1058
9781059
9791060
9801061
......
9901071
9911072
9921073
993
1074
9941075
9951076
9961077
......
10061087
10071088
10081089
1009
1090
1091
1092
10101093
10111094
10121095
10131096
1014
1097
10151098
10161099
10171100
......
10201103
10211104
10221105
1106
1107
1108
10231109
10241110
10251111
10261112
1027
1113
1114
1115
1116
1117
10281118
10291119
10301120
......
10381128
10391129
10401130
1131
1132
1133
1134
1135
1136
1137
10411138
10421139
10431140
......
10861183
10871184
10881185
1089
1186
1187
1188
10901189
10911190
10921191
......
12761375
12771376
12781377
1279
1378
12801379
12811380
12821381
......
15421641
15431642
15441643
1545
1644
15461645
15471646
15481647
#include "modules.h"
#include "sl.h"
#ifndef DEBUG_GUI
#define DEBUG_GUI 0
#endif
#if DEBUG_GUI==2
#define DBG(x...)printf(x);sleep(2)
#elif DEBUG_GUI==1
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#endif
gui_t gui;// gui structure
font_t font_small;
font_t font_console;
static void drawStrCenteredAt(char *text, font_t *font, pixmap_t *blendInto, position_t p);
static position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p);
static void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);
#if DEBUG
#if DEBUG_GUI
static int dprintf( window_t * window, const char * fmt, ...);
#endif
static void sputc(int c, struct putc_info * pi);
uint16_twidth;
uint16_theight;
uint8_t*imagedata;
if ((unsigned)(strlen(image) + strlen(theme_name) + 30 ) > sizeof(dirspec)) {
if ((unsigned)(strlen(image) + strlen(theme_name) + strlen(src) + (6+1) ) > sizeof(dirspec)) {
DBG("Path of %s/%s/%s.png to long\n", src, theme_name, image);
return 1;
}
if (images[i].image == NULL) {
images[i].image = malloc(sizeof(pixmap_t));
if (images[i].image == NULL) {
DBG("Unable to allocate memory for %s.png\n", image);
return 1;
}
}
images[i].image->height = height;
images[i].image->pixels = (pixel_t *)imagedata;
flipRB(images[i].image);
DBG("[ %s ] succesfully loaded and registred !!\n", dirspec);
return 0;
}
#ifdef EMBED_THEME
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 {
DBG("Unable to load %s, this image not vital anyway, reseting and returning success !!\n", dirspec);
free(images[i].image);
images[i].image = NULL;
}
}
else
{
#ifndef EMBED_THEME
#if DEBUG_GUI
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#else
#ifndef CONFIG_EMBED_THEME
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#endif
#endif
free(images[i].image);
images[i].image = NULL;
return 1;
}
}
}
#if DEBUG_GUI
printf("[ %s/%s/%s.png ] not used in this version, skipped !!\n",src, theme_name, image);
sleep(2);
#endif
return 1;
}
static int loadGraphics(char *src)
{
DBG("Loading image into memory....\n",theme_name);
LOADPNG(src, background, IMG_REQUIRED);
LOADPNG(src, logo, IMG_REQUIRED);
LOADPNG(src, font_console, IMG_REQUIRED);
LOADPNG(src, font_small, IMG_REQUIRED);
DBG("Initializing font....\n",theme_name);
initFont( &font_console, &images[iFontConsole]);
initFont( &font_small, &images[iFontSmall]);
DBG("Graphic objects successfully loaded !!\n",theme_name);
return 0;
}
{
gui.backbuffer = malloc(sizeof(pixmap_t));
if(!gui.backbuffer)
{
DBG("Unable to allocate memory for gui.backbuffer");
return 1;
}
gui.backbuffer->pixels = malloc( window->width * window->height * 4 );
if(!gui.backbuffer->pixels)
{
free(gui.backbuffer);
gui.backbuffer = 0;
DBG("Unable to allocate memory for gui.backbuffer->pixels");
return 1;
}
{
window->pixmap = malloc(sizeof(pixmap_t));
if(!window->pixmap)
{
DBG("Unable to allocate memory for window->pixmap");
return 1;
}
window->pixmap->pixels = malloc( window->width * window->height * 4 );
if(!window->pixmap->pixels)
{
free(window->pixmap);
window->pixmap = 0;
DBG("Unable to allocate memory for window->pixmap->pixels");
return 1;
}
int initGUI(void)
{
bool dummybool = true;
int ret = 1;
bool theme_ran= false;
bool theme_name_set= false;
getBoolForKey(kGUIKey, &dummybool, &bootInfo->bootConfig);
if (!dummybool) {
return 1;
}
getBoolForKey("RandomTheme", &theme_ran, &bootInfo->bootConfig);
{
long flags;
long time;
long ret = -1;
int len;
ret = GetFileInfo("rd(0,0)/Extra/", "Themes", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "rd(0,0)/Extra/Themes");
} else {
ret = GetFileInfo("/Extra/", "Themes", &flags, &time);
theme_name_set = getValueForKey( "Theme", &theme_name, &len, &bootInfo->bootConfig );
if (theme_ran)
{
retry:
ret = GetFileInfo("rd(0,0)/Extra/", "Themes", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "/Extra/Themes");
sprintf(dirsrc, "rd(0,0)/Extra/Themes");
} else {
ret = GetFileInfo("bt(0,0)/Extra/", "Themes", &flags, &time);
ret = GetFileInfo("/Extra/", "Themes", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "bt(0,0)/Extra/Themes");
sprintf(dirsrc, "/Extra/Themes");
} else {
printf("Failed to find the /extra/Themes folder\n");
return 1;
ret = GetFileInfo("bt(0,0)/Extra/", "Themes", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "bt(0,0)/Extra/Themes");
} else {
printf("Failed to find the /extra/Themes folder\n");
return 1;
}
}
}
}
else if (theme_name_set)
{
ret = GetFileInfo("rd(0,0)/Extra/Themes/", theme_name, &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "rd(0,0)/Extra/Themes");
} else {
ret = GetFileInfo("/Extra/Themes/", theme_name, &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "/Extra/Themes");
} else {
ret = GetFileInfo("bt(0,0)/Extra/Themes/", theme_name, &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "bt(0,0)/Extra/Themes");
} else {
printf("Failed to find the /extra/Themes/%s folder\n",theme_name);
theme_name_set = false;
goto retry;
}
}
}
}
}
}
}
int len;
bool theme_ran= false;
getBoolForKey("RandomTheme", &theme_ran, &bootInfo->bootConfig);
int ret = 1;
if (theme_ran) {
if (theme_ran)
{
ret = randomTheme(dirsrc, &theme_name);
if (ret) printf("randomTheme Failed !! \n");
if (ret) printf("randomTheme Failed !! \n");
}
if (ret)
{
if (getValueForKey( "Theme", &theme_name, &len, &bootInfo->bootConfig ) == true)
if (theme_name_set == true)
{
ret = startGUI();
}
#endif
if (ret) {
if (ret && (strcmp(theme_name, THEME_NAME_DEFAULT) != 0)) {
theme_name = THEME_NAME_DEFAULT;
ret = startGUI();
char dirspec[256];
if ((unsigned)(strlen(theme_name) + 34) > sizeof(dirspec)) {
if ((unsigned)(strlen(theme_name) + strlen(dirsrc) + strlen("theme.plist") + 2 ) > sizeof(dirspec)) {
DBG("Path of %s/%s/theme.plist to long\n", dirsrc, theme_name);
return 1;
}
sprintf(dirspec, "%s/%s/theme.plist", dirsrc ,theme_name);
if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) {
#ifdef EMBED_THEME
config = &bootInfo->themeConfig;
if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) {
DBG("Unable to load embed theme plist datas.\n");
return 1;
}
}
#else
return 1;
DBG("Unable to load %s theme plist.\n",theme_name);
return 1;
#endif
}
screen_params[1] = val;
}
}
#if DEBUG_GUI
else
{
printf("No getResolution function hook installed, using default resolution.\n",theme_name);
}
#endif
// Initalizing GUI strucutre.
}
}
}
DBG("Loading error occurred, reseting...\n",theme_name);
// Loading error occurred, freeing resources
freeWindowBuffer(&gui.menu);
freeWindowBuffer(&gui.infobox);
if(gui.menu.draw)
drawInfoMenuItems();
#if DEBUG
#if DEBUG_GUI
gui.debug.cursor = pos( 10, 100);
dprintf( &gui.screen, "label %s\n", param->label );
dprintf( &gui.screen, "biosdev 0x%x\n", param->biosdev );
}
return 1;
}
#if DEBUG
#if DEBUG_GUI
static int dprintf( window_t * window, const char * fmt, ...)
{
char *formattedtext;

Archive Download the corresponding diff file

Revision: 1737