/*********************************************************************/ /* */ /* ProgramName: SetMouse */ /* */ /* Purpose: To indicate that the mouse is connected to a */ /* specific game port */ /* */ /* Programmer: Kodiak, Commodore-Amiga Inc. */ /* */ /* PlagiarPolicy: You got it, use it however you want. */ /* */ /*********************************************************************/ #include #include #include #include #include #include struct IOStdReq ior; struct MsgPort iorp; main(argc, argv) int argc; char *argv[]; { UBYTE port; /**/ /* this is not intended to be a tutorial about how to get arguments /* from either the CLI or workbench, so I'll just hard code this to /* set the mouse port to port '2' (the right mouse port). Assign /* the value port = 0; to set port '1' (the left mouse port). /**/ port = 1; /* Open the input device */ if (OpenDevice("input.device", 0, &ior, 0) != 0) { exit(20); } /* set up the message port in the I/O request */ iorp.mp_Node.ln_Type = NT_MSGPORT; iorp.mp_Flags = 0; if ((iorp.mp_SigBit = AllocSignal(-1)) < 0) { CloseDevice(&ior); exit(20); } iorp.mp_SigTask = (struct Task *) FindTask((char *) NULL); NewList(&iorp.mp_MsgList); ior.io_Message.mn_ReplyPort = &iorp; /* initiate the I/O request to change the mouse port */ ior.io_Command = IND_SETMPORT; ior.io_Data = &port; ior.io_Length = 1; DoIO(&ior); /* clean up */ CloseDevice(&ior); FreeSignal(iorp.mp_SigBit); }