␊ |
#define IMG_REQUIRED -1␊ |
#define THEME_NAME_DEFAULT␉"Default"␊ |
static const char *theme_name = THEME_NAME_DEFAULT;␉␊ |
static const char *theme_name = THEME_NAME_DEFAULT;␊ |
␊ |
#ifdef CONFIG_EMBED_THEME␊ |
#include "art.h"␊ |
|
iDeviceGeneric_o,␊ |
iDeviceHFS,␊ |
iDeviceHFS_o,␊ |
␉iDeviceHFS_Lion,␊ |
iDeviceHFS_ML,␊ |
iDeviceHFS_ML_o,␊ |
iDeviceHFS_Lion,␊ |
iDeviceHFS_Lion_o,␊ |
␉iDeviceHFS_SL,␊ |
iDeviceHFS_SL,␊ |
iDeviceHFS_SL_o,␊ |
␉iDeviceHFS_Leo,␊ |
iDeviceHFS_Leo,␊ |
iDeviceHFS_Leo_o,␊ |
␉iDeviceHFS_Tiger,␊ |
iDeviceHFS_Tiger,␊ |
iDeviceHFS_Tiger_o,␊ |
iDeviceHFSRAID,␊ |
iDeviceHFSRAID_o,␊ |
␉iDeviceHFSRAID_Lion,␊ |
iDeviceHFSRAID_ML,␊ |
iDeviceHFSRAID_ML_o,␊ |
iDeviceHFSRAID_Lion,␊ |
iDeviceHFSRAID_Lion_o,␊ |
␉iDeviceHFSRAID_SL,␊ |
iDeviceHFSRAID_SL,␊ |
iDeviceHFSRAID_SL_o,␊ |
␉iDeviceHFSRAID_Leo,␊ |
iDeviceHFSRAID_Leo,␊ |
iDeviceHFSRAID_Leo_o,␊ |
␉iDeviceHFSRAID_Tiger,␊ |
iDeviceHFSRAID_Tiger,␊ |
iDeviceHFSRAID_Tiger_o,␊ |
iDeviceEXT3,␊ |
iDeviceEXT3_o,␊ |
|
{.name = "device_generic", .image = NULL},␊ |
{.name = "device_generic_o", .image = NULL},␊ |
{.name = "device_hfsplus", .image = NULL},␊ |
{.name = "device_hfsplus_o", .image = NULL},␉␊ |
␉{.name = "device_hfsplus_lion", .image = NULL},␊ |
{.name = "device_hfsplus_lion_o", .image = NULL},␊ |
␉{.name = "device_hfsplus_sl", .image = NULL},␊ |
{.name = "device_hfsplus_sl_o", .image = NULL},␊ |
␉{.name = "device_hfsplus_leo", .image = NULL},␊ |
{.name = "device_hfsplus_leo_o", .image = NULL},␊ |
␉{.name = "device_hfsplus_tiger", .image = NULL},␊ |
{.name = "device_hfsplus_tiger_o", .image = NULL},␊ |
␉␊ |
{.name = "device_hfsplus_o", .image = NULL},␊ |
{.name = "device_hfsplus_ml", .image = NULL},␊ |
{.name = "device_hfsplus_ml_o", .image = NULL},␊ |
{.name = "device_hfsplus_lion", .image = NULL},␊ |
{.name = "device_hfsplus_lion_o", .image = NULL},␊ |
{.name = "device_hfsplus_sl", .image = NULL},␊ |
{.name = "device_hfsplus_sl_o", .image = NULL},␊ |
{.name = "device_hfsplus_leo", .image = NULL},␊ |
{.name = "device_hfsplus_leo_o", .image = NULL},␊ |
{.name = "device_hfsplus_tiger", .image = NULL},␊ |
{.name = "device_hfsplus_tiger_o", .image = NULL},␊ |
␊ |
{.name = "device_hfsraid", .image = NULL},␊ |
{.name = "device_hfsraid_o", .image = NULL},␊ |
␉{.name = "device_hfsraid_lion", .image = NULL},␊ |
{.name = "device_hfsraid_lion_o", .image = NULL},␊ |
␉{.name = "device_hfsraid_sl", .image = NULL},␊ |
{.name = "device_hfsraid_sl_o", .image = NULL},␊ |
␉{.name = "device_hfsraid_leo", .image = NULL},␊ |
{.name = "device_hfsraid_leo_o", .image = NULL},␊ |
␉{.name = "device_hfsraid_tiger", .image = NULL},␊ |
{.name = "device_hfsraid_tiger_o", .image = NULL},␊ |
{.name = "device_hfsraid_ml", .image = NULL},␊ |
{.name = "device_hfsraid_ml_o", .image = NULL},␊ |
{.name = "device_hfsraid_lion", .image = NULL},␊ |
{.name = "device_hfsraid_lion_o", .image = NULL},␊ |
{.name = "device_hfsraid_sl", .image = NULL},␊ |
{.name = "device_hfsraid_sl_o", .image = NULL},␊ |
{.name = "device_hfsraid_leo", .image = NULL},␊ |
{.name = "device_hfsraid_leo_o", .image = NULL},␊ |
{.name = "device_hfsraid_tiger", .image = NULL},␊ |
{.name = "device_hfsraid_tiger_o", .image = NULL},␊ |
{.name = "device_ext3", .image = NULL},␊ |
{.name = "device_ext3_o", .image = NULL},␊ |
{.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
|
extern char gBootArgs[BOOT_STRING_LEN];␊ |
␊ |
char prompt_text[] = "boot: ";␊ |
␊ |
␊ |
menuitem_t infoMenuItems[] =␊ |
{␊ |
␉{ .text = "Boot" },␊ |
|
unsigned int embed_size;␊ |
embed_data = embeddedImages[e].pngdata;␊ |
embed_size = *embeddedImages[e].length;␊ |
␊ |
␊ |
if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0)␊ |
{␊ |
images[i].image->width = width;␊ |
|
␉␉␉␉images[i].image->pixels = images[alt_image].image->pixels;␊ |
␉␉␉␉␊ |
␉␉␉} else {␊ |
␊ |
␊ |
␉␉␉␉// Unable to load or to find the image, this image not vital anyway, reseting and returning success !!␊ |
␊ |
␊ |
␉␉␉␉free(images[i].image);␊ |
␉␉␉␉images[i].image = NULL;␊ |
␉␉␉} ␊ |
|
␉␉␉free(images[i].image);␊ |
␉␉␉images[i].image = NULL;␊ |
␉␉␉return 1;␊ |
␊ |
␊ |
} ␊ |
␊ |
␊ |
}␊ |
␉return 1;␊ |
}␊ |
|
␉LOADPNG(device_generic_o, iDeviceGeneric);␊ |
␉LOADPNG(device_hfsplus, iDeviceGeneric);␊ |
␉LOADPNG(device_hfsplus_o, iDeviceHFS);␊ |
␉LOADPNG(device_hfsplus_ml, iDeviceHFS_ML);␊ |
␉LOADPNG(device_hfsplus_ml_o, iDeviceHFS_ML_o);␊ |
␉LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion);␊ |
␉LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o);␊ |
␉LOADPNG(device_hfsplus_sl, iDeviceHFS_SL);␊ |
|
␉LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o);␊ |
␉LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger);␊ |
␉LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o);␊ |
␉␊ |
␊ |
␉LOADPNG(device_hfsraid, iDeviceGeneric);␊ |
␉LOADPNG(device_hfsraid_o, iDeviceHFSRAID);␊ |
␉LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);␊ |
␉LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);␊ |
␉LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);␊ |
␉LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);␊ |
␉LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);␊ |
␉LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo_o);␊ |
␉LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID_Tiger);␊ |
␉LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger_o);␊ |
␉LOADPNG(device_hfsraid_ml, iDeviceHFSRAID_ML);␊ |
␉LOADPNG(device_hfsraid_ml_o, iDeviceHFSRAID_ML_o);␊ |
␉LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);␊ |
␉LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);␊ |
␉LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);␊ |
␉LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);␊ |
␉LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);␊ |
␉LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo_o);␊ |
␉LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID_Tiger);␊ |
␉LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger_o);␊ |
␉LOADPNG(device_ext3, iDeviceGeneric);␊ |
␉LOADPNG(device_ext3_o, iDeviceEXT3);␊ |
␉LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
|
␊ |
␉return 0;␊ |
}␊ |
␊ |
␊ |
static int unloadGraphics(void)␊ |
{␊ |
int i;␊ |
␊ |
destroyFont(&font_console);␊ |
destroyFont(&font_small);␊ |
␊ |
␉for (i = 0; i < sizeof(images) / sizeof(images[0]); i++)␊ |
␉{␊ |
␉ if (images[i].image)␊ |
|
␉return 0;␊ |
}␊ |
␊ |
int freeBackBuffer( window_t *window )␊ |
{␊ |
if (gui.backbuffer && gui.backbuffer->pixels)␊ |
{␊ |
free(gui.backbuffer->pixels);␊ |
free(gui.backbuffer);␊ |
gui.backbuffer = 0;␊ |
return 0;␊ |
}␊ |
␊ |
return 1;␊ |
}␊ |
␊ |
pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height )␊ |
{␊ |
␉␊ |
|
{␊ |
␉gui.backbuffer = malloc(sizeof(pixmap_t));␊ |
␉if(!gui.backbuffer)␊ |
␉{␊ |
␉␉return 1;␊ |
␉␊ |
␉}␊ |
␉gui.backbuffer->pixels = malloc( window->width * window->height * 4 );␊ |
␉if(!gui.backbuffer->pixels)␊ |
␉{␊ |
|
␉␊ |
␉gui.backbuffer->width = gui.screen.width;␊ |
␉gui.backbuffer->height = gui.screen.height;␊ |
␊ |
␊ |
␉return 0;␊ |
}␊ |
␊ |
int freeBackBuffer( window_t *window )␊ |
{␊ |
␉if (gui.backbuffer && gui.backbuffer->pixels)␊ |
{␊ |
␉␉free(gui.backbuffer->pixels);␊ |
␉␉free(gui.backbuffer);␊ |
␉␉gui.backbuffer = 0;␊ |
␉␉return 0;␊ |
␉}␊ |
␊ |
␉return 1;␊ |
}␊ |
␊ |
int createWindowBuffer( window_t *window )␊ |
{␊ |
␉window->pixmap = malloc(sizeof(pixmap_t));␊ |
␉if(!window->pixmap)␊ |
␉{␊ |
␉␉return 1;␊ |
␉}␊ |
␊ |
␉window->pixmap->pixels = malloc( window->width * window->height * 4 );␊ |
␉if(!window->pixmap->pixels)␊ |
|
␉␊ |
␉window->pixmap->width = window->width;␊ |
␉window->pixmap->height = window->height;␊ |
␉␉␊ |
␊ |
␉return 0;␊ |
}␊ |
␊ |
|
␉␉free(window->pixmap);␊ |
␉␉return 0;␊ |
␉}␊ |
␉␉␊ |
␊ |
␉return 1;␊ |
}␊ |
␊ |
|
␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )␊ |
␉␉␉gui.devicelist.pos.y = pixel;␊ |
␉␉break;␊ |
␉␉␊ |
␊ |
␉case HorizontalLayout:␊ |
␉default:␊ |
␉␉gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);␊ |
|
␉if(getColorForKey("font_console_color", &color, theme))␊ |
␉␉gui.screen.font_console_color = (color & 0x00FFFFFF);␊ |
}␊ |
␊ |
␊ |
int initGUI(void)␊ |
{␊ |
␉int␉␉val;␊ |
|
␉␉␉}␊ |
␉␉}␊ |
␉}␊ |
␉// not available memory, freeing resources␊ |
␉freeWindowBuffer(&gui.menu);␊ |
␉freeWindowBuffer(&gui.infobox);␊ |
␉freeWindowBuffer(&gui.bootprompt);␊ |
␉freeWindowBuffer(&gui.devicelist);␊ |
␉freeWindowBuffer(&gui.screen);␊ |
␉freeBackBuffer(&gui.screen);␊ |
␉unloadGraphics();␊ |
␊ |
// not available memory, freeing resources␊ |
freeWindowBuffer(&gui.menu);␊ |
freeWindowBuffer(&gui.infobox);␊ |
freeWindowBuffer(&gui.bootprompt);␊ |
freeWindowBuffer(&gui.devicelist);␊ |
freeWindowBuffer(&gui.screen);␊ |
freeBackBuffer(&gui.screen);␊ |
unloadGraphics();␊ |
␊ |
␉return 1;␊ |
}␊ |
␊ |
|
␉␉␉{␉␉␉␉␊ |
␊ |
␉␉␉␉// Use HFS or HFSRAID icon depending on bvr flags.␊ |
␉␉␉␉if (device->flags & kBVFlagBooter) {␊ |
␉␉␉␉if (device->flags & kBVFlagBooter)␊ |
␉␉␉␉{␊ |
␊ |
␉␉␉␉␉switch (device->OSVersion[3]) {␊ |
␉␉␉␉␉␉case '8':␊ |
␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFSRAID_ML) ? iDeviceHFSRAID_ML : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;␊ |
␉␉␉␉␉␉␉break;␊ |
␉␉␉␉␉␉case '7':␊ |
␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;␊ |
␉␉␉␉␉␉␉break;␊ |
|
␉␉␉␉␉␉␉break;␊ |
␉␉␉␉␉}␊ |
␉␉␉␉␉␊ |
␉␉␉␉} ␊ |
else␊ |
␉␉␉␉{␉␉␉␉␉␊ |
␉␉␉␉␉␊ |
␉␉␉␉} else {␉␉␉␉␉␊ |
␊ |
␉␉␉␉␉switch (device->OSVersion[3]) {␊ |
␉␉␉␉␉␉case '8':␊ |
␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFS_ML) ? iDeviceHFS_ML : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;␊ |
␉␉␉␉␉␉␉break;␊ |
␉␉␉␉␉␉case '7':␊ |
␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;␊ |
␉␉␉␉␉␉␉break;␊ |
|
␉␉␉case kPartitionTypeHPFS:␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric;␉␉// Use HPFS / NTFS icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␊ |
␉␉␉case kPartitionTypeFAT16:␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric;␉␉// Use FAT16 icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␊ |
␉␉␉case kPartitionTypeFAT32:␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric;␉␉// Use FAT32 icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␊ |
␉␉␉case kPartitionTypeEXT3:␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric;␉␉// Use EXT2/3 icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␉␉␉case kPartitionTypeFreeBSD:␊ |
␊ |
␉␉␉case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric;␉␉// Use FreeBSD icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␉␉␉case kPartitionTypeOpenBSD:␊ |
␊ |
␉␉␉case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric;␉␉// Use OpenBSD icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␉␉␉case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */␊ |
␊ |
␉␉␉case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */␊ |
␉␉␉␉devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon␊ |
␉␉␉␉break;␊ |
␉␉␉␉␊ |
␊ |
␉␉␉default:␊ |
␉␉␉␉devicetype = iDeviceGeneric;␉// Use Generic icon␊ |
␉␉␉␉break;␊ |
|
if (isSelected)␊ |
␉{␊ |
␉␉blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p));␊ |
␉␉devicetype++;␊ |
␉␉devicetype++; // selec override image ␊ |
␉}␊ |
␊ |
␉// draw icon␊ |
|
␉position_t␉p, p_prev, p_next;␊ |
␊ |
␉//uint8_t␉maxDevices = MIN( gui.maxdevices, menucount );␊ |
␉␉␊ |
␊ |
␉fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor);␊ |
␊ |
␉makeRoundedCorners( gui.devicelist.pixmap);␊ |
|
if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END)␊ |
infoMenuSelection = 0;␊ |
}␊ |
␉␉␉ ␊ |
␊ |
␉␉␉if (gui.menu.draw)␊ |
␉␉␉␉drawInfoMenuItems();␊ |
␉␉␉␊ |
|
␉updateVRAM();␊ |
␉␊ |
}␊ |
␊ |
␊ |
void clearGraphicBootPrompt()␊ |
{␊ |
␉// clear text buffer␊ |
|
␉␉␉␉␉␉//␉␉␉␉␉␉break;␉␉␉␉␉␉␉␊ |
␉␉␉␉␉case 15:␊ |
␉␉␉␉␉␉*(uint16_t *)(((uint8_t *)vram)+i*VIDEO (rowBytes) + j*2) = ((b&0xf8)>>3) | ((g&0xf8)<<2) | ((r&0xf8)<<7);␊ |
␉␉␉␉␉␉break;␉␉␉␉␉␉␉␉␉␉␉␉␉␉␊ |
␉␉␉␉␉␉break;␉␊ |
␉␉␉␉}␊ |
␉␉␉}␊ |
␉}␊ |
|
␊ |
␉␉if (gui.bootprompt.draw)␊ |
␉␉␉blend( gui.bootprompt.pixmap, gui.backbuffer, gui.bootprompt.pos );␊ |
␉␉␉␉␊ |
␊ |
␉␉if (gui.menu.draw)␊ |
␉␉␉blend( gui.menu.pixmap, gui.backbuffer, gui.menu.pos );␊ |
␉␉␊ |
␉␉if (gui.infobox.draw)␊ |
␉␉␉blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos );␊ |
␉}␊ |
␉␊ |
␊ |
␉vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height );␊ |
␊ |
␉if (gui.redraw)␊ |
|
␉␉bounds.y = ( window->height - window->vborder );␊ |
␉␉␊ |
␉␉cursor = origin;␊ |
␉␉␉␊ |
␊ |
␉␉font_t *font = &font_console;␊ |
␉␉␉␊ |
␊ |
␉␉for( i=0; i< strlen(formattedtext); i++ )␊ |
␉␉{␊ |
␉␉␉character = formattedtext[i];␊ |
␉␉␉␊ |
␉␉␉character -= 32;␊ |
␉␉␉␉␊ |
␊ |
␉␉␉// newline ?␊ |
␉␉␉if( formattedtext[i] == '\n' )␊ |
␉␉␉{␊ |
|
␊ |
␉␉␉␉continue;␊ |
␉␉␉}␊ |
␉␉␉␉␊ |
␊ |
␉␉␉// tab ?␊ |
␉␉␉if( formattedtext[i] == '\t' )␊ |
␉␉␉␉cursor.x += ( font->chars[0]->width * 5 );␊ |
|
␉␉bounds.x = ( window->width - ( window->hborder * 2 ) );␊ |
␉␉bounds.y = ( window->height - ( window->vborder * 2 ) );␊ |
␉␉cursor = origin;␊ |
␉␉␉␊ |
␊ |
␉␉for( i=0; i< strlen(formattedtext); i++ )␊ |
␉␉{␊ |
␉␉␉character = formattedtext[i];␊ |
|
␉␉␉␉cursor.x = origin.x;␊ |
␉␉␉␉cursor.y += font->height;␊ |
␉␉␉}␊ |
␉␉␉␉␊ |
␊ |
␉␉␉// check y pos and reset to origin.y␊ |
␉␉␉if ( cursor.y > ( bounds.y + font->chars[0]->height) )␊ |
␉␉␉{␊ |
|
␉drawStr(text, font, blendInto, p);␊ |
}␊ |
␊ |
int destroyFont(font_t *font)␊ |
{␊ |
int i;␊ |
for (i = 0; i < CHARACTERS_COUNT; i++)␊ |
{␊ |
if (font->chars[i])␊ |
{␊ |
if (font->chars[i]->pixels) free (font->chars[i]->pixels);␊ |
free (font->chars[i]);␊ |
font->chars[i] = 0;␊ |
}␊ |
}␊ |
return 0;␊ |
}␊ |
␊ |
int initFont(font_t *font, image_t *data)␊ |
{␊ |
␉unsigned int x = 0, y = 0, x2 = 0, x3 = 0;␊ |
|
␉for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++)␊ |
␉{␊ |
␉␉start = end;␊ |
␉␉␉␉␊ |
␊ |
␉␉// if the pixel is red we've reached the end of the char␊ |
␉␉if( pixel( data->image, x, 0 ).value == 0xFFFF0000)␊ |
␉␉{␊ |
|
␉␉␉␉␉// check if font is monospaced␊ |
␉␉␉␉␉if( ( count > 0 ) && ( font->width != font->chars[count]->width ) )␊ |
␉␉␉␉␉␉monospaced = true;␊ |
␉␉␉␉␉␉␊ |
␊ |
␉␉␉␉␉font->width = font->chars[count]->width;␊ |
␉␉␉␉␉␊ |
␉␉␉␉␉count++;␊ |
|
␉return 0;␊ |
}␊ |
␊ |
int destroyFont(font_t *font)␊ |
{␊ |
␉int i;␊ |
for (i = 0; i < CHARACTERS_COUNT; i++)␊ |
{␊ |
␉␉if (font->chars[i])␊ |
␉␉{␊ |
␉␉␉if (font->chars[i]->pixels) free (font->chars[i]->pixels);␊ |
␉␉␉free (font->chars[i]);␊ |
␉␉␉font->chars[i] = 0;␊ |
␉␉}␊ |
}␊ |
return 0;␊ |
}␊ |
␊ |
void colorFont(font_t *font, uint32_t color)␊ |
{␊ |
␉if( !color )␊ |
|
␉␉␉␉break;␊ |
␉␉␉}␊ |
␉␉}␊ |
␉␉␉␉␊ |
␊ |
␉␉fillPixmapWithColor( gui.infobox.pixmap, gui.infobox.bgcolor);␊ |
␊ |
␉␉makeRoundedCorners( gui.infobox.pixmap);␊ |
␉␉␉␊ |
␊ |
␉␉// print the title if present␊ |
␉␉if( title )␊ |
␉␉␉drawStr(title, &font_console, gui.infobox.pixmap, pos_title);␊ |
|
␉␉␉updateVRAM();␊ |
␉␉␉break;␊ |
␉␉}␊ |
␉␉␊ |
␊ |
␉␉if(key == ' ') // spacebar = next page␊ |
␉␉{␊ |
␉␉␉if( lines > ( currentline + visiblelines ) ) ␊ |
|
␉␉for(x=todraw, x2 = 0; x < width - 1; x++, x2++)␊ |
␉␉{␊ |
␉␉␉if(x2 == (buffBG->width -2 )) x2 = 0;␊ |
␉␉␉␉pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value;␊ |
␉␉␉pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value;␊ |
␉␉}␊ |
␉␉if(progress < 100)␊ |
␉␉␉pixel(&progressbar, width - 1, y).value = pixel(buffBG, buffBG->width - 1, y).value;␊ |
|
␉␉␉pixel(&progressbar, 0, y).value = pixel(buffBG, buffBG->width - 1, y).value;␊ |
␉␉x2=0;␊ |
␉}␊ |
␉ ␊ |
␊ |
␉blend(&progressbar, blendInto, p);␊ |
␉animateProgressBar();␊ |
␉free(progressbar.pixels);␊ |
|
␉for ( i = 0, n = iMenuBoot; i < infoMenuItemsCount; i++, n++)␊ |
␉{␊ |
␉␉if (i == infoMenuSelection)␊ |
␉␉{␊ |
␉␉␉blend(selection, gui.menu.pixmap, position);␊ |
␉␉}␊ |
␊ |
␉␉pbuff = images[n].image;␊ |
␉␉if (offset && i >= INFOMENU_NATIVEBOOT_START && i <= INFOMENU_NATIVEBOOT_END)␊ |
␉␉{␊ |
␉␉␉blend( images[n + (iMenuHelp - iMenuBoot)].image , gui.menu.pixmap, ␊ |
␉␉␉␉pos((position.x + (gui.menu.hborder / 2)), position.y + ((selection->height - pbuff->height) / 2)));␊ |
␉␉}␊ |
␉␉else␊ |
␉␉{␊ |
␉␉␉blend( pbuff, gui.menu.pixmap, ␊ |
␉␉␉␉pos((position.x + (gui.menu.hborder / 2)), position.y + ((selection->height - pbuff->height) / 2)));␊ |
␉␉}␊ |
␊ |
␉␉drawStr(infoMenuItems[i].text, &font_console, gui.menu.pixmap, ␊ |
␉␉␉pos(position.x + (pbuff->width + gui.menu.hborder), ␊ |
|
␉{␊ |
␊ |
␉␉case KEY_UP:␉// up arrow␊ |
␉␉␉␉if (infoMenuSelection > 0)␊ |
␉␉␉if (infoMenuSelection > 0)␊ |
␉␉␉{␊ |
␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_END + 1)␊ |
␉␉␉␉{␊ |
␉␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_END + 1)␊ |
␉␉␉␉␉␉infoMenuSelection -= 4;␊ |
␉␉␉␉␉␊ |
␉␉␉␉␉else␊ |
␉␉␉␉␉␉infoMenuSelection--;␊ |
␉␉␉␉␉␉drawInfoMenuItems();␊ |
␉␉␉␉␉␉updateVRAM();␊ |
␉␉␉␉␉␊ |
␉␉␉␉} else {␊ |
␉␉␉␉␉␊ |
␉␉␉␉␉gui.menu.draw = false;␊ |
␉␉␉␉␉gui.redraw = true;␊ |
␊ |
␉␉␉␉␉updateVRAM();␊ |
␉␉␉␉␉␊ |
␉␉␉␉␉return CLOSE_INFO_MENU;␊ |
␉␉␉␉␉infoMenuSelection -= 4;␊ |
␉␉␉␉}␊ |
␉␉␉␉break;␊ |
␊ |
␉␉case KEY_DOWN:␉// down arrow␊ |
␉␉␉␉if (infoMenuSelection < infoMenuItemsCount - 1)␊ |
␉␉␉␉else␊ |
␉␉␉␉{␊ |
␉␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_START - 1)␊ |
␉␉␉␉␉␉infoMenuSelection += 4;␊ |
␉␉␉␉␉else␊ |
␉␉␉␉␉␉infoMenuSelection++;␊ |
␉␉␉␉␉drawInfoMenuItems();␊ |
␉␉␉␉␉updateVRAM();␊ |
␉␉␉␉␉infoMenuSelection--;␊ |
␉␉␉␉}␊ |
␉␉␉␉break;␊ |
␉␉␉␉drawInfoMenuItems();␊ |
␉␉␉␉updateVRAM();␊ |
␊ |
␉␉␉}␊ |
␉␉␉else␊ |
␉␉␉{␊ |
␊ |
␉␉␉␉gui.menu.draw = false;␊ |
␉␉␉␉gui.redraw = true;␊ |
␊ |
␉␉␉␉updateVRAM();␊ |
␉␉␉␉␊ |
␉␉␉␉return CLOSE_INFO_MENU;␊ |
␉␉␉}␊ |
␉␉␉break;␊ |
␊ |
␉␉case KEY_DOWN:␉// down arrow␊ |
␉␉␉if (infoMenuSelection < infoMenuItemsCount - 1)␊ |
␉␉␉{␊ |
␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_START - 1)␊ |
␉␉␉␉␉infoMenuSelection += 4;␊ |
␉␉␉␉else␊ |
␉␉␉␉␉infoMenuSelection++;␊ |
␉␉␉␉drawInfoMenuItems();␊ |
␉␉␉␉updateVRAM();␊ |
␉␉␉}␊ |
␉␉␉break;␊ |
␊ |
␉␉case KEY_ENTER:␊ |
␉␉␉␉key = 0;␊ |
␉␉␉␉if( infoMenuSelection == MENU_SHOW_MEMORY_INFO )␊ |
␉␉␉␉␉showInfoBox( "Memory Info. Press q to quit.\n", getMemoryInfoString());␊ |
␉␉␉key = 0;␊ |
␉␉␉if( infoMenuSelection == MENU_SHOW_MEMORY_INFO )␊ |
␉␉␉␉showInfoBox( "Memory Info. Press q to quit.\n", getMemoryInfoString());␊ |
␊ |
␉␉␉␉else if( infoMenuSelection == MENU_SHOW_VIDEO_INFO )␊ |
␉␉␉␉␉showInfoBox( getVBEInfoString(), getVBEModeInfoString() );␊ |
␉␉␉else if( infoMenuSelection == MENU_SHOW_VIDEO_INFO )␊ |
␉␉␉␉showInfoBox( getVBEInfoString(), getVBEModeInfoString() );␊ |
␉␉␉␊ |
␉␉␉␉else if( infoMenuSelection == MENU_SHOW_HELP )␊ |
␉␉␉␉␉showHelp();␊ |
␉␉␉␉␉␊ |
␉␉␉␉else␊ |
␉␉␉␉{␊ |
␉␉␉␉␉int buff = infoMenuSelection;␊ |
␉␉␉␉␉infoMenuSelection = 0;␊ |
␉␉␉␉␉return buff;␊ |
␉␉␉␉}␊ |
␉␉␉␉break;␊ |
␉␉}␊ |
␉␉␉else if( infoMenuSelection == MENU_SHOW_HELP )␊ |
␉␉␉␉showHelp();␊ |
␊ |
␉␉␉else␊ |
␉␉␉{␊ |
␉␉␉␉int buff = infoMenuSelection;␊ |
␉␉␉␉infoMenuSelection = 0;␊ |
␉␉␉␉return buff;␊ |
␉␉␉}␊ |
␉␉␉break;␊ |
␉}␊ |
␉return DO_NOT_BOOT;␊ |
}␊ |
␊ |