mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-18 00:10:04 +00:00
dee1bd55d7
PR: 5352
782 lines
21 KiB
Plaintext
782 lines
21 KiB
Plaintext
diff -ruN ../virgin/Makefile ./Makefile
|
|
--- ../virgin/Makefile Wed Dec 31 18:00:00 1969
|
|
+++ ./Makefile Tue Dec 10 11:42:20 1996
|
|
@@ -0,0 +1,24 @@
|
|
+
|
|
+SUBDIR+= joystick4doom
|
|
+SUBDIR+= musserver
|
|
+
|
|
+all: doom.sh
|
|
+
|
|
+install:
|
|
+ mkdir -p ${PREFIX}/libexec/doom
|
|
+ mkdir -p ${PREFIX}/share/doom
|
|
+ install -c -m 755 doom.sh ${PREFIX}/bin/doom
|
|
+ for i in xdoom sndserver; do \
|
|
+ install -c -m 755 doom-1.8/$$i ${PREFIX}/libexec/doom; \
|
|
+ done
|
|
+ for i in doom1.wad README README.config README.linuxx; do \
|
|
+ install -c -m 644 doom-1.8/$$i ${PREFIX}/share/doom; \
|
|
+ done
|
|
+ (cd musserver; make install)
|
|
+ (cd joystick4doom; make install)
|
|
+
|
|
+.include <bsd.subdir.mk>
|
|
+
|
|
+doom.sh:
|
|
+ sed "s,@PREFIX@,${PREFIX}," doom.sh.in >doom.sh
|
|
+
|
|
Binary files ../virgin/doom-1.8/pat and ./doom-1.8/pat differ
|
|
Binary files ../virgin/doom-1.8/sdoom and ./doom-1.8/sdoom differ
|
|
Binary files ../virgin/doom-1.8/xdoom and ./doom-1.8/xdoom differ
|
|
diff -ruN ../virgin/doom.sh.in ./doom.sh.in
|
|
--- ../virgin/doom.sh.in Wed Dec 31 18:00:00 1969
|
|
+++ ./doom.sh.in Wed Dec 11 09:58:06 1996
|
|
@@ -0,0 +1,20 @@
|
|
+#!/bin/sh
|
|
+
|
|
+if [ -e /dev/joy0 ]; then
|
|
+ if sh -c 'exec 9</dev/joy0' 2>/dev/null; then
|
|
+ echo using joystick
|
|
+ exec 9>&-
|
|
+ [ -f /tmp/joystick4doom.pid ] && @PREFIX@/libexec/doom/joystick4xdoom -k
|
|
+ @PREFIX@/libexec/doom/joystick4xdoom /dev/joy0 Control Space &
|
|
+ fi
|
|
+fi
|
|
+
|
|
+DOOMWADDIR=@PREFIX@/share/doom; export DOOMWADDIR
|
|
+PATH=@PREFIX@/libexec/doom:${PATH}
|
|
+
|
|
+cd @PREFIX@/libexec/doom
|
|
+@PREFIX@/libexec/doom/xdoom $*
|
|
+[ -f /tmp/joystick4doom.pid ] && @PREFIX@/libexec/doom/joystick4xdoom -k
|
|
+
|
|
+ipcrm $(ipcs -m |sed -n 's,^\(m *[0-9][0-9]*\).*,-\1,p')
|
|
+
|
|
diff -ruN ../virgin/joystick4doom/Makefile ./joystick4doom/Makefile
|
|
--- ../virgin/joystick4doom/Makefile Wed Dec 14 01:27:14 1994
|
|
+++ ./joystick4doom/Makefile Tue Dec 10 11:39:26 1996
|
|
@@ -13,8 +13,8 @@
|
|
# Define this to be the file where the joystick settings are saved.
|
|
DATFILE = \"/usr/local/lib/joystick.dat\"
|
|
|
|
-CFLAGS = -O2 $(DEBUG) $(THRESHOLD) -I. -DJOYSTICK_DAT=$(DATFILE)
|
|
-XLDPATH = -L/usr/X11R6/lib
|
|
+CFLAGS = -O2 $(DEBUG) $(THRESHOLD) -I${X11BASE}/include -DJOYSTICK_DAT=$(DATFILE)
|
|
+XLDPATH = -L${X11BASE}/lib
|
|
LDFLAGS = -s
|
|
XLIBS = -lX11
|
|
|
|
@@ -22,15 +22,16 @@
|
|
OBJS = joystick4doom.o
|
|
XBIN = joystick4xdoom
|
|
SBIN = joystick4sdoom
|
|
-PRGS = $(XBIN) $(SBIN)
|
|
+PRGS = $(XBIN)
|
|
|
|
all: $(PRGS) $(SRCS)
|
|
|
|
$(XBIN):
|
|
$(CC) -DX11 $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(XBIN) $(XLDPATH) $(XLIBS)
|
|
|
|
-$(SBIN):
|
|
- $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(SBIN)
|
|
-
|
|
clean:
|
|
$(RM) $(OBJS) $(PRGS)
|
|
+
|
|
+install: ${XBIN}
|
|
+ install -cs ${XBIN} ${PREFIX}/libexec/doom
|
|
+
|
|
diff -ruN ../virgin/joystick4doom/README.FreeBSD ./joystick4doom/README.FreeBSD
|
|
--- ../virgin/joystick4doom/README.FreeBSD Wed Dec 31 18:00:00 1969
|
|
+++ ./joystick4doom/README.FreeBSD Tue Dec 10 11:20:58 1996
|
|
@@ -0,0 +1,27 @@
|
|
+Sun Nov 12 23:52:35 PST 1995
|
|
+Hi,
|
|
+
|
|
+The Linux Joystick for doom has been ported to FreeBSD and it is at:
|
|
+rah.star-gate.com:/pub/joystick4doom.tar.gz
|
|
+
|
|
+I have included in the tar file the original FreeBSD joystick.c
|
|
+test program . joystick.c is not part of the original linux's
|
|
+joystick tar distribution.
|
|
+
|
|
+to compile the joystick4doom:
|
|
+
|
|
+ cc -o joystick4doom -I/usr/X11R6/include -DX11 joystick4doom.c -L/usr/X11R6/lib -lX11 -lm
|
|
+
|
|
+now calibrate it:
|
|
+./joystick4doom -c /dev/joy0
|
|
+
|
|
+To run, I use the following command:
|
|
+./joystick4doom /dev/joy0 Control Space
|
|
+
|
|
+Now run xdoom and have a ball 8)
|
|
+
|
|
+ Amancio
|
|
+
|
|
+
|
|
+
|
|
+
|
|
diff -ruN ../virgin/joystick4doom/joystick.c ./joystick4doom/joystick.c
|
|
--- ../virgin/joystick4doom/joystick.c Wed Dec 31 18:00:00 1969
|
|
+++ ./joystick4doom/joystick.c Tue Dec 10 11:20:58 1996
|
|
@@ -0,0 +1,320 @@
|
|
+/*
|
|
+ * Joystick test program for FreeBSD
|
|
+ *
|
|
+ * Compile with: cc -o joystick joystick.c -lncurses
|
|
+ *
|
|
+ *
|
|
+ * (C) Copyright 1995 Dave Bodenstab
|
|
+ * All rights reserved.
|
|
+ *
|
|
+ * This program and/or source code may be used or distributed without
|
|
+ * restriction provided this copyright notice is preserved, no fee is
|
|
+ * charged, and this source code is included with any binary distribution.
|
|
+ * Commercial use (i.e. you make money using this software) is prohibited
|
|
+ * without the express written consent of the author. The author may be
|
|
+ * contacted at the following address:
|
|
+ *
|
|
+ * Dave Bodenstab
|
|
+ * 22W451 Oldwoods Drive
|
|
+ * Naperville, Illinois 60565
|
|
+ * USA
|
|
+ */
|
|
+#include <stdio.h>
|
|
+#include <fcntl.h>
|
|
+#include <ncurses.h>
|
|
+#include <machine/joystick.h>
|
|
+
|
|
+const char m_align_ul[] ="Move stick to upper left corner and press a button";
|
|
+const char m_align_lr[] ="Move stick to lower right corner and press a button";
|
|
+const char m_button[] ="Press a button to continue";
|
|
+
|
|
+main( int argc, char **argv )
|
|
+{
|
|
+ int js, x, y, button1, button2;
|
|
+ int xLeft, xRight, yTop, yBotton;
|
|
+ int quitLeftX, quitTopY, quitRightX, quitBottomY;
|
|
+ WINDOW *winMovement, *winButton1Outline, *winButton2Outline, *winButton1, *winButton2, *winQuit;
|
|
+ struct joystick joystick;
|
|
+ char buffer[100];
|
|
+
|
|
+ if ( (js = open("/dev/joy0",O_RDONLY)) == -1 )
|
|
+ {
|
|
+ perror( "/dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ initscr();
|
|
+ curs_set( 0 );
|
|
+ leaveok( stdscr, TRUE );
|
|
+ border( 0, 0, 0, 0, 0, 0, 0, 0 );
|
|
+
|
|
+ /*
|
|
+ * Align the stick...
|
|
+ */
|
|
+ x = (COLS - 2 - strlen( m_align_ul )) / 2;
|
|
+ y = (LINES - 2) / 2;
|
|
+ mvaddstr( y, x, (char*)m_align_ul );
|
|
+ refresh();
|
|
+
|
|
+ for( ; ; napms(100) ) /* Wait for a button press... */
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( joystick.b1 || joystick.b2 )
|
|
+ {
|
|
+ xLeft = joystick.x;
|
|
+ yTop = joystick.y;
|
|
+
|
|
+ /* Wait for the button(s) to be released... */
|
|
+ for( ; ; napms(100) )
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( ! (joystick.b1 || joystick.b2) )
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ x = (COLS - 2 - strlen( m_align_lr )) / 2;
|
|
+ mvaddstr( y + 1, x, (char*)m_align_lr );
|
|
+ refresh();
|
|
+
|
|
+ for( ; ; napms(100) ) /* Wait for a button press... */
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( joystick.b1 || joystick.b2 )
|
|
+ {
|
|
+ xRight = joystick.x;
|
|
+ yBotton = joystick.y;
|
|
+
|
|
+ /* Wait for the button(s) to be released... */
|
|
+ for( ; ; napms(100) )
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( ! (joystick.b1 || joystick.b2) )
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ sprintf( buffer, "Upper left = (%d,%d)", xLeft, yTop );
|
|
+ x = (COLS - 2 - strlen( buffer )) / 2;
|
|
+ mvaddstr( y+2, x, buffer );
|
|
+ sprintf( buffer, "Lower right = (%d,%d)", xRight, yBotton );
|
|
+ x = (COLS - 2 - strlen( buffer )) / 2;
|
|
+ mvaddstr( y+3, x, buffer );
|
|
+ x = (COLS - 2 - strlen( m_button )) / 2;
|
|
+ mvaddstr( y+4, x, (char*)m_button );
|
|
+ refresh();
|
|
+
|
|
+ if ( xLeft >= xRight || yTop >= yBotton )
|
|
+ {
|
|
+ endwin();
|
|
+
|
|
+ printf( "The stick cannot be aligned properly. Either you didn't align the\n"
|
|
+ "stick properly in the upper-left and lower-right corners, or your\n"
|
|
+ "hardware is not working.\n" );
|
|
+
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ /* Wait for a button press... */
|
|
+ for( ; ; napms(100) )
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( joystick.b1 || joystick.b2 )
|
|
+ {
|
|
+ /* Wait for the button(s) to be released... */
|
|
+ for( ; ; napms(100) )
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( ! (joystick.b1 || joystick.b2) )
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ * Create the button windows, the movement window, and the QUIT window
|
|
+ */
|
|
+ x = (COLS - 2 - 2*7) / 3;
|
|
+ winButton1Outline = subwin( stdscr, 3, 7, LINES-3, x+1 );
|
|
+ wborder( winButton1Outline, 0, 0, 0, 0, 0, 0, ACS_BTEE, ACS_BTEE );
|
|
+ winButton1 = derwin( winButton1Outline, 1, 5, 1, 1 );
|
|
+
|
|
+ winButton2Outline = subwin( stdscr, 3, 7, LINES-3, COLS-1 - x - 1 - (7 - 1) );
|
|
+ wborder( winButton2Outline, 0, 0, 0, 0, 0, 0, ACS_BTEE, ACS_BTEE );
|
|
+ winButton2 = derwin( winButton2Outline, 1, 5, 1, 1 );
|
|
+
|
|
+ winMovement = subwin( stdscr, LINES-4, COLS-2, 1, 1 );
|
|
+ werase( winMovement );
|
|
+
|
|
+ winQuit = newwin( 5, 10, (LINES-4)/3 - 5/2, (COLS-2)/2 - 10/2 );
|
|
+ getbegyx( winQuit, quitTopY, quitLeftX );
|
|
+ getmaxyx( winQuit, quitBottomY, quitRightX );
|
|
+ quitRightX += quitLeftX - 1;
|
|
+ quitBottomY += quitTopY - 1;
|
|
+ wborder( winQuit, 0, 0, 0, 0, 0, 0, 0, 0 );
|
|
+ mvwaddstr( winQuit, 2, 3, "QUIT" );
|
|
+ overwrite( winQuit, winMovement );
|
|
+
|
|
+ touchwin( stdscr );
|
|
+ refresh();
|
|
+
|
|
+ /*
|
|
+ * Read the joystick, moving an '*' around the movement window. When a
|
|
+ * button is pressed, highlight the corresponding button window. If the
|
|
+ * current position is within the QUIT window and a button is pressed,
|
|
+ * exit the program.
|
|
+ */
|
|
+ button1 = 0;
|
|
+ button2 = 0;
|
|
+ x = (COLS-2) / 2;
|
|
+ y = (LINES-4) / 2;
|
|
+ mvwaddch( winMovement, y, x, '*' );
|
|
+ wrefresh( winMovement );
|
|
+
|
|
+ for( ; ; napms(100) )
|
|
+ {
|
|
+ if ( read(js,&joystick,sizeof(joystick)) != sizeof(joystick) )
|
|
+ {
|
|
+ endwin();
|
|
+ perror( "read /dev/joy0" );
|
|
+ exit( 1 );
|
|
+ }
|
|
+
|
|
+ if ( button1 != joystick.b1 ) /* Check for button 1 */
|
|
+ {
|
|
+ touchwin( winMovement );
|
|
+
|
|
+ switch( button1 = joystick.b1 )
|
|
+ {
|
|
+ case 0:
|
|
+ wattroff( winButton1, A_REVERSE );
|
|
+ break;
|
|
+ case 1:
|
|
+ wattron( winButton1, A_REVERSE );
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ mvwaddstr( winButton1, 0, 0, " " );
|
|
+ wrefresh( winButton1 );
|
|
+ }
|
|
+
|
|
+ if ( button2 != joystick.b2 ) /* Check for button 2 */
|
|
+ {
|
|
+ touchwin( winMovement );
|
|
+
|
|
+ switch( button2 = joystick.b2 )
|
|
+ {
|
|
+ case 0:
|
|
+ wattroff( winButton2, A_REVERSE );
|
|
+ break;
|
|
+ case 1:
|
|
+ wattron( winButton2, A_REVERSE );
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ mvwaddstr( winButton2, 0, 0, " " );
|
|
+ wrefresh( winButton2 );
|
|
+ }
|
|
+
|
|
+ if ( joystick.x != x || joystick.y != y ) /* Check for movement */
|
|
+ {
|
|
+ int nx, ny;
|
|
+
|
|
+ /* Scale the actual coordinates to the nearest character coordinate */
|
|
+ nx = ((joystick.x - xLeft) * (COLS-2 - 1)) / (xRight - xLeft);
|
|
+ if ( nx < 0 )
|
|
+ nx = 0;
|
|
+ else
|
|
+ if ( nx > COLS-2 - 1 )
|
|
+ nx = COLS-2 - 1;
|
|
+
|
|
+ ny = ((joystick.y - yTop) * (LINES-4 - 1)) / (yBotton - yTop);
|
|
+ if ( ny < 0 )
|
|
+ ny = 0;
|
|
+ else
|
|
+ if ( ny > LINES-4 - 1 )
|
|
+ ny = LINES-4 - 1;
|
|
+
|
|
+ if ( x != nx || y != ny ) /* Check for visible movement */
|
|
+ {
|
|
+ mvwaddch( winMovement, y, x, ' ' );
|
|
+
|
|
+ /*
|
|
+ * If the old (x,y) was within the QUIT window, then it must be
|
|
+ * refreshed to restore any character that was overwritten by the
|
|
+ * '*'
|
|
+ */
|
|
+ if ( x+1 >= quitLeftX && x+1 <= quitRightX && y+1 >= quitTopY && y+1 <= quitBottomY )
|
|
+ {
|
|
+ touchwin( stdscr );
|
|
+ overwrite( winQuit, winMovement );
|
|
+ }
|
|
+
|
|
+ mvwaddch( winMovement, y = ny, x = nx, '*' );
|
|
+ wrefresh( winMovement );
|
|
+
|
|
+ /* Show the current coordinates */
|
|
+ sprintf( buffer, "[%3d,%3d]", x, y );
|
|
+ mvaddstr( LINES-2, COLS-1 -3 - strlen(buffer), buffer );
|
|
+ refresh();
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ * If (x,y) is within the QUIT window, then we exit if either button
|
|
+ * is pressed
|
|
+ */
|
|
+ if ( x+1 >= quitLeftX && x+1 <= quitRightX && y+1 >= quitTopY && y+1 <= quitBottomY )
|
|
+ {
|
|
+ if ( button1 || button2 )
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ endwin();
|
|
+ exit( 0 );
|
|
+}
|
|
diff -ruN ../virgin/joystick4doom/joystick4doom.c ./joystick4doom/joystick4doom.c
|
|
--- ../virgin/joystick4doom/joystick4doom.c Wed Dec 14 01:26:42 1994
|
|
+++ ./joystick4doom/joystick4doom.c Tue Dec 10 11:20:58 1996
|
|
@@ -24,7 +24,7 @@
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <signal.h>
|
|
-
|
|
+#include <machine/joystick.h>
|
|
#ifdef X11
|
|
#define XK_MISCELLANY
|
|
#define XK_LATIN1
|
|
@@ -41,19 +41,19 @@
|
|
#define FALSE 0
|
|
#endif /* X11 */
|
|
|
|
-#include <linux/joystick.h>
|
|
+/*#include <linux/joystick.h> */
|
|
|
|
#define PIDFILE "/tmp/joystick4doom.pid"
|
|
#ifndef JOYSTICK_DAT
|
|
-#define JOYSTICK_DAT "/usr/local/lib/joystick.dat"
|
|
+#define JOYSTICK_DAT "/usr/local/share/doom/joystick.dat"
|
|
#endif
|
|
|
|
#define PAUSETIME 100000
|
|
|
|
#define RELEASED 0
|
|
#define PRESSED 1
|
|
-#define HOLDDOWN 2
|
|
-#define UNPRESSED 3
|
|
+#define HOLDDOWN 1
|
|
+#define UNPRESSED -1
|
|
|
|
#define FIRST_BUTTON 0
|
|
#define SECOND_BUTTON 1
|
|
@@ -99,13 +99,15 @@
|
|
char *progname;
|
|
int joystick_device;
|
|
char *device_name;
|
|
-struct JS_DATA_TYPE js;
|
|
+/*struct JS_DATA_TYPE js; */
|
|
+ struct joystick js;
|
|
int button[2];
|
|
int xpos_left, xpos_middle, xpos_right, xpos_actual;
|
|
int ypos_upper,ypos_middle, ypos_lower, ypos_actual;
|
|
int i,j;
|
|
|
|
/* Keep track of where the joystick is */
|
|
+#define JS_RETURN 16
|
|
#define CENTERED 0x00
|
|
#define CUTRIGHT 0x01
|
|
#define CUTLEFT 0x02
|
|
@@ -182,9 +184,10 @@
|
|
"left", 0x69, 0xe9,
|
|
};
|
|
#endif /* X11 */
|
|
-
|
|
+
|
|
fprintf(stdout, "Joystick4Doom, 1994 by Artsoft Development\n");
|
|
-
|
|
+ button[0] = 0;
|
|
+ button[1] = 0;
|
|
/* Kill an existing joystick process if requested */
|
|
if ( (argc == 2) && (strcmp(argv[1], "-k") == 0) ) {
|
|
if ( (pidfile=fopen(PIDFILE, "r")) != NULL ) {
|
|
@@ -300,7 +303,7 @@
|
|
|
|
for(i=0;i<2;i++)
|
|
{
|
|
- if (button[i]==PRESSED)
|
|
+ if (button[i]==1)
|
|
{
|
|
#ifdef X11
|
|
SendKeyEvent(KeyPress,joykey[key[i]].pressed,joykey[key[i]].key);
|
|
@@ -321,7 +324,7 @@
|
|
#endif
|
|
}
|
|
}
|
|
- if (button[i]==RELEASED)
|
|
+ if (button[i]==0)
|
|
{
|
|
#ifdef X11
|
|
SendKeyEvent(KeyRelease,joykey[key[i]].released,joykey[key[i]].key);
|
|
@@ -492,7 +495,7 @@
|
|
WaitButton();
|
|
xpos_left =js.x;
|
|
ypos_upper=js.y;
|
|
- fprintf(stdout, "xpos_left = %d\nypos_upper = %d\n", js.x, js.y);
|
|
+
|
|
|
|
fprintf(stdout, "Move joystick to the lower right and press any button!\n");
|
|
WaitButton();
|
|
@@ -524,13 +527,14 @@
|
|
exit(-1);
|
|
}
|
|
|
|
- for(i=0;i<2;i++)
|
|
- {
|
|
- if (js.buttons & (1<<i))
|
|
- button[i] = (JB_UNPRESSED(i) ? PRESSED : HOLDDOWN);
|
|
- else
|
|
- button[i] = (JB_PRESSED(i) ? RELEASED : UNPRESSED);
|
|
- }
|
|
+ if (button[0] == 0 && js.b1 == 0 ) {
|
|
+ button[0] = -1;
|
|
+ } else button[0]= js.b1;
|
|
+
|
|
+ if (button[1] == 0 && js.b2 == 0 ) {
|
|
+ button[1] = -1;
|
|
+ } else button[1]= js.b2;
|
|
+
|
|
|
|
xpos_actual=js.x;
|
|
ypos_actual=js.y;
|
|
@@ -583,8 +587,11 @@
|
|
#else
|
|
void SendKeyEvent(char key)
|
|
{
|
|
+
|
|
if ( ioctl(console, TIOCSTI, &key) < 0 )
|
|
perror("ioctl(TIOCSTI)");
|
|
}
|
|
#endif /* X11 */
|
|
+
|
|
+
|
|
|
|
Binary files ../virgin/joystick4doom/joystick4sdoom and ./joystick4doom/joystick4sdoom differ
|
|
Binary files ../virgin/joystick4doom/joystick4xdoom and ./joystick4doom/joystick4xdoom differ
|
|
diff -ruN ../virgin/joystick4doom/linux/joystick.h ./joystick4doom/linux/joystick.h
|
|
--- ../virgin/joystick4doom/linux/joystick.h Tue Nov 8 02:11:32 1994
|
|
+++ ./joystick4doom/linux/joystick.h Tue Dec 10 11:20:59 1996
|
|
@@ -1,12 +1,11 @@
|
|
|
|
-#include <linux/sched.h>
|
|
-#include <linux/errno.h>
|
|
-#include <linux/major.h>
|
|
-#include <asm/io.h>
|
|
+/*#include <linux/sched.h> */
|
|
+#include <errno.h>
|
|
+/*#include <asm/io.h>
|
|
#include <asm/segment.h>
|
|
#include <asm/system.h>
|
|
#include <linux/module.h>
|
|
-
|
|
+*/
|
|
#define JS_RETURN sizeof(struct JS_DATA_TYPE) /*number of bytes returned by js_read*/
|
|
#define JS_TRUE 1
|
|
#define JS_FALSE 0
|
|
diff -ruN ../virgin/joystick4doom/linux/joystick.h~ ./joystick4doom/linux/joystick.h~
|
|
--- ../virgin/joystick4doom/linux/joystick.h~ Wed Dec 31 18:00:00 1969
|
|
+++ ./joystick4doom/linux/joystick.h~ Tue Dec 10 11:20:59 1996
|
|
@@ -0,0 +1,58 @@
|
|
+
|
|
+#include <linux/sched.h>
|
|
+#include <linux/errno.h>
|
|
+#include <linux/major.h>
|
|
+#include <asm/io.h>
|
|
+#include <asm/segment.h>
|
|
+#include <asm/system.h>
|
|
+#include <linux/module.h>
|
|
+
|
|
+#define JS_RETURN sizeof(struct JS_DATA_TYPE) /*number of bytes returned by js_read*/
|
|
+#define JS_TRUE 1
|
|
+#define JS_FALSE 0
|
|
+#define JS_PORT 0x201 /*io port for joystick operations*/
|
|
+#define JS_DEF_TIMEOUT 0x1300 /*default timeout value for js_read()*/
|
|
+#define JS_DEF_CORR 0 /*default correction factor*/
|
|
+#define JS_DEF_TIMELIMIT 10L /*default data valid time =10 jiffies == 100ms*/
|
|
+#define JS_X_0 0x01 /*bit mask for x-axis js0*/
|
|
+#define JS_Y_0 0x02 /*bit mask for y-axis js0*/
|
|
+#define JS_X_1 0x04 /*bit mask for x-axis js1*/
|
|
+#define JS_Y_1 0x08 /*bit mask for y-axis js1*/
|
|
+#define JS_MAX 2 /*Max number of joysticks*/
|
|
+#define PIT_MODE 0x43 /*io port for timer 0*/
|
|
+#define PIT_COUNTER_0 0x40 /*io port for timer 0*/
|
|
+#define JS_SET_CAL 0x01 /*ioctl cmd to set joystick correction factor*/
|
|
+#define JS_GET_CAL 0x02 /*ioctl cmd to get joystick correction factor*/
|
|
+#define JS_SET_TIMEOUT 0x03 /*ioctl cmd to set maximum number of iterations
|
|
+ to wait for a timeout*/
|
|
+#define JS_GET_TIMEOUT 0x04 /*as above, to get*/
|
|
+#define JS_SET_TIMELIMIT 0x05 /*set data retention time*/
|
|
+#define JS_GET_TIMELIMIT 0x06 /*get data retention time*/
|
|
+#define JS_GET_ALL 0x07 /*get the whole JS_DATA[minor] struct*/
|
|
+#define JS_SET_ALL 0x08 /*set the whole JS_DATA[minor] struct
|
|
+ except JS_BUSY!*/
|
|
+
|
|
+/*This union is used for the ioctl to set the scaling factor and to return
|
|
+ the current values for a joystick. 'buttons' is ignored on the ioctl call*/
|
|
+
|
|
+struct JS_DATA_TYPE {
|
|
+ int buttons;
|
|
+ int x;
|
|
+ int y;
|
|
+};
|
|
+
|
|
+/* This struct is used for misc data about the joystick*/
|
|
+struct JS_DATA_SAVE_TYPE {
|
|
+ int JS_TIMEOUT; /*timeout*/
|
|
+ int BUSY; /*joystick is in use*/
|
|
+ long JS_EXPIRETIME; /*Time when stick after which stick must be re-read*/
|
|
+ long JS_TIMELIMIT; /*Max time before data is invalid*/
|
|
+ struct JS_DATA_TYPE JS_SAVE; /*last read data*/
|
|
+ struct JS_DATA_TYPE JS_CORR; /*correction factor*/
|
|
+};
|
|
+
|
|
+#define LATCH (1193180L/HZ) /*initial timer 0 value*/
|
|
+#define DELTA_TIME(X,Y) ((X)-(Y)+(((X)>=(Y))?0:LATCH))
|
|
+#define CURRENT_JIFFIES (jiffies)
|
|
+
|
|
+#define JOYSTICK_MAJOR 15
|
|
diff -ruN ../virgin/musserver/Makefile ./musserver/Makefile
|
|
--- ../virgin/musserver/Makefile Fri Jul 28 01:30:47 1995
|
|
+++ ./musserver/Makefile Tue Dec 10 11:43:30 1996
|
|
@@ -7,12 +7,12 @@
|
|
|
|
# Uncomment this line for extra debugging output
|
|
#CFLAGS = -g -DDEBUG -I. -Wall -O2 -m486
|
|
-CFLAGS = -g -I. -Wall -O2 -m486
|
|
+CFLAGS = -I. -Wall -O2 -m486
|
|
#CFLAGS = -I. -Wall
|
|
LIBS = -s
|
|
|
|
INSTALL = install
|
|
-DESTDIR = /usr/local/bin
|
|
+DESTDIR = /usr/local/libexec/doom
|
|
SHELL = /bin/sh
|
|
|
|
#############################################
|
|
@@ -21,16 +21,25 @@
|
|
|
|
OBJS = musserver.o readwad.o playmus.o sequencer.o
|
|
|
|
-musserver: $(OBJS)
|
|
+musserver.bin: $(OBJS)
|
|
$(CC) $(LIBS) -o $@ $(OBJS)
|
|
|
|
+musserver.sh: musserver.sh.in
|
|
+ sed "s,@PREFIX@,${PREFIX}," musserver.sh.in >$@
|
|
+
|
|
clean:
|
|
- rm -f $(OBJS) ipc.o ipc musserver
|
|
+ rm -f $(OBJS) ipc.o ipc musserver.bin
|
|
|
|
-all: musserver
|
|
+all: musserver.bin musserver.sh doom-patch
|
|
|
|
install: all
|
|
- $(INSTALL) musserver $(DESTDIR)
|
|
+ $(INSTALL) -cs musserver.bin $(DESTDIR)
|
|
+ ${INSTALL} -c -m 755 musserver.sh ${DESTDIR}/musserver
|
|
|
|
ipc: ipc.o
|
|
$(CC) -o $@ ipc.o
|
|
+
|
|
+doom-patch:
|
|
+ zcat doompat.tgz |(cd ../doom-1.8; pax -rv)
|
|
+ @cd ../doom-1.8; ./pat @mus11.pat@xdoom || (/usr/bin/linux; ./pat @mus11.pat@xdoom)
|
|
+ touch doom-patch
|
|
Binary files ../virgin/musserver/musserver and ./musserver/musserver differ
|
|
diff -ruN ../virgin/musserver/musserver.c ./musserver/musserver.c
|
|
--- ../virgin/musserver/musserver.c Tue Aug 22 20:50:56 1995
|
|
+++ ./musserver/musserver.c Tue Dec 10 11:20:57 1996
|
|
@@ -28,6 +28,7 @@
|
|
#include <sys/ipc.h>
|
|
#include <sys/msg.h>
|
|
#include "musserver.h"
|
|
+#include <sys/errno.h>
|
|
|
|
extern int use_synth;
|
|
extern int seqfd;
|
|
diff -ruN ../virgin/musserver/musserver.h ./musserver/musserver.h
|
|
--- ../virgin/musserver/musserver.h Wed Aug 9 04:18:00 1995
|
|
+++ ./musserver/musserver.h Tue Dec 10 11:20:57 1996
|
|
@@ -18,7 +18,7 @@
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*************************************************************************/
|
|
|
|
-#include <sys/soundcard.h>
|
|
+#include <machine/soundcard.h>
|
|
|
|
struct mus_header { /* header of music lump */
|
|
char id[4];
|
|
diff -ruN ../virgin/musserver/musserver.sh.in ./musserver/musserver.sh.in
|
|
--- ../virgin/musserver/musserver.sh.in Wed Dec 31 18:00:00 1969
|
|
+++ ./musserver/musserver.sh.in Tue Dec 10 11:20:57 1996
|
|
@@ -0,0 +1,2 @@
|
|
+#!/bin/sh
|
|
+exec @PREFIX@/libexec/doom/musserver.bin -f $*
|
|
diff -ruN ../virgin/musserver/playmus.c ./musserver/playmus.c
|
|
--- ../virgin/musserver/playmus.c Tue Aug 22 20:14:30 1995
|
|
+++ ./musserver/playmus.c Tue Dec 10 11:20:57 1996
|
|
@@ -29,6 +29,7 @@
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include "musserver.h"
|
|
+#include <sys/errno.h>
|
|
|
|
void seqbuf_dump(void);
|
|
void reset_midi(void);
|
|
@@ -52,6 +53,8 @@
|
|
|
|
int returnval = 0;
|
|
|
|
+#define msgbuf mymsg
|
|
+
|
|
static char *doom2names[] = {
|
|
"D_RUNNIN", "D_STALKS", "D_COUNTD", "D_BETWEE", "D_DOOM", "D_THE_DA",
|
|
"D_SHAWN", "D_DDTBLU", "D_IN_CIT", "D_DEAD", "D_STLKS2", "D_THEDA2",
|
|
@@ -152,6 +155,7 @@
|
|
}
|
|
cleanup(1);
|
|
break;
|
|
+#if 0
|
|
case EIDRM:
|
|
if (verbose)
|
|
{
|
|
@@ -160,6 +164,7 @@
|
|
}
|
|
cleanup(1);
|
|
break;
|
|
+#endif
|
|
case EINTR:
|
|
if (verbose)
|
|
printf("Could not receive IPC message: received an interrupt signal\n");
|
|
@@ -172,8 +177,10 @@
|
|
}
|
|
cleanup(1);
|
|
break;
|
|
+#if 0
|
|
case ENOMSG:
|
|
break;
|
|
+#endif
|
|
}
|
|
free(recv);
|
|
}
|