home *** CD-ROM | disk | FTP | other *** search
- /***************************************************\
- * *
- * S T I C K M O U S E *
- * *
- * 901002 V 1.0 written and released by Dr. Music *
- * *
- * Dr. Music is: *
- * Henning Schmiedehausen *
- * Glueckstrasse 3 *
- * D-8520 Erlangen *
- * GERMANY *
- * hgschmie@faui41.informatik.uni-erlangen.de *
- * *
- * This program is placed in the public domain *
- * It may be distributed freely as long as this *
- * message is left unchanged. *
- * You may add it to any PD-Disk you want, as long *
- * as you don't charge more money than necessary *
- * to distribute the Disk. *
- * *
- \***************************************************/
-
- /* This program will switch the intuition-input.device
- to use different ports and Devices at the external ports to
- control the mouse-pointer. The trigger button will simulate
- the left mouse button, the right button must be simulated via
- Right-Amiga and ALT
- */
-
- /* Usage of this program: STICKMOUSE <port> <device> */
- /* just STICKMOUSE
- will set the port to 0 and the device to MOUSE (default) */
-
- #include <ctype.h>
- #include <exec/types.h>
- #include <devices/input.h>
- #include <devices/gameport.h>
-
- void SetMousePort(request,port)
- struct IOStdReq *request;
- UBYTE port;
- {
- UBYTE MyPort;
- MyPort = port;
- request->io_Command = (UWORD)IND_SETMPORT;
- request->io_Data = (APTR)&MyPort;
- request->io_Length = 1L;
- DoIO(request);
- }
-
- void SetMouseDev(request,dev)
- struct IOStdReq *request;
- UBYTE dev;
- {
- UBYTE MyDev;
- MyDev = dev;
- request->io_Command = (UWORD)IND_SETMTYPE;
- request->io_Data = (APTR)&MyDev;
- request->io_Length = 1L;
- DoIO(request);
- }
-
- static struct IOStdReq *StickMouseReq;
- static struct MsgPort *StickMousePort;
-
- main(argc,argv)
- int argc;
- STRPTR argv[];
- {
-
- register COUNT i; /* for our loops */
-
- UBYTE Stick_Port, /* This will keep the Port-Number */
- Stick_Dev; /* and this one the Device-Type */
-
- if((argc<3))
- {
- if(argc==1)
- {
- Stick_Port = 0;
- Stick_Dev = GPCT_MOUSE; /* Default-Settings for MOUSE */
- }
- else
- if((argc==2) && (argv[1][0] == '?'))
- {
- printf("\n\n STICKMOUSE: switches the Mouse-Pointer-Device\n");
- printf(" USAGE: STICKMOUSE <port> <device>\n");
- printf(" <port> = 0/1 for the Joyports\n");
- printf(" <device> = MOUSE/JOY for the Device\n");
- printf(" STICKMOUSE without params will set to default\n");
- printf(" written by Dr. Music 1990\n");
- exit(10);
- }
- else
- {
- printf("Useage: StickMouse <port> <dev> or StickMouse ? for help\n");
- exit(10);
- }
- }
- else
- {
- Stick_Port = (short)((char)argv[1][0] - '0');
- if((Stick_Port < 0) || (Stick_Port > 1))
- {
- printf("Port-Number must be 0 or 1\n");
- exit(10);
- }
- for(i=0;i<strlen(argv[2]);i++)
- argv[2][i] = toupper((char)argv[2][i]);
- if(!strcmp(argv[2],"JOY"))
- Stick_Dev = GPCT_RELJOYSTICK;
- else
- if(!strcmp(argv[2],"MOUSE"))
- Stick_Dev = GPCT_MOUSE;
- else
- {
- printf("Device must be either MOUSE or JOY\n");
- exit(10);
- }
- }
- /* ok, end of parsing: 0 / 1 is port-number, GPCT_MOUSE / RELJOYSTICK is type
- */
- StickMousePort = (struct MsgPort *)CreatePort("StickMouse_is_here",NULL);
- StickMouseReq = (struct IOStdReq *)CreateStdIO(StickMousePort);
- OpenDevice("input.device",0,StickMouseReq,0);
-
-
- SetMousePort(StickMouseReq,Stick_Port);
- SetMouseDev(StickMouseReq,Stick_Dev);
-
- CloseDevice(StickMouseReq);
- DeleteStdIO(StickMouseReq);
- DeletePort(StickMousePort);
-
- }
-
-
-