Chameleon

Chameleon Commit Details

Date:2010-10-23 14:38:56 (13 years 5 months ago)
Author:Azimutz
Commit:603
Parents: 602
Message:More AutoResolution restructure, in preparation to convert it to a module. Introducing options.h.
Changes:
A/branches/azimutz/Chazi/i386/boot2/options.h
M/branches/azimutz/Chazi/i386/boot2/options.c
M/branches/azimutz/Chazi/i386/libsaio/autoresolution.h
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/libsaio/autoresolution.c

File differences

branches/azimutz/Chazi/i386/libsaio/autoresolution.c
1515
1616
1717
18
19
18
19
20
21
2022
2123
2224
......
563565
564566
565567
566
568
567569
568570
569571
......
616618
617619
618620
619
620
621
622
621623
622624
623625
624626
625
627
626628
627629
628
630
629631
630
632
631633
632634
633635
......
643645
644646
645647
646
647
648
649
650
648
649
651650
652651
653652
654653
655
656
657
658
659
654
655
660656
661657
662658
663659
664660
665
661
666662
667663
668
669
670
671
672
673664
674665
675
666
676667
677
678
668
669
670
671
679672
680
681
682
673
674
675
683676
684
685
677
678
679
680
681
682
686683
687
688
689
690
691
692
693
694
684
685
695686
696
697
698
699
700
701
702
687
688
689
690
691
692
693
694
703695
704
696
697
698
699
700
701
702
705703
706
704
705
706
707707
708
709
710
708
709
711710
712
713
711
712
713
714
715
714716
715
716
717
718
719
717
718
720719
721
722
720
721
722
723
724
725
726
727
728
729
723730
724
725
726
727
728
729
730
731
732
733
731
732
733
734734
735
736
737
735
736
738737
739
740
738
739
740
741
742
741743
742
743
744
745
744
745
746
747
748
749
746750
751
752
753
754
755
756
757
758
759
760
761
762
747763
748
749
750
764
765
766
767
768
769
770
771
772
773
774
775
751776
752
753
754
777
778
779
780
781
782
783
784
785
755786
756
757
758
759
760
787
788
789
//#include "libsaio.h"
//#include "autoresolution.h" - included on *_resolution.h
//#include "boot.h"
//#include "gui.h"
//------------
#include "boot.h"
#include "gui.h"
#include "options.h"
#include "nvidia_resolution.h"
#include "ati_resolution.h"
#include "gma_resolution.h"
{
bcopy(table->backup, (uint8_t *)table->pointer, table->size);
table = table->next;
//verbose("Table/s restored...\n");
verbose("Restoring table/s for patch cancelation\n");
}
relockVbios(map);
}
relockVbios(map);
return;
}
/*
void patchRes()
void startAutoRes()
{
//UInt32 paramsAR[4];
paramsAR[3] = 0;
// Open the VBios and store VBios or Tables
// Open the Vbios and store Vbios or Tables
map = openVbios(CT_UNKWN);
//Get Resolution from Graphics Mode key...
//Get resolution from Graphics Mode key...
int count = getNumberArrayFromProperty(kGraphicsModeKey, paramsAR, 4);
// ... or EDID.
if (count < 3)
{
if ( paramsAR[2] == 555 ) paramsAR[2] = 16;
if ( paramsAR[2] == 888 ) paramsAR[2] = 32;
}
// If using GUI, patch the video bios with the extracted resolution,
// before initGui.
// perfom the actual VBIOS patching
// perfom the actual Vbios patching
if (paramsAR[0] != 0 && paramsAR[1] != 0)
{
patchVbios(map, paramsAR[0], paramsAR[1], paramsAR[2], 0, 0);
}
closeVbios(map);
//Azi: gAutoResolution was just set to false on closeVbios().
gAutoResolution = true;
//Azi: passing resolution for TEXT MODE "verbose" boot. (check again later!)
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
gui.screen.width = paramsAR[0];
gui.screen.height = paramsAR[1];
}
// If the patch is working properly, we're done. If not and it's just a matter
// of wrong resolution, we can try reapply the patch; see "case kF2Key:", options.c.
// The patch works properly but we're not using GUI; keep Vbios open and patch/close
// on drawBootGraphics().
// ??????Don't forget we´re maybe using this to get correct resolution after login,
// despite having qe/ci or not...!!!!
}
void reloadRes()
void reloadAutoRes()
{
//UInt32 paramsAR[4];
paramsAR[3] = 0;
extern int key;
extern int nextRow;
extern BVRef menuBVR;
extern bool showPrompt;
map = openVbios(CT_UNKWN);
// Has the target Resolution Changed ?
int count = getNumberArrayFromProperty(kGraphicsModeKey, paramsAR, 4);
extern bool showBootBanner;
extern MenuItem * menuItems;
extern int selectIndex;
if ( count < 3 ) // why this? we are implicitly trying to change the resolution
// at boot prompt, using Graphics Mode flag...
extern void showMenu( const MenuItem * items, int count, int selection, int row, int height );
extern void showBootPrompt(int row, bool visible);
extern void clearBootArgs(void);
extern void changeCursor( int col, int row, int type, CursorState * cs );
if ((gAutoResolution == true) && useGUI && map )
{
getResolution(paramsAR);
}
else
{
if ( paramsAR[2] == 256 ) paramsAR[2] = 8;
if ( paramsAR[2] == 555 ) paramsAR[2] = 16;
if ( paramsAR[2] == 888 ) paramsAR[2] = 32;
}
// get the new Graphics Mode key
processBootOptions(); //Azi: use processBootArgument instead?
// user changed resolution...
if ((paramsAR[0] != 0) && (paramsAR[1] != 0) &&
(paramsAR[0] != map->currentX) && (paramsAR[1] != map->currentY))
{
//Azi: same shit as "case kTabKey:" - check
// Go back to TEXT mode while we change the mode
if (bootArgs->Video.v_display == GRAPHICS_MODE)
//UInt32 paramsAR[4];
paramsAR[3] = 0;
getNumberArrayFromProperty(kGraphicsModeKey, paramsAR, 4);
// user changed resolution...
if ((paramsAR[0] != 0) && (paramsAR[1] != 0) &&
(paramsAR[0] != map->currentX) && (paramsAR[1] != map->currentY))
{
CursorState cursorState;
//Azi: identical to "case kTabKey:"(check later)
if (bootArgs->Video.v_display == GRAPHICS_MODE)
{
CursorState cursorState;
// Go back to TEXT MODE while we change the mode
setVideoMode(VGA_TEXT_MODE, 0);
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
clearScreenRows(0, kScreenLastRow);
changeCursor( 0, 0, kCursorTypeHidden, &cursorState );
setCursorPosition(0, 0, 0);
clearScreenRows(0, kScreenLastRow);
changeCursor( 0, 0, kCursorTypeHidden, &cursorState );
// Reapply patch
patchVbios(map, paramsAR[0], paramsAR[1], paramsAR[2], 0, 0);
// Reapply patch
patchVbios(map, paramsAR[0], paramsAR[1], paramsAR[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 && (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;
if (!useGUI)
useGUI = true;
// redraw the background buffer
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
if (showBootBanner)
{
// Display banner and show hardware info.
gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024);
}
// redraw the background buffer
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
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);
// redraw background
memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels,
gui.backbuffer->width * gui.backbuffer->height * 4);
nextRow = kMenuTopRow;
showPrompt = true;
nextRow = kMenuTopRow;
showPrompt = true;
if (gDeviceCount)
{
showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems );
nextRow += min( gDeviceCount, kMenuMaxItems ) + 3;
}
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; (check again later!)
}
}
clearBootArgs();
key = 0;
}
else // if gAutoResolution == false...
{
// ... do "nothing".(Reviewing...)
clearBootArgs();
key = 0;
}
}
// Show the boot prompt.
showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
showBootPrompt( nextRow, showPrompt );
void endAutoRes()
{
// Restore and close Vbios for patch cancelation.
if ((gAutoResolution == false) && map)
{
restoreVbios(map);
closeVbios(map);
//Azi: closing Vbios here without restoring it as above, causes an allocation error,
// if the user tries to boot, after a e.g."Can't find bla_kernel" msg.
// Doing it on execKernel() instead.
}
// this is used to avoid resetting the incorrect mode while quiting the boot menu
//map->hasSwitched = true;
}
//Azi: while testing i didn't got any problems booting without closing Vbios...
// closing it just in case. (check again later!)
if ((gAutoResolution == true) && map)
{
closeVbios(map);
// gAutoResolution was just set to false on closeVbios().
// We need to be "true" for drawBootGraphics().
gAutoResolution = true;
}
closeVbios(map);
//Azi: gAutoResolution was just set to false on closeVbios.
gAutoResolution = true;
}*/
}
branches/azimutz/Chazi/i386/libsaio/autoresolution.h
1
21
32
43
......
1312
1413
1514
15
1616
1717
1818
......
2020
2121
2222
23
2423
2524
2625
27
26
2827
2928
3029
......
4241
4342
4443
45
44
4645
4746
48
4947
5048
5149
......
5654
5755
5856
59
6057
6158
6259
......
6663
6764
6865
69
7066
7167
7268
......
9894
9995
10096
101
10297
103
10498
10599
106100
......
147141
148142
149143
150
151
152
153144
/* Copied from 915 resolution created by steve tomljenovic
*
* This code is based on the techniques used in :
*
* This source code is into the public domain.
*/
#ifndef __915_RESOLUTION_H
#define __915_RESOLUTION_H
#include "saio_internal.h"
#include "edid.h"
//#define AUTORES_DEBUG 1 // enable AutoResolution debug - review!
#if DEBUG
#ifndef AUTORES_DEBUG
#define AUTORES_DEBUG
#define AUTORES_DEBUG //Azi: review
#endif
#endif
#define VBIOS_START 0xc0000
#define VBIOS_SIZE 0x10000
//#define false 0(Reviewing...)
//#define false 0//Azi: (Reviewing...)
//#define true 1
bool gAutoResolution;
UInt32 paramsAR[4]; //Azi: testing autoresolution
uint8_t height;
} sAspect;
typedef enum
{
CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G,
CT_GM45, CT_G41, CT_G31, CT_G45, CT_500
} chipsetType;
typedef enum
{
BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA
struct sModeTable_ *prev;
struct sModeTable_ *next;
} sModeTable;
typedef struct
{
uint32_t chipsetId;
void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);
//void patchRes();
//void reloadRes();
#endif
branches/azimutz/Chazi/i386/boot2/options.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* Portions Copyright (c) 1999-2004 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
* The Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef __BOOT2_OPTIONS_H
#define __BOOT2_OPTIONS_H
//#include "boot.h"
//#include "bootstruct.h"
//#include "graphics.h"
extern intgDeviceCount;
typedef struct {
int x;
int y;
int type;
} CursorState;
enum {
kMenuTopRow = 5,
kMenuMaxItems = 10,
kScreenLastRow = 24
};
/*
extern const MenuItem * gMenuItems;
void clearBootArgs(void);
void addBootArg(const char * argStr);
void changeCursor( int col, int row, int type, CursorState * cs );
void moveCursor( int col, int row );
void restoreCursor( const CursorState * cs );
void printMemoryInfo(void);
void lspci(void);
void printMenuItem( const MenuItem * item, int highlight );
bool flushKeyboardBuffer(void);
extern bool shouldboot;
#ifdef UNUSED
extern int multiboot_timeout;
extern int multiboot_timeout_set;
#endif
extern BVRef bvChain;
//extern intmenucount;
//==========================================================================
extern char gBootArgs[BOOT_STRING_LEN];
extern char * gBootArgsPtr;
extern char * gBootArgsEnd;
extern char booterCommand[BOOT_STRING_LEN];
extern char booterParam[BOOT_STRING_LEN];
//==========================================================================
extern int gMenuItemCount;
extern int gMenuRow;
extern int gMenuHeight;
extern int gMenuTop;
extern int gMenuBottom;
extern int gMenuSelection;
extern int gMenuStart;
extern int gMenuEnd;
extern unsigned char chainbootdev;
extern unsigned char chainbootflag;
// Maximum config table value size
#define VALUE_SIZE 2048
*/
#endif /* __BOOT2_OPTIONS_H */
branches/azimutz/Chazi/i386/boot2/boot.c
7676
7777
7878
79
79
8080
8181
8282
......
128128
129129
130130
131
132
131133
132134
133135
......
189191
190192
191193
192
193
194
195
196
197
198
199
200
201
202
203194
195
196
197
198
199
204200
205201
206202
......
209205
210206
211207
212
208
213209
214210
215211
......
376372
377373
378374
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
375
420376
421377
422378
......
465421
466422
467423
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483424
425
426
427
428
484429
485430
486431
int gDeviceCount = 0;
BVRef bvr;
BVRef menuBVR;
//BVRef menuBVR; - doesn't seem used here
BVRef bvChain;
bool useGUI;
//==========================================================================
// execKernel - Load the kernel image (mach-o) and jump to its entry point.
extern void startAutoRes();
extern void endAutoRes();
static int ExecKernel(void *binary)
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL);
if ((gAutoResolution == true) && map)
{
closeVbios(map);
//Azi: as a side note, while testing i didn't got any problems booting without
// closing Vbios... closing it just in case. (check again later!)
// gAutoResolution was just set to false on closeVbios().
// We need to be "true" for drawBootGraphics().
gAutoResolution = true;
}
//AutoResolution - Check if user disabled AutoResolution at the boot prompt.
getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
// Cancel and/or finalize the patch.
endAutoRes();
// If we were in text mode, switch to graphics mode.
// This will draw the boot graphics unless we are in
// verbose mode.
setVideoMode( GRAPHICS_MODE, 0 );
else
drawBootGraphics();
setupBooterLog();
finalizeBootStruct();
// Patch the Video Bios with the extracted resolution, before initGui.
if (gAutoResolution == true)
{
//patchRes();
//UInt32 paramsAR[4];
paramsAR[3] = 0;
// Open the Vbios and store VBios or Tables
map = openVbios(CT_UNKWN);
//Get Resolution from Graphics Mode key...
int count = getNumberArrayFromProperty(kGraphicsModeKey, paramsAR, 4);
// ... or EDID.
if (count < 3)
{
getResolution(paramsAR);
// check the DEBUG stuff... also on TEXT MODE (this is not printing).
PRINT("Resolution: %dx%d (EDID)\n",paramsAR[0], paramsAR[1]);
}
else
{
PRINT("Resolution: %dx%d (Graphics Mode key)\n",paramsAR[0], paramsAR[1]);
if ( paramsAR[2] == 256 ) paramsAR[2] = 8;
if ( paramsAR[2] == 555 ) paramsAR[2] = 16;
if ( paramsAR[2] == 888 ) paramsAR[2] = 32;
}
// perfom the actual VBIOS patching
if (paramsAR[0] != 0 && paramsAR[1] != 0)
{
patchVbios(map, paramsAR[0], paramsAR[1], paramsAR[2], 0, 0);
}
//Azi: passing resolution for TEXT MODE "verbose" boot. (check again later!)
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
gui.screen.width = paramsAR[0];
gui.screen.height = paramsAR[1];
}
// If the patch is working properly, we're done. If not and it's just a matter
// of wrong resolution, we can try reapply the patch; see "case kF2Key:", options.c.
startAutoRes();
}
if (useGUI && initGUI())
}
status = processBootOptions();
//AutoResolution - cancel if Graphics Mode was incorrect or EDID Info was insane.
// Check if user disabled AutoResolution at the boot prompt.
getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig);
// Restore and close Vbios for patch cancelation.
if ((gAutoResolution == false) && map)
{
restoreVbios(map);
closeVbios(map);
//Azi: closing Vbios here without restoring it as above, causes an allocation error,
// if the user tries to boot, after a e.g."Can't find bla_kernel" msg.
// Doing it on execKernel() instead.
}
//Azi: AutoResolution - closing Vbios here without restoring, causes an allocation error,
// if the user tries to boot, after a e.g."Can't find bla_kernel" msg.
// Doing it on execKernel() instead.
// Status == 1 means to chainboot
if ( status ==1 ) break;
branches/azimutz/Chazi/i386/boot2/options.c
2828
2929
3030
31
3132
3233
3334
......
3839
3940
4041
41
42
4243
4344
4445
4546
4647
4748
48
49
50
51
52
53
5449
5550
56
57
58
59
60
61
62
51
52
6353
6454
6555
......
203193
204194
205195
206
196
197
207198
208199
209200
......
306297
307298
308299
309
300
301
310302
311303
312304
......
678670
679671
680672
673
674
675
676
681677
682678
683679
684680
685
686
681
682
687683
688684
689685
690
691
686
687
688
689
692690
693691
694692
......
10111009
10121010
10131011
1014
1015
1012
1013
10161014
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
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1015
10991016
11001017
11011018
......
11201037
11211038
11221039
1123
1124
1040
1041
1042
1043
11251044
11261045
11271046
......
11371056
11381057
11391058
1140
1059
1060
11411061
11421062
11431063
......
11461066
11471067
11481068
1149
1069
1070
1071
1072
1073
1074
1075
1076
11501077
11511078
11521079
#include "gui.h"
#include "embedded.h"
#include "pci.h"
#include "options.h"
bool showBootBanner = true; //Azi:debuginfo
static bool shouldboot = false;
extern BVRef bvChain;
//extern intmenucount;
extern intgDeviceCount;
//extern intgDeviceCount; //Azi: header
chargMacOSVersion[8]; //Azi: moved from boot.c
static bool getOSVersion(char *str); //||
intselectIndex = 0;
MenuItem * menuItems = NULL;
enum {
kMenuTopRow = 5,
kMenuMaxItems = 10,
kScreenLastRow = 24
};
//==========================================================================
typedef struct {
int x;
int y;
int type;
} CursorState;
static void changeCursor( int col, int row, int type, CursorState * cs )
//static
void changeCursor( int col, int row, int type, CursorState * cs )
{
if (cs) getCursorPositionAndType( &cs->x, &cs->y, &cs->type );
setCursorType( type );
//==========================================================================
static void showBootPrompt(int row, bool visible)
//static
void showBootPrompt(int row, bool visible)
{
extern char bootPrompt[];
extern char bootRescanPrompt[];
//==========================================================================
static void showMenu( const MenuItem * items, int count,
//static
void showMenu( const MenuItem * items, int count,
int selection, int row, int height )
{
int i;
}
//==========================================================================
int key;
int nextRow;
BVRef menuBVR;
bool showPrompt;
int getBootOptions(bool firstRun)
{
int i;
int key;
int nextRow;
//int key;
//int nextRow;
int timeout;
int bvCount;
BVRef bvr;
BVRef menuBVR;
bool showPrompt, newShowPrompt, isCDROM;
//BVRef menuBVR;
//bool showPrompt;
bool newShowPrompt, isCDROM;
extern void reloadAutoRes(); //Azi: autoresolution
// Initialize default menu selection entry.
gBootVolume = menuBVR = selectBootVolume(bvChain);
clearBootArgs();
break;
// AutoResolution - Reapply the patch if Graphics Mode was incorrect or EDID Info was insane.
//Azi:
// AutoResolution - Reapply the patch if Graphics Mode was incorrect
// or EDID Info was insane.
case kF2Key:
if ((gAutoResolution == true) && map)
{
// get the new Graphics Mode key
processBootOptions(); //Azi: use processBootArgument instead?
//reloadRes();
//UInt32 paramsAR[4];
paramsAR[3] = 0;
getNumberArrayFromProperty(kGraphicsModeKey, paramsAR, 4);
// user changed resolution...
if ((paramsAR[0] != 0) && (paramsAR[1] != 0) &&
(paramsAR[0] != map->currentX) && (paramsAR[1] != map->currentY))
{
//Azi: same stuff as "case kTabKey:"(Reviewing...)
// 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
patchVbios(map, paramsAR[0], paramsAR[1], paramsAR[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 (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; (check again later!)
}
}
clearBootArgs();
key = 0;
}
else // if gAutoResolution == false...
{
// ... do "nothing".
clearBootArgs();
key = 0;
}
reloadAutoRes();
break;
case kF5Key:
// 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)
{
if (bootArgs->Video.v_display == GRAPHICS_MODE)
{
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
nextRow = kMenuTopRow;
showPrompt = true;
if (gDeviceCount) {
if (gDeviceCount)
{
printf("Use \30\31 keys to select the startup volume.");
showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems);
nextRow += min(gDeviceCount, kMenuMaxItems) + 3;
showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
showBootPrompt(nextRow, showPrompt);
//changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 );
} else {
// need to disable F2 here but can't do useGUI = false...
// not a big deal but since i disabled it when in TEXT MODE,
// were it makes no sense and it just hangs the prompt.. not fatal, though...
// back later...
}
else
{
gui.redraw = true;
setVideoMode(GRAPHICS_MODE, 0);
updateVRAM();

Archive Download the corresponding diff file

Revision: 603