Hello all,

	This patch lets vgamp v1.0 work with svgalib. I use 80x50 console and 
vgamp would mess things up on exit. Using svgalib fixes this problem.
Thanks Gwoho for this nifty mpeg player.

	Have fun,

		James Klicman <james@ccnet.com>





diff -c vgamp/Makefile svgamp/Makefile
*** vgamp/Makefile	Wed May  4 16:39:01 1994
--- svgamp/Makefile	Sun Jan 15 11:26:17 1995
***************
*** 1,17 ****
! CFLAGS = -O -fomit-frame-pointer -pipe -m486
  LDFLAGS = -s -N
! AFLAGS = -DADJUST=2 -DCPU_NUMBER=3 -DDCT_EIGHT
  
  .SUFFIXES: .S .o .c .h
  
  .S.o:
! 	cpp $(AFLAGS) $< | as -o $@ -
  
  OBJS = asm_stuff.o util.o video.o parseblock.o decoders.o main.o \
  	recon.o dither.o asmrevdct.o output.o hw.o
  
  vgamp: $(OBJS)
! 	cc $(LDFLAGS) $(OBJS) -o vgamp
  
  asmrevdct.o: asmrevdct.S dct.S dct_const.h
  
--- 1,17 ----
! CFLAGS = -O -fomit-frame-pointer -pipe -m486 -D_USE_SVGALIB_
  LDFLAGS = -s -N
! AFLAGS = -DADJUST=2 -DCPU_NUMBER=4 -DDCT_EIGHT
  
  .SUFFIXES: .S .o .c .h
  
  .S.o:
! 	/lib/cpp $(AFLAGS) $< | as -o $@ -
  
  OBJS = asm_stuff.o util.o video.o parseblock.o decoders.o main.o \
  	recon.o dither.o asmrevdct.o output.o hw.o
  
  vgamp: $(OBJS)
! 	cc $(LDFLAGS) $(OBJS) -o vgamp -lvga
  
  asmrevdct.o: asmrevdct.S dct.S dct_const.h
  
diff -c vgamp/README svgamp/README
*** vgamp/README	Wed May  4 16:39:01 1994
--- svgamp/README	Sun Jan 15 20:39:45 1995
***************
*** 28,36 ****
--- 28,45 ----
  Specifying none of the above will cause vgamp to output color ordinary size.
  
  
+ #ifdef _USE_SVGALIB_
+ 
+ Works with svga, wacky console modes etc...
+ 
+ #else
+ 
  This program doesn't know anything about SVGA.  If you use wacky cosole
  like 132x40 or such, this program probably will not work--it doesn't know about
  the wacky SVGA mode.  Use 80x25 console.
+ 
+ #endif
+ 
  
  
  Before you complain that the output looks lousy, please keep the following
diff -c vgamp/hw.c svgamp/hw.c
*** vgamp/hw.c	Wed May  4 16:39:00 1994
--- svgamp/hw.c	Sun Jan 15 20:19:38 1995
***************
*** 6,11 ****
--- 6,15 ----
  #include <signal.h>
  #include <asm/io.h>
  
+ #ifdef _USE_SVGALIB_
+ #include <vga.h>
+ #endif
+ 
  #define VGABASE		0x3d4
  
  static struct regs {
***************
*** 166,179 ****
  void
  eexit()
  {
  	text_mode();
  	_exit(0);
  }
  
  get_rid_of_root()
  {
  	int i;
- 
  	if ((i = open("/dev/mem",2)) < 0) {
  		write_2("can't open /dev/mem\n");
  		_exit(1);
--- 170,186 ----
  void
  eexit()
  {
+ #ifdef _USE_SVGALIB_
+ 	vga_setmode(TEXT);
+ #else
  	text_mode();
+ #endif
  	_exit(0);
  }
  
  get_rid_of_root()
  {
  	int i;
  	if ((i = open("/dev/mem",2)) < 0) {
  		write_2("can't open /dev/mem\n");
  		_exit(1);
diff -c vgamp/main.c svgamp/main.c
*** vgamp/main.c	Wed May  4 16:39:00 1994
--- svgamp/main.c	Sun Jan 15 20:22:20 1995
***************
*** 16,22 ****
--- 16,26 ----
  {
  	int i,j;
  
+ #ifdef _USE_SVGALIB_
+ 	vga_init();
+ #else
  	get_rid_of_root();
+ #endif
  	for (i=1; i<argc; i++)
  		if (*argv[i] == '-') {
  			if (strcmp(argv[i],"--") == 0) {
diff -c vgamp/output.c svgamp/output.c
*** vgamp/output.c	Wed May  4 16:39:00 1994
--- svgamp/output.c	Sun Jan 15 20:21:14 1995
***************
*** 6,11 ****
--- 6,15 ----
  #include <sys/types.h>
  #include <sys/timeb.h>
  
+ #ifdef _USE_SVGALIB_
+ #include <vga.h>
+ #endif
+ 
  extern mb_width,width,height,mod_y,mod_c,gray,frames;
  extern struct pict_image *current;
  extern char *vram;
***************
*** 43,49 ****
--- 47,61 ----
  			pal[(i+128)*3+1] = C_CONV(-j*0.34414);
  			pal[(i+128)*3+2] = C_CONV(j*1.77200);
  		}
+ #ifdef _USE_SVGALIB_
+ 	vga_setmode(G320x200x256);
+ 	for (i=0; i<256; i++) {
+ 		vga_setpalette(i,pal[i*3]>>2,pal[i*3+1]>>2,pal[i*3+2]>>2);
+ 	}
+ 	vram = graph_mem;
+ #else
  	graph_mode(pal);
+ #endif
  	ftime(&start);
  }
  
***************
*** 56,61 ****
--- 68,74 ----
  	if (gray) {
  		hs = width>320 ? 320 : width;
  		vs = height>200 ? 200 : height;
+ 
  		a = vram;
  		b = current->lum;
  		do {
