Projects / matrix_saver

matrix_saver

matrix_saver is a console screen saver for FreeBSD. It is based on Chris Allegretta's "cmatrix" which, in turn, was based on the "code" effect in the movie "The Matrix." The net effect is a cross between a code listing and rain falling on a window pane.

Tags
Licenses
Operating Systems
Implementation

RSS Recent releases

  •  18 Feb 2001 12:25

Release Notes: This version works under FreeBSD 4.2-CURRENT.

RSS Recent comments

25 Mar 2003 11:23 Tayeb

Installing under FreeBSD 4x
It's quite easy to implement for FreeBSD 4x.

Check the ports. Under /usr/ports/misc find matrix-kmod

Under matrix-kmod do the following:

make
make install

Once installed without errors do:

cp /usr/local/lib/matrix/modules/matrix_saver.ko /modules/matrix_saver.ko

Next under /usr edit rc.conf and find saver:

saver="matrix"

Save rc.conf and reboot. Your matrix screensaver should work now.

:)

Tayeb

25 Oct 1999 01:06 magitechnicus

Diff to run under FreeBSD 3.3 -- author supplied
diff -ruN matrix_saver-1.0.0/README matrix_saver-1.0.0-kld/README
--- matrix_saver-1.0.0/README Sun Apr 25 04:24:11 1999
+++ matrix_saver-1.0.0-kld/README Wed Apr 28 18:40:57 1999
@@ -1,35 +1,41 @@
matrix_saver

- This is a text-mode screen saver for FreeBSD 3.x, based on an
+ This is a text-mode screen saver for FreeBSD [34].x, based on an
effect in the 1999 movie, "The Matrix," and more immediately inspired
by Chris Allegretta's 'cmatrix', a way cool display hack.

* TO INSTALL:

Copy the entire 'matrix' directory to
-/usr/src/lkm/syscons/matrix, alongside all the other screen savers.
+/usr/src/sys/modules/syscons/matrix, alongside all the other screen savers.

Build it:
- cd /usr/src/lkm/syscons/matrix
+ cd /usr/src/sys/modules/syscons/matrix
make
make install

- Edit /etc/rc.conf . Find the line that begins with "saver=",
-and change it to read
+ Edit /etc/rc.conf and add

- saver="matrix"
+saver="matrix"

-(and make sure that "blanktime" is set to a reasonable value, like
-300).
+ or replace the current value if one is already set.
+
+ In FreeBSD 3.1+ "blanktime" is set to 300 seconds in
+/etc/defaults/rc.conf. If you want to change this then override
+blanktime in /etc/rc.conf. You can also adjust it with vidcontrol
+as root, f.e.
+
+ vidcontrol -t 30
+
+would set it to 30 seconds.

Now either reboot, or load the screen saver manually.

To install it manually:
- - Use 'modstat' to get the ID of your current screen saver.
- - Use 'modunload -i ' to unload it; is the ID that
+ - Use 'kldstat' to get the ID of your current screen saver.
+ - Use 'kldunload -i ' to unload it; is the ID that
you found in the previous step.
- - Install matrix_saver:
- modload -u -o /tmp/saver_mod -q /lkm/matrix_saver_mod.o
+ - Install matrix_saver: 'kldload matrix_saver.ko'
(or look for "saver" in /etc/rc.i386, and do what it does)


diff -ruN matrix_saver-1.0.0/matrix/Makefile matrix_saver-1.0.0-kld/matrix/Makefile
--- matrix_saver-1.0.0/matrix/Makefile Sun Apr 25 04:24:40 1999
+++ matrix_saver-1.0.0-kld/matrix/Makefile Wed Apr 28 18:41:36 1999
@@ -1,6 +1,6 @@
# $Id: Makefile,v 1.1 1999/04/25 09:24:40 arensb Exp $

-KMOD= matrix_saver_mod
+KMOD= matrix_saver
SRCS= matrix_saver.c

NOMAN=
diff -ruN matrix_saver-1.0.0/matrix/matrix_saver.c matrix_saver-1.0.0-kld/matrix/matrix_saver.c
--- matrix_saver-1.0.0/matrix/matrix_saver.c Sun Apr 25 04:24:44 1999
+++ matrix_saver-1.0.0-kld/matrix/matrix_saver.c Wed Apr 28 18:44:27 1999
@@ -26,25 +26,24 @@
* work.
*
* $Id: matrix_saver.c,v 1.1 1999/04/25 09:24:44 arensb Exp $
+ *
+ * 28apr99 amcl
+ * Converted lkm to kld.
*/

#include
#include
-#include
-#include
-#include
+#include
#include
+#include

#include
#include

#include

-MOD_MISC(matrix_saver);
-
-extern timeout_t scrn_timer;
-
static u_short *window;
+static int blanked;

/* Columns:
* The screen saver displays a number of falling columns. Each column
@@ -118,8 +117,8 @@
/* matrix_saver
* Main loop for the screen saver. Most of this is voodoo code.
*/
-static void
-matrix_saver(int blank)
+static int
+matrix_saver(video_adapter_t *adp, int blank)
{
scr_stat *scp = cur_console;
static char beat = 0; /* Current beat. See comment above */
@@ -129,14 +128,12 @@
beat %= NUM_SPEEDS;

if (blank) {
- if (!ISTEXTSC(scp))
- return;
- if (scrn_blanked va_info.vi_flags & V_INFO_GRAPHICS)
+ return EAGAIN;
+ if (blanked == 0) {
/* Initialize the screen saver */
-
- scp->status |= SAVER_RUNNING;
- window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
- scrn_blanked = 1;
+ window = (u_short *)adp->va_window;
+ blanked = 1;

/* Erase the screen */
fillw((FG_MAGENTA|BG_BLACK) 0) {
- set_border(scp, scp->border);
- scrn_blanked = 0;
- scp->status &= ~SAVER_RUNNING;
- }
- }
+ } else /* Turn off the screen saver */
+ blanked = 0;
+
+ return 0;
}

static int
-matrix_saver_load(struct lkm_table *lkmtp, int cmd)
+matrix_init(video_adapter_t *adp)
{
- int err;
int i;
scr_stat *scp = cur_console;

@@ -237,33 +228,22 @@
tails[i] = (random() % 30) + 5;
speeds[i] = random() % NUM_SPEEDS;
}
- if ((err = add_scrn_saver(matrix_saver)) != 0)
- {
- free(lengths, M_DEVBUF);
- free(tails, M_DEVBUF);
- free(speeds, M_DEVBUF);
- }
- return err;
+
+ return 0;
}

static int
-matrix_saver_unload(struct lkm_table *lkmtp, int cmd)
+matrix_term(video_adapter_t *adp)
{
- int err;
+ free(lengths, M_DEVBUF);
+ free(tails, M_DEVBUF);
+ free(speeds, M_DEVBUF);

- err = remove_scrn_saver(matrix_saver);
- if (err == 0)
- {
- free(lengths, M_DEVBUF);
- free(tails, M_DEVBUF);
- free(speeds, M_DEVBUF);
- }
- return err;
+ return 0;
}

-int
-matrix_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
-{
- MOD_DISPATCH(matrix_saver, lkmtp, cmd, ver,
- matrix_saver_load, matrix_saver_unload, lkm_nullcmd);
-}
+static scrn_saver_t matrix_module = {
+ "matrix_saver", matrix_init, matrix_term, matrix_saver, NULL,
+};
+
+SAVER_MODULE(matrix_saver, matrix_module);

23 Oct 1999 17:14 magitechnicus

Doesn't seem to work under 3.3
I tried installing this under 3.3, and came up with the following build errors:
cc -O -pipe -I/usr/src/sys/modules/syscons/matrix/.. -DKERNEL -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wuninitialized -Wformat -Wunused -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I- -I/usr/src/sys/modules/syscons/matrix/.. -I/usr/src/sys/modules/syscons/matrix -I/usr/src/sys/modules/syscons/matrix/@ -c matrix_saver.c
matrix_saver.c: In function `matrix_saver':
matrix_saver.c:134: `scrn_blanked' undeclared (first use this function)
matrix_saver.c:134: (Each undeclared identifier is reported only once
matrix_saver.c:134: for each function it appears in.)
matrix_saver.c:138: `biosvidsw' undeclared (first use this function)
matrix_saver.c: In function `matrix_saver_load':
matrix_saver.c:240: warning: implicit declaration of function `add_scrn_saver'
matrix_saver.c: In function `matrix_saver_unload':
matrix_saver.c:254: warning: implicit declaration of function `remove_scrn_saver'
*** Error code 1
Stop.

Open for comments :)
-B

Screenshot

Project Spotlight

Jackcess

A pure Java library for reading and writing MS Access databases.

Screenshot

Project Spotlight

Camera Life

A photo gallery system.