2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
8 #include <proto/lowlevel.h>
9 #include <libraries/lowlevel_ext.h>
15 struct Library
*LowLevelBase
;
17 static void printbuttons(ULONG val
)
19 if (val
& JPF_BUTTON_PLAY
) printf("[PLAY/MMB]");
20 if (val
& JPF_BUTTON_REVERSE
) printf("[REVERSE]");
21 if (val
& JPF_BUTTON_FORWARD
) printf("[FORWARD]");
22 if (val
& JPF_BUTTON_GREEN
) printf("[SHUFFLE]");
23 if (val
& JPF_BUTTON_RED
) printf("[SELECT/LMB/FIRE]");
24 if (val
& JPF_BUTTON_BLUE
) printf("[STOP/RMB]");
27 static void printmousedirections(ULONG val
)
29 printf("[%d,%d]", (int)(val
& JP_MHORZ_MASK
), (int)(val
& JP_MVERT_MASK
) >> 8);
32 static void printajoydirections(ULONG val
)
34 printf("[%d, %d]", (int)(val
& JP_XAXIS_MASK
), (int)(val
& JP_YAXIS_MASK
) >> 8);
36 static void printjoydirections(ULONG val
)
38 if (val
& JPF_JOY_UP
) printf("[UP]");
39 if (val
& JPF_JOY_DOWN
) printf("[DOWN]");
40 if (val
& JPF_JOY_LEFT
) printf("[LEFT]");
41 if (val
& JPF_JOY_RIGHT
) printf("[RIGHT]");
44 static void printjoyport(ULONG val
)
48 for(i
= 31; i
>= 0; i
--)
50 printf("%d", (val
& (1 << i
)) ? 1 : 0);
55 if ((val
& JP_TYPE_MASK
) == JP_TYPE_NOTAVAIL
) printf("NOT AVAILABLE");
56 if ((val
& JP_TYPE_MASK
) == JP_TYPE_UNKNOWN
) printf("UNKNOWN");
58 if ((val
& JP_TYPE_MASK
) == JP_TYPE_JOYSTK
)
60 printf("JOYSTICK - ");
61 printjoydirections(val
);
65 if ((val
& JP_TYPE_MASK
) == JP_TYPE_GAMECTLR
)
67 printf("GAME CONTROLLER - ");
68 printjoydirections(val
);
72 if ((val
& JP_TYPE_MASK
) == JP_TYPE_MOUSE
)
75 printmousedirections(val
);
79 if ((val
& JP_TYPE_MASK
) == JP_TYPE_ANALOGUE
)
81 printf("JOYSTICK[ANALOGUE] - ");
82 printajoydirections(val
);
89 int main(int argc
, char **argv
)
93 if (argc
== 2) unit
= atoi(argv
[1]);
95 LowLevelBase
= OpenLibrary("lowlevel.library", 0);
101 while(!CheckSignal(SIGBREAKF_CTRL_C
))
105 new = ReadJoyPort(unit
);
114 CloseLibrary(LowLevelBase
);