1 #ifndef _INCLUDE_SYS_INP_H
2 #define _INCLUDE_SYS_INP_H
3 
4 #include "cleantyp.h"
5 #if defined(ENABLE_NETPLAY)
6 #include "SDL_net.h"
7 #endif
8 
9 /*
10  * Input section
11  *
12  * This one function part implements the input functionality
13  * It's called every vsync I think, i.e. almost 60 times a sec
14  */
15 
16 /*!
17  * Updates the Joypad variables, save/load game, make screenshots, display
18  * gui or launch fileselector if asked
19  * \return 1 if we must quit the emulation
20  * \return 0 else
21  */
22 int osd_keyboard(void);
23 
24 /*!
25  * Initialize the input services
26  * \return 1 if the initialization failed
27  * \return 0 on success
28  */
29 int osd_init_input(void);
30 
31 /*!
32  * Shutdown input services
33  */
34 void osd_shutdown_input(void);
35 
36 #if defined(ENABLE_NETPLAY)
37 /*!
38  * Initialize the netplay support
39  * \return 1 if the initialization failed
40  * \return 0 on success
41  */
42 int osd_init_netplay(void);
43 
44 /*!
45  * Shutdown netplay support
46  */
47 void osd_shutdown_netplay(void);
48 #endif
49 
50 /*!
51  * Number of the input configuration
52  */
53 extern UChar current_config;
54 
55 /*
56  * joymap
57  *
58  *
59  */
60 typedef enum
61 {
62   J_UP = 0,
63   J_DOWN,
64   J_LEFT,
65   J_RIGHT,
66   J_I,
67   J_II,
68   J_SELECT,
69   J_RUN,
70   J_AUTOI,
71   J_AUTOII,
72   J_PI,
73   J_PII,
74   J_PSELECT,
75   J_PRUN,
76   J_PAUTOI,
77   J_PAUTOII,
78   J_PXAXIS,
79   J_PYAXIS,
80   J_MAX,
81 
82   J_PAD_START = J_PI
83 } joymap;
84 
85 extern const char* joymap_reverse[J_MAX];
86 
87 /*
88  * input_config
89  *
90  * Definition of the type representating an input configuration
91  */
92 
93 /*
94  * local_input means the input data can be read locally and need not been relayed
95  * server_input means the data
96  */
97 
98 typedef enum { LOCAL_PROTOCOL, LAN_PROTOCOL, INTERNET_PROTOCOL } netplay_type ;
99 
100 typedef struct
101 {
102 
103 	//! Mouse device, 0 for none
104 	UChar mousedev;
105 
106 	//! Joypad device, 0 for none
107 	UChar joydev;
108 
109 	//! whether autofire is set
110 	UChar autoI;
111 	UChar autoII;
112 
113 	//! whether autofire triggered event
114 	UChar firedI;
115 	UChar firedII;
116 
117 	//! mapping for joypad and keyboard
118 	//! J_UP to J_PAD_START (excluded) are for use with the keyboard, others are
119 	//! for the joypad
120 	UInt16 joy_mapping[J_MAX];
121 
122 } individual_input_config;
123 
124 typedef struct
125 {
126   individual_input_config individual_config[5];
127 } input_config;
128 
129 /*
130  * config
131  *
132  * The array of input configuration settings
133  */
134 extern input_config config[16];
135 
136 /* defines for input type field */
137 
138 #define NONE      0
139 
140 #define KEYBOARD1 1
141 #define KEYBOARD2 2
142 #define KEYBOARD3 3
143 #define KEYBOARD4 4
144 #define KEYBOARD5 5
145 
146 #define JOYPAD1  11
147 #define JOYPAD2  12
148 #define JOYPAD3  13
149 #define JOYPAD4  14
150 
151 #define MOUSE1   20
152 #define MOUSE2   21
153 
154 #define SYNAPLINK 255
155 
156 	/*
157 	 * The associated prototypes for common input functions
158 	 */
159 
160 /* for nothing */
161 UInt16 noinput();
162 
163 /* for keyboard/gamepad input */
164 UInt16 input1();
165 UInt16 input2();
166 UInt16 input3();
167 UInt16 input4();
168 UInt16 input5();
169 
170 /* for joypad */
171 UInt16 joypad1();
172 UInt16 joypad2();
173 UInt16 joypad3();
174 UInt16 joypad4();
175 
176 /* for mouse */
177 UInt16 mouse1();
178 UInt16 mouse2();
179 
180 /* for synaptic link */
181 UInt16 synaplink();
182 
183 #endif
184