Chameleon

Chameleon Commit Details

Date:2014-12-31 03:15:07 (9 years 3 months ago)
Author:ErmaC
Commit:2521
Parents: 2520
Message:typo
Changes:
M/trunk/i386/boot2/modules.c
M/trunk/i386/libsaio/vbe.c
M/trunk/i386/boot2/options.c
M/trunk/i386/libsaio/sys.c

File differences

trunk/i386/libsaio/vbe.c
116116
117117
118118
119
120
119121
120122
121123
......
153155
154156
155157
158
159
156160
157161
158162
......
260264
261265
262266
267
268
263269
264270
265271
......
273279
274280
275281
282
283
276284
277285
278286
......
286294
287295
288296
297
298
289299
290300
291301
......
299309
300310
301311
312
313
302314
303315
304316
......
308320
309321
310322
323
324
311325
312326
313327
return(bb.eax.r.h);
}
//==============================================================================
/*
* Default GTF parameter values.
*/
return x*y;
}
//==============================================================================
int generateCRTCTiming( unsigned short width,
unsigned short height,
unsigned long paramValue,
return 0;
}
//==============================================================================
int setVBEMode(unsigned short mode, const VBECRTCInfoBlock * timing)
{
bb.intno = 0x10;
return(bb.eax.r.h);
}
//==============================================================================
int setVBEPalette(void *palette)
{
bb.intno = 0x10;
return(bb.eax.r.h);
}
//==============================================================================
int getVBEPalette(void *palette)
{
bb.intno = 0x10;
return(bb.eax.r.h);
}
//==============================================================================
int getVBECurrentMode(unsigned short *mode)
{
bb.intno = 0x10;
return(bb.eax.r.h);
}
//==============================================================================
int getVBEPixelClock(unsigned short mode, unsigned long * pixelClock)
{
bb.intno = 0x10;
trunk/i386/libsaio/sys.c
4444
4545
4646
47
48
49
5047
5148
5249
5350
5451
52
53
54
5555
5656
57
58
59
60
61
6257
6358
6459
......
8883
8984
9085
91
86
87
9288
9389
9490
......
120116
121117
122118
119
120
121
122
123
123124
124125
125126
......
129130
130131
131132
132
133
134
133
134
135
135136
136137
137138
138
139
139140
140
141
141
142
142143
143
144
144145
145
146
146147
147
148
148149
149
150
150151
151152
152153
153154
154
155
155
156
156157
157158
158159
......
193194
194195
195196
196
197
197198
198199
199
200
201
200202
201203
202204
......
206208
207209
208210
209
211
210212
211213
212214
213215
214216
215217
216
218
217219
218220
219221
......
274276
275277
276278
277
279
280
278281
279282
280283
......
282285
283286
284287
288
289
285290
286291
287292
288293
289
290
291
292
293
294
295
296
297
298
294299
295
300
296301
297
298
299
300
301
302
303
304
305
306
302307
303
304
305
306
308
309
310
311
307312
308313
309
314
310315
311316
312317
313
318
314319
315320
316321
......
354359
355360
356361
357
362
358363
359
360
364
361365
362
363
366
367
364368
365369
366370
......
379383
380384
381385
382
386
383387
384388
385389
386
387
390
388391
389392
390393
......
394397
395398
396399
397
398
399
400
401
402
403
400404
401405
402406
403
404
407
408
409
410
411
412
413
405414
406415
407416
408
417
418
419
409420
410421
411422
......
435446
436447
437448
438
449
450
439451
440452
441453
......
514526
515527
516528
517
529
530
518531
519532
520533
......
527540
528541
529542
530
531
543
544
545
546
532547
533548
549
534550
535551
536552
537553
538554
539555
540
556
557
541558
542559
543560
......
557574
558575
559576
577
560578
561579
562580
563
564
565
566
567
568
581
582
583
584
585
586
569587
570588
571589
......
629647
630648
631649
632
650
633651
634652
635653
......
662680
663681
664682
665
683
666684
667685
668686
669687
670688
671
689
690
672691
673692
674693
675
694
695
676696
677697
678698
679
699
700
680701
681702
682703
......
694715
695716
696717
697
718
698719
699720
700
721
701722
702723
703
724
704725
705726
706
727
707728
708
729
709730
710
731
711732
712733
713734
735
736
714737
715738
716
717
718
739
740
741
719742
720
743
721744
722745
723
746
724747
725
748
726749
727750
728751
752
753
729754
730755
731756
732
757
733758
734759
735
760
736761
737762
738
763
739764
740
765
741766
742
767
743768
744769
745770
......
751776
752777
753778
754
779
780
755781
756782
757783
......
791817
792818
793819
794
795
820
821
796822
797
798
799
823
824
825
800826
801
802
803
827
828
829
804830
805
831
806832
807833
808834
809835
810
811
836
837
838
812839
813840
814841
815842
816843
817844
818
819
845
846
847
848
820849
821850
822851
823852
824853
825854
826
855
827856
828857
829858
830859
831
832
860
833861
834862
835863
......
839867
840868
841869
842
843
870
844871
845872
846873
......
920947
921948
922949
923
950
924951
925952
926953
......
966993
967994
968995
996
969997
970998
971999
......
10081036
10091037
10101038
1011
1039
10121040
10131041
1014
1042
10151043
10161044
10171045
10181046
10191047
1020
1021
1022
10231048
10241049
10251050
......
10281053
10291054
10301055
1056
1057
10311058
10321059
10331060
......
10391066
10401067
10411068
1069
1070
10421071
10431072
10441073
......
10531082
10541083
10551084
1085
10561086
10571087
10581088
......
10631093
10641094
10651095
1066
1067
1068
1096
1097
1098
10691099
1070
1100
10711101
1072
1102
1103
10731104
10741105
10751106
10761107
10771108
10781109
1079
1110
1111
10801112
10811113
10821114
......
10841116
10851117
10861118
1087
1119
1120
1121
10881122
10891123
10901124
......
11091143
11101144
11111145
1112
1146
11131147
11141148
11151149
......
12271261
12281262
12291263
1264
12301265
12311266
12321267
......
12471282
12481283
12491284
1250
1285
12511286
12521287
12531288
......
12631298
12641299
12651300
1266
1301
12671302
12681303
1304
1305
* where everything is defaulted
* Add routine, ptol(), to parse partition letters.
*
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
*@(#)sys.c7.1 (Berkeley) 6/5/86
*
* Copyright 2007 VMware Inc. "Preboot" ramdisk support added by David Elliott
*
*/
/* Copyright 2007 VMware Inc.
"Preboot" ramdisk support added by David Elliott
*/
#include "libsaio.h"
#include "boot.h"
#include "bootstruct.h"
extern int multiboot_skip_partition;
extern int multiboot_skip_partition_set;
struct devsw {
struct devsw
{
const char * name;
// size increased from char to short to handle non-BIOS internal devices
unsigned short biosdev;
void * gFSLoadAddress = 0;
#define LP '('
#define RP ')'
int gBIOSDev;
// Turbo - save what we think is our original BIOS boot volume if we have one 0xab
BVRef gBIOSBootVolume = NULL;
BVRef gBootVolume;
//==========================================================================
// LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION.
// Load the specified file from the specified volume
// to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
// Load the specified file from the specified volume
// to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
long LoadVolumeFile(BVRef bvr, const char *filePath)
{
long fileSize;
long fileSize;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
gFSLoadAddress = (void *) LOAD_ADDR;
fileSize = bvr->fs_loadfile(bvr, (char *)filePath);
fileSize = bvr->fs_loadfile(bvr, (char *)filePath);
// Return the size of the file, or -1 if load failed.
// Return the size of the file, or -1 if load failed.
return fileSize;
return fileSize;
}
//==========================================================================
// LoadFile - LOW-LEVEL FILESYSTEM FUNCTION.
// Load the specified file to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
// Load the specified file to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
long LoadFile(const char * fileSpec)
{
long LoadThinFatFile(const char *fileSpec, void **binary)
{
const char*filePath;
const char*filePath = "";
FSReadFilereadFile;
BVRefbvr;
unsigned long length, length2;
unsigned longlength;
unsigned longlength2;
// Resolve the boot volume from the file spec.
}
*binary = (void *)kLoadAddr;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
readFile = bvr->fs_readfile;
if (readFile != NULL)
{
// Read the first 4096 bytes (fat header)
return -1;
}
if(bvr->fs_getuuid) {
if(bvr->fs_getuuid)
{
rval = bvr->fs_getuuid(bvr, uuidStr);
}
}
#endif
//==========================================================================
// filesystem-specific getUUID functions call this shared string generator
long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr)
{
unsigned fmtbase, fmtidx, i;
uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 };
char *p = uuidStr;
MD5_CTX md5c;
uint8_t mdresult[16];
unsignedfmtbase, fmtidx, i;
uint8_tuuidfmt[] = { 4, 2, 2, 2, 6 };
char*p = uuidStr;
MD5_CTXmd5c;
uint8_tmdresult[16];
bzero(mdresult, sizeof(mdresult));
bzero(mdresult, sizeof(mdresult));
// just like AppleFileSystemDriver
MD5Init(&md5c);
MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1));
MD5Update(&md5c, uubytes, nbytes);
MD5Final(mdresult, &md5c);
// just like AppleFileSystemDriver
MD5Init(&md5c);
MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1));
MD5Update(&md5c, uubytes, nbytes);
MD5Final(mdresult, &md5c);
// this UUID has been made version 3 style (i.e. via namespace)
// see "-uuid-urn-" IETF draft (which otherwise copies byte for byte)
mdresult[6] = 0x30 | ( mdresult[6] & 0x0F );
mdresult[8] = 0x80 | ( mdresult[8] & 0x3F );
// this UUID has been made version 3 style (i.e. via namespace)
// see "-uuid-urn-" IETF draft (which otherwise copies byte for byte)
mdresult[6] = 0x30 | ( mdresult[6] & 0x0F );
mdresult[8] = 0x80 | ( mdresult[8] & 0x3F );
// generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292
// generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292
i = 0;
fmtbase = 0;
for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++)
for (fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++)
{
for (i = 0; i < uuidfmt[fmtidx]; i++)
{
//==========================================================================
// GetDirEntry - LOW-LEVEL FILESYSTEM FUNCTION.
// Fetch the next directory entry for the given directory.
// Fetch the next directory entry for the given directory.
long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name,
long * flags, u_int32_t * time)
long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, long * flags, u_int32_t * time)
{
const char * dirPath;
BVRef bvr;
const char*dirPath;
BVRefbvr;
// Resolve the boot volume from the dir spec.
//==========================================================================
// GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION.
// Get attributes for the specified file.
// Get attributes for the specified file.
static char* gMakeDirSpec;
long GetFileInfo(const char * dirSpec, const char * name,
long * flags, u_int32_t * time)
long GetFileInfo(const char * dirSpec, const char * name, long * flags, u_int32_t * time)
{
long long index = 0;
const char * entryName;
gMakeDirSpec = (char *)malloc(1024);
}
if (!dirSpec) {
long idx, len;
if (!dirSpec)
{
longidx;
longlen;
len = strlen(name);
for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {}
if (idx == 0) {
if(name[idx] == '/' || name[idx] == '\\') ++name; // todo: ensure other functions handel \ properly
if (idx == 0)
{
if(name[idx] == '/' || name[idx] == '\\')
{
++name; // todo: ensure other functions handel \ properly
}
gMakeDirSpec[0] = '/';
gMakeDirSpec[1] = '\0';
gMakeDirSpec[idx] = '\0';
} else {
}
else
{
idx++;
strncpy(gMakeDirSpec, name, idx);
gMakeDirSpec[idx] = '\0'; // ISSUE: http://forge.voodooprojects.org/p/chameleon/issues/270/
// Resolve the boot volume from the file spec.
if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) {
if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL)
{
// printf("Boot volume for '%s' is bogus\n", fileSpec);
return -1;
}
intfdesc;
inti;
if (bvr == NULL) {
if (bvr == NULL)
{
return -1;
}
// Find the next available memory block in the download buffer.
io->i_buf = (char *) LOAD_ADDR;
for (i = 0; i < NFILES; i++) {
if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) {
for (i = 0; i < NFILES; i++)
{
if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc))
{
continue;
}
io->i_buf = MAX(iob[i].i_filesize + iob[i].i_buf, io->i_buf);
}
// Load entire file into memory. Unnecessary open() calls must be avoided.
gFSLoadAddress = io->i_buf;
io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath);
if (io->i_filesize < 0) {
if (io->i_filesize < 0)
{
close(fdesc);
return -1;
}
return -1;
}
//==========================================================================
int open_bvdev(const char *bvd, const char *path, int flags)
{
const struct devsw*dp;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
if ((i = open(path, flags)) >= 0)
{
//==========================================================================
// lseek() - Reposition the byte offset of the file descriptor from the
// beginning of the file. Returns the relocated offset.
// beginning of the file. Returns the relocated offset.
int b_lseek(int fdesc, int offset, int ptr)
{
//==========================================================================
// read() - Read up to 'count' bytes of data from the file descriptor
// into the buffer pointed to by buf.
// into the buffer pointed to by buf.
int read(int fdesc, char * buf, int count)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL) {
if ((io = iob_from_fdesc(fdesc)) == NULL)
{
return (-1);
}
if ((io->i_offset + count) > (unsigned int)io->i_filesize) {
if ((io->i_offset + count) > (unsigned int)io->i_filesize)
{
count = io->i_filesize - io->i_offset;
}
if (count <= 0) {
if (count <= 0)
{
return 0; // end of file
}
int write(int fdesc, const char * buf, int count)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + count) > (unsigned int)io->i_filesize)
count = io->i_filesize - io->i_offset;
if (count <= 0)
return 0; // end of file
bcopy(buf, io->i_buf + io->i_offset, count);
io->i_offset += count;
return count;
}
//==========================================================================
int writebyte(int fdesc, char value)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + 1) > (unsigned int)io->i_filesize)
return 0; // end of file
io->i_buf[io->i_offset++] = value;
return 1;
}
//==========================================================================
int writeint(int fdesc, int value)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + 4) > (unsigned int)io->i_filesize)
return 0; // end of file
bcopy(&value, io->i_buf + io->i_offset, 4);
io->i_offset += 4;
return 4;
}
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == 0) {
if ((io = iob_from_fdesc(fdesc)) == 0)
{
return 0;
}
const char * dirPath;
BVRef bvr;
if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL)
goto error;
if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL)
goto error;
dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
dirp->dir_path = newString(dirPath);
if (dirp->dir_path == NULL)
goto error;
dirp->dir_path = newString(dirPath);
if (dirp->dir_path == NULL)
goto error;
dirp->dir_bvr = bvr;
dirp->dir_bvr = bvr;
return dirp;
error:
closedir(dirp);
return NULL;
closedir(dirp);
return NULL;
}
//==========================================================================
int closedir(struct dirstuff * dirp)
{
if (dirp) {
if (dirp->dir_path) {
if (dirp)
{
if (dirp->dir_path)
{
free(dirp->dir_path);
}
free(dirp);
}
return 0;
return 0;
}
//==========================================================================
int readdir(struct dirstuff * dirp, const char ** name, long * flags,
u_int32_t * time)
int readdir(struct dirstuff * dirp, const char ** name, long * flags, u_int32_t * time)
{
return dirp->dir_bvr->fs_getdirentry(dirp->dir_bvr,
/* dirPath */ dirp->dir_path,
//==========================================================================
int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,
u_int32_t * time, FinderInfo *finderInfo, long *infoValid)
int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, u_int32_t * time, FinderInfo *finderInfo, long *infoValid)
{
return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr,
/* dirPath */ dirp->dir_path,
{
filteredChain = true;
}
if (multiboot_partition_set)
{
for ( bvr = chain; bvr; bvr = bvr->next )
continue;
}
}
if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev )
{
foundPrimary = true;
}
}
}
bvr = bvr2 ? bvr2 :
bvr1 ? bvr1 : chain;
return bvr;
}
//==========================================================================
#define LP '('
#define RP ')'
int gBIOSDev;
/*!
This is like boot2's gBootVolume except it is for the internal use of
*/
static BVRef gRootVolume;
//==========================================================================
void setRootVolume(BVRef volume)
{
gRootVolume = volume;
}
}
//==========================================================================
void setBootGlobals(BVRef chain)
{
// Record default boot device.
setRootVolume(gBootVolume);
}
//==========================================================================
/*!
Extracts the volume selector from the pathname, returns the selected
BVRef, and sets *outPath to the remainder of the path.
*/
BVRef getBootVolumeRef( const char * path, const char ** outPath )
{
const char * cp;
BVRef bvr = gRootVolume;
int biosdev = gBIOSDev;
const char*cp;
BVRef bvr= gRootVolume;
int biosdev= gBIOSDev;
// Search for left parenthesis in the path specification.
// Search for left parenthesis in the path specification.
for (cp = path; *cp; cp++) {
for (cp = path; *cp; cp++)
{
if (*cp == LP || *cp == '/')
{
break;
}
}
if (*cp != LP) { // no left paren found
if (*cp != LP) // no left paren found
{
cp = path;
// Path is using the implicit current device so if there is
// no current device, then we must fail.
{
return NULL;
}
} else if ((cp - path) == 2) { // found "xx("
}
else if ((cp - path) == 2) // found "xx("
{
const struct devsw * dp;
const char * xp = path;
error("Unknown device '%c%c'\n", xp[0], xp[1]);
return NULL;
}
// Extract the optional unit number from the specification.
// hd(unit) or hd(unit, part).
}
bvr1 = bvr;
if ( bvr->part_no == partno )
{
break;
{
return 0;
}
*str = '\0';
if (bvr)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
}
return 0;
}
//==========================================================================
trunk/i386/boot2/modules.c
6060
6161
6262
63
64
63
64
6565
6666
6767
......
119119
120120
121121
122
122
123123
124124
125125
......
178178
179179
180180
181
181
182
182183
183184
184185
......
269270
270271
271272
272
273
273274
274275
275276
......
299300
300301
301302
302
303
304
303
304
305
305306
306307
307308
......
309310
310311
311312
312
313
314
315
316
313
314
315
316
317
317318
318319
319320
......
482483
483484
484485
485
486
486487
487488
488489
*/
int init_module_system()
{
// Start any modules that were compiled in first.
start_built_in_modules();
// Start any modules that were compiled in first.
start_built_in_modules();
int retVal = 0;
char* name = strdup(last);
name[strlen(last) - sizeof("dylib")] = 0;
DBG("Loading multiboot module %s", name);
DBG("Loading multiboot module %s\n", name);
module_start = parse_mach(module_data, &load_module, &add_symbol, NULL);
char* tmp = malloc(strlen(name) + 1);
strcpy(tmp, name);
if(!load_module(tmp)) {
if(!load_module(tmp))
{
// failed to load
// free(tmp);
}
{
// This only can handle 32bit symbols
symbolList_t* entry;
//DBG("Adding symbol %s at 0x%X\n", symbol, addr);
DBG("Adding symbol %s at 0x%X\n", symbol, addr);
entry = malloc(sizeof(symbolList_t));
entry->next = moduleSymbols;
loadedModules = new_entry;
if(!name) name = "Unknown";
if(!author) author = "Unknown";
if(!description) description = "";
if(!name) name = "Unknown";
if(!author) author = "Unknown";
if(!description) description = "";
new_entry->name = name;
new_entry->author = author;
new_entry->version = version;
new_entry->compat = compat;
msglog("Module '%s' by '%s' Loaded.\n", name, author);
msglog("\tInitialization: 0x%X\n", start);
msglog("\tDescription: %s\n", description);
msglog("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix
msglog("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix
DBG("Module '%s' by '%s' Loaded.\n", name, author);
DBG("\tInitialization: 0x%X\n", start);
DBG("\tDescription: %s\n", description);
DBG("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix
DBG("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix
}
int is_module_loaded(const char* name)
}
}
break;
case LC_SEGMENT_64:// 64bit macho's
case LC_SEGMENT_64:// 64bit macho's
{
segCommand64 = binary + binaryIndex;
UInt32 sectionIndex;
trunk/i386/boot2/options.c
108108
109109
110110
111
112
113
114
115
111
112
113
116114
115
116
117117
118118
119119
......
122122
123123
124124
125
125
126126
127127
128128
129129
130
130
131131
132132
133
133
134134
135135
136136
137
137
138138
139
139
140140
141
142
141
142
143143
144144
145145
146146
147147
148148
149
150
149
150
151151
152
153
154
152
153
154
155155
156
157
158
156
157
158
159159
160
161
162
163
160
161
162
163
164164
165165
166166
167167
168168
169169
170
171
170
171
172172
173173
174174
......
176176
177177
178178
179
179
180180
181
181
182182
183
183
184184
185185
186186
......
196196
197197
198198
199
199
200
200201
201202
202203
......
219220
220221
221222
222
223
223
224
225
224226
225227
226228
227229
228230
229
230
231
231
232
233
234
235
236
232237
233
238
239
240
234241
235242
236243
237244
238
239
245
246
247
248
249
240250
241
251
252
253
242254
243255
244256
......
267279
268280
269281
270
271
272
273
274
282
283
284
285
286
275287
276
277
278
279
288
289
290
291
280292
281293
282294
283
284
285
295
296
297
286298
287
288
289
290
291
292
299
300
301
302
303
304
305
306
293307
294308
295309
......
361375
362376
363377
364
378
365379
366380
367381
368
382
369383
370384
371385
......
374388
375389
376390
377
391
378392
379393
380394
static int countdown( const char * msg, int row, int timeout )
{
unsigned long time;
int ch = 0;
int col = strlen(msg) + 1;
flushKeyboardBuffer();
unsigned long time;
int ch = 0;
int col = strlen(msg) + 1;
flushKeyboardBuffer();
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
moveCursor( 0, row );
} else {
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
// make this screen the new background
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
}
int multi_buff = 18 * (timeout);
int multi = ++multi_buff;
int multi = ++multi_buff;
int lasttime=0;
int lasttime=0;
for ( time = time18(), timeout++; timeout > 0; )
{
for ( time = time18(), timeout++; timeout > 0; )
{
if( time18() > lasttime)
{
multi--;
lasttime=time18();
}
if ( (ch = readKeyboardStatus()) )
break;
if ( (ch = readKeyboardStatus()) )
break;
// Count can be interrupted by holding down shift,
// control or alt key
if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 )
// Count can be interrupted by holding down shift,
// control or alt key
if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 )
{
ch = 1;
break;
}
ch = 1;
break;
}
if ( time18() >= time )
{
time += 18;
timeout--;
if ( time18() >= time )
{
time += 18;
timeout--;
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
moveCursor( col, row );
printf("(%d) ", timeout);
}
}
}
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) );
updateVRAM();
}
}
}
flushKeyboardBuffer();
flushKeyboardBuffer();
return ch;
return ch;
}
//==========================================================================
gBootArgsPtr = gBootArgs;
memset(gBootArgs, '\0', BOOT_STRING_LEN);
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE)
{
clearGraphicBootPrompt();
}
execute_hook("ClearArgs", NULL, NULL, NULL, NULL);
extern char bootPrompt[];
extern char bootRescanPrompt[];
if( bootArgs->Video.v_display == VGA_TEXT_MODE ) {
changeCursor( 0, row, kCursorTypeUnderline, 0 );
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
changeCursor( 0, row, kCursorTypeUnderline, 0 );
clearScreenRows( row, kScreenLastRow );
}
clearBootArgs();
if (visible) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (gEnableCDROMRescan) {
if (visible)
{
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
if (gEnableCDROMRescan)
{
printf( bootRescanPrompt );
} else {
}
else
{
printf( bootPrompt );
printf( gBootArgs );
}
}
} else {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
}
else
{
if (bootArgs->Video.v_display != VGA_TEXT_MODE)
{
clearGraphicBootPrompt();
} else {
}
else
{
printf("Press Enter to start up the foreign OS. ");
}
}
x--;
}
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
}
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
}
else
{
updateGraphicBootPrompt();
}
}
{
updateGraphicBootPrompt();
}
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
*gBootArgsPtr++ = key;
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
*gBootArgsPtr++ = key;
if( bootArgs->Video.v_display != VGA_TEXT_MODE ) updateGraphicBootPrompt();
else if ( key >= ' ' && key < 0x7f) putchar(key);
}
break;
}
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
updateGraphicBootPrompt();
else if ( key >= ' ' && key < 0x7f)
putchar(key);
}
break;
}
}
//==========================================================================
// Draw the visible items.
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection);
else {
changeCursor( 0, row, kCursorTypeHidden, &cursorState );
for ( i = gMenuTop; i <= gMenuBottom; i++ )
}
restoreCursor( &cursorState );
}
}
}
//==========================================================================

Archive Download the corresponding diff file

Revision: 2521