psx_gpu: fix interlace mode
[pcsx_rearmed.git] / plugins / dfinput / main.c
CommitLineData
4c08b9e7 1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2011
3 *
4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
9 */
10
11#include "main.h"
12
13unsigned char CurPad, CurByte, CurCmd, CmdLen;
14
15/* since this is not a proper plugin, so we'll hook emu internals in a hackish way like this */
16extern void *PAD1_startPoll, *PAD1_poll;
17extern void *PAD2_startPoll, *PAD2_poll;
18extern unsigned char PAD1__startPoll(int pad);
19extern unsigned char PAD2__startPoll(int pad);
20extern unsigned char PAD1__poll(unsigned char value);
21extern unsigned char PAD2__poll(unsigned char value);
22
23static int old_controller_type1 = -1, old_controller_type2 = -1;
24
25#define select_pad(n) \
26 if (pad.controllerType != old_controller_type##n) \
27 { \
28 switch (pad.controllerType) \
29 { \
30 case PSE_PAD_TYPE_ANALOGPAD: \
31 PAD##n##_startPoll = PADstartPoll_pad; \
32 PAD##n##_poll = PADpoll_pad; \
33 pad_init(); \
34 break; \
35 case PSE_PAD_TYPE_GUNCON: \
36 PAD##n##_startPoll = PADstartPoll_guncon; \
37 PAD##n##_poll = PADpoll_guncon; \
38 guncon_init(); \
39 break; \
40 case PSE_PAD_TYPE_GUN: \
41 default: \
42 PAD##n##_startPoll = PAD##n##__startPoll; \
43 PAD##n##_poll = PAD##n##__poll; \
44 break; \
45 } \
46 }
47
48void dfinput_activate(void)
49{
50 PadDataS pad;
51
52 PAD1_readPort1(&pad);
53 select_pad(1);
54
55 PAD2_readPort2(&pad);
56 select_pad(2);
57}