From 34a7bb526b09dfefeddd135bf9bd0fbf45b73f83 Mon Sep 17 00:00:00 2001 From: sos Date: Thu, 17 Sep 1998 19:40:30 +0000 Subject: Fix the sreensavers so the work again with the new syscons & friends. Submitted by: Kazutaka YOKOTA --- lkm/syscons/blank/blank_saver.c | 4 +++- lkm/syscons/daemon/daemon_saver.c | 15 +++++++++------ lkm/syscons/fade/fade_saver.c | 22 ++++++++++------------ lkm/syscons/green/green_saver.c | 4 +++- lkm/syscons/saver.h | 3 +-- lkm/syscons/snake/snake_saver.c | 17 ++++++++++------- lkm/syscons/star/star_saver.c | 16 ++++++++++------ 7 files changed, 46 insertions(+), 35 deletions(-) (limited to 'lkm') diff --git a/lkm/syscons/blank/blank_saver.c b/lkm/syscons/blank/blank_saver.c index d5f4cf0..1bb7323 100644 --- a/lkm/syscons/blank/blank_saver.c +++ b/lkm/syscons/blank/blank_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: blank_saver.c,v 1.12 1998/09/15 18:16:38 sos Exp $ */ #include @@ -46,6 +46,7 @@ blank_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; + cur_console->status |= SAVER_RUNNING; switch (crtc_type) { case KD_VGA: outb(TSIDX, 0x01); val = inb(TSREG); @@ -84,6 +85,7 @@ blank_saver(int blank) default: break; } + cur_console->status &= ~SAVER_RUNNING; scrn_blanked = 0; } } diff --git a/lkm/syscons/daemon/daemon_saver.c b/lkm/syscons/daemon/daemon_saver.c index 688df41..59e99f0 100644 --- a/lkm/syscons/daemon/daemon_saver.c +++ b/lkm/syscons/daemon/daemon_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: daemon_saver.c,v 1.9 1998/08/06 09:14:20 yokota Exp $ + * $Id: daemon_saver.c,v 1.10 1998/09/15 18:16:38 sos Exp $ */ #include @@ -43,7 +43,7 @@ #include #define CONSOLE_VECT(x, y) \ - ((u_short*)(Crtat + (y)*cur_console->xsize + (x))) + (window + (y)*cur_console->xsize + (x)) #define DAEMON_MAX_WIDTH 32 #define DAEMON_MAX_HEIGHT 19 @@ -52,6 +52,7 @@ MOD_MISC(daemon_saver); static char *message; static int messagelen; +static u_short *window; /* Who is the author of this ASCII pic? */ @@ -201,10 +202,14 @@ daemon_saver(int blank) int min, max; if (blank) { + if (!ISTEXTSC(scp)) + return; if (scrn_blanked == 0) { + scp->status |= SAVER_RUNNING; + window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window; /* clear the screen and set the border color */ fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20], - Crtat, scp->xsize * scp->ysize); + window, scp->xsize * scp->ysize); set_border(scp, 0); xlen = ylen = tlen = 0; } @@ -324,6 +329,7 @@ daemon_saver(int blank) if (scrn_blanked > 0) { set_border(scp, scp->border); scrn_blanked = 0; + scp->status &= ~SAVER_RUNNING; } } } @@ -333,9 +339,6 @@ daemon_saver_load(struct lkm_table *lkmtp, int cmd) { int err; - if (cur_console->mode >= M_VESA_BASE) - return ENODEV; - messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 + strlen(osrelease); message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); diff --git a/lkm/syscons/fade/fade_saver.c b/lkm/syscons/fade/fade_saver.c index 41176e7..0d31bd6 100644 --- a/lkm/syscons/fade/fade_saver.c +++ b/lkm/syscons/fade/fade_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: fade_saver.c,v 1.13 1998/09/15 18:16:39 sos Exp $ */ #include @@ -44,26 +44,23 @@ static void fade_saver(int blank) { static int count = 0; + u_char pal[256*3]; int i; if (blank) { scrn_blanked = 1; + cur_console->status |= SAVER_RUNNING; switch (crtc_type) { case KD_VGA: if (count < 64) { - outb(PIXMASK, 0xFF); /* no pixelmask */ - outb(PALWADR, 0x00); - outb(PALDATA, 0); - outb(PALDATA, 0); - outb(PALDATA, 0); - for (i = 3; i < 768; i++) { - if (palette[i] - count > 15) - outb(PALDATA, palette[i]-count); + pal[0] = pal[1] = pal[2] = 0; + for (i = 3; i < 256*3; i++) { + if (palette[i] - count > 60) + pal[i] = palette[i] - count; else - outb(PALDATA, 15); + pal[i] = 60; } - inb(crtc_addr+6); /* reset flip/flop */ - outb(ATC, 0x20); /* enable palette */ + load_palette(cur_console, pal); count++; } break; @@ -100,6 +97,7 @@ fade_saver(int blank) default: break; } + cur_console->status &= ~SAVER_RUNNING; scrn_blanked = 0; } } diff --git a/lkm/syscons/green/green_saver.c b/lkm/syscons/green/green_saver.c index 6678662..0e61c2e 100644 --- a/lkm/syscons/green/green_saver.c +++ b/lkm/syscons/green/green_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: green_saver.c,v 1.12 1998/09/15 18:16:39 sos Exp $ */ #include @@ -46,6 +46,7 @@ green_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; + cur_console->status |= SAVER_RUNNING; switch (crtc_type) { case KD_VGA: outb(TSIDX, 0x01); val = inb(TSREG); @@ -88,6 +89,7 @@ green_saver(int blank) default: break; } + cur_console->status &= ~SAVER_RUNNING; scrn_blanked = 0; } } diff --git a/lkm/syscons/saver.h b/lkm/syscons/saver.h index 96cc010..9eb1995 100644 --- a/lkm/syscons/saver.h +++ b/lkm/syscons/saver.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: saver.h,v 1.11 1998/09/15 18:16:38 sos Exp $ */ #include #include @@ -42,4 +42,3 @@ extern int scrn_blanked; extern int fonts_loaded; extern char font_8[], font_14[], font_16[]; extern char palette[]; -extern char *video_mode_ptr; diff --git a/lkm/syscons/snake/snake_saver.c b/lkm/syscons/snake/snake_saver.c index c5011d0..efb76d5 100644 --- a/lkm/syscons/snake/snake_saver.c +++ b/lkm/syscons/snake/snake_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: snake_saver.c,v 1.18 1998/09/15 18:16:39 sos Exp $ */ #include @@ -47,6 +47,7 @@ MOD_MISC(snake_saver); static char *message; static u_char **messagep; static int messagelen; +static u_short *window; static void snake_saver(int blank) @@ -60,15 +61,19 @@ snake_saver(int blank) #define savs messagep if (blank) { + if (!ISTEXTSC(scp)) + return; if (scrn_blanked <= 0) { + scp->status |= SAVER_RUNNING; + window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window; fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20], - Crtat, scp->xsize * scp->ysize); + window, scp->xsize * scp->ysize); set_border(scp, 0); dirx = (scp->xpos ? 1 : -1); diry = (scp->ypos ? scp->xsize : -scp->xsize); for (f=0; f< messagelen; f++) - savs[f] = (u_char *)Crtat + 2 * + savs[f] = (u_char *)window + 2 * (scp->xpos+scp->ypos*scp->xsize); *(savs[0]) = scr_map[*save]; f = scp->ysize * scp->xsize + 5; @@ -84,7 +89,7 @@ snake_saver(int blank) *(savs[messagelen-1]) = scr_map[0x20]; for (f=messagelen-1; f > 0; f--) savs[f] = savs[f-1]; - f = (savs[0] - (u_char *)Crtat) / 2; + f = (savs[0] - (u_char *)window) / 2; if ((f % scp->xsize) == 0 || (f % scp->xsize) == scp->xsize - 1 || (random() % 50) == 0) @@ -101,6 +106,7 @@ snake_saver(int blank) if (scrn_blanked > 0) { set_border(scp, scp->border); scrn_blanked = 0; + scp->status &= ~SAVER_RUNNING; } } } @@ -110,9 +116,6 @@ snake_saver_load(struct lkm_table *lkmtp, int cmd) { int err; - if (cur_console->mode >= M_VESA_BASE) - return ENODEV; - messagelen = strlen(ostype) + 1 + strlen(osrelease); message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); sprintf(message, "%s %s", ostype, osrelease); diff --git a/lkm/syscons/star/star_saver.c b/lkm/syscons/star/star_saver.c index 8ac65bd..2e56a3c 100644 --- a/lkm/syscons/star/star_saver.c +++ b/lkm/syscons/star/star_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: star_saver.c,v 1.15 1998/09/15 18:16:39 sos Exp $ */ #include @@ -43,6 +43,8 @@ MOD_MISC(star_saver); #define NUM_STARS 50 +static u_short *window; + /* * Alternate saver that got its inspiration from a well known utility * package for an inferior^H^H^H^H^H^Hfamous OS. @@ -58,9 +60,13 @@ star_saver(int blank) static u_short stars[NUM_STARS][2]; if (blank) { + if (!ISTEXTSC(scp)) + return; if (scrn_blanked <= 0) { + scp->status |= SAVER_RUNNING; + window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window; scrn_blanked = 1; - fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], Crtat, + fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], window, scp->xsize * scp->ysize); set_border(scp, 0); for(i=0; i= sizeof(pattern)-1) { @@ -82,6 +88,7 @@ star_saver(int blank) if (scrn_blanked > 0) { set_border(scp, scp->border); scrn_blanked = 0; + scp->status &= ~SAVER_RUNNING; } } } @@ -89,9 +96,6 @@ star_saver(int blank) static int star_saver_load(struct lkm_table *lkmtp, int cmd) { - if (cur_console->mode >= M_VESA_BASE) - return ENODEV; - return add_scrn_saver(star_saver); } -- cgit v1.1