Chameleon

Chameleon Commit Details

Date:2010-09-01 09:58:31 (8 years 9 months ago)
Author:Azimutz
Commit:469
Parents: 468
Message:Last changes on boot2 folder, before testing. Cleaned some #include in the process. On to libsaio folder...
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/boot2/boot.h
M/branches/azimutz/Chazi/i386/boot2/gui.h

File differences

branches/azimutz/Chazi/i386/boot2/boot.c
5858
5959
6060
61
62
6361
6462
6563
......
331329
332330
333331
334
332
333
334
335335
336336
337337
......
366366
367367
368368
369
370369
371370
372371
......
413412
414413
415414
416
417415
418416
419417
......
458456
459457
460458
461
462459
463460
464461
#include "ramdisk.h"
#include "gui.h"
#include "platform.h"
#include "edid.h" // Autoresolution
#include "autoresolution.h" //Azi:includes - "was" included on boot.h, which is everywere!! -> gui.h -> graphics.h
long gBootMode; /* defaults to 0 == kBootModeNormal */
bool gOverrideKernel;
// Override useGUI default
getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig);
//Azi:autoresolution begin
/*
* AutoResolution
*/
// Before initGui, patch the video bios with the correct resolution
UInt32 params[4];
params[3] = 0;
if (params[0] != 0 && params[1] != 0)
patchVbios(map, params[0], params[1], params[2], 0, 0);
}
//Azi:autoresolution end
if (useGUI && initGUI())
{
updateVRAM();
}
//Azi:autoresolution begin
//
//AutoResolution - Reapply the patch or cancel if Graphics Mode was incorrect
// or EDID Info was insane
}
closeVbios(map);
}
//Azi:autoresolution end
status = processBootOptions();
// Status == 1 means to chainboot
branches/azimutz/Chazi/i386/boot2/boot.h
9696
9797
9898
99
99
100100
101101
102102
#define kMD0Image"md0"// ramdisk.h
#define kTestConfigKey"config"// stringTable.c
#define kCanOverrideKey"CanOverride"// stringTable.c
#define kAutoResolutionKey"AutoResolution"// boot.c - don't forget F2 key, to change resolution!
#define kAutoResolutionKey"AutoResolution"// boot.c - don't forget F2 key, to change resolution! - Add to BootHelp.txt
/*
* Flags to the booter and/or kernel - these end with "Flag".
branches/azimutz/Chazi/i386/boot2/gui.c
2222
2323
2424
25
25
2626
2727
2828
......
701701
702702
703703
704
705
706
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
707737
708
709
710
711738
712739
713740
714741
715742
743
716744
717745
718746
719747
720748
749
721750
722751
723752
......
732761
733762
734763
764
765
766
767
768
735769
736770
737771
......
739773
740774
741775
742
743
744
745
746
747
748
776
777
778
779
780
781
782
783
749784
750785
751786
......
888923
889924
890925
891
892926
893927
894928
......
18261860
18271861
18281862
1829
1863
18301864
18311865
18321866
......
18381872
18391873
18401874
1841
1842
1843
1844
1845
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
18461909
1847
1848
1849
1850
1851
18521910
1853
1911
18541912
18551913
18561914
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y)) //Azi: take care of this in the process.***
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define VIDEO(x) (bootArgs->Video.v_ ## x)
return 1;
#endif
}
// parse display size parameters
if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0) {
screen_params[0] = val;
/*
* AutoResolution
*/
if (gAutoResolution == true)
{
// Get Resolution from Graphics Mode key
count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4);
// If no Graphics Mode key, get it from EDID
if ( count < 3 )
{
getResolution(screen_params);
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]);
}
}
else
{
// parse display size parameters
if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0)
{
screen_params[0] = val;
}
if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0)
{
screen_params[1] = val;
}
}
if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0) {
screen_params[1] = val;
}
// Initalizing GUI strucutre.
bzero(&gui, sizeof(gui_t));
// find best matching vesa mode for our requested width & height
loadConfigFile(dirspec, &bootInfo->themeConfig); //Azi: check this later.
getGraphicModeParams(screen_params);
// set our screen structure with the mode width & height
gui.screen.width = screen_params[0];
gui.screen.height = screen_params[1];
PRINT("Found mode %dx%d in VESA Table\n", gui.screen.width, gui.screen.height);
// load graphics otherwise fail and return
if (loadGraphics() == 0) {
if (createWindowBuffer(&gui.bootprompt) == 0) {
if (createWindowBuffer(&gui.infobox) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
#ifdef AUTORES_DEBUG
printf("Press Any Key...\n");
getc();
#endif
gui.logo.draw = true;
drawBackground();
// lets copy the screen into the back buffer
setVideoMode( GRAPHICS_MODE, 0 );
gui.initialised = true;
return 0;
}
}
}
}
}
}
}
} else printf("createWindowBuffer(&gui.menu) Failed\n");
} else printf("createWindowBuffer(&gui.infobox) Failed\n");
} else printf("createWindowBuffer(&gui.bootprompt) Failed\n");
} else printf("createWindowBuffer(&gui.devicelist) Failed\n");
} else printf("createWindowBuffer(&gui.screen) Failed\n");
} else printf("createBackBuffer(&gui.screen) Failed\n");
} else printf("loadGraphics() Failed\n");
return 1;
}
dprintf( &gui.screen, "attr: 0x%x\n", gui.screen.attr );
dprintf( &gui.screen, "mm: %d\n", gui.screen.mm );
}
}
drawDeviceIcon( param, gui.devicelist.pixmap, p, isSelected);
void drawBootGraphics(void)
{
int pos;
int length;
int length, count;
const char *dummyVal;
int oldScreenWidth, oldScreenHeight;
bool legacy_logo;
loadBootGraphics();
}
// parse display size parameters - Azi: shouldn't this stuff be like the one on initGUI? no "else"
if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0) {
screen_params[0] = pos;
} else {
screen_params[0] = DEFAULT_SCREEN_WIDTH;
/*
* AutoResolution - Azi: review this stuff...***
*/
if (gAutoResolution == true)
{
// Get Resolution from Graphics Mode key
count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4);
// If no Graphics Mode key, get it from EDID
if ( count < 3 )
{
getResolution(screen_params);
}
}
else
{
// parse display size parameters
if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0)
{
screen_params[0] = pos;
}
/*else
{
screen_params[0] = DEFAULT_SCREEN_WIDTH;
}*/
if (getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0)
{
screen_params[1] = pos;
}
/*else
{
screen_params[1] = DEFAULT_SCREEN_HEIGHT;
}*/
}
if (getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0) {
screen_params[1] = pos;
} else {
screen_params[1] = DEFAULT_SCREEN_HEIGHT;
}
// Save current screen resolution.
// Save current screen resolution. Azi: ... and this too.***
oldScreenWidth = gui.screen.width;
oldScreenHeight = gui.screen.height;
branches/azimutz/Chazi/i386/boot2/gui.h
88
99
1010
11
12
11
12
13
14
1315
14
1516
17
18
1619
1720
1821
......
4649
4750
4851
52
4953
5054
5155
......
97101
98102
99103
100
101
104
105
106
107
108
109
110
111
102112
103113
104114
*
*/
#include "boot.h"
#include "bootstruct.h"
//Azi:include
//#include "boot.h" - included on graphics.h
//#include "bootstruct.h" - same as above
//#include "graphic_utils.h" - same as above
#include "graphics.h"
#include "graphic_utils.h"
#include "picopng.h"
#include "autoresolution.h"
#include "edid.h"
#ifndef __BOOT2_GUI_H
#define __BOOT2_GUI_H
kUpArrowkey= 0x4800,
kDownArrowkey= 0x5000,
kASCIIKeyMask= 0x7f,
kF2Key= 0x3c00,
kF5Key= 0x3f00,
kF10Key= 0x4400
};
uint32_tfont_console_color;// Color for consle font AARRGGBB
booldraw;// Draw flag
//resolution specifics
uint8_tmm;// Azi: debuginfo
uint16_tattr;
uint16_thtotal;
uint16_tvtotal;
uint16_thsyncstart;
uint16_thsyncend;
uint16_tvsyncstart;
uint16_tvsyncend;
uint8_tmm;// Azi:autoresolution - debuginfo
uint16_tattr;//||||
} window_t;
/*
branches/azimutz/Chazi/i386/boot2/options.c
2222
2323
2424
25
26
25
26
27
2728
2829
2930
......
874875
875876
876877
877
878878
879879
880880
......
982982
983983
984984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
9851002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
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
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
9861070
9871071
9881072
......
10051089
10061090
10071091
1008
1009
1092
1093
1094
1095
10101096
10111097
10121098
......
10311117
10321118
10331119
1120
1121
1122
1123
1124
1125
10341126
10351127
10361128
1129
1130
1131
1132
1133
1134
1135
10371136
10381137
10391138
* @APPLE_LICENSE_HEADER_END@
*/
#include "boot.h"
#include "bootstruct.h"
//Azi:include
//#include "boot.h" - included on graphics.h, which is included on gui.h
//#include "bootstruct.h" - same as above
#include "fdisk.h"
#include "ramdisk.h"
#include "gui.h"
gui.devicelist.draw = true;
gui.redraw = true;
if (!(gBootMode & kBootModeQuiet)) {
//bool showBootBanner = true; Azi:debuginfo
// Check if "Boot Banner"=N switch is present in config file.
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig);
case kEscapeKey:
clearBootArgs();
break;
/*
* AutoResolution - Reapply the patch if Graphics Mode was incorrect
* or EDID Info was insane
*/
case kF2Key:
//get the new Graphics Mode key
processBootOptions();
if ((gAutoResolution == TRUE) && map)
{
UInt32 params[4];
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))
{
//Go back to TEXT mode while we change the mode
if (bootArgs->Video.v_display == GRAPHICS_MODE)
{
CursorState cursorState;
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
clearScreenRows(0, kScreenLastRow);
changeCursor( 0, 0, kCursorTypeHidden, &cursorState );
//Reapply patch in case resolution have changed
patchVbios(map, params[0], params[1], params[2], 0, 0);
if (useGUI && (gui.initialised == true))
initGUI();
// Make sure all values are set
if (bootArgs->Video.v_display != GRAPHICS_MODE)
bootArgs->Video.v_display = GRAPHICS_MODE;
if (!useGUI)
useGUI = true;
// redraw the background buffer
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
if (!(gBootMode & kBootModeQuiet))
{
// Check if "Boot Banner"=N switch is present in config file.
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig);
if (showBootBanner)
// Display banner and show hardware info.
gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024);
// redraw background
memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4);
}
nextRow = kMenuTopRow;
showPrompt = true;
if (gDeviceCount)
{
showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems );
nextRow += min( gDeviceCount, kMenuMaxItems ) + 3;
}
// Show the boot prompt.
showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
showBootPrompt( nextRow, showPrompt );
//this is used to avoid resetting the incorrect mode while quiting the boot menu
map->hasSwitched = true;
}
}
clearBootArgs();
key = 0;
}
break;
case kF5Key:
// New behavior:
// Clear gBootVolume to restart the loop
// New behavior:
// Switch between text & graphic interfaces
// Only Permitted if started in graphics interface
if (useGUI) {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (useGUI) //Azi: check if Tab still works with AutoResolution (boot.c, 370)***
{
if (bootArgs->Video.v_display == GRAPHICS_MODE) //Azi: this is missing on Chazileon & AutoRes branch***
{
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
showBootPrompt(nextRow, showPrompt);
//changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 );
/*
* AutoResolution - make sure all values are set
*/
bootArgs->Video.v_display = VGA_TEXT_MODE;
useGUI = false;
} else {
gui.redraw = true;
setVideoMode(GRAPHICS_MODE, 0);
/*
* AutoResolution - make sure all values are set
*/
bootArgs->Video.v_display = GRAPHICS_MODE;
useGUI = true;
updateVRAM();
}
}

Archive Download the corresponding diff file

Revision: 469