Create Xref-Html Frames Remove All Frames
file:/home/jivera/wd/pcsx/Dreamcast/PlugPAD.c (Tue Nov 25 22:46:14 2003
)
1: #include <kos.h>
2: #include "plugins.h"
3:
4: uint8 c;
5: long PadFlags = 0;
6:
7: long PAD__init(long flags) {
8: // SysPrintf("start PAD_init()\r\n");
9:
10: // printf("Flags: %08x\n", flags);
11: PadFlags |= flags;
12:
13: /* Read Configuration here */
14:
15: // SysPrintf("end PAD_init()\r\n");
16:
17: return 0;
18: }
19:
20: long PAD__shutdown(void) {
21: return 0;
22: }
23:
24: long PAD__open(void)
25: {
26: // SysPrintf("start PAD1_open()\r\n");
27: c = maple_first_controller();
28: // SysPrintf("end PAD1_open()\r\n");
29: return 0;
30: }
31:
32: long PAD__close(void) {
33: return 0;
34: }
35:
36: long PAD__readPort1(PadDataS* pad) {
37: // SysPrintf("start PAD1_readPort()\r\n");
38: cont_cond_t cond;
39: uint16 pad_status = 0xffff;
40:
41: if (cont_get_cond(c, &cond) < 0) {
42: printf("Error reading controller\n");
43: }
44: if (!(cond.buttons & CONT_START))
45: pad_status &= ~(1<<3);
46: if (!(cond.buttons & CONT_A))
47: pad_status &= ~(1<<14);
48: if (!(cond.buttons & CONT_B))
49: pad_status &= ~(1<<13);
50: if (!(cond.buttons & CONT_X))
51: pad_status &= ~(1<<15);
52: if (!(cond.buttons & CONT_Y))
53: pad_status &= ~(1<<12);
54: if (!(cond.buttons & CONT_DPAD_UP))
55: pad_status &= ~(1<<4);
56: if (!(cond.buttons & CONT_DPAD_DOWN))
57: pad_status &= ~(1<<6);
58: if (!(cond.buttons & CONT_DPAD_LEFT))
59: pad_status &= ~(1<<7);
60: if (!(cond.buttons & CONT_DPAD_RIGHT))
61: pad_status &= ~(1<<5);
62:
63: pad->buttonStatus = pad_status;
64: pad->controllerType = 4; // standard
65: // printf("Pad1 Status: %04x\n", pad_status);
66: // SysPrintf("end PAD1_readPort()\r\n");
67: return 0;
68: }
69:
70: long PAD__readPort2(PadDataS*a) {
71: return -1;
72: }
73: /* arch-tag: Matthew Dempsky Wed Oct 15 10:34:20 CST 2003 (Dreamcast/PlugPAD.c)
74: */
75:
Html form generated by Xrefactory version 1.6.4 on Fri Dec 12 20:52:56 2003
Trial version.