X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbsod.c;h=553eb5e0cfa7eabfbe695303e4d93f6f1b566b2a;hb=39809ded547bdbb08207d3e514950425215b4410;hp=e520433ad5cd4f4788d035d9078715dfec3ebfaa;hpb=de460e831dc8578acfa8b72251ab9346c99c1f96;p=xscreensaver diff --git a/hacks/bsod.c b/hacks/bsod.c index e520433a..553eb5e0 100644 --- a/hacks/bsod.c +++ b/hacks/bsod.c @@ -1,11 +1,11 @@ -/* xscreensaver, Copyright (c) 1998-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 1998-2017 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. No representations are made about the suitability of this - * software for any purpose. It is provided "as is" without express or + * software for any purpose. It is provided "as is" without express or * implied warranty. * * Blue Screen of Death: the finest in personal computer emulation. @@ -40,6 +40,7 @@ #include "apple2.h" #include +#include #ifdef HAVE_XSHM_EXTENSION #include "xshm.h" @@ -49,7 +50,7 @@ # include #endif /* HAVE_UNAME */ -#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) || defined(HAVE_COCOA) +#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) || defined(HAVE_JWXYZ) # define DO_XPM #endif @@ -58,23 +59,31 @@ # include "images/hmac.xpm" # include "images/osx_10_2.xpm" # include "images/osx_10_3.xpm" +# include "images/android.xpm" +# include "images/ransomware.xpm" #endif #include "images/atari.xbm" #include "images/mac.xbm" #include "images/macbomb.xbm" +#include "images/apple.xbm" #include "images/atm.xbm" #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) +# undef MIN +# undef MAX +# define MIN(A,B) ((A)<(B)?(A):(B)) +# define MAX(A,B) ((A)>(B)?(A):(B)) + #undef EOF -typedef enum { EOF=0, - LEFT, CENTER, RIGHT, - LEFT_FULL, CENTER_FULL, RIGHT_FULL, +typedef enum { EOF=0, + LEFT, CENTER, RIGHT, + LEFT_FULL, CENTER_FULL, RIGHT_FULL, COLOR, INVERT, MOVETO, MARGINS, - CURSOR_BLOCK, CURSOR_LINE, RECT, COPY, PIXMAP, IMG, + CURSOR_BLOCK, CURSOR_LINE, RECT, LINE, COPY, PIXMAP, IMG, FONT, PAUSE, CHAR_DELAY, LINE_DELAY, - LOOP + LOOP, RESET, VERT_MARGINS, CROP } bsod_event_type; struct bsod_event { @@ -86,13 +95,15 @@ struct bsod_state { Display *dpy; Window window; XWindowAttributes xgwa; - XFontStruct *font; + XFontStruct *font, *fontA, *fontB, *fontC; unsigned long fg, bg; GC gc; int left_margin, right_margin; /* for text wrapping */ - int top_margin, bottom_margin; /* for text scrolling */ + int top_margin, bottom_margin; /* for text scrolling and cropping */ + int xoff, yoff; Bool wrap_p; Bool scroll_p; + Bool crop_p; /* If True, chops off extra text vertically */ Pixmap pixmap; /* Source image used by BSOD_PIXMAP */ @@ -202,6 +213,16 @@ struct bsod_state { (bst)->pos++; \ } while (0) +/* Set the prevailing top/bottom margins (used when scrolling and cropping text) + */ +#define BSOD_VERT_MARGINS(bst,top,bottom) do { \ + ensure_queue (bst); \ + (bst)->queue[(bst)->pos].type = VERT_MARGINS; \ + (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (top)); \ + (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (bottom)); \ + (bst)->pos++; \ + } while (0) + /* Draw a blinking cursor; type is CURSOR_BLOCK or CURSOR_LINE. usec is how long 1/2 of a cycle is. count is how many times to blink. (You can pass a gigantic number if this is the last thing in your mode.) @@ -227,6 +248,19 @@ struct bsod_state { (bst)->pos++; \ } while (0) +/* Draw a line. + */ +#define BSOD_LINE(bst,x,y,x2,y2,thick) do { \ + ensure_queue (bst); \ + (bst)->queue[(bst)->pos].type = LINE; \ + (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (x)); \ + (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (y)); \ + (bst)->queue[(bst)->pos].arg3 = (void *) ((long) (x2)); \ + (bst)->queue[(bst)->pos].arg4 = (void *) ((long) (y2)); \ + (bst)->queue[(bst)->pos].arg5 = (void *) ((long) (thick)); \ + (bst)->pos++; \ + } while (0) + /* Copy a rect from the window, to the window. */ #define BSOD_COPY(bst,srcx,srcy,w,h,tox,toy) do { \ @@ -256,7 +290,16 @@ struct bsod_state { (bst)->pos++; \ } while (0) -/* Jump around in the state table. You can use this as the last thing +/* Switch between fonts A, B and C. + */ +#define BSOD_FONT(bst,n) do { \ + ensure_queue (bst); \ + (bst)->queue[(bst)->pos].type = FONT; \ + (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (n)); \ + (bst)->pos++; \ + } while (0) + +/* Jump around in the state table. You can use this as the last thing in your state table to repeat the last N elements forever. */ #define BSOD_LOOP(bst,off) do { \ @@ -266,6 +309,24 @@ struct bsod_state { (bst)->pos++; \ } while (0) +/* Restart the whole thing from the beginning. + */ +#define BSOD_RESET(bst) do { \ + ensure_queue (bst); \ + (bst)->queue[(bst)->pos].type = RESET; \ + (bst)->pos++; \ + } while (0) + +/* Sets the crop state, if True, will not write text below the bottom_margin + */ +#define BSOD_CROP(bst, state) do { \ + ensure_queue (bst); \ + (bst)->queue[(bst)->pos].type = CROP; \ + (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (state)); \ + (bst)->pos++; \ + } while (0) + + static void ensure_queue (struct bsod_state *bst) @@ -278,10 +339,10 @@ ensure_queue (struct bsod_state *bst) if (n < 100) n *= 2; n *= 1.2; - bst->queue = (struct bsod_event *) + bst->queue = (struct bsod_event *) realloc (bst->queue, n * sizeof(*bst->queue)); if (!bst->queue) abort(); - memset (bst->queue + bst->queue_size, 0, + memset (bst->queue + bst->queue_size, 0, (n - bst->queue_size) * sizeof(*bst->queue)); bst->queue_size = n; } @@ -315,11 +376,11 @@ position_for_text (struct bsod_state *bst, const char *line) switch (bst->queue[bst->pos].type) { case LEFT: case LEFT_FULL: - bst->current_left = bst->left_margin; + bst->current_left = bst->left_margin + bst->xoff; break; case RIGHT: case RIGHT_FULL: - bst->x = max_width - bst->right_margin; + bst->x = max_width - bst->right_margin - bst->xoff; bst->current_left = bst->x; break; case CENTER: @@ -328,7 +389,7 @@ position_for_text (struct bsod_state *bst, const char *line) int w = (bst->xgwa.width - bst->left_margin - bst->right_margin - max_width); if (w < 0) w = 0; - bst->x = bst->left_margin + (w / 2); + bst->x = bst->left_margin + bst->xoff + (w / 2); bst->current_left = bst->x; break; } @@ -344,20 +405,21 @@ bst_crlf (struct bsod_state *bst) int lh = bst->font->ascent + bst->font->descent; bst->x = bst->current_left; if (!bst->scroll_p || - bst->y + lh < bst->xgwa.height - bst->bottom_margin) + bst->y + lh < bst->xgwa.height - bst->bottom_margin - bst->yoff) bst->y += lh; else { int w = bst->xgwa.width - bst->right_margin - bst->left_margin; int h = bst->xgwa.height - bst->top_margin - bst->bottom_margin; XCopyArea (bst->dpy, bst->window, bst->window, bst->gc, - bst->left_margin, - bst->top_margin + lh, + bst->left_margin + bst->xoff, + bst->top_margin + bst->yoff + lh, w, h - lh, - bst->left_margin, - bst->top_margin); + bst->left_margin + bst->xoff, + bst->top_margin + bst->yoff); XClearArea (bst->dpy, bst->window, - bst->left_margin, bst->top_margin + h - lh, w, lh, False); + bst->left_margin + bst->xoff, + bst->top_margin + bst->yoff + h - lh, w, lh, False); } } @@ -367,6 +429,12 @@ draw_char (struct bsod_state *bst, char c) { if (!c) abort(); + else if (bst->crop_p && bst->y >= + (bst->xgwa.height - bst->bottom_margin - bst->yoff)) + { + /* reached the bottom of the drawing area, and crop_p = True */ + return; + } else if (c == '\r') { bst->x = bst->current_left; @@ -376,10 +444,10 @@ draw_char (struct bsod_state *bst, char c) if (bst->macx_eol_kludge) { /* Special case for the weird way OSX crashes print newlines... */ - XDrawImageString (bst->dpy, bst->window, bst->gc, + XDrawImageString (bst->dpy, bst->window, bst->gc, bst->x, bst->y, " ", 1); - XDrawImageString (bst->dpy, bst->window, bst->gc, - bst->x, + XDrawImageString (bst->dpy, bst->window, bst->gc, + bst->x, bst->y + bst->font->ascent + bst->font->descent, " ", 1); } @@ -391,8 +459,8 @@ draw_char (struct bsod_state *bst, char c) ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width : bst->font->min_bounds.width); bst->x -= cw; - if (bst->x < bst->left_margin) - bst->x = bst->left_margin; + if (bst->x < bst->left_margin + bst->xoff) + bst->x = bst->left_margin + bst->xoff; } else { @@ -400,11 +468,11 @@ draw_char (struct bsod_state *bst, char c) XCharStruct ov; XTextExtents (bst->font, &c, 1, &dir, &ascent, &descent, &ov); - if (bst->wrap_p && - bst->x + ov.width > bst->xgwa.width - bst->right_margin) + if (bst->wrap_p && + bst->x + ov.width > bst->xgwa.width - bst->right_margin - bst->xoff) bst_crlf (bst); - XDrawImageString (bst->dpy, bst->window, bst->gc, + XDrawImageString (bst->dpy, bst->window, bst->gc, bst->x, bst->y, &c, 1); bst->x += ov.width; } @@ -435,13 +503,14 @@ bsod_pop (struct bsod_state *bst) { long delay = bst->line_delay; bst->pos++; - bst->current_left = bst->left_margin; + bst->current_left = bst->left_margin + bst->xoff; return delay; } if (! bst->queue[bst->pos].arg3) /* "done once" */ { position_for_text (bst, s); + bst->queue[bst->pos].arg4 = (void *) bst->queue[bst->pos].type; bst->queue[bst->pos].type = LEFT; if (type == CENTER_FULL || @@ -507,6 +576,20 @@ bsod_pop (struct bsod_state *bst) bst->pos++; return 0; } + case LINE: + { + int x1 = (long) bst->queue[bst->pos].arg1; + int y1 = (long) bst->queue[bst->pos].arg2; + int x2 = (long) bst->queue[bst->pos].arg3; + int y2 = (long) bst->queue[bst->pos].arg4; + int t = (long) bst->queue[bst->pos].arg5; + XGCValues gcv; + gcv.line_width = t; + XChangeGC (bst->dpy, bst->gc, GCLineWidth, &gcv); + XDrawLine (bst->dpy, bst->window, bst->gc, x1, y1, x2, y2); + bst->pos++; + return 0; + } case COPY: case PIXMAP: { @@ -516,8 +599,8 @@ bsod_pop (struct bsod_state *bst) int h = (long) bst->queue[bst->pos].arg4; int tox = (long) bst->queue[bst->pos].arg5; int toy = (long) bst->queue[bst->pos].arg6; - XCopyArea (bst->dpy, - (type == PIXMAP ? bst->pixmap : bst->window), + XCopyArea (bst->dpy, + (type == PIXMAP ? bst->pixmap : bst->window), bst->window, bst->gc, srcx, srcy, w, h, tox, toy); bst->pos++; @@ -526,12 +609,24 @@ bsod_pop (struct bsod_state *bst) case IMG: { if (bst->img_loader) abort(); - bst->img_loader = load_image_async_simple (0, bst->xgwa.screen, + bst->img_loader = load_image_async_simple (0, bst->xgwa.screen, bst->window, bst->window, 0, 0); bst->pos++; return 0; } + case FONT: + { + switch ((long) bst->queue[bst->pos].arg1) { + case 0: bst->font = bst->fontA; break; + case 1: bst->font = bst->fontB; break; + case 2: bst->font = bst->fontC; break; + default: abort(); break; + } + XSetFont (bst->dpy, bst->gc, bst->font->fid); + bst->pos++; + return 0; + } case PAUSE: { long delay = (long) bst->queue[bst->pos].arg1; @@ -557,6 +652,13 @@ bsod_pop (struct bsod_state *bst) bst->pos++; return 0; } + case VERT_MARGINS: + { + bst->top_margin = (long) bst->queue[bst->pos].arg1; + bst->bottom_margin = (long) bst->queue[bst->pos].arg2; + bst->pos++; + return 0; + } case CURSOR_BLOCK: case CURSOR_LINE: { @@ -596,6 +698,29 @@ bsod_pop (struct bsod_state *bst) abort(); return 0; } + case RESET: + { + int i; + for (i = 0; i < bst->queue_size; i++) + switch (bst->queue[i].type) { + case LEFT: case LEFT_FULL: + case CENTER: case CENTER_FULL: + case RIGHT: case RIGHT_FULL: + bst->queue[i].arg2 = bst->queue[i].arg1; + bst->queue[i].arg3 = 0; + bst->queue[i].type = (bsod_event_type) bst->queue[i].arg4; + break; + default: break; + } + bst->pos = 0; + return 0; + } + case CROP: + { + bst->crop_p = (long) bst->queue[bst->pos].arg1; + bst->pos++; + return 0; + } case EOF: { bst->pos = -1; @@ -616,7 +741,9 @@ make_bsod_state (Display *dpy, Window window, struct bsod_state *bst; char buf1[1024], buf2[1024]; char buf3[1024], buf4[1024]; - const char *font1, *font2; + char buf5[1024], buf6[1024]; + char buf7[1024], buf8[1024]; + const char *font1, *font2, *font3, *font4; bst = (struct bsod_state *) calloc (1, sizeof (*bst)); bst->queue_size = 10; @@ -632,7 +759,13 @@ make_bsod_state (Display *dpy, Window window, If the window is big: use ".bigFont" if it is loadable, else use ".bigFont2". */ - if (bst->xgwa.height < 640) + if ( +# ifdef HAVE_MOBILE + 1 +# else + bst->xgwa.height < 640 +# endif + ) { sprintf (buf1, "%.100s.font", name); sprintf (buf2, "%.100s.font", class); @@ -646,9 +779,31 @@ make_bsod_state (Display *dpy, Window window, sprintf (buf3, "%.100s.bigFont2", name); sprintf (buf4, "%.100s.bigFont2", class); } + sprintf (buf5, "%.100s.fontB", name); + sprintf (buf6, "%.100s.fontB", class); + sprintf (buf7, "%.100s.fontC", name); + sprintf (buf8, "%.100s.fontC", class); font1 = get_string_resource (dpy, buf1, buf2); font2 = get_string_resource (dpy, buf3, buf4); + font3 = get_string_resource (dpy, buf5, buf6); + font4 = get_string_resource (dpy, buf7, buf8); + + /* If there was no ".mode.font2" resource also look for ".font2". + Under real X11, the wildcard does this, so this is redundant, + but jwxyz needs it because it doesn't implement wildcards. + */ +# define RES2(VAR, BUF1, BUF2) do { \ + if (! VAR) { \ + VAR = get_string_resource (dpy, \ + strchr (BUF1, '.') + 1, \ + strchr (BUF2, '.') + 1); \ + }} while(0) + RES2 (font1, buf1, buf2); + RES2 (font2, buf3, buf4); + RES2 (font3, buf5, buf6); + RES2 (font4, buf7, buf8); +#undef RES2 if (font1) bst->font = XLoadQueryFont (dpy, font1); @@ -664,6 +819,17 @@ make_bsod_state (Display *dpy, Window window, if (! bst->font) abort(); + if (font3) + bst->fontB = XLoadQueryFont (dpy, font3); + if (font4) + bst->fontC = XLoadQueryFont (dpy, font4); + + if (! bst->fontB) bst->fontB = bst->font; + if (! bst->fontC) bst->fontC = bst->font; + + bst->fontA = bst->font; + + gcv.font = bst->font->fid; sprintf (buf1, "%.100s.foreground", name); @@ -676,13 +842,25 @@ make_bsod_state (Display *dpy, Window window, buf1, buf2); bst->gc = XCreateGC (dpy, window, GCFont|GCForeground|GCBackground, &gcv); -#ifdef HAVE_COCOA - jwxyz_XSetAntiAliasing (dpy, bst->gc, False); +#ifdef HAVE_JWXYZ + jwxyz_XSetAntiAliasing (dpy, bst->gc, True); #endif +# ifdef USE_IPHONE + /* Stupid iPhone X bezel. + #### This is the worst of all possible ways to do this! + */ + if (bst->xgwa.width == 2436 || bst->xgwa.height == 2436) { + if (bst->xgwa.width > bst->xgwa.height) + bst->xoff = 96; + else + bst->yoff = 96; + } +# endif + bst->left_margin = bst->right_margin = 10; - bst->x = bst->left_margin; - bst->y = bst->font->ascent + bst->left_margin; + bst->x = bst->left_margin + bst->xoff; + bst->y = bst->font->ascent + bst->left_margin + bst->yoff; XSetWindowBackground (dpy, window, gcv.background); return bst; @@ -754,6 +932,9 @@ static struct bsod_state * windows_31 (Display *dpy, Window window) { struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows"); + + bst->xoff = bst->left_margin = bst->right_margin = 0; + BSOD_INVERT (bst); BSOD_TEXT (bst, CENTER, "Windows\n"); BSOD_INVERT (bst); @@ -768,7 +949,7 @@ windows_31 (Display *dpy, Window window) "\n"); BSOD_TEXT (bst, CENTER, "Press any key to continue"); - bst->y = ((bst->xgwa.height - + bst->y = ((bst->xgwa.height - bst->yoff - ((bst->font->ascent + bst->font->descent) * 9)) / 2); @@ -776,11 +957,69 @@ windows_31 (Display *dpy, Window window) return bst; } +static struct bsod_state * +vmware (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "vmware", "VMware"); + + unsigned long fg = bst->fg; + unsigned long bg = bst->bg; + unsigned long fg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "vmware.foreground2", + "vmware.foreground"); + BSOD_COLOR (bst, fg2, bg); + BSOD_TEXT (bst, LEFT, + "VMware ESX Server [Releasebuild-98103]\n"); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, LEFT, + "PCPU 1 locked up. Failed to ack TLB invalidate.\n" + "frame=0x3a37d98 ip=0x625e94 cr2=0x0 cr3=0x40c66000 cr4=0x16c\n" + "es=0xffffffff ds=0xffffffff fs=0xffffffff gs=0xffffffff\n" + "eax=0xffffffff ebx=0xffffffff ecx=0xffffffff edx=0xffffffff\n" + "ebp=0x3a37ef4 esi=0xffffffff edi=0xffffffff err=-1 eflags=0xffffffff\n" + "*0:1037/helper1-4 1:1107/vmm0:Fagi 2:1121/vmware-vm 3:1122/mks:Franc\n" + "0x3a37ef4:[0x625e94]Panic+0x17 stack: 0x833ab4, 0x3a37f10, 0x3a37f48\n" + "0x3a37f04:[0x625e94]Panic+0x17 stack: 0x833ab4, 0x1, 0x14a03a0\n" + "0x3a37f48:[0x64bfa4]TLBDoInvalidate+0x38f stack: 0x3a37f54, 0x40, 0x2\n" + "0x3a37f70:[0x66da4d]XMapForceFlush+0x64 stack: 0x0, 0x4d3a, 0x0\n" + "0x3a37fac:[0x652b8b]helpFunc+0x2d2 stack: 0x1, 0x14a4580, 0x0\n" + "0x3a37ffc:[0x750902]CpuSched_StartWorld+0x109 stack: 0x0, 0x0, 0x0\n" + "0x3a38000:[0x0]blk_dev+0xfd76461f stack: 0x0, 0x0, 0x0\n" + "VMK uptime: 7:05:43:45.014 TSC: 1751259712918392\n" + "Starting coredump to disk\n"); + BSOD_CHAR_DELAY (bst, 10000); + BSOD_TEXT (bst, LEFT, "using slot 1 of 1... "); + BSOD_CHAR_DELAY (bst, 300000); + BSOD_TEXT (bst, LEFT, "9876"); + BSOD_CHAR_DELAY (bst, 3000000); + BSOD_TEXT (bst, LEFT, "66665"); + BSOD_CHAR_DELAY (bst, 100000); + BSOD_TEXT (bst, LEFT, "4321"); + BSOD_CHAR_DELAY (bst, 0); + BSOD_TEXT (bst, LEFT, "Disk dump successfull.\n" + "Waiting for Debugger (world 1037)\n" + "Debugger is listening on serial port ...\n"); + BSOD_CHAR_DELAY (bst, 10000); + BSOD_TEXT (bst, LEFT, "Press Escape to enter local debugger\n"); + BSOD_CHAR_DELAY (bst, 10000); + BSOD_TEXT (bst, LEFT, "Remote debugger activated. Local debugger no longer available.\n"); + +/* BSOD_CURSOR (bst, CURSOR_LINE, 240000, 999999);*/ + +/* bst->y = ((bst->xgwa.height - bst->yoff - + ((bst->font->ascent + bst->font->descent) * 9)) + / 2);*/ + + XClearWindow (dpy, window); + return bst; +} + + static struct bsod_state * windows_nt (Display *dpy, Window window) { - struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows"); + struct bsod_state *bst = make_bsod_state (dpy, window, "nt", "NT"); BSOD_TEXT (bst, LEFT, "*** STOP: 0x0000001E (0x80000003,0x80106fc0,0x8025ea21,0xfd6829e8)\n" @@ -872,7 +1111,7 @@ windows_me (Display *dpy, Window window) BSOD_CURSOR (bst, CURSOR_LINE, 120000, 999999); bst->left_margin = 40; - bst->y = ((bst->xgwa.height - + bst->y = ((bst->xgwa.height - bst->yoff - ((bst->font->ascent + bst->font->descent) * 3)) / 2); @@ -930,7 +1169,7 @@ windows_xp (Display *dpy, Window window) static struct bsod_state * windows_lh (Display *dpy, Window window) { - struct bsod_state *bst = + struct bsod_state *bst = make_bsod_state (dpy, window, "windowslh", "WindowsLH"); unsigned long fg = bst->fg; @@ -966,7 +1205,8 @@ windows_lh (Display *dpy, Window window) "or computer\n" "manufacturer.\n" ); - BSOD_MOVETO (bst, bst->left_margin, bst->xgwa.height - bst->font->descent); + BSOD_MOVETO (bst, bst->left_margin + bst->xoff, + bst->xgwa.height - bst->yoff - bst->font->descent); BSOD_COLOR (bst, bg, bg2); BSOD_TEXT (bst, LEFT_FULL, " SPACE=Continue\n"); @@ -977,6 +1217,173 @@ windows_lh (Display *dpy, Window window) } +static struct bsod_state * +windows_10_update (Display *dpy, Window window) +{ + struct bsod_state *bst = + make_bsod_state (dpy, window, "win10", "Win10"); + const char *fmt = "Working on updates %d%%"; + char line1[255]; + const char *line2 = "Don't turn off your PC. This will take a while."; + const char *line3 = "Your PC will restart several times."; + int line_height = bst->fontA->ascent + bst->fontA->descent; + int y1 = bst->xgwa.height / 2 - line_height * 4; + int y2 = bst->xgwa.height - bst->yoff - line_height * 3; + int pct; + + /* TODO: win10_spinner.gif goes at (y - line_height * 2 - 64). */ + + for (pct = 0; pct < 98; pct++) + { + BSOD_MOVETO (bst, 0, y1); + sprintf (line1, fmt, pct); + BSOD_TEXT (bst, CENTER, line1); + BSOD_MOVETO (bst, 0, y1 + line_height); + BSOD_TEXT (bst, CENTER, line2); + BSOD_MOVETO (bst, 0, y2); + BSOD_TEXT (bst, CENTER, line3); + BSOD_PAUSE (bst, 200000 + (random() % 3000000) + (random() % 3000000)); + } + + XClearWindow (dpy, window); + return bst; +} + + +static struct bsod_state * +windows_10 (Display *dpy, Window window) +{ + struct bsod_state *bst = + make_bsod_state (dpy, window, "win10", "Win10"); + + int qr_width = 41; + int qr_height = 41; + static const unsigned char qr_bits[] = { + 0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0x01, + 0x03,0x9A,0x70,0xEE,0x80,0x01,0xFB,0x22,0xAA,0xA6,0xBE,0x01, + 0x8B,0x8E,0x74,0xE7,0xA2,0x01,0x8B,0xEE,0x42,0xC4,0xA2,0x01, + 0x8B,0x42,0x6E,0xED,0xA2,0x01,0xFB,0xDA,0x63,0xA6,0xBE,0x01, + 0x03,0xAA,0xAA,0xAA,0x80,0x01,0xFF,0x8B,0xD8,0x9D,0xFF,0x01, + 0x63,0x62,0xDA,0x1B,0x98,0x01,0x6F,0x67,0x98,0x9F,0xBC,0x01, + 0x4F,0xCC,0x55,0x81,0x83,0x01,0xB7,0x6D,0xFF,0x68,0xB2,0x01, + 0xC3,0x10,0x87,0x8B,0x96,0x01,0x6F,0xB1,0x91,0x58,0x94,0x01, + 0xE3,0x36,0x88,0x84,0xB8,0x01,0x83,0x9B,0xFE,0x59,0xD7,0x01, + 0x3B,0x74,0x98,0x5C,0xB4,0x01,0x37,0x75,0xDC,0x91,0xA6,0x01, + 0x77,0xDE,0x01,0x54,0xBA,0x01,0xBB,0x6D,0x8B,0xB9,0xB5,0x01, + 0x1F,0x06,0xBD,0x9B,0xB4,0x01,0xD3,0xBD,0x91,0x19,0x84,0x01, + 0x0B,0x20,0xD8,0x91,0xB4,0x01,0x33,0x95,0xBC,0x0A,0xD5,0x01, + 0xB3,0x60,0xDC,0xD9,0xB6,0x01,0xEF,0x77,0x18,0x09,0xA4,0x01, + 0xA3,0xC2,0x95,0x51,0xB2,0x01,0xDF,0x63,0xDB,0xBE,0xB3,0x01, + 0x03,0x08,0xC9,0x09,0xF0,0x01,0xFF,0xA3,0x19,0xBD,0xFB,0x01, + 0x03,0x2E,0x84,0xA5,0xAA,0x01,0xFB,0x9A,0xFC,0x9B,0xBB,0x01, + 0x8B,0x7E,0x9C,0x1D,0xB0,0x01,0x8B,0x6E,0x58,0xA1,0xDB,0x01, + 0x8B,0xDA,0xD5,0x65,0xA2,0x01,0xFB,0x72,0xFB,0xE9,0xF0,0x01, + 0x03,0x02,0x99,0x3B,0xB3,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0x01, + 0xFF,0xFF,0xFF,0xFF,0xFF,0x01}; + Pixmap pixmap; + + const char *lines[] = { + ":(\n", + "\n", + "Your PC ran into a problem and needs to restart. We're just\n", + "collecting some error info, and then we'll restart for you.\n", + "\n", + "\n", + "\n", + "For more information about this issue and\n", + "possible fixes, visit\n", +/* "https://www.jwz.org/xscreensaver\n",*/ + "http://youtu.be/-RjmN9RZyr4\n", + "\n", + "If you call a support person, give them this info:\n", + "Stop code CRITICAL_PROCESS_DIED", + }; + int i, y = 0, y0 = 0; + int line_height0 = bst->fontB->ascent; + int line_height1 = bst->fontA->ascent + bst->fontA->descent; + int line_height2 = bst->fontC->ascent + bst->fontC->descent; + int line_height = line_height0; + int top, left0, left; + int stop = 60 + (random() % 39); + + if (!(random() % 7)) + return windows_10_update (dpy, window); + + + line_height1 *= 1.3; + line_height2 *= 1.5; + + top = ((bst->xgwa.height - bst->yoff + - (line_height0 * 1 + + line_height1 * 6 + + line_height2 * 6)) + / 2); + + { + int dir, ascent, descent; + XCharStruct ov; + const char *s = lines[2]; + XTextExtents (bst->fontA, s, strlen(s), + &dir, &ascent, &descent, &ov); + left = left0 = (bst->xgwa.width - ov.width) / 2; + } + + pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) qr_bits, + qr_width, qr_height, + bst->fg, bst->bg, bst->xgwa.depth); + for (i = 0; i < 2; i++) + { + pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth, + pixmap, qr_width, qr_height); + qr_width *= 2; + qr_height *= 2; + } + bst->pixmap = pixmap; + + y = top; + line_height = line_height0; + BSOD_FONT (bst, 1); + for (i = 0; i < countof(lines); i++) + { + BSOD_MOVETO (bst, left, y); + BSOD_TEXT (bst, LEFT, lines[i]); + y += line_height; + if (i == 0) + { + BSOD_FONT (bst, 0); + line_height = line_height1; + } + else if (i == 4) + { + y0 = y; + y += line_height / 2; + BSOD_PIXMAP (bst, 0, 0, qr_width, qr_height, left, y + line_height1); + BSOD_FONT (bst, 2); + line_height = line_height2; + left += qr_width + line_height2 / 2; +# ifdef HAVE_MOBILE + y -= 14; +# endif + } + } + + left = left0; + BSOD_FONT (bst, 0); + for (i = 0; i <= stop; i++) + { + char buf[100]; + sprintf (buf, "%d%% complete", i); + BSOD_MOVETO (bst, left, y0); + BSOD_TEXT (bst, LEFT, buf); + BSOD_PAUSE (bst, 85000); + } + BSOD_PAUSE (bst, 3000000); + + XClearWindow (dpy, window); + return bst; +} + + static struct bsod_state * windows_other (Display *dpy, Window window) { @@ -992,6 +1399,500 @@ windows_other (Display *dpy, Window window) } } +/* Windows and Apple2 ransomware. + */ +static struct bsod_state *apple2ransomware (Display *, Window); + +static struct bsod_state * +windows_ransomware (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, + "ransomware", "Ransomware"); + char buf[1024]; + + int pix_w = 0, pix_h = 0; + Pixmap pixmap = xpm_data_to_pixmap (dpy, window, + (char **) (ransomware_xpm), + &pix_w, &pix_h, 0); + + /* Don't start the countdown from the start, advance the deadline by 3 - 30 + hours */ + int advance_deadline = (random() % 97200) + 10800; + + time_t now = time(NULL); + const time_t stage1_deadline = now + 259200 - advance_deadline; /* 3 days */ + const time_t stage2_deadline = now + 604800 - advance_deadline; /* 7 days */ + char stage1_deadline_str[25], stage2_deadline_str[25]; + char countdown_str[16]; + int stage1_countdown_y, stage2_countdown_y; + int countdown_d, countdown_h, countdown_m, countdown_s, countdown_r; + const int line_height = bst->font->ascent + bst->font->descent; + int i; + + const char *currencies[] = { + "Blitcoin", + "clicks", + "Ass Pennies", + "Dollary-doos", + "Dunning-Krugerrands", + "Dunning-Krugerrands", + "Dunning-Krugerrands", + "Dunning-Krugerrands", + "Dunning-Krugerrands", + "gift certificates", + "secret sauce", + "Tribbles", + }; + + const char *currency = currencies[random() % countof(currencies)]; + + const char *header_quips[] = { + "Oops, your screens have been encrypted!", + "Oops, your screens have been encrypted!", + "Oops, your screens have been encrypted!", + "Oops, your screens have been encrypted!", + "Oops, your screen have encrypted!", + "Oops, you're screens have been encrypted!", + "Oops, your screens have been encrupted!", + "Oops, your screens have been encrumpet!", + "Oops, your screens have been encrusted!", + "If you don't pay this ransom, then you are a theif!", + "Your screen was subject to the laws of mathomatics!", + "Oops, your screen was shaved by Occam's Razor!", + "Oops, your screen was perturbated by Langford's Basilisk!", + "Your screen is now stored as Snapchat messages!", + "Oops, your screen is now stored on Betamax!", + "Oops, your screen is now in the clown!", + "Oops, your screen has been deprecated!", + "Oops, you're screen was seized by the FBI!", + "All your screen was shared with your coworkers!", + "All your screen are belong to us.", + "Well actually, your screen isn't needed anymore.", + "u just got popped with some 0day shit!!", + "M'lady,", + }; + + const char *header_quip = header_quips[random() % countof(header_quips)]; + + /* You got this because... */ + const char *excuse_quips[] = { + "all human actions are equivalent and all are on principle doomed " + "to failure", + "you hold a diverse portfolio of cryptocurrencies", + "you need to get in on ransomware futures at the ground floor", + "your flight was overbooked", + "you did not apply the security update for bugs NSA keys secret from " + "Microsoft in your Windows(R) operating system", + "you are bad and you should feel bad", + "you used the wifi at defcon", + "you lack official Clown Strike[TM] threaty threat technology", + }; + + const char *excuse_quip = excuse_quips[random() % countof(excuse_quips)]; + + /* WELL ACTUALLY, screensavers aren't really nescessary anymore because... */ + const char *screensaver_quips[] = { + "I read it on hacker news", + "that's official Debian policy now", + "that is the official policy of United Airlines", + "they cause global warming", + "they lack an eternal struggle", + "they lack a vapid dichotomy", + "those electrons could be used for gold farming instead", + "you can make more money in art exhibitions", + }; + + const char *screensaver_quip = + screensaver_quips[random() % countof(screensaver_quips)]; + + /* Positions of UI elements. Layout: + + +---------+-+---------------------------------------+ + | LOGO | | HEADER | + | | |---------------------------------------| + | | | NOTE TEXT | + | DEAD | | | + | LINE | | | + | TIMERS | | | + | | | | + | | | | + | | | | + | | | | + | | | | + +---------+ | | + | LINKS | +---------------------------------------+ + | LINKS | | FOOTER | + +---------+-+---------------------------------------+ + + The right side of the UI maximises to available width. + The note text maximises to available height. + The logo, header and timers are anchored to the top left of the window. + The links and footer are anchored to the bottom left of the window. + The entire window is a fixed 4:3 scale, with a minimum margin around it. + */ + + /* Minimum margin around the window */ + int margin_size = 50; + + /* Right side of window (header, ransom note, BTC address, buttons) */ + const int right_pane_x = 270; + /* "oops" header */ + const int header_y = 5; + /* Ransom note */ + const int ransom_y = 40; + /* Footer area */ + const int footer_height = 100; + + /* Left pane (deadlines, countdown, links) */ + const int left_pane_width = right_pane_x - 5; + /* Logo (shown at top left corner) */ + int logo_x = (left_pane_width - pix_w) / 2; + int logo_y = 10; + /* Deadline position */ + const int deadline_y = 130; + /* Links height */ + const int links_height = 100; + const int links_x = 20; + + /* main window text */ + unsigned long fg = bst->fg; + unsigned long bg = bst->bg; + /* ransom note */ + unsigned long fg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.foreground2", + "Ransomware.Foreground"); + unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.background2", + "Ransomware.Background"); + /* buttons */ + unsigned long fg3 = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.foreground3", + "Ransomware.Foreground"); + unsigned long bg3 = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.background3", + "Ransomware.Background"); + /* links */ + unsigned long link = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.link", + "Ransomware.Foreground"); + /* headers */ + unsigned long theader = get_pixel_resource (dpy, bst->xgwa.colormap, + "ransomware.timerheader", + "Ransomware.Foreground"); + + const char *lines[] = { + "*What Happened To My Computer?\n", + "Your important pixels are paintcrypted. All of your documents, photos, ", + "videos, databases, icons, dick pics are not accessible because they ", + "have been bitblted. Maybe you are looking for a way to get them back, ", + "but don't waste your time. Nobody can recover your pixels without our ", + "pointer motion clicker services.\n", + "\n", + "*Can I Recover My Important Dick Pix?\n", + "Yes. We guarantee that you can recover them safely and easily. But you ", + "not have much time.\n", + "You can expose some files for free. Try it now by pressing .\n", + "But if you want to unsave all your screens, then you need to pay. ", + "You have only 3 days to click. After that the clicks will double. ", + "After 7 days your pixels will be gone forever.\n", + "We will have free events for cheapskates who can't pay in 6 months, ", + "long after all the pixels are xored.\n", + "\n", + "*How do I pay?\n", + "Payment is accepted in ", "[C]", + " only. For more information, press .", + " Please check the current price of ", "[C]", " and buy some ", "[C]", + ". For more information, press .\n", + "And send the correct amount to the address specified below. After your ", + "payment, press . Best time to check: 4-6am, Mon-Fri.\n", + "\n", + "*Why Did I Get This?\n", + "You got this because ", "[Q]", + ". Also you didn't click hard enough and now Tinkerbelle is dead.\n", + "\n", + "*But Aren't Screensavers Are Necessary?\n", + "WELL ACTUALLY, screensavers aren't really nescessary anymore because ", + "[S]", ".\n", + "\n", + "Please file complaints to @POTUS on Twitter.\n", + "\n" + "\n" + "\n" + "\n", + "*GREETZ TO CRASH OVERRIDE AND ALSO JOEY\n", + }; + + /* Make a 4:3 ratio box inside of the workspace */ + int box_width = bst->xgwa.width - (margin_size * 2); + int box_height = bst->xgwa.height - bst->yoff - (margin_size * 2); + int box_x = margin_size; + int box_y = margin_size; + if ((bst->xgwa.width / 4) * 3 > bst->xgwa.height) { + /* Widescreen, make narrow bits */ + box_width = (bst->xgwa.height * 4 / 3) - (margin_size * 2); + box_x = (bst->xgwa.width - box_width) / 2; + } else { + /* Narrowscreen, make wide bits */ + box_height = (bst->xgwa.width * 3 / 4) - (margin_size * 2); + box_y = (bst->xgwa.height - bst->yoff - box_height) / 2; + } + + if (box_width < 750 && box_x == margin_size) { + /* Not much width... */ + box_width = bst->xgwa.width; + box_x = 0; + } + + + bst->xoff = bst->left_margin = bst->right_margin = 0; + + if (!(random() % 8)) + return apple2ransomware (dpy, window); + + /* Grab the desktop image */ + /* BSOD_IMG (bst); */ + bst->wrap_p = True; + + /* Draw the main red window */ + BSOD_INVERT (bst); + BSOD_RECT (bst, True, box_x, box_y, box_width, box_height); + + if (pixmap) { + bst->pixmap = pixmap; + BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, box_x + logo_x, box_y + logo_y); + } + + /* Setup deadlines */ + strftime (stage1_deadline_str, sizeof(stage1_deadline_str), + "%m/%d/%Y %H:%M:%S\n\n", localtime(&stage1_deadline)); + strftime (stage2_deadline_str, sizeof(stage1_deadline_str), + "%m/%d/%Y %H:%M:%S\n\n", localtime(&stage2_deadline)); + + BSOD_INVERT (bst); + /* Draw header pane */ + BSOD_FONT (bst, 0); + BSOD_MOVETO (bst, box_x + right_pane_x, box_y + header_y + bst->fontA->ascent); + BSOD_MARGINS (bst, box_x + right_pane_x, box_x); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, CENTER, header_quip); + + /* Draw left-side timers */ + BSOD_MOVETO (bst, box_x, box_y + deadline_y); + BSOD_MARGINS (bst, box_x, box_x + box_width - left_pane_width); + BSOD_FONT (bst, 1); + + BSOD_COLOR (bst, theader, bg); + BSOD_TEXT (bst, CENTER, "Payment will be raised on\n"); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, CENTER, stage1_deadline_str); + + BSOD_TEXT (bst, CENTER, "Time Left\n"); + stage1_countdown_y = (line_height * 4) + box_y + deadline_y; + BSOD_TEXT (bst, CENTER, "\n"); + BSOD_TEXT (bst, CENTER, "\n\n"); + + BSOD_COLOR (bst, theader, bg); + BSOD_TEXT (bst, CENTER, "Your pixels will be lost on\n"); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, CENTER, stage2_deadline_str); + + BSOD_TEXT (bst, CENTER, "Time Left\n"); + stage2_countdown_y = (line_height * 9) + box_y + deadline_y; + BSOD_TEXT (bst, CENTER, "\n"); + + /* Draw links */ + BSOD_FONT (bst, 1); + BSOD_MOVETO (bst, box_x + links_x, box_y + box_height - links_height); + BSOD_MARGINS (bst, box_x + links_x, box_x + box_width - left_pane_width); + BSOD_COLOR (bst, link, bg); + + if (box_height > 425) { + /* Don't show this on small screens */ + BSOD_TEXT (bst, LEFT, "\n"); + BSOD_TEXT (bst, LEFT, "About "); + BSOD_TEXT (bst, LEFT, currency); + BSOD_TEXT (bst, LEFT, "\n\n" + "How to buy "); + BSOD_TEXT (bst, LEFT, currency); + BSOD_TEXT (bst, LEFT, "\n\n" + "Contact us\n"); + } + + /* Ransom note text area */ + BSOD_COLOR (bst, bg2, fg2); + BSOD_RECT (bst, True, box_x + right_pane_x, box_y + ransom_y, + box_width - right_pane_x - 10, + box_height - ransom_y - footer_height); + BSOD_MOVETO (bst, box_x + right_pane_x + 5, + box_y + ransom_y + (line_height * 1.1)); + BSOD_MARGINS (bst, box_x + right_pane_x + 5, box_x + 15); + /* VERT_MARGINS are a bit high, to ensure we draw as much text as we can in + * the box, even if the line is partially cut. We'll draw over this later. + */ + BSOD_VERT_MARGINS (bst, box_y + ransom_y, box_y + (footer_height / 2)); + BSOD_INVERT (bst); + + /* Write out the ransom note itself */ + BSOD_CROP (bst, True); + for (i = 0; i < countof(lines); i++) + { + const char *s = lines[i]; + if (!strcmp(s, "[C]")) s = currency; + else if (!strcmp(s, "[Q]")) s = excuse_quip; + else if (!strcmp(s, "[S]")) s = screensaver_quip; + + if (*s == '*') + { + s++; + BSOD_FONT (bst, 2); + } + else + BSOD_FONT (bst, 0); + + BSOD_TEXT (bst, LEFT, s); + } + BSOD_CROP (bst, False); + BSOD_FONT (bst, 0); + + /* Draw over any overflowing ransom text. */ + BSOD_COLOR (bst, bg, fg); + BSOD_RECT (bst, True, box_x + right_pane_x, + box_y + box_height - footer_height, + box_width - right_pane_x, footer_height); + + /* Draw the footer */ + BSOD_COLOR (bst, theader, bg); + BSOD_MOVETO (bst, box_x + right_pane_x, + box_y + box_height - footer_height + line_height); + + sprintf(buf, "Send $%.2f of %s to this address:\n", 101+frand(888), currency); + BSOD_TEXT (bst, LEFT, buf); + BSOD_COLOR (bst, fg2, bg2); + + /* address, has some extra slashes in there because it's a fake address */ + for (i = 0; i < 40; i++) { + const char *s = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123459789"; + buf[i] = s[random() % strlen(s)]; + } + strncpy (buf, " //", 3); + buf[10] = '/'; + buf[17] = '/'; + buf[24] = '/'; + strcpy (buf+33, " "); + BSOD_TEXT (bst, LEFT, buf); + + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, LEFT, " "); + BSOD_COLOR (bst, fg3, bg3); + BSOD_TEXT (bst, LEFT, " Copy "); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, LEFT, "\n\n"); + + BSOD_COLOR (bst, fg3, bg3); + BSOD_TEXT (bst, LEFT, " Demogrify Screen "); + BSOD_COLOR (bst, fg, bg); + BSOD_TEXT (bst, LEFT, " "); + BSOD_COLOR (bst, fg3, bg3); + BSOD_TEXT (bst, LEFT, " Check Payment "); + + + /* Draw countdown timers */ + BSOD_COLOR (bst, fg, bg); + BSOD_FONT (bst, 0); + do { + /* First timer */ + BSOD_MOVETO (bst, box_x, stage1_countdown_y); + BSOD_MARGINS (bst, box_x, box_x + box_width - left_pane_width); + + countdown_r = stage1_deadline - now; + countdown_s = countdown_r % 60; + countdown_m = (countdown_r / 60) % 60; + countdown_h = (countdown_r / 3600) % 24; + countdown_d = (countdown_r / 86400); + + sprintf (countdown_str, "%02d:%02d:%02d:%02d\n", + countdown_d, countdown_h, countdown_m, countdown_s); + + BSOD_TEXT (bst, CENTER, countdown_str); + + /* Second timer */ + BSOD_MOVETO (bst, box_x, stage2_countdown_y); + + countdown_r = stage2_deadline - now; + countdown_s = countdown_r % 60; + countdown_m = (countdown_r / 60) % 60; + countdown_h = (countdown_r / 3600) % 24; + countdown_d = (countdown_r / 86400); + + sprintf (countdown_str, "%02d:%02d:%02d:%02d\n", + countdown_d, countdown_h, countdown_m, countdown_s); + + BSOD_TEXT (bst, CENTER, countdown_str); + + BSOD_PAUSE (bst, 1000000); + now++; + + /* While the "correct" thing to do is create enough of a script to fill the + * stage2_deadline, this would be 7 days of "frames", which is quite a bit + * of memory. Instead, only fill the buffer with 1 hour of frames, which is + * enough to make the point before xscreensaver cycles us. + */ + } while (stage1_deadline - now > 3600); + + XClearWindow (dpy, window); + return bst; +} + + +/* As seen in Portal 2. By jwz. + */ +static struct bsod_state * +glados (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "glaDOS", "GlaDOS"); + const char * panicstr[] = { + "\n", + "MOLTEN CORE WARNING\n", + "\n", + "An operator error exception has occurred at FISSREAC0020093:09\n", + "FISSREAC0020077:14 FISSREAC0020023:17 FISSREAC0020088:22\n", + "neutron multiplication rate at spikevalue 99999999\n", + "\n", + "* Press any key to vent radiological emissions into atmosphere.\n", + "* Consult reactor core manual for instructions on proper reactor core\n", + "maintenance and repair.\n", + "\n", + "Press any key to continue\n", + }; + + int i; + + bst->xoff = bst->left_margin = bst->right_margin = 0; + + bst->y = ((bst->xgwa.height - bst->yoff - + ((bst->font->ascent + bst->font->descent) * countof(panicstr))) + / 2); + + BSOD_MOVETO (bst, 0, bst->y); + BSOD_INVERT (bst); + BSOD_TEXT (bst, CENTER, "OPERATOR ERROR\n"); + BSOD_INVERT (bst); + for (i = 0; i < countof(panicstr); i++) + BSOD_TEXT (bst, CENTER, panicstr[i]); + BSOD_PAUSE (bst, 1000000); + BSOD_INVERT (bst); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_INVERT (bst); + BSOD_PAUSE (bst, 250000); + BSOD_RESET (bst); + + XClearWindow (dpy, window); + return bst; +} + + /* SCO OpenServer 5 panic, by Tom Kelly */ @@ -1031,7 +1932,7 @@ sco (Display *dpy, Window window) "** Press Any Key to Reboot **\n" ); - bst->y = ((bst->xgwa.height - + bst->y = ((bst->xgwa.height - bst->yoff - ((bst->font->ascent + bst->font->descent) * 18))); XClearWindow (dpy, window); @@ -1044,9 +1945,11 @@ sco (Display *dpy, Window window) static struct bsod_state * sparc_linux (Display *dpy, Window window) { - struct bsod_state *bst = make_bsod_state (dpy, window, "sco", "SCO"); + struct bsod_state *bst = make_bsod_state (dpy, window, + "sparclinux", "SparcLinux"); bst->scroll_p = True; - bst->y = bst->xgwa.height - bst->font->ascent - bst->font->descent; + bst->y = bst->xgwa.height - bst->yoff + - bst->font->ascent - bst->font->descent; BSOD_TEXT (bst, LEFT, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" @@ -1128,7 +2031,7 @@ bsd (Display *dpy, Window window) BSOD_TEXT (bst, LEFT, (b ? "damn!" : "sunk!")); BSOD_TEXT (bst, LEFT, "\nRebooting\n"); - bst->y = ((bst->xgwa.height - + bst->y = ((bst->xgwa.height - bst->yoff - ((bst->font->ascent + bst->font->descent) * 4))); XClearWindow (dpy, window); @@ -1150,17 +2053,22 @@ amiga (Display *dpy, Window window) "amiga.background2", "Amiga.Background"); + bst->yoff = 0; + bst->top_margin = bst->bottom_margin = 0; + # ifdef DO_XPM pixmap = xpm_data_to_pixmap (dpy, window, (char **) amiga_hand, &pix_w, &pix_h, 0); # endif /* DO_XPM */ - if (pixmap && bst->xgwa.height > 600) /* scale up the bitmap */ + if (pixmap && + MIN (bst->xgwa.width, bst->xgwa.height) > 600) /* scale up the bitmap */ { pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth, pixmap, pix_w, pix_h); pix_w *= 2; pix_h *= 2; + lw *= 2; } XSetLineAttributes (dpy, bst->gc, lw, LineSolid, CapButt, JoinMiter); @@ -1238,7 +2146,7 @@ atari (Display *dpy, Window window) for (i = 1; i< 7; i++) BSOD_COPY (bst, x, y, pix_w, pix_h, (x + (i*offset)), y); - for (; i< 10; i++) + for (; i< 10; i++) { BSOD_PAUSE (bst, 1000000); BSOD_COPY (bst, x, y, pix_w, pix_h, (x + (i*offset)), y); @@ -1266,6 +2174,8 @@ mac (Display *dpy, Window window) const char *string = ("0 0 0 0 0 0 0 F\n" "0 0 0 0 0 0 0 3"); + bst->xoff = bst->left_margin = bst->right_margin = 0; + pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) mac_bits, mac_width, mac_height, bst->fg, bst->bg, bst->xgwa.depth); @@ -1399,6 +2309,8 @@ macsbug (Display *dpy, Window window) "macsbug.borderColor", "MacsBug.BorderColor"); + bst->xoff = bst->left_margin = bst->right_margin = 0; + for (s = body; *s; s++) if (*s == '\n') body_lines++; char_width = (bst->font->per_char @@ -1409,8 +2321,8 @@ macsbug (Display *dpy, Window window) col_right = char_width * 12; /* number of columns in `left' */ page_bottom = line_height * 47; /* number of lines in `left' */ - if (page_bottom > bst->xgwa.height) - page_bottom = bst->xgwa.height; + if (page_bottom > bst->xgwa.height - bst->yoff) + page_bottom = bst->xgwa.height - bst->yoff; row_bottom = page_bottom - line_height; row_top = row_bottom - (line_height * 4); @@ -1444,15 +2356,15 @@ macsbug (Display *dpy, Window window) BSOD_TEXT (bst, LEFT, bottom); BSOD_RECT (bst, True, xoff + col_right, yoff, 2, page_bottom); - BSOD_RECT (bst, True, xoff + col_right, yoff + row_top, + BSOD_RECT (bst, True, xoff + col_right, yoff + row_top, page_right - col_right, 1); - BSOD_RECT (bst, True, xoff + col_right, yoff + row_bottom, + BSOD_RECT (bst, True, xoff + col_right, yoff + row_bottom, page_right - col_right, 1); BSOD_RECT (bst, False, xoff-2, yoff, page_right+4, page_bottom); BSOD_LINE_DELAY (bst, 500); - BSOD_MOVETO (bst, - xoff + col_right + char_width, + BSOD_MOVETO (bst, + xoff + col_right + char_width, yoff + body_top + line_height); BSOD_MARGINS (bst, xoff + col_right + char_width, yoff); BSOD_TEXT (bst, LEFT, body); @@ -1488,6 +2400,16 @@ mac1 (Display *dpy, Window window) macbomb_width, macbomb_height, bst->fg, bst->bg, bst->xgwa.depth); + if (pixmap && + pix_w < bst->xgwa.width / 2 && + pix_h < bst->xgwa.height / 2) + { + pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, + bst->xgwa.depth, pixmap, pix_w, pix_h); + pix_w *= 2; + pix_h *= 2; + } + x = (bst->xgwa.width - pix_w) / 2; y = (bst->xgwa.height - pix_h) / 2; if (y < 0) y = 0; @@ -1526,6 +2448,18 @@ macx_10_0 (Display *dpy, Window window) pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac, &pix_w, &pix_h, &mask); +# ifdef HAVE_MOBILE + if (pixmap) + { + pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, + bst->xgwa.depth, pixmap, pix_w, pix_h); + mask = double_pixmap (dpy, bst->gc, bst->xgwa.visual, + 1, mask, pix_w, pix_h); + pix_w *= 2; + pix_h *= 2; + } +# endif + x = (bst->xgwa.width - pix_w) / 2; y = (bst->xgwa.height - pix_h) / 2; if (y < 0) y = 0; @@ -1577,61 +2511,324 @@ macx_10_0 (Display *dpy, Window window) # ifdef DO_XPM static struct bsod_state * -macx_10_2 (Display *dpy, Window window, Bool v10_3_p) +macx_10_2 (Display *dpy, Window window, Bool v10_3_p) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX"); + + Pixmap pixmap = 0; + int pix_w = 0, pix_h = 0; + int x, y; + + pixmap = xpm_data_to_pixmap (dpy, window, + (char **) (v10_3_p ? osx_10_3 : osx_10_2), + &pix_w, &pix_h, 0); + if (! pixmap) abort(); + +#if 0 + if (bst->xgwa.height > 600) /* scale up the bitmap */ + { + pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth, + pixmap, pix_w, pix_h); + if (! pixmap) abort(); + pix_w *= 2; + pix_h *= 2; + } +#endif + + BSOD_IMG (bst); + BSOD_PAUSE (bst, 2000000); + + bst->pixmap = pixmap; + + x = (bst->xgwa.width - pix_w) / 2; + y = ((bst->xgwa.height - pix_h) / 2); + BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y); + + return bst; +} +# endif /* DO_XPM */ + + +/* 2006 Mac Mini with MacOS 10.6 failing with a bad boot drive. By jwz. + */ +static struct bsod_state * +mac_diskfail (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "macdisk", "Mac"); + int cw = (bst->font->per_char + ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width + : bst->font->min_bounds.width); + int h = bst->font->ascent + bst->font->descent; + int L = (bst->xgwa.width - (cw * 80)) / 2; + int T = (bst->xgwa.height - (h * 10)) / 2; + + unsigned long fg = bst->fg; + unsigned long bg = bst->bg; + unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "macx.background", + "Mac.Background"); + if (L < 0) L = 0; + if (T < 0) T = 0; + + bst->wrap_p = True; + bst->scroll_p = True; + + BSOD_COLOR(bst, bg2, bg); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_PAUSE (bst, 3000000); + + BSOD_COLOR(bst, bg, fg); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_COLOR(bst, fg, bg); + + BSOD_MARGINS (bst, L, L); + BSOD_MOVETO (bst, L, T); + + BSOD_TEXT (bst, LEFT, + "efiboot loaded from device: Acpi(PNP0A03,0)/Pci*1F|2)/Ata" + "(Primary,Slave)/HD(Part\n" + "2,Sig8997E427-064E-4FE7-8CB9-F27A784B232C)\n" + "boot file path: \\System\\Library\\CoreServices\\boot.efi\n" + ".Loading kernel cache file 'System\\Library\\Caches\\" + "com.apple.kext.caches\\Startup\\\n" + "kernelcache_i386.2A14EC2C'\n" + "Loading 'mach_kernel'...\n" + ); + BSOD_CHAR_DELAY (bst, 7000); + BSOD_TEXT (bst, LEFT, + ".....................\n" + ); + BSOD_CHAR_DELAY (bst, 0); + BSOD_TEXT (bst, LEFT, + "root device uuid is 'B62181B4-6755-3C27-BFA1-49A0E053DBD6\n" + "Loading drivers...\n" + "Loading System\\Library\\Caches\\com.apple.kext.caches\\" + "Startup\\Extensions.mkext....\n" + ); + BSOD_CHAR_DELAY (bst, 7000); + BSOD_TEXT (bst, LEFT, + "..............................................................." + ".................\n" + "..............................................................." + ".................\n" + "..............\n" + ); + BSOD_INVERT (bst); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_INVERT (bst); + + BSOD_MARGINS (bst, 0, 0); + BSOD_MOVETO (bst, 0, h); + + BSOD_CHAR_DELAY (bst, 0); + BSOD_LINE_DELAY (bst, 5000); + BSOD_TEXT (bst, LEFT, + "npvhash=4095\n" + "PRE enabled\n" + "Darwin Kernel Version 10.8.9: Tue Jun 7 16:33:36 PDT 2011;" + " root:xnu-1504.15.3~1/RELEASE_I386\n" + "vm_page_bootstrap: 508036 free pages and 16252 wired pages\n" + "standard timeslicing quantum is 10000 us\n" + "mig_table_max_displ = 73\n" + "AppleACPICPU: ProcessorId=0 LocalApicId=0 Enabled\n" + "AppleACPICPU: ProcessorId=1 LocalApicId=1 Enabled\n" + "calling npo_policy_init for Quarantine\n" + "Security policy loaded: Quaantine policy (Quarantine)\n" + "calling npo_policy_init for Sandbox\n" + "Security policy loaded: Seatbelt sandbox policy (Sandbox)\n" + "calling npo_policy_init for TMSafetyNet\n" + "Security policy loaded: Safety net for Time Machine " + "(TMSafetyNet)\n" + "Copyright (c) 1982, 1986, 1989, 1991, 1993\n" + "The Regents of the University of California. All rights " + "reserved.\n" + "\n" + "MAC Framework successfully initialized\n" + "using 10485 buffer headers and 4096 cluster IO buffer headers\n" + "IOAPIC: Version 0x20 Vectors 64:87\n" + "ACPI: System State [S0 S3 S4 S5] (S3)\n" + "PFM64 0x10000000, 0xf0000000\n" + "[ PCI configuration begin ]\n" + "PCI configuration changed (bridge=1 device=1 cardbus=0)\n" + "[ PCI configuration end, bridges 4 devices 17 ]\n" + "nbinit: done (64 MB memory set for nbuf pool)\n" + "rooting via boot-uuid from /chosen: " + "B62181B4-6755-3C27-BFA1-49A0E053DBD6\n" + "Waiting on IOProviderClass" + "IOResourcesIOResourceMatch" + "boot-uuid-nedia\n" + "com.apple.AppleFSCCompressionTypeZlib kmod start\n" + "com.apple.AppleFSCCompressionTypeZlib kmod succeeded\n" + "AppleIntelCPUPowerManagementClient: ready\n" + "FireWire (OHCI) Lucent ID 5811 built-in now active, GUID " + "0019e3fffe97f8b4; max speed s400.\n" + "Got boot device = IOService:/AppleACPIPlatformExpert/PCI000/" + "AppleACPIPCI/SATA@1F,2/AppleAHCI/PRI202/IOAHCIDevice@0/" + "AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/" + "IOBlockStorageDriver/ST96812AS Media/IOGUIDPartitionScheme/" + "Customer02\n" + ); + BSOD_PAUSE (bst, 1000000); + BSOD_TEXT (bst, LEFT, + "BSD root: Disk0s, major 14, minor 2\n" + "[Bluetooth::CSRHIDTransition] switchtoHCIMode (legacy)\n" + "[Bluetooth::CSRHIDTransition] transition complete.\n" + "CSRUSBBluetoothHCIController::setupHardware super returned 0\n" + ); + BSOD_PAUSE (bst, 3000000); + BSOD_TEXT (bst, LEFT, + "disk0s2: I/O error.\n" + "0 [Level 3] [ReadUID 0] [Facility com.apple.system.fs] " + "[ErrType IO] [ErrNo 5] [IOType Read] [PBlkNum 48424] " + "[LBlkNum 1362] [FSLogMsgID 2009724291] [FSLogMsgOrder First]\n" + "0 [Level 3] [ReadUID 0] [Facility com.apple.system.fs] " + "[DevNode root_device] [MountPt /] [FSLogMsgID 2009724291] " + "[FSLogMsgOrder Last]\n" + "panic(cpu 0 caller 0x47f5ad): \"Process 1 exec of /sbin/launchd" + " failed, errno 5\\n\"0/SourceCache/xnu/xnu-1504.15.3/bsd/kern/" + "kern_exec.c:3145\n" + "Debugger called: \n" + "Backtrace (CPU 0), Frame : Return Address (4 potential args " + "on stack)\n" + "0x34bf3e48 : 0x21b837 (0x5dd7fc 0x34bf3e7c 0x223ce1 0x0)\n" + "0x34bf3e98 : 0x47f5ad (0x5cf950 0x831c08 0x5 0x0)\n" + "0x34bf3ef8 : 0x4696d2 (0x4800d20 0x1fe 0x45a69a0 0x80000001)\n" + "0x34bf3f38 : 0x48fee5 (0x46077a8 0x84baa0 0x34bf3f88 " + "0x34bf3f94)\n" + "0x34bf3f68 : 0x219432 (0x46077a8 0xffffff7f 0x0 0x227c4b)\n" + "0x34bf3fa8 : 0x2aacb4 (0xffffffff 0x1 0x22f8f5 0x227c4b)\n" + "0x34bf3fc8 : 0x2a1976 (0x0 0x0 0x2a17ab 0x4023ef0)\n" + "\n" + "BSD process name corresponding to current thread: init\n" + "\n" + "Mac OS version:\n" + "Not yet set\n" + "\n" + "Kernel version:\n" + "Darwin Kernel version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; " + "root:xnu-1504.15-3~1/RELEASE_I386\n" + "System model name: Macmini1,1 (Mac-F4208EC0)\n" + "\n" + "System uptime in nanoseconds: 13239332027\n" + ); + BSOD_CURSOR (bst, CURSOR_BLOCK, 500000, 999999); + + XClearWindow (dpy, window); + + return bst; +} + + +/* 2017 MacOS 10.12 interminable software update, by jwz. + */ +static struct bsod_state * +macx_install (Display *dpy, Window window) { - struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX"); + struct bsod_state *bst = make_bsod_state (dpy, window, "macinstall", "MacX"); Pixmap pixmap = 0; - int pix_w = 0, pix_h = 0; + int pix_w = apple_width; + int pix_h = apple_height; int x, y; + int bw1, bh1; + int bw2, bh2; + + unsigned long fg = get_pixel_resource (dpy, bst->xgwa.colormap, + "macinstall.foreground", + "Mac.Foreground"); + unsigned long bg = get_pixel_resource (dpy, bst->xgwa.colormap, + "macinstall.background", + "Mac.Background"); + unsigned long fg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "macinstall.barForeground", + "Mac.Foreground"); + unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "macinstall.barBackground", + "Mac.Background"); + char buf[1024]; + int lh = bst->font->ascent + bst->font->descent; + int i, min; + double pct; - pixmap = xpm_data_to_pixmap (dpy, window, - (char **) (v10_3_p ? osx_10_3 : osx_10_2), - &pix_w, &pix_h, 0); - if (! pixmap) abort(); - -#if 0 - if (bst->xgwa.height > 600) /* scale up the bitmap */ - { - pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth, - pixmap, pix_w, pix_h); - if (! pixmap) abort(); - pix_w *= 2; - pix_h *= 2; - } -#endif - - BSOD_IMG (bst); - BSOD_PAUSE (bst, 2000000); + bst->xoff = bst->left_margin = bst->right_margin = 0; + pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) apple_bits, + apple_width, apple_height, + fg, bg, bst->xgwa.depth); bst->pixmap = pixmap; x = (bst->xgwa.width - pix_w) / 2; - y = ((bst->xgwa.height - pix_h) / 2); + y = (bst->xgwa.height) / 2 - pix_h; + if (y < 0) y = 0; + + XSetLineAttributes (dpy, bst->gc, 1, LineSolid, CapRound, JoinMiter); + + BSOD_COLOR(bst, bg, bg); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_COLOR(bst, fg, bg); BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y); + y += pix_h * 2 - lh; + + /* progress bar */ + bw1 = pix_w * 2.5; + bh1 = lh * 0.66; + if (bh1 < 8) bh1 = 8; + + x = (bst->xgwa.width - bw1) / 2; + BSOD_COLOR(bst, fg2, bg); + BSOD_LINE (bst, x, y, x + bw1, y, bh1); + + bw2 = bw1 - 1; + bh2 = bh1 - 4; + BSOD_COLOR(bst, bg2, bg); + BSOD_LINE (bst, x+1, y, x + bw2, y, bh2); + + BSOD_COLOR(bst, fg, bg); + BSOD_LINE (bst, x, y, x + 1, y, bh1); + + pct = 5 + (random() % 40); + min = 5 + (random() % 40); + + for (i = 0; i < 100; i++) { + pct += frand(0.3); + min += (random() % 3) - 1; /* sometimes down, mostly up */ + + if (pct > 90) pct = 90; + BSOD_RECT (bst, True, x, y - bh1/2, bw1 * pct / 100, bh1); + + sprintf (buf, " Installing Software Update: about %d minutes. ", min); + bst->y = y + lh * 3; + BSOD_TEXT (bst, CENTER, buf); + BSOD_PAUSE (bst, 1000000); + } return bst; } -# endif /* DO_XPM */ static struct bsod_state * macx (Display *dpy, Window window) { # ifdef DO_XPM - switch (random() % 3) { + switch (1?4:random() % 5) { case 0: return macx_10_0 (dpy, window); break; case 1: return macx_10_2 (dpy, window, False); break; case 2: return macx_10_2 (dpy, window, True); break; + case 3: return mac_diskfail (dpy, window); break; + case 4: return macx_install (dpy, window); break; default: abort(); } # else /* !DO_XPM */ - return macx_10_0 (dpy, window); + switch (random() % 3) { + case 0: return macx_10_0 (dpy, window); break; + case 1: return macx_install (dpy, window); break; + default: return mac_diskfail (dpy, window); break; + } # endif /* !DO_XPM */ } -#ifndef HAVE_COCOA /* #### I have no idea how to implement this without +#ifndef HAVE_JWXYZ /* #### I have no idea how to implement this without real plane-masks. I don't think it would look right if done with alpha-transparency... */ /* blit damage @@ -1645,7 +2842,7 @@ macx (Display *dpy, Window window) static struct bsod_state * blitdamage (Display *dpy, Window window) { - struct bsod_state *bst = + struct bsod_state *bst = make_bsod_state (dpy, window, "blitdamage", "BlitDamage"); int i; @@ -1653,48 +2850,45 @@ blitdamage (Display *dpy, Window window) int w, h; int chunk_h, chunk_w; int steps; - long gc_mask = 0; int src_x, src_y; int x, y; - + w = bst->xgwa.width; h = bst->xgwa.height; - gc_mask = GCForeground; - XSetPlaneMask (dpy, bst->gc, random()); steps = 50; chunk_w = w / (random() % 1 + 1); chunk_h = h / (random() % 1 + 1); - if (random() & 0x1000) + if (random() & 0x1000) delta_y = random() % 600; if (!delta_y || (random() & 0x2000)) delta_x = random() % 600; - src_x = 0; - src_y = 0; + src_x = 0; + src_y = 0; x = 0; y = 0; - + BSOD_IMG (bst); for (i = 0; i < steps; i++) { - if (x + chunk_w > w) + if (x + chunk_w > w) x -= w; else x += delta_x; - + if (y + chunk_h > h) y -= h; else y += delta_y; - + BSOD_COPY (bst, src_x, src_y, chunk_w, chunk_h, x, y); BSOD_PAUSE (bst, 1000); } return bst; } -#endif /* !HAVE_COCOA */ +#endif /* !HAVE_JWXYZ */ /* @@ -1850,7 +3044,7 @@ os2 (Display *dpy, Window window) /* SPARC Solaris panic. Should look pretty authentic on Solaris boxes. * Anton Solovyev - */ + */ static struct bsod_state * sparc_solaris (Display *dpy, Window window) { @@ -1861,13 +3055,13 @@ sparc_solaris (Display *dpy, Window window) bst->wrap_p = True; bst->left_margin = bst->right_margin = bst->xgwa.width * 0.07; bst->top_margin = bst->bottom_margin = bst->xgwa.height * 0.07; - bst->y = bst->top_margin + bst->font->ascent; + bst->y = bst->top_margin + bst->yoff + bst->font->ascent; BSOD_IMG (bst); BSOD_PAUSE (bst, 3000000); BSOD_INVERT(bst); - BSOD_RECT (bst, True, + BSOD_RECT (bst, True, bst->left_margin, bst->top_margin, bst->xgwa.width - bst->left_margin - bst->right_margin, bst->xgwa.height - bst->top_margin - bst->bottom_margin); @@ -1938,6 +3132,9 @@ linux_fsck (Display *dpy, Window window) int i; const char *sysname; char buf[1024]; +# ifdef HAVE_UNAME + struct utsname uts; +#endif /* UNAME */ const char *linux_panic[] = { " kernel: Unable to handle kernel paging request at virtual " @@ -1980,7 +3177,6 @@ linux_fsck (Display *dpy, Window window) sysname = "linux"; # ifdef HAVE_UNAME { - struct utsname uts; char *s; if (uname (&uts) >= 0) sysname = uts.nodename; @@ -1999,7 +3195,7 @@ linux_fsck (Display *dpy, Window window) BSOD_CHAR_DELAY (bst, 300000); BSOD_TEXT (bst, LEFT, ".........\n"); BSOD_CHAR_DELAY (bst, 0); - BSOD_TEXT (bst, LEFT, + BSOD_TEXT (bst, LEFT, "xinit: X server slow to shut down, sending KILL signal.\n" "waiting for server to die "); BSOD_CHAR_DELAY (bst, 300000); @@ -2166,7 +3362,7 @@ linux_fsck (Display *dpy, Window window) if (0 == random() % 10) goto PANIC; - BSOD_TEXT (bst, LEFT, + BSOD_TEXT (bst, LEFT, "Pass 3: Checking directory connectivity\n" "/lost+found not found. Create? yes\n"); BSOD_PAUSE (bst, 2000000); @@ -2174,7 +3370,7 @@ linux_fsck (Display *dpy, Window window) /* Unconnected directory inode 4949 (/var/spool/squid/06/???) Connect to /lost+found? yes - '..' in /var/spool/squid/06/08 (20351) is (0), should be + '..' in /var/spool/squid/06/08 (20351) is (0), should be /var/spool/squid/06 (20350). Fix? yes @@ -2281,12 +3477,16 @@ linux_fsck (Display *dpy, Window window) static struct bsod_state * hppa_linux (Display *dpy, Window window) { - struct bsod_state *bst = + struct bsod_state *bst = make_bsod_state (dpy, window, "hppalinux", "HPPALinux"); int i = 0; const char *release, *sysname, *gccversion, *version; long int linedelay = 0; + char ss[1024]; +# ifdef HAVE_UNAME + struct utsname uts; +# endif /* UNAME */ __extension__ struct { long int delay; const char *string; } linux_panic[] = @@ -2362,7 +3562,7 @@ hppa_linux (Display *dpy, Window window) { -1, "Soft power switch enabled, polling @ 0xf0400804.\n" }, { -1, "pty: 256 Unix98 ptys configured\n" }, { -1, "Generic RTC Driver v1.07\n" }, - { -1, "Serial: 8250/16550 driver $Revision: 1.90 $ 13 ports, " + { -1, "Serial: 8250/16550 driver $" "Revision: 1.100 $ 13 ports, " "IRQ sharing disabled\n" }, { -1, "ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A\n" }, { -1, "ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A\n" }, @@ -2427,7 +3627,6 @@ hppa_linux (Display *dpy, Window window) version = "#2 Mon Dec 8 06:09:27 GMT 2003"; # ifdef HAVE_UNAME { - struct utsname uts; char *s; if (uname (&uts) >= 0) { @@ -2451,8 +3650,7 @@ hppa_linux (Display *dpy, Window window) /* Insert current host name into banner on line 2 */ { - char ss[1024]; - snprintf (ss, 1024, linux_panic[1].string, + snprintf (ss, 1024, linux_panic[1].string, release, sysname, gccversion, version); linux_panic[1].string = ss; } @@ -2467,7 +3665,8 @@ hppa_linux (Display *dpy, Window window) i++; } - bst->y = bst->xgwa.height - bst->font->ascent - bst->font->descent; + bst->y = bst->xgwa.height - bst->yoff + - bst->font->ascent - bst->font->descent; XClearWindow(dpy, window); return bst; @@ -2488,6 +3687,9 @@ vms (Display *dpy, Window window) char *s, *s1; int i; int arg_count; +# ifdef HAVE_UNAME + struct utsname uts; +# endif /* UNAME */ __extension__ @@ -2560,7 +3762,6 @@ vms (Display *dpy, Window window) sysname = "VMS001"; # ifdef HAVE_UNAME { - struct utsname uts; if (uname (&uts) >= 0) sysname = uts.nodename; s = strchr (sysname, '.'); @@ -2662,7 +3863,8 @@ hvx (Display *dpy, Window window) bst->scroll_p = True; bst->wrap_p = True; - bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent; + bst->y = bst->xgwa.height - bst->bottom_margin - bst->yoff + - bst->font->ascent; BSOD_CHAR_DELAY (bst, 10000); BSOD_TEXT (bst, LEFT, @@ -2721,17 +3923,20 @@ hvx (Display *dpy, Window window) static struct bsod_state * hpux (Display *dpy, Window window) { - struct bsod_state *bst = make_bsod_state (dpy, window, "hvx", "HVX"); + struct bsod_state *bst = make_bsod_state (dpy, window, "hpux", "HPUX"); const char *sysname; char buf[2048]; +# ifdef HAVE_UNAME + struct utsname uts; +# endif /* UNAME */ bst->scroll_p = True; - bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent; + bst->y = bst->xgwa.height - bst->bottom_margin - bst->yoff + - bst->font->ascent; sysname = "HPUX"; # ifdef HAVE_UNAME { - struct utsname uts; char *s; if (uname (&uts) >= 0) sysname = uts.nodename; @@ -2823,7 +4028,7 @@ hpux (Display *dpy, Window window) for (i = 0; i <= steps; i++) { if (i > steps) i = steps; - sprintf (buf, + sprintf (buf, "*** Dumping: %3d%% complete (%d of 40 MB) (device 64:0x2)\r", i * 100 / steps, i * size / steps); @@ -2850,7 +4055,8 @@ os390 (Display *dpy, Window window) struct bsod_state *bst = make_bsod_state (dpy, window, "os390", "OS390"); bst->scroll_p = True; - bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent; + bst->y = bst->xgwa.height - bst->bottom_margin - bst->yoff + - bst->font->ascent; BSOD_LINE_DELAY (bst, 100000); BSOD_TEXT (bst, LEFT, @@ -2912,14 +4118,17 @@ tru64 (Display *dpy, Window window) struct bsod_state *bst = make_bsod_state (dpy, window, "tru64", "Tru64"); const char *sysname; char buf[2048]; +# ifdef HAVE_UNAME + struct utsname uts; +#endif /* UNAME */ bst->scroll_p = True; - bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent; + bst->y = bst->xgwa.height - bst->bottom_margin - bst->yoff + - bst->font->ascent; sysname = "127.0.0.1"; # ifdef HAVE_UNAME { - struct utsname uts; if (uname (&uts) >= 0) sysname = uts.nodename; } @@ -2976,7 +4185,7 @@ tru64 (Display *dpy, Window window) BSOD_PAUSE (bst, 3000000); BSOD_TEXT (bst, LEFT, - "\n" + "\n" "CPU 0 booting\n" "\n" "\n" @@ -3145,7 +4354,7 @@ nvidia_draw (struct bsod_state *bst) nvs->tick++; if ((random() % 5) == 0) /* change the display */ - nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, + nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, countof(nvs->bits), False); return 250000; @@ -3201,7 +4410,7 @@ nvidia (Display *dpy, Window window) if (!nvs->gc1) nvs->gc1 = XCreateGC (dpy, nvs->bits[i], 0, &gcv); XSetForeground (dpy, nvs->gc1, 0); - XFillRectangle (dpy, nvs->bits[i], nvs->gc1, 0, 0, + XFillRectangle (dpy, nvs->bits[i], nvs->gc1, 0, 0, nvs->cellw, nvs->cellh); XSetForeground (dpy, nvs->gc1, 1); @@ -3215,10 +4424,10 @@ nvidia (Display *dpy, Window window) /* Randomize the grid */ - nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, + nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, countof(nvs->bits), True); for (i = 0; i < 20; i++) - nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, + nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors, countof(nvs->bits), False); return bst; @@ -3237,7 +4446,7 @@ nvidia (Display *dpy, Window window) * The Apple ][ logic and video hardware is in apple2.c. The TV is emulated by * analogtv.c for maximum realism * - * Trevor Blackwell + * Trevor Blackwell */ static const char * const apple2_basic_errors[]={ @@ -3284,10 +4493,10 @@ static void a2controller_crash(apple2_sim_t *sim, int *stepno, if (!sim->controller_data) sim->controller_data = calloc(sizeof(struct mydata),1); mine=(struct mydata *) sim->controller_data; - + switch(*stepno) { case 0: - + a2_init_memory_active(sim); sim->dec->powerup = 1000.0; @@ -3476,6 +4685,7 @@ static void a2controller_crash(apple2_sim_t *sim, int *stepno, case A2CONTROLLER_FREE: free(mine); + mine = 0; break; } } @@ -3518,6 +4728,137 @@ apple2crash (Display *dpy, Window window) } +static void +a2controller_ransomware(apple2_sim_t *sim, int *stepno, + double *next_actiontime) +{ + apple2_state_t *st=sim->st; + + struct mydata { + const char *str; + Bool bold_p; + } *mine; + + if (!sim->controller_data) + sim->controller_data = calloc(sizeof(struct mydata),1); + mine=(struct mydata *) sim->controller_data; + + switch(*stepno) { + case 0: + + st->gr_mode |= A2_GR_FULL; + a2_cls(st); + a2_goto(st,0,16); + a2_prints(st, "APPLE ]["); + a2_goto(st,2,0); + *stepno = 10; + *next_actiontime += 2; + break; + + case 10: + a2_prints(st, "READY\n\n"); + *stepno = 11; + *next_actiontime += 1; + break; + + case 11: + a2_goto(st, 1, 0); + *stepno = 12; + mine->str = + ("\n" + " _____________________________________\n" + "/ \\\n" + "! OOPS YOUR FILES HAVE BEEN ENCRYPTED !\n" + "! ________________________ !\n" + "! ! ! !\n" + "! [/--\\] ! [ WHAT HAPPENED TO MY ] ! !\n" + "! [!] [!] ! [ COMPUTER? ] ! !\n" + "! [!] [!] ! ! !\n" + "! [######] ! [ CAN I RECOVER MY ] ! !\n" + "! [######] ! [ FILES? ] ! !\n" + "! [######] ! ! !\n" + "! [######] ! [ HOW DO I PAY? ] ! !\n" + "! ! ! !\n" + "! !________________________! !\n" + "! !\n" + "! BITCOIN ACCEPTED HERE !\n" + "\\_____________________________________/\n" + "\n" + "\n" + "WAITING FOR BLOCKCHAIN..@\n" + "\n" + "PLEASE INSERT NEXT FLOPPY: " + ); + break; + + case 12: + { + char c = *mine->str; + mine->str++; + + if (c == 0) + { + *next_actiontime += 30; + *stepno = 0; + } + else if (c == '[') + mine->bold_p++; + else if (c == ']') + mine->bold_p--; + else + { + if (c == '@') + { + c = '.'; + *next_actiontime += 2; + } + + if (mine->bold_p) + c |= 0xC0; + a2_printc_noscroll(st, c); + if (c == '.') + *next_actiontime += 1; + } + } + break; + + case A2CONTROLLER_FREE: + return; + } +} + + +static int +a2_ransomware_draw (struct bsod_state *bst) +{ + apple2_sim_t *sim = (apple2_sim_t *) bst->closure; + if (! sim) { + sim = apple2_start (bst->dpy, bst->window, 9999999, + a2controller_ransomware); + bst->closure = sim; + } + + if (! apple2_one_frame (sim)) { + bst->closure = 0; + } + + return 10000; +} + +static struct bsod_state * +apple2ransomware (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "apple2", "Apple2"); + bst->draw_cb = a2_ransomware_draw; + bst->free_cb = a2_free; + return bst; +} + + + +/* A crash spotted on a cash machine circa 2006, by jwz. I didn't note + what model it was; probably a Tranax Mini-Bank 1000 or similar vintage. + */ static struct bsod_state * atm (Display *dpy, Window window) { @@ -3535,7 +4876,7 @@ atm (Display *dpy, Window window) atm_width, atm_height, bst->fg, bst->bg, bst->xgwa.depth); - while (pix_w <= bst->xgwa.width * scale && + while (pix_w <= bst->xgwa.width * scale && pix_h <= bst->xgwa.height * scale) { pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth, @@ -3570,6 +4911,227 @@ atm (Display *dpy, Window window) } +/* An Android phone boot loader, by jwz. + */ +static struct bsod_state * +android (Display *dpy, Window window) +{ + struct bsod_state *bst = make_bsod_state (dpy, window, "android", "Android"); + + unsigned long bg = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.background", + "Android.Background"); + unsigned long fg = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.foreground", + "Android.Foreground"); + unsigned long c1 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color1", + "Android.Foreground"); + unsigned long c2 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color2", + "Android.Foreground"); + unsigned long c3 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color3", + "Android.Foreground"); + unsigned long c4 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color4", + "Android.Foreground"); + unsigned long c5 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color5", + "Android.Foreground"); + unsigned long c6 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color6", + "Android.Foreground"); + unsigned long c7 = get_pixel_resource (dpy, bst->xgwa.colormap, + "android.color7", + "Android.Foreground"); + + const char *lines0[] = { + "Calculating... please wait\n", + "osbl: 0x499DF907\n", + "amss: 0x73162409\n", + "hboot: 0xE46C3327\n", + "boot: 0xBA570E7A\n", + "recovery: 0xC8BBA213\n", + "system: 0x87C3B1F0\n", + "\n", + "Press power key to go back.\n", + }; + + const char *lines1[] = { + "Checking SD card update...\n", + "", + " SD Checking...\n", + " Failed to open zipfile\n", + " loading preload_content...\n", + " [Caution] Preload Content Not Found\n", + " loading HTCUpdateZipName image...\n", + "", + " Checking...[PG46IMG.zip]\n", + "Please plug off USB\n", + }; + + const char *lines2[] = { + " SD Checking...\n", + " Loading...[PK76DIAG.zip]\n", + " No image!\n", + " Loading...[PK76DIAG.nbh]\n", + " No image or wrong image!\n", + " Loading...[PK76IMG.zip]\n", + " No image!\n", + " Loading...[PK76IMG.nbh]\n", + " No image or wrong image!\n", + " Loading...[PK76IMG.tar]\n", + " No image!\n", + " Loading...[PK76IMG.aes]\n", + " No image!\n", + " Loading...[PK76IMG.enc]\n", + " No image!\n", + }; + + int cw = (bst->font->per_char + ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width + : bst->font->min_bounds.width); + int line_height = bst->font->ascent + bst->font->descent; + + int state = 0; + + Pixmap pixmap = 0; + int pix_w = 0, pix_h = 0; + +# ifdef DO_XPM + pixmap = xpm_data_to_pixmap (dpy, window, (char **) android_skate, + &pix_w, &pix_h, 0); + if (! pixmap) abort(); + bst->pixmap = pixmap; +# endif /* DO_XPM */ + + bst->left_margin = (bst->xgwa.width - (cw * 40)) / 2; + if (bst->left_margin < 0) bst->left_margin = 0; + + while (1) { + unsigned long delay = + ((state == 0 || + state == countof(lines0) || + state == countof(lines0) + countof(lines1) || + state == countof(lines0) + countof(lines1) + countof(lines2)) + ? 10000 : 0); + BSOD_LINE_DELAY (bst, delay); + + if (state <= countof(lines0) + countof(lines1) + countof(lines2)) + { + BSOD_COLOR (bst, bg, bg); + BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height); + BSOD_COLOR (bst, bg, c1); + BSOD_MOVETO (bst, bst->left_margin + bst->xoff, + bst->top_margin + bst->yoff + line_height); + BSOD_TEXT (bst, LEFT, "*** UNLOCKED ***\n"); + BSOD_COLOR (bst, c2, bg); + BSOD_TEXT (bst, LEFT, + "PRIMOU PVT SHIP S-OFF RL\n" + "HBOOT-1.17.0000\n" + "CPLD-None\n" + "MICROP-None\n" + "RADIO-3831.17.00.23_2\n" + "eMMC-bootmode: disabled\n" + "CPU-bootmode : disabled\n" + "HW Secure boot: enabled\n" + "MODEM PATH : OFF\n" + "May 15 2012, 10:28:15\n" + "\n"); + BSOD_COLOR (bst, bg, c3); + + if (pixmap) + { + int x = (bst->xgwa.width - pix_w) / 2; + int y = bst->xgwa.height - bst->yoff - pix_h; + BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y); + } + } + + if (state == countof(lines0) || + state == countof(lines0) + countof(lines1) || + state == countof(lines0) + countof(lines1) + countof(lines2)) + { + BSOD_TEXT (bst, LEFT, "HBOOT USB\n"); + BSOD_COLOR (bst, c4, bg); + BSOD_TEXT (bst, LEFT, + "\n" + " to previous item\n" + " to next item\n" + " to select item\n" + "\n"); + BSOD_COLOR (bst, c5, bg); BSOD_TEXT (bst, LEFT, "FASTBOOT\n"); + BSOD_COLOR (bst, c6, bg); BSOD_TEXT (bst, LEFT, "RECOVERY\n"); + BSOD_COLOR (bst, c7, bg); BSOD_TEXT (bst, LEFT, "FACTORY RESET\n"); + BSOD_COLOR (bst, c3, bg); BSOD_TEXT (bst, LEFT, "SIMLOCK\n"); + BSOD_COLOR (bst, bg, c3); BSOD_TEXT (bst, LEFT, "HBOOT USB\n"); + BSOD_COLOR (bst, fg, bg); BSOD_TEXT (bst, LEFT, "IMAGE CRC\n"); + BSOD_COLOR (bst, c3, bg); BSOD_TEXT (bst, LEFT, "SHOW BARCODE\n"); + BSOD_PAUSE (bst, 3000000); + } + else if (state < countof(lines0)) + { + BSOD_TEXT (bst, LEFT, "IMAGE CRC\n\n"); + BSOD_COLOR (bst, c5, bg); + { + int i; + for (i = 0; i <= state; i++) { + const char *s = lines0[i]; + BSOD_COLOR (bst, (strchr(s, ':') ? c7 : c3), bg); + BSOD_TEXT (bst, LEFT, s); + } + } + BSOD_PAUSE (bst, 500000); + if (state == countof(lines0)-1) + BSOD_PAUSE (bst, 2000000); + } + else if (state < countof(lines0) + countof(lines1)) + { + BSOD_TEXT (bst, LEFT, "HBOOT\n\n"); + BSOD_COLOR (bst, c5, bg); + { + int i; + for (i = countof(lines0); i <= state; i++) { + const char *s = lines1[i - countof(lines0)]; + BSOD_COLOR (bst, (*s == ' ' ? c6 : c3), bg); + BSOD_TEXT (bst, LEFT, s); + } + } + BSOD_PAUSE (bst, 500000); + if (state == countof(lines0) + countof(lines1) - 1) + BSOD_PAUSE (bst, 2000000); + } + else if (state < countof(lines0) + countof(lines1) + countof(lines2)) + { + BSOD_TEXT (bst, LEFT, "HBOOT USB\n\n"); + BSOD_COLOR (bst, c5, bg); + { + int i; + for (i = countof(lines0) + countof(lines1); i <= state; i++) { + const char *s = lines2[i - countof(lines0) - countof(lines1)]; + BSOD_COLOR (bst, (*s == ' ' ? c6 : c3), bg); + BSOD_TEXT (bst, LEFT, s); + } + } + BSOD_PAUSE (bst, 500000); + if (state == countof(lines0) + countof(lines1) + countof(lines2)-1) + BSOD_PAUSE (bst, 2000000); + } + else + break; + + state++; + } + + XClearWindow (dpy, window); + + return bst; +} + + + + /***************************************************************************** *****************************************************************************/ @@ -3581,6 +5143,8 @@ static const struct { { "Windows", windows_31 }, { "NT", windows_nt }, { "Win2K", windows_other }, + { "Win10", windows_10 }, + { "Ransomware", windows_ransomware }, { "Amiga", amiga }, { "Mac", mac }, { "MacsBug", macsbug }, @@ -3592,7 +5156,7 @@ static const struct { { "SparcLinux", sparc_linux }, { "BSD", bsd }, { "Atari", atari }, -#ifndef HAVE_COCOA +#ifndef HAVE_JWXYZ { "BlitDamage", blitdamage }, #endif { "Solaris", sparc_solaris }, @@ -3606,13 +5170,17 @@ static const struct { { "Nvidia", nvidia }, { "Apple2", apple2crash }, { "ATM", atm }, + { "GLaDOS", glados }, + { "Android", android }, + { "VMware", vmware }, }; struct driver_state { const char *name; - int only, which; - int delay; + int only, which, next_one; + int mode_duration; + int delay_remaining; time_t start; Bool debug_p, cycle_p; struct bsod_state *bst; @@ -3622,7 +5190,7 @@ struct driver_state { static void hack_title (struct driver_state *dst) { -# ifndef HAVE_COCOA +# ifndef HAVE_JWXYZ char *oname = 0; XFetchName (dst->bst->dpy, dst->bst->window, &oname); if (oname && !strncmp (oname, "BSOD: ", 6)) { @@ -3635,7 +5203,7 @@ hack_title (struct driver_state *dst) XStoreName (dst->bst->dpy, dst->bst->window, nname); free (nname); } -# endif /* !HAVE_COCOA */ +# endif /* !HAVE_JWXYZ */ } static void * @@ -3644,12 +5212,13 @@ bsod_init (Display *dpy, Window window) struct driver_state *dst = (struct driver_state *) calloc (1, sizeof(*dst)); char *s; - dst->delay = get_integer_resource (dpy, "delay", "Integer"); - if (dst->delay < 3) dst->delay = 3; + dst->mode_duration = get_integer_resource (dpy, "delay", "Integer"); + if (dst->mode_duration < 3) dst->mode_duration = 3; dst->debug_p = get_boolean_resource (dpy, "debug", "Boolean"); dst->only = -1; + dst->next_one = -1; s = get_string_resource(dpy, "doOnly", "DoOnly"); if (s && !strcasecmp (s, "cycle")) { @@ -3685,20 +5254,36 @@ bsod_draw (Display *dpy, Window window, void *closure) AGAIN: now = time ((time_t *) 0); - time_left = dst->start + dst->delay - now; + time_left = dst->start + dst->mode_duration - now; if (dst->bst && dst->bst->img_loader) /* still loading */ { - dst->bst->img_loader = + dst->bst->img_loader = load_image_async_simple (dst->bst->img_loader, 0, 0, 0, 0, 0); return 100000; } + DELAY_NOW: + /* Rather than returning a multi-second delay from the draw() routine, + meaning "don't call us again for N seconds", we quantize that down + to 1/10th second intervals so that it's more responsive to + rotate/reshape events. + */ + if (dst->delay_remaining) + { + int inc = 10000; + int this_delay = MIN (dst->delay_remaining, inc); + dst->delay_remaining = MAX (0, dst->delay_remaining - inc); + return this_delay; + } + if (! dst->bst && time_left > 0) /* run completed; wait out the delay */ { if (dst->debug_p) fprintf (stderr, "%s: %s: %d left\n", progname, dst->name, time_left); - return 500000; + dst->start = 0; + if (time_left > 5) time_left = 5; /* Boooored now */ + dst->delay_remaining = 1000000 * time_left; } else if (dst->bst) /* sub-mode currently running */ @@ -3708,12 +5293,15 @@ bsod_draw (Display *dpy, Window window, void *closure) if (time_left > 0) this_delay = bsod_pop (dst->bst); - /* XSync (dpy, False); slows down char drawing too much on HAVE_COCOA */ + /* XSync (dpy, False); slows down char drawing too much on HAVE_JWXYZ */ if (this_delay == 0) goto AGAIN; /* no delay, not expired: stay here */ else if (this_delay >= 0) - return this_delay; /* return; time to sleep */ + { + dst->delay_remaining = this_delay; /* return; time to sleep */ + goto DELAY_NOW; + } else { /* sub-mode run completed or expired */ if (dst->debug_p) @@ -3725,7 +5313,9 @@ bsod_draw (Display *dpy, Window window, void *closure) } else /* launch a new sub-mode */ { - if (dst->cycle_p) + if (dst->next_one >= 0) + dst->which = dst->next_one, dst->next_one = -1; + else if (dst->cycle_p) dst->which = (dst->which + 1) % countof(all_modes); else if (dst->only >= 0) dst->which = dst->only; @@ -3759,9 +5349,9 @@ bsod_draw (Display *dpy, Window window, void *closure) dst->which = dst->only = 0; } } - + if (dst->debug_p) - fprintf (stderr, "%s: %s: launch\n", progname, + fprintf (stderr, "%s: %s: launch\n", progname, all_modes[dst->which].name); /* Run the mode setup routine... @@ -3778,15 +5368,18 @@ bsod_draw (Display *dpy, Window window, void *closure) if (dst->bst) { if (dst->debug_p) - fprintf (stderr, "%s: %s: queue size: %d (%d)\n", progname, + fprintf (stderr, "%s: %s: queue size: %d (%d)\n", progname, dst->name, dst->bst->pos, dst->bst->queue_size); hack_title (dst); dst->bst->pos = 0; - dst->bst->x = dst->bst->current_left = dst->bst->left_margin; + dst->bst->x = dst->bst->current_left = + dst->bst->left_margin + dst->bst->xoff; - if (dst->bst->y < dst->bst->top_margin + dst->bst->font->ascent) - dst->bst->y = dst->bst->top_margin + dst->bst->font->ascent; + if (dst->bst->y < + dst->bst->top_margin + dst->bst->yoff + dst->bst->font->ascent) + dst->bst->y = + dst->bst->top_margin + dst->bst->yoff + dst->bst->font->ascent; } } @@ -3795,7 +5388,7 @@ bsod_draw (Display *dpy, Window window, void *closure) static void -bsod_reshape (Display *dpy, Window window, void *closure, +bsod_reshape (Display *dpy, Window window, void *closure, unsigned int w, unsigned int h) { struct driver_state *dst = (struct driver_state *) closure; @@ -3808,11 +5401,13 @@ bsod_reshape (Display *dpy, Window window, void *closure, if (dst->debug_p) fprintf (stderr, "%s: %s: reshape reset\n", progname, dst->name); - /* just pick a new mode and restart when the window is resized. */ + /* just restart this mode and restart when the window is resized. */ if (dst->bst) free_bsod_state (dst->bst); dst->bst = 0; dst->start = 0; + dst->delay_remaining = 0; + dst->next_one = dst->which; dst->name = "none"; XClearWindow (dpy, window); } @@ -3826,16 +5421,8 @@ bsod_event (Display *dpy, Window window, void *closure, XEvent *event) /* pick a new mode and restart when mouse clicked, or certain keys typed. */ - if (event->type == ButtonPress) + if (screenhack_event_helper (dpy, window, event)) reset_p = True; - else if (event->type == KeyPress) - { - KeySym keysym; - char c = 0; - XLookupString (&event->xkey, &c, 1, &keysym, 0); - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') - reset_p = True; - } if (reset_p) { @@ -3845,6 +5432,7 @@ bsod_event (Display *dpy, Window window, void *closure, XEvent *event) free_bsod_state (dst->bst); dst->bst = 0; dst->start = 0; + dst->delay_remaining = 0; dst->name = "none"; XClearWindow (dpy, window); return True; @@ -3865,13 +5453,15 @@ bsod_free (Display *dpy, Window window, void *closure) static const char *bsod_defaults [] = { - "*delay: 30", + "*delay: 45", "*debug: False", "*doOnly: ", "*doWindows: True", "*doNT: True", "*doWin2K: True", + "*doWin10: True", + "*doRansomware: True", "*doAmiga: True", "*doMac: True", "*doMacsBug: True", @@ -3895,11 +5485,9 @@ static const char *bsod_defaults [] = { "*doOS2: True", "*doNvidia: True", "*doATM: True", - - "*font: 9x15bold", - "*font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", - "*bigFont: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", - "*bigFont2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + "*doGLaDOS: True", + "*doAndroid: True", + "*doVMware: True", ".foreground: White", ".background: Black", @@ -3907,10 +5495,29 @@ static const char *bsod_defaults [] = { ".windows.foreground: White", ".windows.background: #0000AA", /* EGA color 0x01. */ + ".nt.foreground: White", + ".nt.background: #0000AA", /* EGA color 0x01. */ + ".windowslh.foreground: White", ".windowslh.background: #AA0000", /* EGA color 0x04. */ ".windowslh.background2: #AAAAAA", /* EGA color 0x07. */ + ".win10.foreground: White", + ".win10.background: #1070AA", + + ".ransomware.foreground: White", + ".ransomware.background: #841212", + ".ransomware.foreground2: Black", /* ransom note */ + ".ransomware.background2: White", + ".ransomware.foreground3: Black", /* buttons */ + ".ransomware.background3: #AAAAAA", + ".ransomware.link: #7BF9F6", + ".ransomware.timerheader: #BDBE02", + + + ".glaDOS.foreground: White", + ".glaDOS.background: #0000AA", /* EGA color 0x01. */ + ".amiga.foreground: #FF0000", ".amiga.background: Black", ".amiga.background2: White", @@ -3921,8 +5528,6 @@ static const char *bsod_defaults [] = { ".atari.foreground: Black", ".atari.background: White", - ".macsbug.font: -*-courier-medium-r-*-*-*-80-*-*-m-*-*-*", - ".macsbug.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".macsbug.foreground: Black", ".macsbug.background: White", ".macsbug.borderColor: #AAAAAA", @@ -3935,52 +5540,42 @@ static const char *bsod_defaults [] = { ".macx.textBackground: Black", ".macx.background: #888888", - ".sco.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".macinstall.barForeground: #C0C0C0", + ".macinstall.barBackground: #888888", + ".sco.foreground: White", ".sco.background: Black", - ".hvx.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".hvx.foreground: White", ".hvx.background: Black", ".linux.foreground: White", ".linux.background: Black", - ".hppalinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".hppalinux.foreground: White", ".hppalinux.background: Black", - ".sparclinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".sparclinux.foreground: White", ".sparclinux.background: Black", - ".bsd.font: vga", - ".bsd.bigFont: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*", - ".bsd.bigFont2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".bsd.foreground: #c0c0c0", ".bsd.background: Black", - ".solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*", ".solaris.foreground: Black", ".solaris.background: White", - ".hpux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".hpux.foreground: White", ".hpux.background: Black", - ".os390.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".os390.background: Black", ".os390.foreground: Red", - ".tru64.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".tru64.foreground: White", ".tru64.background: #0000AA", /* EGA color 0x01. */ - ".vms.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".vms.foreground: White", ".vms.background: Black", - ".msdos.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".msdos.foreground: White", ".msdos.background: Black", @@ -3990,19 +5585,166 @@ static const char *bsod_defaults [] = { ".atm.foreground: Black", ".atm.background: #FF6600", - "*dontClearRoot: True", + ".android.foreground: Black", + ".android.background: White", + ".android.color1: #AA00AA", /* violet */ + ".android.color2: #336633", /* green1 */ + ".android.color3: #0000FF", /* blue */ + ".android.color4: #CC7744", /* orange */ + ".android.color5: #99AA55", /* green2 */ + ".android.color6: #66AA33", /* green3 */ + ".android.color7: #FF0000", /* red */ + + ".vmware.foreground: White", + ".vmware.foreground2: Yellow", + ".vmware.background: #a700a8", /* purple */ - "*apple2TVColor: 50", - "*apple2TVTint: 5", - "*apple2TVBrightness: 10", - "*apple2TVContrast: 90", - "*apple2SimulateUser: True", + "*dontClearRoot: True", ANALOGTV_DEFAULTS #ifdef HAVE_XSHM_EXTENSION "*useSHM: True", #endif + + "*fontB: ", + "*fontC: ", + +# if defined(USE_IPHONE) + + "*font: PxPlus IBM VGA8 16, Courier-Bold 14", + "*bigFont: ", + "*font2: ", + "*bigFont2: ", + + ".mac.font: Courier-Bold 18", + ".macsbug.font: Courier-Bold 8", + ".macx.font: Courier-Bold 14", + ".macdisk.font: Courier-Bold 14", + ".macinstall.font: Helvetica 12, Arial 12", + ".macinstall.bigFont: Helvetica 12, Arial 12", + ".msdos.font: PxPlus IBM VGA8 32, Courier-Bold 28", + ".nt.font: PxPlus IBM VGA8 12, Courier-Bold 10", + ".win10.font: Arial 12, Helvetica 12", + ".win10.bigFont: Arial 12, Helvetica 12", + ".win10.fontB: Arial 50, Helvetica 50", + ".win10.fontC: Arial 9, Helvetica 9", + ".win10.bigFont2: ", + + ".ransomware.font: Arial 10, Helvetica 10", + ".ransomware.fontB: Arial 8, Helvetica 8", + ".ransomware.fontC: Arial 10, Helvetica Bold 10", + +# elif defined(HAVE_ANDROID) + + "*font: PxPlus IBM VGA8 16", + "*bigFont: ", + "*font2: ", + "*bigFont2: ", + + ".mac.font: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + ".macsbug.font: -*-courier-bold-r-*-*-*-80-*-*-m-*-*-*", + ".macx.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".macdisk.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".macinstall.font: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*", + ".macinstall.bigFont: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*", + ".msdos.font: PxPlus IBM VGA8 32", + ".nt.font: PxPlus IBM VGA8 12", + + ".win10.font: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*", + ".win10.bigFont: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*", + ".win10.fontB: -*-helvetica-medium-r-*-*-*-500-*-*-*-*-*-*", + ".win10.fontC: -*-helvetica-medium-r-*-*-*-90-*-*-*-*-*-*", + ".win10.bigFont2: ", + + ".ransomware.font: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*", + ".ransomware.fontB: -*-helvetica-medium-r-*-*-*-80-*-*-*-*-*-*", + ".ransomware.fontC: -*-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*", + +# elif defined(HAVE_COCOA) + + "*font: PxPlus IBM VGA8 8, Courier Bold 9", + "*bigFont: PxPlus IBM VGA8 32, Courier Bold 24", + "*font2: ", + "*bigFont2: ", + + ".mac.font: Monaco 10, Courier Bold 9", + ".mac.bigFont: Monaco 18, Courier Bold 18", + + ".macsbug.font: Monaco 10, Courier Bold 9", + ".macsbug.bigFont: Monaco 24, Courier Bold 24", + + ".macx.font: Courier Bold 9", + ".macx.bigFont: Courier Bold 14", + ".macdisk.font: Courier Bold 9", + ".macdisk.bigFont: Courier Bold 18", + ".macinstall.font: Helvetica 24, Arial 24", + ".macinstall.bigFont: Helvetica 24, Arial 24", + + ".hvx.bigFont: PxPlus IBM VGA8 16, Courier Bold 14", + ".hppalinux.bigFont: PxPlus IBM VGA8 16, Courier Bold 14", + ".solaris.bigFont: PxPlus IBM VGA8 16, Courier Bold 14", + ".linux.bigFont: PxPlus IBM VGA8 16, Courier Bold 14", + ".hpux.bigFont: PxPlus IBM VGA8 16, Courier Bold 14", + ".msdos.font: PxPlus IBM VGA8 16, Courier Bold 14", + + ".win10.font: Arial 24, Helvetica 24", + ".win10.bigFont: Arial 24, Helvetica 24", + ".win10.fontB: Arial 100, Helvetica 100", + ".win10.fontC: Arial 16, Helvetica 16", + ".win10.bigFont2: ", + + ".ransomware.font: Arial 24, Helvetica 24", + ".ransomware.bigFont: Arial 24, Helvetica 24", + ".ransomware.fontB: Arial 16, Helvetica 16", + ".ransomware.fontC: Arial Bold 24, Helvetica Bold 24", + +# else /* X11 */ + + "*font: 9x15bold", + "*font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + "*bigFont: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + "*bigFont2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + + ".macsbug.font: -*-courier-medium-r-*-*-*-80-*-*-m-*-*-*", + ".macsbug.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + + ".macdisk.font: -*-courier-bold-r-*-*-*-80-*-*-m-*-*-*", + ".macdisk.bigFont: -*-courier-bold-r-*-*-*-100-*-*-m-*-*-*", + ".macinstall.font: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + ".macinstall.bigFont: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + + ".sco.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".hvx.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".hppalinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".sparclinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + + ".bsd.font: vga", + ".bsd.bigFont: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*", + ".bsd.bigFont2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + + ".solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*", + ".hpux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".os390.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".tru64.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".vms.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".msdos.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + + ".win10.font: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + ".win10.bigFont: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + ".win10.fontB: -*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-*", + ".win10.fontC: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-*-*", + ".win10.font2: ", + ".win10.bigFont2: ", + + ".ransomware.font: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + ".ransomware.bigFont: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*", + ".ransomware.fontB: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-*-*", + ".ransomware.fontC: -*-helvetica-bold-r-*-*-*-180-*-*-*-*-*-*", + + +# endif /* X11 */ + 0 }; @@ -4016,6 +5758,10 @@ static const XrmOptionDescRec bsod_options [] = { { "-no-nt", ".doNT", XrmoptionNoArg, "False" }, { "-2k", ".doWin2K", XrmoptionNoArg, "True" }, { "-no-2k", ".doWin2K", XrmoptionNoArg, "False" }, + { "-win10", ".doWin10", XrmoptionNoArg, "True" }, + { "-no-win10", ".doWin10", XrmoptionNoArg, "False" }, + { "-ransomware", ".doRansomware", XrmoptionNoArg, "True" }, + { "-no-ransomware", ".doRansomware", XrmoptionNoArg, "False" }, { "-amiga", ".doAmiga", XrmoptionNoArg, "True" }, { "-no-amiga", ".doAmiga", XrmoptionNoArg, "False" }, { "-mac", ".doMac", XrmoptionNoArg, "True" }, @@ -4062,6 +5808,12 @@ static const XrmOptionDescRec bsod_options [] = { { "-no-os2", ".doOS2", XrmoptionNoArg, "False" }, { "-atm", ".doATM", XrmoptionNoArg, "True" }, { "-no-atm", ".doATM", XrmoptionNoArg, "False" }, + { "-glados", ".doGLaDOS", XrmoptionNoArg, "True" }, + { "-no-glados", ".doGLaDOS", XrmoptionNoArg, "False" }, + { "-android", ".doAndroid", XrmoptionNoArg, "True" }, + { "-no-android", ".doAndroid", XrmoptionNoArg, "False" }, + { "-vmware", ".doVMware", XrmoptionNoArg, "True" }, + { "-no-vmware", ".doVMware", XrmoptionNoArg, "False" }, ANALOGTV_OPTIONS { 0, 0, 0, 0 } };