Chameleon

Chameleon Commit Details

Date:2010-10-02 13:16:41 (8 years 10 months ago)
Author:Azimutz
Commit:567
Parents: 566
Message:Changing theme files to load from bt(0,0) (now are the last!). Some adjustments to AutoResolution code.
Changes:
M/branches/azimutz/Chazi/i386/boot2/options.c
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/boot2/gui.c
M/branches/azimutz/Chazi/i386/libsaio/autoresolution.c

File differences

branches/azimutz/Chazi/i386/libsaio/autoresolution.c
232232
233233
234234
235
235
236236
237237
238238
}
void closeVbios(vBiosMap * map);
//void closeVbios(vBiosMap * map); azi: dup - declared on header
vBiosMap * openVbios(chipsetType forcedChipset)
{
branches/azimutz/Chazi/i386/boot2/boot.c
358358
359359
360360
361
361362
363
362364
365
363366
364367
365368
......
373376
374377
375378
379
376380
381
377382
378383
379384
......
424429
425430
426431
427
432
428433
429434
430435
......
447452
448453
449454
455
450456
457
451458
459
452460
453461
454462
......
464472
465473
466474
475
476
477
467478
468479
469480
......
623634
624635
625636
626
627
628
629
630
631
632
633
634
635
636
637
637
638
639
640
641
642
643
644
645
646
647
648
638649
639650
640651
641652
642653
643654
644
645
655
656
646657
647658
648659
......
674685
675686
676687
677
678
679
688
689
690
680691
681692
682
683
693
694
695
684696
685697
686698
{
//Get Resolution from Graphics Mode key or EDID
int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4);
if (count < 3)
{
getResolution(params);
}
else
{
if ( params[2] == 256 ) params[2] = 8;
//perfom the actual VBIOS patching
if (params[0] != 0 && params[1] != 0)
{
patchVbios(map, params[0], params[1], params[2], 0, 0);
}
}
if (useGUI && initGUI())
//
//AutoResolution - Reapply the patch or cancel if Graphics Mode was incorrect
// or EDID Info was insane
getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
//getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
//Restore the vbios for Cancelation
if ((gAutoResolution == false) && map)
{
//or get resolution from Graphics Mode or EDID
int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4);
if (count < 3)
{
getResolution(params);
}
else
{
if ( params[2] == 256 ) params[2] = 8;
patchVbios(map, params[0], params[1], params[2], 0, 0);
}
closeVbios(map);
//Azi: gAutoResolution was just set to false on closeVbios;
// we need it to be true here for drawBootGraphics().
gAutoResolution = true;
}
status = processBootOptions();
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.R/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.S/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
// Not found any alternate locations, using the original kernel image path.
strcpy(bootFileSpec, bootFile);
}
}
sprintf(bootFileSpec, "com.apple.boot.R/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.S/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
// Not found any alternate locations, using the original kernel image path.
strcpy(bootFileSpec, bootFile);
}
}
}
verbose("Loading kernel %s\n", bootFileSpec);
ret = LoadThinFatFile(bootFileSpec, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
}
} while (0);
// chainboot
if (status==1) {
if (getVideoMode() == GRAPHICS_MODE) {// if we are already in graphics-mode,
setVideoMode(VGA_TEXT_MODE, 0);// switch back to text mode
}
if (getVideoMode() == GRAPHICS_MODE) {// if we are already in graphics-mode,
setVideoMode(VGA_TEXT_MODE, 0);// switch back to text mode
}
}
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
nbpUnloadBaseCode();
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit)
{
nbpUnloadBaseCode();
}
}
branches/azimutz/Chazi/i386/boot2/gui.c
236236
237237
238238
239
239
240240
241241
242242
......
679679
680680
681681
682
682
683683
684684
685685
......
715715
716716
717717
718
718
719719
720720
721721
......
18371837
18381838
18391839
1840
1840
18411841
18421842
18431843
......
18501850
18511851
18521852
1853
1854
1855
1856
18571853
1854
1855
1856
18581857
18591858
1860
1859
1860
18611861
1862
1862
1863
1864
18631865
18641866
1867
1868
1869
1870
18651871
18661872
1867
1873
18681874
18691875
18701876
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1877
1878
1879
1880
1881
18861882
18871883
1888
1884
18891885
18901886
18911887
18921888
1893
1889
18941890
18951891
1896
1892
18971893
18981894
18991895
19001896
19011897
1902
1898
19031899
19041900
1905
1901
19061902
19071903
1908
1909
1910
1911
19121904
19131905
19141906
......
19161908
19171909
19181910
1919
1920
1911
1912
19211913
19221914
19231915
if (images[i].image == NULL) {
images[i].image = malloc(sizeof(pixmap_t));
}
sprintf(dirspec, "/Extra/Themes/%s/%s.png", theme_name, image);
sprintf(dirspec, "bt(0.0)/Extra/Themes/%s/%s.png", theme_name, image);
width = 0;
height = 0;
imagedata = NULL;
if ((strlen(theme_name) + 27) > sizeof(dirspec)) {
return 1;
}
sprintf(dirspec, "/Extra/Themes/%s/theme.plist", theme_name);
sprintf(dirspec, "bt(0.0)/Extra/Themes/%s/theme.plist", theme_name);
if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) {
#ifdef EMBED_THEME
config_file_t*config;
}
else
{
// parse display size parameters
// parse display size parameters
if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0)
{
screen_params[0] = val;
usePngImage = false;
return;
}
sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name);
sprintf(dirspec, "bt(0.0)/Extra/Themes/%s/boot.png", theme_name);
if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) {
#ifdef EMBED_THEME
if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0)
// drawBootGraphics
void drawBootGraphics(void)
{
int pos;
int length, count;
const char *dummyVal;
int oldScreenWidth, oldScreenHeight;
bool legacy_logo;
const char *dummyVal;
int pos;//, count;
int length, oldScreenWidth, oldScreenHeight;
uint16_t x, y;
if (getBoolForKey(kLegacyLogoKey, &legacy_logo, &bootInfo->bootConfig) && legacy_logo) {
if (getBoolForKey(kLegacyLogoKey, &legacy_logo, &bootInfo->bootConfig) && legacy_logo)
{
usePngImage = false;
} else if (bootImageData == NULL) {
}
else if (bootImageData == NULL)
{
loadBootGraphics();
}
// Save current screen resolution.
oldScreenWidth = gui.screen.width;
oldScreenHeight = gui.screen.height;
/*
* AutoResolution - Azi: check this later; resolution on theme.plist overrides the native one!
* AutoResolution
*/
if (gAutoResolution == true)
{
// Get Resolution from Graphics Mode key
count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4); //Azi: this is ok!
// If no Graphics Mode key, get it from EDID
if ( count < 3 )
{
getResolution(screen_params); //Azi: this returns default resolution (1024x768x32) if nothing found.
//PRINT("Resolution : %dx%d (EDID)\n",screen_params[0], screen_params[1]);
}
/*else
{
PRINT("Resolution : %dx%d (Graphics Mode key)\n",screen_params[0], screen_params[1]);
}*/
}
//Azi: if this stuff is working properly, resolution is set, Vbios is closed and
// most probably we want to use oldScreenWidth/Height so...
screen_params[0] = oldScreenWidth;
screen_params[1] = oldScreenHeight;
}
else
{
// parse display size parameters
// parse display size parameters
if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0)
{
screen_params[0] = pos;
}
/*else
else
{
screen_params[0] = DEFAULT_SCREEN_WIDTH;
}*/
}
if (getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0)
{
screen_params[1] = pos;
}
/*else
else
{
screen_params[1] = DEFAULT_SCREEN_HEIGHT;
}*/
}
}
// Save current screen resolution. Azi: ... and this too.***
oldScreenWidth = gui.screen.width;
oldScreenHeight = gui.screen.height;
gui.screen.width = screen_params[0];
gui.screen.height = screen_params[1];
getGraphicModeParams(screen_params);
// Set graphics mode if the booter was in text mode or the screen resolution has changed.
if (bootArgs->Video.v_display == VGA_TEXT_MODE
|| (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) )
if (bootArgs->Video.v_display == VGA_TEXT_MODE ||
(screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) )
{
setVideoMode(GRAPHICS_MODE, 0);
}
branches/azimutz/Chazi/i386/boot2/options.c
10231023
10241024
10251025
1026
10261027
1028
10271029
1030
10281031
1029
1030
1032
1033
10311034
10321035
10331036
params[3] = 0;
//Has the target Resolution Changed ?
int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4);
if ( count < 3 )
{
getResolution(params);
}
if ((params[0] != 0) && (params[1] != 0)
&&(params[0] != map->currentX) && (params[1] != map->currentY))
if ((params[0] != 0) && (params[1] != 0) &&
(params[0] != map->currentX) && (params[1] != map->currentY))
{
//Go back to TEXT mode while we change the mode

Archive Download the corresponding diff file

Revision: 567