Date: Sun, 18 May 1997 15:28:25 +0200 (CEST) From: S Sigala <ssigala@globalnet.it> To: freebsd-hackers@freebsd.org Subject: NEW SCREENSAVER: "the daemon is jumpin' around" Message-ID: <Pine.BSF.3.96.970518152302.1494A-100000@lattice.milk.it>
index | next in thread | raw e-mail
I have just written this new LKM screensaver.
Create the `/usr/src/lkm/syscons/daemon' directory, extract the shar
archive there, compile and enjoy!
(This screensaver may be included in the freebsd distributions, if someone
like it... ;->)
Regards,
-sandro
-------------------------
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# Makefile
# daemon_saver.c
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X# $Id$
X
XKMOD= daemon_saver_mod
XSRCS= daemon_saver.c
X
XNOMAN=
XCFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
X
X.include <bsd.kmod.mk>
END-of-Makefile
echo x - daemon_saver.c
sed 's/^X//' >daemon_saver.c << 'END-of-daemon_saver.c'
X/*-
X * Copyright (c) 1997 Sandro Sigala, Brescia, Italy.
X * Copyright (c) 1995 Søren Schmidt
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer
X * in this position and unchanged.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X *
X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X *
X * $Id$
X */
X
X#include <sys/param.h>
X#include <sys/systm.h>
X#include <sys/conf.h>
X#include <sys/exec.h>
X#include <sys/sysent.h>
X#include <sys/lkm.h>
X#include <sys/errno.h>
X
X#include <machine/md_var.h>
X
X#include "saver.h"
X
XMOD_MISC(daemon_saver);
X
Xvoid (*current_saver)(int blank);
Xvoid (*old_saver)(int blank);
X
X#define DAEMON_MAX_WIDTH 32
X#define DAEMON_MAX_HEIGHT 19
X
X/* How is the author of this ASCII pic? */
X
Xstatic char *daemon_pic[] = {
X " , ,",
X " /( )`",
X " \\ \\___ / |",
X " /- _ `-/ '",
X " (/\\/ \\ \\ /\\",
X " / / | ` \\",
X " O O ) / |",
X " `-^--'`< '",
X " (_.) _ ) /",
X " `.___/` /",
X " `-----' /",
X "<----. __ / __ \\",
X "<----|====O)))==) \\) /====",
X "<----' `--' `.__,' \\",
X " | |",
X " \\ / /\\",
X " ______( (_ / \\______/",
X " ,' ,-----' |",
X " `--{__________)",
X NULL
X};
X
Xstatic char *daemon_attr[] = {
X " R R",
X " RR RR",
X " R RRRR R R",
X " RR W RRR R",
X " RWWW W R RR",
X " W W W R R",
X " B B W R R",
X " WWWWWWRR R",
X " RRRR R R R",
X " RRRRRRR R",
X " RRRRRRR R",
X "YYYYYY RR R RR R",
X "YYYYYYYYYYRRRRYYR RR RYYYY",
X "YYYYYY RRRR RRRRRR R",
X " R R",
X " R R RR",
X " CCCCCCR RR R RRRRRRRR",
X " CC CCCCCCC C",
X " CCCCCCCCCCCCCCC",
X NULL
X};
X
X
Xstatic void
Xdraw_daemon(int xpos, int ypos)
X{
X int x, y;
X int attr;
X
X for (y = 0; daemon_pic[y] != NULL; y++)
X for (x = 0; daemon_pic[y][x] != '\0'; x++) {
X switch (daemon_attr[y][x]) {
X case 'R': attr = (FG_LIGHTRED|BG_BLACK)<<8; break;
X case 'Y': attr = (FG_YELLOW|BG_BLACK)<<8; break;
X case 'B': attr = (FG_LIGHTBLUE|BG_BLACK)<<8; break;
X case 'W': attr = (FG_LIGHTGREY|BG_BLACK)<<8; break;
X case 'C': attr = (FG_CYAN|BG_BLACK)<<8; break;
X }
X *((u_short*)(Crtat + (ypos+y)*cur_console->xsize + xpos + x)) =
X scr_map[daemon_pic[y][x]]|attr;
X }
X}
X
Xstatic void
Xdraw_string(int xpos, int ypos, char *s, int len)
X{
X int x, y;
X
X for (x = 0; x < len; x++)
X *((u_short*)(Crtat + ypos*cur_console->xsize + xpos + x)) =
X scr_map[s[x]]|(FG_LIGHTGREEN|BG_BLACK)<<8;
X}
X
Xstatic void
Xdaemon_saver(int blank)
X{
X static const char message[] = {"FreeBSD 3.0 CURRENT"};
X static int dxpos = 0, dypos = 0;
X static int dxdir = 1, dydir = 1;
X static int txpos = 10, typos = 10;
X static int txdir = -1, tydir = -1;
X static int moved_daemon = 0;
X scr_stat *scp = cur_console;
X
X if (blank) {
X if (scrn_blanked++ < 2)
X return;
X fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], Crtat,
X scp->xsize * scp->ysize);
X set_border(0);
X scrn_blanked = 1;
X
X if (++moved_daemon) {
X if (dxdir > 0) {
X if (dxpos + 1 >= scp->xsize - DAEMON_MAX_WIDTH)
X dxdir = -1;
X } else {
X if (dxpos == 0) dxdir = 1;
X }
X if (dydir > 0) {
X if (dypos + 1 >= scp->ysize - DAEMON_MAX_HEIGHT)
X dydir = -1;
X } else {
X if (dypos == 0) dydir = 1;
X }
X moved_daemon = -1;
X dxpos += dxdir; dypos += dydir;
X }
X
X if (txdir > 0) {
X if (txpos + 1 >= scp->xsize - sizeof(message)-1)
X txdir = -1;
X } else {
X if (txpos == 0) txdir = 1;
X }
X if (tydir > 0) {
X if (typos + 1 >= scp->ysize - 1)
X tydir = -1;
X } else {
X if (typos == 0) tydir = 1;
X }
X txpos += txdir; typos += tydir;
X
X draw_daemon(dxpos, dypos);
X draw_string(txpos, typos, (char *)message, sizeof(message)-1);
X } else {
X if (scrn_blanked) {
X set_border(scp->border);
X scrn_blanked = 0;
X scp->start = 0;
X scp->end = scp->xsize * scp->ysize;
X }
X }
X}
X
Xstatic int
Xdaemon_saver_load(struct lkm_table *lkmtp, int cmd)
X{
X (*current_saver)(0);
X old_saver = current_saver;
X current_saver = daemon_saver;
X return 0;
X}
X
Xstatic int
Xdaemon_saver_unload(struct lkm_table *lkmtp, int cmd)
X{
X (*current_saver)(0);
X current_saver = old_saver;
X return 0;
X}
X
Xint
Xdaemon_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
X{
X DISPATCH(lkmtp, cmd, ver, daemon_saver_load, daemon_saver_unload,
X lkm_nullcmd);
X}
END-of-daemon_saver.c
exit
--------------------
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970518152302.1494A-100000>
