//==========================================================================␊ |
//␊ |
␊ |
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 short␉width,␊ |
static unsigned short getVESAModeWithProperties( unsigned short␉width,␊ |
unsigned short␉height,␊ |
unsigned char␉bitsPerPixel,␊ |
unsigned short␉attributesSet,␊ |
|
//==========================================================================␊ |
// 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,␊ |
static int setVESAGraphicsMode( unsigned short width,␊ |
unsigned short height,␊ |
unsigned char bitsPerPixel,␊ |
unsigned short refreshRate )␊ |
|
␉␉if ( minfo.BitsPerPixel == 8 )␊ |
␉␉{␊ |
␉␉␉VBEPalette palette;␊ |
␉␉␉setupPalette( &palette, appleClut8 );␊ |
␉␉␉setupPalette( &palette, AppleLogoClut );␊ |
␉␉␉if ((err = setVBEPalette(palette)) != errSuccess)␊ |
␉␉␉{␊ |
␉␉␉␉break;␊ |
|
␊ |
//==============================================================================␊ |
␊ |
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;␊ |
|
␉long result;␊ |
␊ |
␉long colorIndex = (index * 3);␊ |
␉long red = appleClut8[ colorIndex ];␊ |
␉long green = appleClut8[ colorIndex++ ];␊ |
␉long blue = appleClut8[ colorIndex++ ];␊ |
␉long red;␊ |
␉long green;␊ |
␉long blue;␊ |
␊ |
␉red = AppleLogoClut[ colorIndex ];␊ |
␉green = AppleLogoClut[ colorIndex++ ];␊ |
␉blue = AppleLogoClut[ colorIndex++ ];␊ |
␊ |
␉switch (depth)␊ |
␉{␊ |
␉␉case 16 :␊ |
|
␊ |
//==============================================================================␊ |
␊ |
void drawColorRectangle( unsigned short x,␊ |
unsigned short y,␊ |
unsigned short width,␊ |
unsigned short height,␊ |
unsigned char colorIndex )␊ |
void drawColorRectangle( uint32_t color )␊ |
{␊ |
␉long␉pixelBytes;␊ |
␉long␉color = lookUpCLUTIndex( colorIndex, VIDEO(depth) );␊ |
␉char␉*vram;␊ |
␉long␉pixelBytes = VIDEO(depth) / 8;␊ |
␉char␉*vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) + pixelBytes;␊ |
␊ |
␉pixelBytes = VIDEO(depth) / 8;␊ |
␉vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x;␊ |
␉int width = VIDEO(width);␊ |
␉int height = VIDEO(height);␊ |
␊ |
␉width = MIN(width, VIDEO(width) - x);␊ |
␉height = MIN(height, VIDEO(height) - y);␊ |
␉int rem = ( pixelBytes * width ) % 4;␊ |
␉int length = pixelBytes * width / 4;␊ |
␊ |
␉bcopy( &color, vram, rem );␊ |
␊ |
␉while ( height-- )␊ |
␉{␊ |
␉␉int rem = ( pixelBytes * width ) % 4;␊ |
␉␉if ( rem )␊ |
␉␉{␊ |
␉␉␉bcopy( &color, vram, rem );␊ |
␉␉}␊ |
␊ |
␉␉stosl( vram + rem, color, pixelBytes * width / 4 );␊ |
␉␉stosl( vram + rem, color, length );␊ |
␉␉vram += VIDEO(rowBytes);␊ |
␉}␊ |
}␊ |
|
␊ |
␉while ( height-- )␊ |
␉{␊ |
␉␉bcopy( data, vram, drawWidth * pixelBytes );␊ |
␉␉bcopy( data, vram, width * pixelBytes );␊ |
␉␉vram += VIDEO(rowBytes);␊ |
␉␉data += width * pixelBytes;␊ |
␉}␊ |
|
␊ |
DECLARE_IOHIBERNATEPROGRESSALPHA␊ |
␊ |
void drawPreview(void *src, uint8_t * saveunder)␊ |
void drawPreview(void *src, uint8_t *saveunder)␊ |
{␊ |
␉uint8_t *screen;␊ |
␉uint32_t rowBytes, pixelShift;␊ |
|
␉␉rowBytes = VIDEO (rowBytes);␊ |
␊ |
␉␉// Set the screen to 75% grey.␊ |
␉␉drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */);␊ |
␉␉drawColorRectangle(0xffbfbfbf);␊ |
␉}␊ |
␊ |
␉pixelShift = VIDEO (depth) >> 4;␊ |
|
␊ |
//==============================================================================␊ |
␊ |
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_t␉rowBytes, pixelShift;␊ |
|
//==========================================================================␊ |
// getNumberArrayFromProperty␊ |
␊ |
static int getNumberArrayFromProperty( const char * propKey,␊ |
static int getNumberArrayFromProperty( const char *propKey,␊ |
unsigned long numbers[],␊ |
unsigned long maxArrayCount )␊ |
{␊ |