Chameleon

Chameleon Commit Details

Date:2015-10-26 03:55:43 (8 years 5 months ago)
Author:ErmaC
Commit:2782
Parents: 2781
Message:Typo only.
Changes:
M/trunk/i386/boot2/graphics.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsaio/fake_efi.c

File differences

trunk/i386/libsaio/fake_efi.c
665665
666666
667667
668
669
668670
669671
670672
......
685687
686688
687689
688
690
689691
690692
691693
{
Node *chosenNode;
chosenNode = DT__FindNode("/chosen", false);
unsigned long adler32 = 0;
if (chosenNode == NULL)
{
stop("setupChosenNode: Couldn't get '/chosen' node");
//DT__AddProperty(chosenNode, "boot-file-path", bootFPsize, gBootFP);
//DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(adler32), adler32);
DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(unsigned long), &adler32);
DT__AddProperty(chosenNode, MACHINE_SIG_PROP, sizeof(Platform.HWSignature), (EFI_UINT32 *)&Platform.HWSignature);
trunk/i386/boot2/graphics.c
108108
109109
110110
111
112
111
113112
114113
115114
......
233232
234233
235234
236
237
235
238236
239237
240238
......
273271
274272
275273
276
277
274
278275
279276
280277
......
288285
289286
290287
291
292
293
288
289
290
294291
295292
296293
297294
298
299
295
300296
301297
302298
......
305301
306302
307303
308
304
309305
310306
311307
312
308
313309
314310
315311
316
317
318
319
320
312
313
321314
322315
323316
324317
325
326
327
328
329
318
319
330320
331321
332322
333323
334324
335
325
336326
337327
338328
339329
340
341
330
342331
343332
344333
345334
346335
347336
348
349
350
337
351338
352339
353
340
354341
355342
356343
357344
358345
359
360
361
346
347
362348
363
349
364350
365351
366
367
368
352
353
369354
370
355
371356
372357
373358
374
359
375360
376361
377362
......
380365
381366
382367
383
368
384369
385370
386371
......
422407
423408
424409
425
426
427
428
429
410
430411
431412
432413
......
485466
486467
487468
488
469
489470
490
491
492
493
471
472
473
474
494475
495476
496477
......
504485
505486
506487
507
508
488
489
509490
510
511
512
491
492
493
494
513495
514
515
496
497
516498
517
518
519
520
521
522
499
500
501
502
503
504
523505
524506
525507
526
508
527509
528510
529511
......
563545
564546
565547
566
567
548
568549
569550
570551
......
617598
618599
619600
620
601
602
621603
622604
623605
......
647629
648630
649631
650
651
632
652633
653634
654635
......
856837
857838
858839
859
860
861
862
863
840
864841
865842
866843
......
929906
930907
931908
932
909
933910
934911
935912
......
10241001
10251002
10261003
1027
1004
10281005
10291006
10301007
......
11221099
11231100
11241101
1125
1102
11261103
11271104
11281105
//==========================================================================
//
void
printVBEModeInfo()
void printVBEModeInfo()
{
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
// Return the VESA mode that matches the properties specified.
// If a mode is not found, then return the "best" available mode.
static unsigned short
getVESAModeWithProperties( unsigned shortwidth,
static unsigned short getVESAModeWithProperties( unsigned shortwidth,
unsigned shortheight,
unsigned charbitsPerPixel,
unsigned shortattributesSet,
// Loop through the mode list, and find the matching mode.
for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr );
*modePtr != modeEndOfList; modePtr++ )
for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); *modePtr != modeEndOfList; modePtr++ )
{
// Get mode information.
#if DEBUG
printf("Mode %x: %dx%dx%d mm:%d attr:%x\n",
*modePtr, modeInfo.XResolution, modeInfo.YResolution,
modeInfo.BitsPerPixel, modeInfo.MemoryModel,
modeInfo.ModeAttributes);
*modePtr, modeInfo.XResolution, modeInfo.YResolution,
modeInfo.BitsPerPixel, modeInfo.MemoryModel,
modeInfo.ModeAttributes);
#endif
// Filter out unwanted modes based on mode attributes.
if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet )
|| ( ( modeInfo.ModeAttributes & attributesClear ) != 0 ) )
if (((modeInfo.ModeAttributes & attributesSet) != attributesSet) || ((modeInfo.ModeAttributes & attributesClear) != 0))
{
continue;
}
modeBitsPerPixel = modeInfo.BitsPerPixel;
if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) )
if ((modeBitsPerPixel == 4) && (modeInfo.MemoryModel == 0))
{
// Text mode, 16 colors.
}
else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) )
else if ((modeBitsPerPixel == 8) && (modeInfo.MemoryModel == 4))
{
// Packed pixel, 256 colors.
}
else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 5 )
&& ( modeInfo.GreenMaskSize == 5 )
&& ( modeInfo.BlueMaskSize == 5 ) )
else if (((modeBitsPerPixel == 16) || (modeBitsPerPixel == 15)) && (modeInfo.MemoryModel == 6) && (modeInfo.RedMaskSize == 5) &&
(modeInfo.GreenMaskSize == 5) && (modeInfo.BlueMaskSize == 5))
{
// Direct color, 16 bpp (1:5:5:5).
modeInfo.BitsPerPixel = modeBitsPerPixel = 16;
}
else if ( ( modeBitsPerPixel == 32 )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 8 )
&& ( modeInfo.GreenMaskSize == 8 )
&& ( modeInfo.BlueMaskSize == 8 ) )
else if ((modeBitsPerPixel == 32) && (modeInfo.MemoryModel == 6) && (modeInfo.RedMaskSize == 8) &&
(modeInfo.GreenMaskSize == 8) && (modeInfo.BlueMaskSize == 8))
{
// Direct color, 32 bpp (8:8:8:8).
}
else
{
continue; // Not a supported mode.
continue;// Not a supported mode.
}
// Modes larger than the specified dimensions are skipped.
if ( ( modeInfo.XResolution > width ) ||
( modeInfo.YResolution > height ) )
if ((modeInfo.XResolution > width) || (modeInfo.YResolution > height))
{
continue;
}
// Perfect match, we're done looking.
if ( ( modeInfo.XResolution == width ) &&
( modeInfo.YResolution == height ) &&
( modeBitsPerPixel == bitsPerPixel ) )
if (modeInfo.XResolution == width && modeInfo.YResolution == height && modeBitsPerPixel == bitsPerPixel)
{
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
bcopy(&modeInfo, outModeInfo, sizeof(modeInfo));
break;
}
// Save the next "best" mode in case a perfect match is not found.
if ( modeInfo.XResolution == outModeInfo->XResolution &&
modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel )
if (modeInfo.XResolution == outModeInfo->XResolution && modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel)
{
continue; // Saved mode has more depth.
continue;// Saved mode has more depth.
}
if ( modeInfo.XResolution < outModeInfo->XResolution ||
modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel )
if (modeInfo.XResolution < outModeInfo->XResolution || modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel)
{
continue; // Saved mode has more resolution.
continue;// Saved mode has more resolution.
}
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
bcopy(&modeInfo, outModeInfo, sizeof(modeInfo));
}
return matchedMode;
//==========================================================================
// setupPalette
static void setupPalette( VBEPalette * p, const unsigned char * g )
static void setupPalette( VBEPalette *p, const unsigned char *g )
{
int i;
unsigned char * source = (unsigned char *) g;
//==========================================================================
// setVESAGraphicsMode
static int
setVESAGraphicsMode( unsigned short width,
unsigned short height,
unsigned char bitsPerPixel,
unsigned short refreshRate )
static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate )
{
VBEModeInfoBlock minfo;
unsigned short mode;
// Set the mode with default refresh rate.
err = setVBEMode(mode | kLinearFrameBufferBit, NULL);
err = setVBEMode(mode | kLinearFrameBufferBit, NULL);
if (err != errSuccess)
{
break;
}
if (err != errSuccess)
{
break;
}
// Set 8-bit color palette.
}
}
// Is this required for buggy Video BIOS implementations?
// On which adapter?
// Is this required for buggy Video BIOS implementations?
// On which adapter?
if ( minfo.BytesPerScanline == 0 )
minfo.BytesPerScanline = ( minfo.XResolution *
minfo.BitsPerPixel ) >> 3;
if ( minfo.BytesPerScanline == 0 )
{
minfo.BytesPerScanline = ( minfo.XResolution * minfo.BitsPerPixel ) >> 3;
}
// Update KernBootStruct using info provided by the selected
// VESA mode.
// Update KernBootStruct using info provided by the selected
// VESA mode.
bootArgs->Video.v_display = GRAPHICS_MODE;
bootArgs->Video.v_width = minfo.XResolution;
bootArgs->Video.v_height = minfo.YResolution;
bootArgs->Video.v_depth = minfo.BitsPerPixel;
bootArgs->Video.v_rowBytes = minfo.BytesPerScanline;
bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
bootArgs->Video.v_display= GRAPHICS_MODE;
bootArgs->Video.v_width= minfo.XResolution;/* 1920 or 1600 */
bootArgs->Video.v_height= minfo.YResolution;/* 1200 or 900 */
bootArgs->Video.v_depth= minfo.BitsPerPixel;/* 32 */
bootArgs->Video.v_rowBytes= minfo.BytesPerScanline;/* 7680 or 6400 */
bootArgs->Video.v_baseAddr= VBEMakeUInt32(minfo.PhysBasePtr);
} while ( 0 );
return err;
return err;
}
//==============================================================================
//==============================================================================
int loadPngImage(const char *filename, uint16_t *width, uint16_t *height,
uint8_t **imageData)
int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData)
{
uint8_t *pngData = NULL;
int pngFile = 0, pngSize;
//==============================================================================
int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) {
int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData)
{
PNG_info_t *info;
int error = 0;
//==============================================================================
void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
uint8_t *data)
void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data)
{
uint16_t drawWidth;
uint8_t *vram = (uint8_t *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + 4 * x;
//==========================================================================
// drawDataRectangle
void drawDataRectangle( unsigned short x,
unsigned short y,
unsigned short width,
unsigned short height,
unsigned char *data )
void drawDataRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char *data )
{
unsigned short drawWidth;
DECLARE_IOHIBERNATEPROGRESSALPHA
void drawPreview(void *src, uint8_t * saveunder)
void drawPreview(void *src, uint8_t *saveunder)
{
uint8_t *screen;
uint32_t rowBytes, pixelShift;
//==============================================================================
void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select)
void updateProgressBar(uint8_t *saveunder, int32_t firstBlob, int32_t select)
{
uint8_t*screen;
uint32_trowBytes, pixelShift;
//==========================================================================
// getNumberArrayFromProperty
static int getNumberArrayFromProperty( const char * propKey,
static int getNumberArrayFromProperty( const char *propKey,
unsigned long numbers[],
unsigned long maxArrayCount )
{
trunk/i386/boot2/boot.c
922922
923923
924924
925
926
927
925928
926929
927930
......
932935
933936
934937
935
936
938
939
937940
938941
939942
940
941943
942944
943945
944946
945
947
948
946949
947950
948951
949952
950
951
952
953
953
954
955
956
957
958
959
960
961
962
954963
955964
956965
return MacOSVerCurrent;
}
// =========================================================================
unsigned long Adler32(unsigned char *buf, long len)
{
#define BASE 65521L /* largest prime smaller than 65536 */
#define NMAX 5000
// NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
#define DO8(buf, i)DO4(buf, i); DO4(buf, i + 4);
#define DO16(buf)DO8(buf, 0); DO8(buf, 8);
unsigned long Adler32(unsigned char *buf, long len)
{
int k;
unsigned long s1 = 1; // adler & 0xffff;
unsigned long s2 = 0; // (adler >> 16) & 0xffff;
unsigned long result;
int k;
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
while (k >= 16)
{
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
if (k != 0)
{
do
{
s1 += *buf++;
s2 += s1;
} while (--k);
}
s1 %= BASE;
s2 %= BASE;
}
trunk/i386/boot2/gui.c
5454
5555
5656
57
5758
5859
5960
......
148149
149150
150151
152
151153
152154
153155
......
394396
395397
396398
399
397400
398401
399402
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_cap,
iDeviceHFS_cap_o,
iDeviceHFS_yos,
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_cap", .image = NULL},
{.name = "device_hfsplus_cap_o", .image = NULL},
{.name = "device_hfsplus_yos", .image = NULL},
LOADPNG(device_generic_o, iDeviceGeneric);
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_cap, iDeviceHFS);
LOADPNG(device_hfsplus_cap_o, iDeviceHFS_cap);
LOADPNG(device_hfsplus_yos, iDeviceHFS);

Archive Download the corresponding diff file

Revision: 2782