Chameleon

Chameleon Commit Details

Date:2010-09-01 06:59:39 (8 years 10 months ago)
Author:Azimutz
Commit:466
Parents: 465
Message:boot.c, boot.h changes. Patch history: http://forum.voodooprojects.org/index.php/topic,1227.0.html
Changes:
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/boot2/boot.h

File differences

branches/azimutz/Chazi/i386/boot2/boot.c
5858
5959
6060
61
62
6163
6264
6365
......
7173
7274
7375
74
76
7577
7678
7779
......
328330
329331
330332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
331371
332372
333373
......
372412
373413
374414
375
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
376463
377464
378465
#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;
int bvCount = 0;
//intmenucount = 0;
int gDeviceCount = 0;
int gDeviceCount = 0;
BVRef bvr;
BVRef menuBVR;
useGUI = true;
// Override useGUI default
getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig);
//Azi:autoresolution begin
// Before initGui, patch the video bios with the correct resolution
UInt32 params[4];
params[3] = 0;
// default to "false" as it doesn't work for everyone atm.
// http://forum.voodooprojects.org/index.php/topic,1227.0.html
gAutoResolution = false;
getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
//Open the VBios and store VBios or Tables
map = openVbios(CT_UNKWN);
if (gAutoResolution == true)
{
//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;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
}
#ifdef AUTORES_DEBUG
printf("Resolution: %dx%d\n",params[0], params[1]);
#endif
//perfom the actual VBIOS patching
if (params[0] != 0 && params[1] != 0)
patchVbios(map, params[0], params[1], params[2], 0, 0);
}
//Azi:autoresolution end
if (useGUI && initGUI())
{
// initGUI() returned with an error, disabling GUI.
drawBackground();
updateVRAM();
}
//Azi:autoresolution begin
//
//AutoResolution - Reapply the patch or cancel if Graphics Mode was incorrect
// or EDID Info was insane
getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
//Restore the vbios for Cancelation
if ((gAutoResolution == false) && map)
{
restoreVbios(map);
closeVbios(map);
}
if ((gAutoResolution == true) && map)
{
// If mode has been switched during boot menu
// use the new resolution
if (map->hasSwitched == true)
{
params[0] = map->currentX;
params[1] = map->currentY;
params[2] = 32;
}
else
{
//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;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
}
}
//Resolution has changed, reapply the patch
if ((params[0] != 0) && (params[1] != 0) && (params[0] != map->currentX) &&
(params[1] != map->currentY))
{
patchVbios(map, params[0], params[1], params[2], 0, 0);
}
closeVbios(map);
}
//Azi:autoresolution end
status = processBootOptions();
// Status == 1 means to chainboot
if ( status ==1 ) break;
branches/azimutz/Chazi/i386/boot2/boot.h
9696
9797
9898
99
99100
100101
101102
#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!
/*
* Flags to the booter and/or kernel - these end with "Flag".

Archive Download the corresponding diff file

Revision: 466