Develop and Download Open Source Software

Browse CVS Repository

Contents of /mame32jp/mame32jp/src/inptport.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Tue May 7 00:17:30 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
CVS Tags: ver_0_60_1, ver0_60_2, ver0_60_3, ver0_60_4, ver0_60_5, HEAD
Changes since 1.5: +479 -26 lines
File MIME type: text/x-csrc
*** empty log message ***

1 /***************************************************************************
2
3 inptport.c
4
5 Input ports handling
6
7 TODO: remove the 1 analog device per port limitation
8 support for inputports producing interrupts
9 support for extra "real" hardware (PC throttle's, spinners etc)
10
11 ***************************************************************************/
12
13 #include "driver.h"
14 #include <math.h>
15
16 #ifdef MAME_NET
17 #include "network.h"
18
19 static unsigned short input_port_defaults[MAX_INPUT_PORTS];
20 static int default_player;
21 static int analog_player_port[MAX_INPUT_PORTS];
22 #endif /* MAME_NET */
23
24 /* header identifying the version of the game.cfg file */
25 /* mame 0.36b11 */
26 #define MAMECFGSTRING_V5 "MAMECFG\5"
27 #define MAMEDEFSTRING_V5 "MAMEDEF\4"
28
29 /* mame 0.36b12 with multi key/joy extension */
30 #define MAMECFGSTRING_V6 "MAMECFG\6"
31 #define MAMEDEFSTRING_V6 "MAMEDEF\5"
32
33 /* mame 0.36b13 with and/or/not combination */
34 #define MAMECFGSTRING_V7 "MAMECFG\7"
35 #define MAMEDEFSTRING_V7 "MAMEDEF\6"
36
37 /* mame 0.36b16 with key/joy merge */
38 #define MAMECFGSTRING_V8 "MAMECFG\x8"
39 #define MAMEDEFSTRING_V8 "MAMEDEF\7"
40
41 extern void *record;
42 extern void *playback;
43
44 extern unsigned int dispensed_tickets;
45 extern unsigned int coins[COIN_COUNTERS];
46 extern unsigned int lastcoin[COIN_COUNTERS];
47 extern unsigned int coinlockedout[COIN_COUNTERS];
48
49 static unsigned short input_port_value[MAX_INPUT_PORTS];
50 static unsigned short input_vblank[MAX_INPUT_PORTS];
51
52 /* Assuming a maxium of one analog input device per port BW 101297 */
53 static struct InputPort *input_analog[MAX_INPUT_PORTS];
54 static int input_analog_current_value[MAX_INPUT_PORTS],input_analog_previous_value[MAX_INPUT_PORTS];
55 static int input_analog_init[MAX_INPUT_PORTS];
56
57 static int mouse_delta_x[OSD_MAX_JOY_ANALOG], mouse_delta_y[OSD_MAX_JOY_ANALOG];
58 static int analog_current_x[OSD_MAX_JOY_ANALOG], analog_current_y[OSD_MAX_JOY_ANALOG];
59 static int analog_previous_x[OSD_MAX_JOY_ANALOG], analog_previous_y[OSD_MAX_JOY_ANALOG];
60
61 #ifdef MAME32JP
62 #define MAX_INPUT_BITS 1024
63 static int auto_pressed(InputSeq *seq, UINT32 type, int bit);
64 static UINT8 autopressed[MAX_INPUT_BITS];
65 static UINT32 autofire_enable;
66
67 extern INT32 volume_multiplier;
68 #endif
69
70 /***************************************************************************
71
72 Configuration load/save
73
74 ***************************************************************************/
75
76 /* this must match the enum in inptport.h */
77 char ipdn_defaultstrings[][MAX_DEFSTR_LEN] =
78 {
79 #ifdef JAPANESE
80 "OFF",
81 "ON",
82 "������",
83 "����",
84 "���C�t",
85 "�{�[�i�X���C�t",
86 "�����x",
87 "�f���T�E���h",
88 "�R�C��������",
89 "�R�C��A",
90 "�R�C��B",
91 "9�R�C��/1�N���W�b�g",
92 "8�R�C��/1�N���W�b�g",
93 "7�R�C��/1�N���W�b�g",
94 "6�R�C��/1�N���W�b�g",
95 "5�R�C��/1�N���W�b�g",
96 "4�R�C��/1�N���W�b�g",
97 "3�R�C��/1�N���W�b�g",
98 "8�R�C��/3�N���W�b�g",
99 "4�R�C��/2�N���W�b�g",
100 "2�R�C��/1�N���W�b�g",
101 "5�R�C��/3�N���W�b�g",
102 "3�R�C��/2�N���W�b�g",
103 "4�R�C��/3�N���W�b�g",
104 "4�R�C��/4�N���W�b�g",
105 "3�R�C��/3�N���W�b�g",
106 "2�R�C��/2�N���W�b�g",
107 "1�R�C��/1�N���W�b�g",
108 "4�R�C��/5�N���W�b�g",
109 "3�R�C��/4�N���W�b�g",
110 "2�R�C��/3�N���W�b�g",
111 "4�R�C��/7�N���W�b�g",
112 "2�R�C��/4�N���W�b�g",
113 "1�R�C��/2�N���W�b�g",
114 "2�R�C��/5�N���W�b�g",
115 "2�R�C��/6�N���W�b�g",
116 "1�R�C��/3�N���W�b�g",
117 "2�R�C��/7�N���W�b�g",
118 "2�R�C��/8�N���W�b�g",
119 "1�R�C��/4�N���W�b�g",
120 "1�R�C��/5�N���W�b�g",
121 "1�R�C��/6�N���W�b�g",
122 "1�R�C��/7�N���W�b�g",
123 "1�R�C��/8�N���W�b�g",
124 "1�R�C��/9�N���W�b�g",
125 "�t���[�v���C",
126 "����",
127 "�A�b�v���C�g",
128 "�J�N�e��",
129 "�������]",
130 "�T�[�r�X���[�h",
131 "���g�p",
132 "�s��"
133 #else
134 "Off",
135 "On",
136 "No",
137 "Yes",
138 "Lives",
139 "Bonus Life",
140 "Difficulty",
141 "Demo Sounds",
142 "Coinage",
143 "Coin A",
144 "Coin B",
145 "9 Coins/1 Credit",
146 "8 Coins/1 Credit",
147 "7 Coins/1 Credit",
148 "6 Coins/1 Credit",
149 "5 Coins/1 Credit",
150 "4 Coins/1 Credit",
151 "3 Coins/1 Credit",
152 "8 Coins/3 Credits",
153 "4 Coins/2 Credits",
154 "2 Coins/1 Credit",
155 "5 Coins/3 Credits",
156 "3 Coins/2 Credits",
157 "4 Coins/3 Credits",
158 "4 Coins/4 Credits",
159 "3 Coins/3 Credits",
160 "2 Coins/2 Credits",
161 "1 Coin/1 Credit",
162 "4 Coins/5 Credits",
163 "3 Coins/4 Credits",
164 "2 Coins/3 Credits",
165 "4 Coins/7 Credits",
166 "2 Coins/4 Credits",
167 "1 Coin/2 Credits",
168 "2 Coins/5 Credits",
169 "2 Coins/6 Credits",
170 "1 Coin/3 Credits",
171 "2 Coins/7 Credits",
172 "2 Coins/8 Credits",
173 "1 Coin/4 Credits",
174 "1 Coin/5 Credits",
175 "1 Coin/6 Credits",
176 "1 Coin/7 Credits",
177 "1 Coin/8 Credits",
178 "1 Coin/9 Credits",
179 "Free Play",
180 "Cabinet",
181 "Upright",
182 "Cocktail",
183 "Flip Screen",
184 "Service Mode",
185 "Unused",
186 "Unknown"
187 #endif
188 };
189
190 struct ipd inputport_defaults[] =
191 {
192 #ifdef JAPANESE
193 { IPT_UI_CONFIGURE, "�������j���[", SEQ_DEF_1(KEYCODE_TAB) },
194 { IPT_UI_ON_SCREEN_DISPLAY, "�I���X�N���[���f�B�X�v���C", SEQ_DEF_1(KEYCODE_TILDE) },
195 { IPT_UI_PAUSE, "�|�[�Y", SEQ_DEF_1(KEYCODE_P) },
196 { IPT_UI_RESET_MACHINE, "�Q�[�������Z�b�g", SEQ_DEF_1(KEYCODE_F3) },
197 { IPT_UI_SHOW_GFX, "�O���t�B�b�N�f�[�^�\��", SEQ_DEF_1(KEYCODE_F4) },
198 { IPT_UI_FRAMESKIP_DEC, "�t���[���X�L�b�v������", SEQ_DEF_1(KEYCODE_F8) },
199 { IPT_UI_FRAMESKIP_INC, "�t���[���X�L�b�v������", SEQ_DEF_1(KEYCODE_F9) },
200 { IPT_UI_THROTTLE, "�X�s�[�h���� �L��/����", SEQ_DEF_1(KEYCODE_F10) },
201 { IPT_UI_SHOW_FPS, "FPS���\��", SEQ_DEF_5(KEYCODE_F11, CODE_NOT, KEYCODE_LCONTROL, CODE_NOT, KEYCODE_LSHIFT) },
202 { IPT_UI_SHOW_PROFILER, "�v���t�@�C���\��", SEQ_DEF_2(KEYCODE_F11, KEYCODE_LSHIFT) },
203 #ifdef MESS
204 { IPT_UI_TOGGLE_UI, "UI �\����������", SEQ_DEF_1(KEYCODE_SCRLOCK) },
205 #endif
206 { IPT_UI_SNAPSHOT, "�X�i�b�v�V���b�g������", SEQ_DEF_1(KEYCODE_F12) },
207 { IPT_UI_TOGGLE_CHEAT, "�`�[�g �L��/����", SEQ_DEF_1(KEYCODE_F6) },
208 #ifdef MAME32JP
209 { IPT_UI_TOGGLE_AUTOFIRE, "�A�� ��������", SEQ_DEF_1(KEYCODE_NONE) },
210 { IPT_UI_TOGGLE_LOGWAVE, "WAV�^�� �J�n/���~", SEQ_DEF_1(KEYCODE_DEL) },
211 { IPT_UI_COMMAND, "�R�}���h�\��", SEQ_DEF_1(KEYCODE_END) },
212 #endif
213 { IPT_UI_UP, "UI ��", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
214 { IPT_UI_DOWN, "UI ��", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
215 { IPT_UI_LEFT, "UI ��", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
216 { IPT_UI_RIGHT, "UI �E", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
217 { IPT_UI_SELECT, "UI ����", SEQ_DEF_3(KEYCODE_ENTER, CODE_OR, JOYCODE_1_BUTTON1) },
218 { IPT_UI_CANCEL, "UI �L�����Z��", SEQ_DEF_1(KEYCODE_ESC) },
219 #if 0
220 { IPT_UI_PAN_UP, "��������������", SEQ_DEF_3(KEYCODE_PGUP, CODE_NOT, KEYCODE_LSHIFT) },
221 { IPT_UI_PAN_DOWN, "��������������", SEQ_DEF_3(KEYCODE_PGDN, CODE_NOT, KEYCODE_LSHIFT) },
222 { IPT_UI_PAN_LEFT, "��������������", SEQ_DEF_2(KEYCODE_PGUP, KEYCODE_LSHIFT) },
223 { IPT_UI_PAN_RIGHT, "�������E������", SEQ_DEF_2(KEYCODE_PGDN, KEYCODE_LSHIFT) },
224 #endif
225 #ifdef MAME_DEBUG
226 { IPT_UI_TOGGLE_DEBUG, "�f�o�b�K�\����������", SEQ_DEF_1(KEYCODE_F5) },
227 #endif
228 { IPT_UI_SAVE_STATE, "�v���C����������", SEQ_DEF_2(KEYCODE_F7, KEYCODE_LSHIFT) },
229 { IPT_UI_LOAD_STATE, "�v���C���������A", SEQ_DEF_3(KEYCODE_F7, CODE_NOT, KEYCODE_LSHIFT) },
230 { IPT_UI_ADD_CHEAT, "�`�[�g����", SEQ_DEF_1(KEYCODE_A) },
231 { IPT_UI_DELETE_CHEAT, "�`�[�g����", SEQ_DEF_1(KEYCODE_D) },
232 { IPT_UI_SAVE_CHEAT, "�`�[�g����", SEQ_DEF_1(KEYCODE_S) },
233 { IPT_UI_WATCH_VALUE, "�E�H�b�`���l�\��", SEQ_DEF_1(KEYCODE_W) },
234 { IPT_UI_EDIT_CHEAT, "�`�[�g���W", SEQ_DEF_1(KEYCODE_E) },
235 { IPT_START1, "1�v���C���[ �X�^�[�g", SEQ_DEF_3(KEYCODE_1, CODE_OR, JOYCODE_1_START) },
236 { IPT_START2, "2�v���C���[ �X�^�[�g", SEQ_DEF_3(KEYCODE_2, CODE_OR, JOYCODE_2_START) },
237 { IPT_START3, "3�v���C���[ �X�^�[�g", SEQ_DEF_3(KEYCODE_3, CODE_OR, JOYCODE_3_START) },
238 { IPT_START4, "4�v���C���[ �X�^�[�g", SEQ_DEF_3(KEYCODE_4, CODE_OR, JOYCODE_4_START) },
239 { IPT_COIN1, "�R�C��1", SEQ_DEF_3(KEYCODE_5, CODE_OR, JOYCODE_1_SELECT) },
240 { IPT_COIN2, "�R�C��2", SEQ_DEF_3(KEYCODE_6, CODE_OR, JOYCODE_2_SELECT) },
241 { IPT_COIN3, "�R�C��3", SEQ_DEF_3(KEYCODE_7, CODE_OR, JOYCODE_3_SELECT) },
242 { IPT_COIN4, "�R�C��4", SEQ_DEF_3(KEYCODE_8, CODE_OR, JOYCODE_4_SELECT) },
243 { IPT_SERVICE1, "�T�[�r�X1", SEQ_DEF_1(KEYCODE_9) },
244 { IPT_SERVICE2, "�T�[�r�X2", SEQ_DEF_1(KEYCODE_0) },
245 { IPT_SERVICE3, "�T�[�r�X3", SEQ_DEF_1(KEYCODE_MINUS) },
246 { IPT_SERVICE4, "�T�[�r�X4", SEQ_DEF_1(KEYCODE_EQUALS) },
247 #ifndef MESS
248 { IPT_TILT, "�e�B���g", SEQ_DEF_1(KEYCODE_T) },
249 #else
250 { IPT_TILT, "�e�B���g", SEQ_DEF_0 },
251 #endif
252
253 { IPT_JOYSTICK_UP | IPF_PLAYER1, "P1 ��", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
254 { IPT_JOYSTICK_DOWN | IPF_PLAYER1, "P1 ��", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
255 { IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 ��", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
256 { IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 �E", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
257 { IPT_BUTTON1 | IPF_PLAYER1, "P1 �{�^��1", SEQ_DEF_5(KEYCODE_LCONTROL, CODE_OR, JOYCODE_1_BUTTON1, CODE_OR, JOYCODE_MOUSE_1_BUTTON1) },
258 { IPT_BUTTON2 | IPF_PLAYER1, "P1 �{�^��2", SEQ_DEF_5(KEYCODE_LALT, CODE_OR, JOYCODE_1_BUTTON2, CODE_OR, JOYCODE_MOUSE_1_BUTTON3) },
259 { IPT_BUTTON3 | IPF_PLAYER1, "P1 �{�^��3", SEQ_DEF_5(KEYCODE_SPACE, CODE_OR, JOYCODE_1_BUTTON3, CODE_OR, JOYCODE_MOUSE_1_BUTTON2) },
260 { IPT_BUTTON4 | IPF_PLAYER1, "P1 �{�^��4", SEQ_DEF_3(KEYCODE_LSHIFT, CODE_OR, JOYCODE_1_BUTTON4) },
261 { IPT_BUTTON5 | IPF_PLAYER1, "P1 �{�^��5", SEQ_DEF_3(KEYCODE_Z, CODE_OR, JOYCODE_1_BUTTON5) },
262 { IPT_BUTTON6 | IPF_PLAYER1, "P1 �{�^��6", SEQ_DEF_3(KEYCODE_X, CODE_OR, JOYCODE_1_BUTTON6) },
263 { IPT_BUTTON7 | IPF_PLAYER1, "P1 �{�^��7", SEQ_DEF_1(KEYCODE_C) },
264 { IPT_BUTTON8 | IPF_PLAYER1, "P1 �{�^��8", SEQ_DEF_1(KEYCODE_V) },
265 { IPT_BUTTON9 | IPF_PLAYER1, "P1 �{�^��9", SEQ_DEF_1(KEYCODE_B) },
266 { IPT_BUTTON10 | IPF_PLAYER1, "P1 �{�^��10", SEQ_DEF_1(KEYCODE_N) },
267 #ifdef MAME32JP
268 { IPT_NEOGEO1 | IPF_PLAYER1, "P1 A+B (Neo-Geo)", SEQ_DEF_0 },
269 { IPT_NEOGEO2 | IPF_PLAYER1, "P1 A+C (Neo-Geo)", SEQ_DEF_0 },
270 { IPT_NEOGEO3 | IPF_PLAYER1, "P1 A+D (Neo-Geo)", SEQ_DEF_0 },
271 { IPT_NEOGEO4 | IPF_PLAYER1, "P1 B+C (Neo-Geo)", SEQ_DEF_0 },
272 { IPT_NEOGEO5 | IPF_PLAYER1, "P1 B+D (Neo-Geo)", SEQ_DEF_0 },
273 { IPT_NEOGEO6 | IPF_PLAYER1, "P1 C+D (Neo-Geo)", SEQ_DEF_0 },
274 { IPT_NEOGEO7 | IPF_PLAYER1, "P1 A+B+C (Neo-Geo)", SEQ_DEF_0 },
275 { IPT_NEOGEO8 | IPF_PLAYER1, "P1 A+B+D (Neo-Geo)", SEQ_DEF_0 },
276 { IPT_NEOGEO9 | IPF_PLAYER1, "P1 B+C+D (Neo-Geo)", SEQ_DEF_0 },
277 { IPT_NEOGEO10 | IPF_PLAYER1, "P1 A+B+C+D (Neo-Geo)",SEQ_DEF_0 },
278 { IPT_CPS1 | IPF_PLAYER1, "P1 �p���`�~2 (CPS)", SEQ_DEF_0 },
279 { IPT_CPS2 | IPF_PLAYER1, "P1 �p���`�~3 (CPS)", SEQ_DEF_0 },
280 { IPT_CPS3 | IPF_PLAYER1, "P1 �L�b�N�~2 (CPS)", SEQ_DEF_0 },
281 { IPT_CPS4 | IPF_PLAYER1, "P1 �L�b�N�~3 (CPS)", SEQ_DEF_0 },
282 { IPT_CPS5 | IPF_PLAYER1, "P1 �{�^��1+2 (CPS)", SEQ_DEF_0 },
283 { IPT_CPS6 | IPF_PLAYER1, "P1 �{�^��2+3 (CPS)", SEQ_DEF_0 },
284 { IPT_CPS7 | IPF_PLAYER1, "P1 �{�^��1+2+3 (CPS)", SEQ_DEF_0 },
285 { IPT_SPEC | IPF_PLAYER1, "P1 �{�^��1+2", SEQ_DEF_0 },
286 #endif
287 { IPT_JOYSTICKRIGHT_UP | IPF_PLAYER1, "P1 �E���o�[/��", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_1_BUTTON2) },
288 { IPT_JOYSTICKRIGHT_DOWN | IPF_PLAYER1, "P1 �E���o�[/��", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_1_BUTTON3) },
289 { IPT_JOYSTICKRIGHT_LEFT | IPF_PLAYER1, "P1 �E���o�[/��", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_1_BUTTON1) },
290 { IPT_JOYSTICKRIGHT_RIGHT | IPF_PLAYER1, "P1 �E���o�[/�E", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_1_BUTTON4) },
291 { IPT_JOYSTICKLEFT_UP | IPF_PLAYER1, "P1 �����o�[/��", SEQ_DEF_3(KEYCODE_E, CODE_OR, JOYCODE_1_UP) },
292 { IPT_JOYSTICKLEFT_DOWN | IPF_PLAYER1, "P1 �����o�[/��", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_1_DOWN) },
293 { IPT_JOYSTICKLEFT_LEFT | IPF_PLAYER1, "P1 �����o�[/��", SEQ_DEF_3(KEYCODE_S, CODE_OR, JOYCODE_1_LEFT) },
294 { IPT_JOYSTICKLEFT_RIGHT | IPF_PLAYER1, "P1 �����o�[/�E", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_1_RIGHT) },
295
296 { IPT_JOYSTICK_UP | IPF_PLAYER2, "P2 ��", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
297 { IPT_JOYSTICK_DOWN | IPF_PLAYER2, "P2 ��", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
298 { IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 ��", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
299 { IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 �E", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
300 { IPT_BUTTON1 | IPF_PLAYER2, "P2 �{�^��1", SEQ_DEF_3(KEYCODE_A, CODE_OR, JOYCODE_2_BUTTON1) },
301 { IPT_BUTTON2 | IPF_PLAYER2, "P2 �{�^��2", SEQ_DEF_3(KEYCODE_S, CODE_OR, JOYCODE_2_BUTTON2) },
302 { IPT_BUTTON3 | IPF_PLAYER2, "P2 �{�^��3", SEQ_DEF_3(KEYCODE_Q, CODE_OR, JOYCODE_2_BUTTON3) },
303 { IPT_BUTTON4 | IPF_PLAYER2, "P2 �{�^��4", SEQ_DEF_3(KEYCODE_W, CODE_OR, JOYCODE_2_BUTTON4) },
304 { IPT_BUTTON5 | IPF_PLAYER2, "P2 �{�^��5", SEQ_DEF_1(JOYCODE_2_BUTTON5) },
305 { IPT_BUTTON6 | IPF_PLAYER2, "P2 �{�^��6", SEQ_DEF_1(JOYCODE_2_BUTTON6) },
306 { IPT_BUTTON7 | IPF_PLAYER2, "P2 �{�^��7", SEQ_DEF_0 },
307 { IPT_BUTTON8 | IPF_PLAYER2, "P2 �{�^��8", SEQ_DEF_0 },
308 { IPT_BUTTON9 | IPF_PLAYER2, "P2 �{�^��9", SEQ_DEF_0 },
309 { IPT_BUTTON10 | IPF_PLAYER2, "P2 �{�^��10", SEQ_DEF_0 },
310 #ifdef MAME32JP
311 { IPT_NEOGEO1 | IPF_PLAYER2, "P2 A+B (Neo-Geo)", SEQ_DEF_0 },
312 { IPT_NEOGEO2 | IPF_PLAYER2, "P2 A+C (Neo-Geo)", SEQ_DEF_0 },
313 { IPT_NEOGEO3 | IPF_PLAYER2, "P2 A+D (Neo-Geo)", SEQ_DEF_0 },
314 { IPT_NEOGEO4 | IPF_PLAYER2, "P2 B+C (Neo-Geo)", SEQ_DEF_0 },
315 { IPT_NEOGEO5 | IPF_PLAYER2, "P2 B+D (Neo-Geo)", SEQ_DEF_0 },
316 { IPT_NEOGEO6 | IPF_PLAYER2, "P2 C+D (Neo-Geo)", SEQ_DEF_0 },
317 { IPT_NEOGEO7 | IPF_PLAYER2, "P2 A+B+C (Neo-Geo)", SEQ_DEF_0 },
318 { IPT_NEOGEO8 | IPF_PLAYER2, "P2 A+B+D (Neo-Geo)", SEQ_DEF_0 },
319 { IPT_NEOGEO9 | IPF_PLAYER2, "P2 B+C+D (Neo-Geo)", SEQ_DEF_0 },
320 { IPT_NEOGEO10 | IPF_PLAYER2, "P2 A+B+C+D (Neo-Geo)",SEQ_DEF_0 },
321 { IPT_CPS1 | IPF_PLAYER2, "P2 �p���`�~2 (CPS)", SEQ_DEF_0 },
322 { IPT_CPS2 | IPF_PLAYER2, "P2 �p���`�~3 (CPS)", SEQ_DEF_0 },
323 { IPT_CPS3 | IPF_PLAYER2, "P2 �L�b�N�~2 (CPS)", SEQ_DEF_0 },
324 { IPT_CPS4 | IPF_PLAYER2, "P2 �L�b�N�~3 (CPS)", SEQ_DEF_0 },
325 { IPT_CPS5 | IPF_PLAYER2, "P2 �{�^��1+2 (CPS)", SEQ_DEF_0 },
326 { IPT_CPS6 | IPF_PLAYER2, "P2 �{�^��2+3 (CPS)", SEQ_DEF_0 },
327 { IPT_CPS7 | IPF_PLAYER2, "P2 �{�^��1+2+3 (CPS)", SEQ_DEF_0 },
328 { IPT_SPEC | IPF_PLAYER2, "P2 �{�^��1+2", SEQ_DEF_0 },
329 #endif
330 { IPT_JOYSTICKRIGHT_UP | IPF_PLAYER2, "P2 �E���o�[/��", SEQ_DEF_0 },
331 { IPT_JOYSTICKRIGHT_DOWN | IPF_PLAYER2, "P2 �E���o�[/��", SEQ_DEF_0 },
332 { IPT_JOYSTICKRIGHT_LEFT | IPF_PLAYER2, "P2 �E���o�[/��", SEQ_DEF_0 },
333 { IPT_JOYSTICKRIGHT_RIGHT | IPF_PLAYER2, "P2 �E���o�[/�E", SEQ_DEF_0 },
334 { IPT_JOYSTICKLEFT_UP | IPF_PLAYER2, "P2 �����o�[/��", SEQ_DEF_0 },
335 { IPT_JOYSTICKLEFT_DOWN | IPF_PLAYER2, "P2 �����o�[/��", SEQ_DEF_0 },
336 { IPT_JOYSTICKLEFT_LEFT | IPF_PLAYER2, "P2 �����o�[/��", SEQ_DEF_0 },
337 { IPT_JOYSTICKLEFT_RIGHT | IPF_PLAYER2, "P2 �����o�[/�E", SEQ_DEF_0 },
338
339 { IPT_JOYSTICK_UP | IPF_PLAYER3, "P3 ��", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
340 { IPT_JOYSTICK_DOWN | IPF_PLAYER3, "P3 ��", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
341 { IPT_JOYSTICK_LEFT | IPF_PLAYER3, "P3 ��", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
342 { IPT_JOYSTICK_RIGHT | IPF_PLAYER3, "P3 �E", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
343 { IPT_BUTTON1 | IPF_PLAYER3, "P3 �{�^��1", SEQ_DEF_3(KEYCODE_RCONTROL, CODE_OR, JOYCODE_3_BUTTON1) },
344 { IPT_BUTTON2 | IPF_PLAYER3, "P3 �{�^��2", SEQ_DEF_3(KEYCODE_RSHIFT, CODE_OR, JOYCODE_3_BUTTON2) },
345 { IPT_BUTTON3 | IPF_PLAYER3, "P3 �{�^��3", SEQ_DEF_3(KEYCODE_ENTER, CODE_OR, JOYCODE_3_BUTTON3) },
346 { IPT_BUTTON4 | IPF_PLAYER3, "P3 �{�^��4", SEQ_DEF_1(JOYCODE_3_BUTTON4) },
347
348 #ifdef MAME32JP
349 { IPT_CPS5 | IPF_PLAYER3, "P3 �{�^��1+2 (CPS)", SEQ_DEF_0 },
350 { IPT_CPS6 | IPF_PLAYER3, "P3 �{�^��2+3 (CPS)", SEQ_DEF_0 },
351 { IPT_CPS7 | IPF_PLAYER3, "P3 �{�^��1+2+3 (CPS)", SEQ_DEF_0 },
352 { IPT_SPEC | IPF_PLAYER3, "P3 �{�^��1+2", SEQ_DEF_0 },
353 #endif
354 { IPT_JOYSTICK_UP | IPF_PLAYER4, "P4 ��", SEQ_DEF_1(JOYCODE_4_UP) },
355 { IPT_JOYSTICK_DOWN | IPF_PLAYER4, "P4 ��", SEQ_DEF_1(JOYCODE_4_DOWN) },
356 { IPT_JOYSTICK_LEFT | IPF_PLAYER4, "P4 ��", SEQ_DEF_1(JOYCODE_4_LEFT) },
357 { IPT_JOYSTICK_RIGHT | IPF_PLAYER4, "P4 �E", SEQ_DEF_1(JOYCODE_4_RIGHT) },
358 { IPT_BUTTON1 | IPF_PLAYER4, "P4 �{�^��1", SEQ_DEF_1(JOYCODE_4_BUTTON1) },
359 { IPT_BUTTON2 | IPF_PLAYER4, "P4 �{�^��2", SEQ_DEF_1(JOYCODE_4_BUTTON2) },
360 { IPT_BUTTON3 | IPF_PLAYER4, "P4 �{�^��3", SEQ_DEF_1(JOYCODE_4_BUTTON3) },
361 { IPT_BUTTON4 | IPF_PLAYER4, "P4 �{�^��4", SEQ_DEF_1(JOYCODE_4_BUTTON4) },
362
363 #ifdef MAME32JP
364 { IPT_CPS5 | IPF_PLAYER4, "P4 �{�^��1+2 (CPS)", SEQ_DEF_0 },
365 { IPT_CPS6 | IPF_PLAYER4, "P4 �{�^��2+3 (CPS)", SEQ_DEF_0 },
366 { IPT_CPS7 | IPF_PLAYER4, "P4 �{�^��1+2+3 (CPS)", SEQ_DEF_0 },
367 { IPT_SPEC | IPF_PLAYER4, "P4 �{�^��1+2", SEQ_DEF_0 },
368 #endif
369 { IPT_PEDAL | IPF_PLAYER1, "�y�_�� 1", SEQ_DEF_3(KEYCODE_LCONTROL, CODE_OR, JOYCODE_1_BUTTON1) },
370 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER1, "P1 ���������[�X <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
371 { IPT_PEDAL | IPF_PLAYER2, "�y�_�� 2", SEQ_DEF_3(KEYCODE_A, CODE_OR, JOYCODE_2_BUTTON1) },
372 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER2, "P2 ���������[�X <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
373 { IPT_PEDAL | IPF_PLAYER3, "�y�_�� 3", SEQ_DEF_3(KEYCODE_RCONTROL, CODE_OR, JOYCODE_3_BUTTON1) },
374 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER3, "P3 ���������[�X <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
375 { IPT_PEDAL | IPF_PLAYER4, "�y�_�� 4", SEQ_DEF_1(JOYCODE_4_BUTTON1) },
376 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER4, "P4 ���������[�X <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
377
378 { IPT_PADDLE | IPF_PLAYER1, "�p�h��", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
379 { (IPT_PADDLE | IPF_PLAYER1)+IPT_EXTENSION, "�p�h��", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
380 { IPT_PADDLE | IPF_PLAYER2, "�p�h�� 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
381 { (IPT_PADDLE | IPF_PLAYER2)+IPT_EXTENSION, "�p�h�� 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
382 { IPT_PADDLE | IPF_PLAYER3, "�p�h�� 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
383 { (IPT_PADDLE | IPF_PLAYER3)+IPT_EXTENSION, "�p�h�� 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
384 { IPT_PADDLE | IPF_PLAYER4, "�p�h�� 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
385 { (IPT_PADDLE | IPF_PLAYER4)+IPT_EXTENSION, "�p�h�� 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
386 { IPT_PADDLE_V | IPF_PLAYER1, "�p�h�� V", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
387 { (IPT_PADDLE_V | IPF_PLAYER1)+IPT_EXTENSION, "�p�h�� V", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
388 { IPT_PADDLE_V | IPF_PLAYER2, "�p�h�� V 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
389 { (IPT_PADDLE_V | IPF_PLAYER2)+IPT_EXTENSION, "�p�h�� V 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
390 { IPT_PADDLE_V | IPF_PLAYER3, "�p�h�� V 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
391 { (IPT_PADDLE_V | IPF_PLAYER3)+IPT_EXTENSION, "�p�h�� V 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
392 { IPT_PADDLE_V | IPF_PLAYER4, "�p�h�� V 4", SEQ_DEF_1(JOYCODE_4_UP) },
393 { (IPT_PADDLE_V | IPF_PLAYER4)+IPT_EXTENSION, "�p�h�� V 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
394 { IPT_DIAL | IPF_PLAYER1, "�_�C�A��", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
395 { (IPT_DIAL | IPF_PLAYER1)+IPT_EXTENSION, "�_�C�A��", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
396 { IPT_DIAL | IPF_PLAYER2, "�_�C�A�� 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
397 { (IPT_DIAL | IPF_PLAYER2)+IPT_EXTENSION, "�_�C�A�� 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
398 { IPT_DIAL | IPF_PLAYER3, "�_�C�A�� 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
399 { (IPT_DIAL | IPF_PLAYER3)+IPT_EXTENSION, "�_�C�A�� 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
400 { IPT_DIAL | IPF_PLAYER4, "�_�C�A�� 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
401 { (IPT_DIAL | IPF_PLAYER4)+IPT_EXTENSION, "�_�C�A�� 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
402 { IPT_DIAL_V | IPF_PLAYER1, "�_�C�A�� V", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
403 { (IPT_DIAL_V | IPF_PLAYER1)+IPT_EXTENSION, "�_�C�A�� V", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
404 { IPT_DIAL_V | IPF_PLAYER2, "�_�C�A�� V 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
405 { (IPT_DIAL_V | IPF_PLAYER2)+IPT_EXTENSION, "�_�C�A�� V 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
406 { IPT_DIAL_V | IPF_PLAYER3, "�_�C�A�� V 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
407 { (IPT_DIAL_V | IPF_PLAYER3)+IPT_EXTENSION, "�_�C�A�� V 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
408 { IPT_DIAL_V | IPF_PLAYER4, "�_�C�A�� V 4", SEQ_DEF_1(JOYCODE_4_UP) },
409 { (IPT_DIAL_V | IPF_PLAYER4)+IPT_EXTENSION, "�_�C�A�� V 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
410
411 { IPT_TRACKBALL_X | IPF_PLAYER1, "�g���b�N X", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
412 { (IPT_TRACKBALL_X | IPF_PLAYER1)+IPT_EXTENSION, "�g���b�N X", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
413 { IPT_TRACKBALL_X | IPF_PLAYER2, "�g���b�N X 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
414 { (IPT_TRACKBALL_X | IPF_PLAYER2)+IPT_EXTENSION, "�g���b�N X 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
415 { IPT_TRACKBALL_X | IPF_PLAYER3, "�g���b�N X 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
416 { (IPT_TRACKBALL_X | IPF_PLAYER3)+IPT_EXTENSION, "�g���b�N X 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
417 { IPT_TRACKBALL_X | IPF_PLAYER4, "�g���b�N X 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
418 { (IPT_TRACKBALL_X | IPF_PLAYER4)+IPT_EXTENSION, "�g���b�N X 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
419
420 { IPT_TRACKBALL_Y | IPF_PLAYER1, "�g���b�N Y", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
421 { (IPT_TRACKBALL_Y | IPF_PLAYER1)+IPT_EXTENSION, "�g���b�N Y", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
422 { IPT_TRACKBALL_Y | IPF_PLAYER2, "�g���b�N Y 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
423 { (IPT_TRACKBALL_Y | IPF_PLAYER2)+IPT_EXTENSION, "�g���b�N Y 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
424 { IPT_TRACKBALL_Y | IPF_PLAYER3, "�g���b�N Y 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
425 { (IPT_TRACKBALL_Y | IPF_PLAYER3)+IPT_EXTENSION, "�g���b�N Y 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
426 { IPT_TRACKBALL_Y | IPF_PLAYER4, "�g���b�N Y 4", SEQ_DEF_1(JOYCODE_4_UP) },
427 { (IPT_TRACKBALL_Y | IPF_PLAYER4)+IPT_EXTENSION, "�g���b�N Y 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
428
429 { IPT_AD_STICK_X | IPF_PLAYER1, "AD �X�e�B�b�N X", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
430 { (IPT_AD_STICK_X | IPF_PLAYER1)+IPT_EXTENSION, "AD �X�e�B�b�N X", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
431 { IPT_AD_STICK_X | IPF_PLAYER2, "AD �X�e�B�b�N X 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
432 { (IPT_AD_STICK_X | IPF_PLAYER2)+IPT_EXTENSION, "AD �X�e�B�b�N X 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
433 { IPT_AD_STICK_X | IPF_PLAYER3, "AD �X�e�B�b�N X 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
434 { (IPT_AD_STICK_X | IPF_PLAYER3)+IPT_EXTENSION, "AD �X�e�B�b�N X 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
435 { IPT_AD_STICK_X | IPF_PLAYER4, "AD �X�e�B�b�N X 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
436 { (IPT_AD_STICK_X | IPF_PLAYER4)+IPT_EXTENSION, "AD �X�e�B�b�N X 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
437
438 { IPT_AD_STICK_Y | IPF_PLAYER1, "AD �X�e�B�b�N Y", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
439 { (IPT_AD_STICK_Y | IPF_PLAYER1)+IPT_EXTENSION, "AD �X�e�B�b�N Y", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
440 { IPT_AD_STICK_Y | IPF_PLAYER2, "AD �X�e�B�b�N Y 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
441 { (IPT_AD_STICK_Y | IPF_PLAYER2)+IPT_EXTENSION, "AD �X�e�B�b�N Y 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
442 { IPT_AD_STICK_Y | IPF_PLAYER3, "AD �X�e�B�b�N Y 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
443 { (IPT_AD_STICK_Y | IPF_PLAYER3)+IPT_EXTENSION, "AD �X�e�B�b�N Y 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
444 { IPT_AD_STICK_Y | IPF_PLAYER4, "AD �X�e�B�b�N Y 4", SEQ_DEF_1(JOYCODE_4_UP) },
445 { (IPT_AD_STICK_Y | IPF_PLAYER4)+IPT_EXTENSION, "AD �X�e�B�b�N Y 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
446
447 { IPT_UNKNOWN, "�s��", SEQ_DEF_0 },
448 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
449 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
450 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
451 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
452 { IPT_END, 0, SEQ_DEF_0 } /* returned when there is no match */
453 #else
454 { IPT_UI_CONFIGURE, "Config Menu", SEQ_DEF_1(KEYCODE_TAB) },
455 { IPT_UI_ON_SCREEN_DISPLAY, "On Screen Display", SEQ_DEF_1(KEYCODE_TILDE) },
456 { IPT_UI_PAUSE, "Pause", SEQ_DEF_1(KEYCODE_P) },
457 { IPT_UI_RESET_MACHINE, "Reset Game", SEQ_DEF_1(KEYCODE_F3) },
458 { IPT_UI_SHOW_GFX, "Show Gfx", SEQ_DEF_1(KEYCODE_F4) },
459 { IPT_UI_FRAMESKIP_DEC, "Frameskip Dec", SEQ_DEF_1(KEYCODE_F8) },
460 { IPT_UI_FRAMESKIP_INC, "Frameskip Inc", SEQ_DEF_1(KEYCODE_F9) },
461 { IPT_UI_THROTTLE, "Throttle", SEQ_DEF_1(KEYCODE_F10) },
462 { IPT_UI_SHOW_FPS, "Show FPS", SEQ_DEF_5(KEYCODE_F11, CODE_NOT, KEYCODE_LCONTROL, CODE_NOT, KEYCODE_LSHIFT) },
463 { IPT_UI_SHOW_PROFILER, "Show Profiler", SEQ_DEF_2(KEYCODE_F11, KEYCODE_LSHIFT) },
464 #ifdef MESS
465 { IPT_UI_TOGGLE_UI, "UI Toggle", SEQ_DEF_1(KEYCODE_SCRLOCK) },
466 #endif
467 { IPT_UI_SNAPSHOT, "Save Snapshot", SEQ_DEF_1(KEYCODE_F12) },
468 { IPT_UI_TOGGLE_CHEAT, "Toggle Cheat", SEQ_DEF_1(KEYCODE_F6) },
469 #ifdef MAME32JP
470 { IPT_UI_TOGGLE_AUTOFIRE, "Toggle Autofire", SEQ_DEF_1(KEYCODE_NONE) },
471 { IPT_UI_TOGGLE_LOGWAVE, "Toggle Log Wave", SEQ_DEF_1(KEYCODE_DEL) },
472 { IPT_UI_COMMAND, "Show Command", SEQ_DEF_1(KEYCODE_END) },
473 #endif
474 { IPT_UI_UP, "UI Up", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
475 { IPT_UI_DOWN, "UI Down", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
476 { IPT_UI_LEFT, "UI Left", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
477 { IPT_UI_RIGHT, "UI Right", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
478 { IPT_UI_SELECT, "UI Select", SEQ_DEF_3(KEYCODE_ENTER, CODE_OR, JOYCODE_1_BUTTON1) },
479 { IPT_UI_CANCEL, "UI Cancel", SEQ_DEF_1(KEYCODE_ESC) },
480 { IPT_UI_PAN_UP, "Pan Up", SEQ_DEF_3(KEYCODE_PGUP, CODE_NOT, KEYCODE_LSHIFT) },
481 { IPT_UI_PAN_DOWN, "Pan Down", SEQ_DEF_3(KEYCODE_PGDN, CODE_NOT, KEYCODE_LSHIFT) },
482 { IPT_UI_PAN_LEFT, "Pan Left", SEQ_DEF_2(KEYCODE_PGUP, KEYCODE_LSHIFT) },
483 { IPT_UI_PAN_RIGHT, "Pan Right", SEQ_DEF_2(KEYCODE_PGDN, KEYCODE_LSHIFT) },
484 { IPT_UI_TOGGLE_DEBUG, "Toggle Debugger", SEQ_DEF_1(KEYCODE_F5) },
485 { IPT_UI_SAVE_STATE, "Save State", SEQ_DEF_2(KEYCODE_F7, KEYCODE_LSHIFT) },
486 { IPT_UI_LOAD_STATE, "Load State", SEQ_DEF_3(KEYCODE_F7, CODE_NOT, KEYCODE_LSHIFT) },
487 { IPT_UI_ADD_CHEAT, "Add Cheat", SEQ_DEF_1(KEYCODE_A) },
488 { IPT_UI_DELETE_CHEAT, "Delete Cheat", SEQ_DEF_1(KEYCODE_D) },
489 { IPT_UI_SAVE_CHEAT, "Save Cheat", SEQ_DEF_1(KEYCODE_S) },
490 { IPT_UI_WATCH_VALUE, "Watch Value", SEQ_DEF_1(KEYCODE_W) },
491 { IPT_UI_EDIT_CHEAT, "Edit Cheat", SEQ_DEF_1(KEYCODE_E) },
492 { IPT_START1, "1 Player Start", SEQ_DEF_3(KEYCODE_1, CODE_OR, JOYCODE_1_START) },
493 { IPT_START2, "2 Players Start", SEQ_DEF_3(KEYCODE_2, CODE_OR, JOYCODE_2_START) },
494 { IPT_START3, "3 Players Start", SEQ_DEF_3(KEYCODE_3, CODE_OR, JOYCODE_3_START) },
495 { IPT_START4, "4 Players Start", SEQ_DEF_3(KEYCODE_4, CODE_OR, JOYCODE_4_START) },
496 { IPT_COIN1, "Coin 1", SEQ_DEF_3(KEYCODE_5, CODE_OR, JOYCODE_1_SELECT) },
497 { IPT_COIN2, "Coin 2", SEQ_DEF_3(KEYCODE_6, CODE_OR, JOYCODE_2_SELECT) },
498 { IPT_COIN3, "Coin 3", SEQ_DEF_3(KEYCODE_7, CODE_OR, JOYCODE_3_SELECT) },
499 { IPT_COIN4, "Coin 4", SEQ_DEF_3(KEYCODE_8, CODE_OR, JOYCODE_4_SELECT) },
500 { IPT_SERVICE1, "Service 1", SEQ_DEF_1(KEYCODE_9) },
501 { IPT_SERVICE2, "Service 2", SEQ_DEF_1(KEYCODE_0) },
502 { IPT_SERVICE3, "Service 3", SEQ_DEF_1(KEYCODE_MINUS) },
503 { IPT_SERVICE4, "Service 4", SEQ_DEF_1(KEYCODE_EQUALS) },
504 #ifndef MESS
505 { IPT_TILT, "Tilt", SEQ_DEF_1(KEYCODE_T) },
506 #else
507 { IPT_TILT, "Tilt", SEQ_DEF_0 },
508 #endif
509
510 { IPT_JOYSTICK_UP | IPF_PLAYER1, "P1 Up", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
511 { IPT_JOYSTICK_DOWN | IPF_PLAYER1, "P1 Down", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
512 { IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
513 { IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
514 { IPT_BUTTON1 | IPF_PLAYER1, "P1 Button 1", SEQ_DEF_5(KEYCODE_LCONTROL, CODE_OR, JOYCODE_1_BUTTON1, CODE_OR, JOYCODE_MOUSE_1_BUTTON1) },
515 { IPT_BUTTON2 | IPF_PLAYER1, "P1 Button 2", SEQ_DEF_5(KEYCODE_LALT, CODE_OR, JOYCODE_1_BUTTON2, CODE_OR, JOYCODE_MOUSE_1_BUTTON3) },
516 { IPT_BUTTON3 | IPF_PLAYER1, "P1 Button 3", SEQ_DEF_5(KEYCODE_SPACE, CODE_OR, JOYCODE_1_BUTTON3, CODE_OR, JOYCODE_MOUSE_1_BUTTON2) },
517 { IPT_BUTTON4 | IPF_PLAYER1, "P1 Button 4", SEQ_DEF_3(KEYCODE_LSHIFT, CODE_OR, JOYCODE_1_BUTTON4) },
518 { IPT_BUTTON5 | IPF_PLAYER1, "P1 Button 5", SEQ_DEF_3(KEYCODE_Z, CODE_OR, JOYCODE_1_BUTTON5) },
519 { IPT_BUTTON6 | IPF_PLAYER1, "P1 Button 6", SEQ_DEF_3(KEYCODE_X, CODE_OR, JOYCODE_1_BUTTON6) },
520 { IPT_BUTTON7 | IPF_PLAYER1, "P1 Button 7", SEQ_DEF_1(KEYCODE_C) },
521 { IPT_BUTTON8 | IPF_PLAYER1, "P1 Button 8", SEQ_DEF_1(KEYCODE_V) },
522 { IPT_BUTTON9 | IPF_PLAYER1, "P1 Button 9", SEQ_DEF_1(KEYCODE_B) },
523 { IPT_BUTTON10 | IPF_PLAYER1, "P1 Button 10", SEQ_DEF_1(KEYCODE_N) },
524 #ifdef MAME32JP
525 { IPT_NEOGEO1 | IPF_PLAYER1, "P1 A+B (Neo-Geo)", SEQ_DEF_0 },
526 { IPT_NEOGEO2 | IPF_PLAYER1, "P1 A+C (Neo-Geo)", SEQ_DEF_0 },
527 { IPT_NEOGEO3 | IPF_PLAYER1, "P1 A+D (Neo-Geo)", SEQ_DEF_0 },
528 { IPT_NEOGEO4 | IPF_PLAYER1, "P1 B+C (Neo-Geo)", SEQ_DEF_0 },
529 { IPT_NEOGEO5 | IPF_PLAYER1, "P1 B+D (Neo-Geo)", SEQ_DEF_0 },
530 { IPT_NEOGEO6 | IPF_PLAYER1, "P1 C+D (Neo-Geo)", SEQ_DEF_0 },
531 { IPT_NEOGEO7 | IPF_PLAYER1, "P1 A+B+C (Neo-Geo)", SEQ_DEF_0 },
532 { IPT_NEOGEO8 | IPF_PLAYER1, "P1 A+B+D (Neo-Geo)", SEQ_DEF_0 },
533 { IPT_NEOGEO9 | IPF_PLAYER1, "P1 B+C+D (Neo-Geo)", SEQ_DEF_0 },
534 { IPT_NEOGEO10 | IPF_PLAYER1, "P1 A+B+C+D (Neo-Geo)",SEQ_DEF_0 },
535 { IPT_CPS1 | IPF_PLAYER1, "P1 2 Punches (CPS)", SEQ_DEF_0 },
536 { IPT_CPS2 | IPF_PLAYER1, "P1 3 Punches (CPS)", SEQ_DEF_0 },
537 { IPT_CPS3 | IPF_PLAYER1, "P1 2 Kicks (CPS)", SEQ_DEF_0 },
538 { IPT_CPS4 | IPF_PLAYER1, "P1 3 Kicks (CPS)", SEQ_DEF_0 },
539 { IPT_CPS5 | IPF_PLAYER1, "P1 Button 1+2 (CPS)", SEQ_DEF_0 },
540 { IPT_CPS6 | IPF_PLAYER1, "P1 Button 2+3 (CPS)", SEQ_DEF_0 },
541 { IPT_CPS7 | IPF_PLAYER1, "P1 Button 1+2+3 (CPS)", SEQ_DEF_0 },
542 { IPT_SPEC | IPF_PLAYER1, "P1 Button 1+2", SEQ_DEF_0 },
543 #endif
544 { IPT_JOYSTICKRIGHT_UP | IPF_PLAYER1, "P1 Right/Up", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_1_BUTTON2) },
545 { IPT_JOYSTICKRIGHT_DOWN | IPF_PLAYER1, "P1 Right/Down", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_1_BUTTON3) },
546 { IPT_JOYSTICKRIGHT_LEFT | IPF_PLAYER1, "P1 Right/Left", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_1_BUTTON1) },
547 { IPT_JOYSTICKRIGHT_RIGHT | IPF_PLAYER1, "P1 Right/Right", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_1_BUTTON4) },
548 { IPT_JOYSTICKLEFT_UP | IPF_PLAYER1, "P1 Left/Up", SEQ_DEF_3(KEYCODE_E, CODE_OR, JOYCODE_1_UP) },
549 { IPT_JOYSTICKLEFT_DOWN | IPF_PLAYER1, "P1 Left/Down", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_1_DOWN) },
550 { IPT_JOYSTICKLEFT_LEFT | IPF_PLAYER1, "P1 Left/Left", SEQ_DEF_3(KEYCODE_S, CODE_OR, JOYCODE_1_LEFT) },
551 { IPT_JOYSTICKLEFT_RIGHT | IPF_PLAYER1, "P1 Left/Right", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_1_RIGHT) },
552
553 { IPT_JOYSTICK_UP | IPF_PLAYER2, "P2 Up", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
554 { IPT_JOYSTICK_DOWN | IPF_PLAYER2, "P2 Down", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
555 { IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
556 { IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
557 { IPT_BUTTON1 | IPF_PLAYER2, "P2 Button 1", SEQ_DEF_3(KEYCODE_A, CODE_OR, JOYCODE_2_BUTTON1) },
558 { IPT_BUTTON2 | IPF_PLAYER2, "P2 Button 2", SEQ_DEF_3(KEYCODE_S, CODE_OR, JOYCODE_2_BUTTON2) },
559 { IPT_BUTTON3 | IPF_PLAYER2, "P2 Button 3", SEQ_DEF_3(KEYCODE_Q, CODE_OR, JOYCODE_2_BUTTON3) },
560 { IPT_BUTTON4 | IPF_PLAYER2, "P2 Button 4", SEQ_DEF_3(KEYCODE_W, CODE_OR, JOYCODE_2_BUTTON4) },
561 { IPT_BUTTON5 | IPF_PLAYER2, "P2 Button 5", SEQ_DEF_1(JOYCODE_2_BUTTON5) },
562 { IPT_BUTTON6 | IPF_PLAYER2, "P2 Button 6", SEQ_DEF_1(JOYCODE_2_BUTTON6) },
563 { IPT_BUTTON7 | IPF_PLAYER2, "P2 Button 7", SEQ_DEF_0 },
564 { IPT_BUTTON8 | IPF_PLAYER2, "P2 Button 8", SEQ_DEF_0 },
565 { IPT_BUTTON9 | IPF_PLAYER2, "P2 Button 9", SEQ_DEF_0 },
566 { IPT_BUTTON10 | IPF_PLAYER2, "P2 Button 10", SEQ_DEF_0 },
567 #ifdef MAME32JP
568 { IPT_NEOGEO1 | IPF_PLAYER2, "P2 A+B (Neo-Geo)", SEQ_DEF_0 },
569 { IPT_NEOGEO2 | IPF_PLAYER2, "P2 A+C (Neo-Geo)", SEQ_DEF_0 },
570 { IPT_NEOGEO3 | IPF_PLAYER2, "P2 A+D (Neo-Geo)", SEQ_DEF_0 },
571 { IPT_NEOGEO4 | IPF_PLAYER2, "P2 B+C (Neo-Geo)", SEQ_DEF_0 },
572 { IPT_NEOGEO5 | IPF_PLAYER2, "P2 B+D (Neo-Geo)", SEQ_DEF_0 },
573 { IPT_NEOGEO6 | IPF_PLAYER2, "P2 C+D (Neo-Geo)", SEQ_DEF_0 },
574 { IPT_NEOGEO7 | IPF_PLAYER2, "P2 A+B+C (Neo-Geo)", SEQ_DEF_0 },
575 { IPT_NEOGEO8 | IPF_PLAYER2, "P2 A+B+D (Neo-Geo)", SEQ_DEF_0 },
576 { IPT_NEOGEO9 | IPF_PLAYER2, "P2 B+C+D (Neo-Geo)", SEQ_DEF_0 },
577 { IPT_NEOGEO10 | IPF_PLAYER2, "P2 A+B+C+D (Neo-Geo)",SEQ_DEF_0 },
578 { IPT_CPS1 | IPF_PLAYER2, "P2 2 Punches (CPS)", SEQ_DEF_0 },
579 { IPT_CPS2 | IPF_PLAYER2, "P2 3 Punches (CPS)", SEQ_DEF_0 },
580 { IPT_CPS3 | IPF_PLAYER2, "P2 2 Kicks (CPS)", SEQ_DEF_0 },
581 { IPT_CPS4 | IPF_PLAYER2, "P2 3 Kicks (CPS)", SEQ_DEF_0 },
582 { IPT_CPS5 | IPF_PLAYER2, "P2 Button 1+2 (CPS)", SEQ_DEF_0 },
583 { IPT_CPS6 | IPF_PLAYER2, "P2 Button 2+3 (CPS)", SEQ_DEF_0 },
584 { IPT_CPS7 | IPF_PLAYER2, "P2 Button 1+2+3 (CPS)", SEQ_DEF_0 },
585 { IPT_SPEC | IPF_PLAYER2, "P2 Button 1+2", SEQ_DEF_0 },
586 #endif
587 { IPT_JOYSTICKRIGHT_UP | IPF_PLAYER2, "P2 Right/Up", SEQ_DEF_0 },
588 { IPT_JOYSTICKRIGHT_DOWN | IPF_PLAYER2, "P2 Right/Down", SEQ_DEF_0 },
589 { IPT_JOYSTICKRIGHT_LEFT | IPF_PLAYER2, "P2 Right/Left", SEQ_DEF_0 },
590 { IPT_JOYSTICKRIGHT_RIGHT | IPF_PLAYER2, "P2 Right/Right", SEQ_DEF_0 },
591 { IPT_JOYSTICKLEFT_UP | IPF_PLAYER2, "P2 Left/Up", SEQ_DEF_0 },
592 { IPT_JOYSTICKLEFT_DOWN | IPF_PLAYER2, "P2 Left/Down", SEQ_DEF_0 },
593 { IPT_JOYSTICKLEFT_LEFT | IPF_PLAYER2, "P2 Left/Left", SEQ_DEF_0 },
594 { IPT_JOYSTICKLEFT_RIGHT | IPF_PLAYER2, "P2 Left/Right", SEQ_DEF_0 },
595
596 { IPT_JOYSTICK_UP | IPF_PLAYER3, "P3 Up", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
597 { IPT_JOYSTICK_DOWN | IPF_PLAYER3, "P3 Down", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
598 { IPT_JOYSTICK_LEFT | IPF_PLAYER3, "P3 Left", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
599 { IPT_JOYSTICK_RIGHT | IPF_PLAYER3, "P3 Right", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
600 { IPT_BUTTON1 | IPF_PLAYER3, "P3 Button 1", SEQ_DEF_3(KEYCODE_RCONTROL, CODE_OR, JOYCODE_3_BUTTON1) },
601 { IPT_BUTTON2 | IPF_PLAYER3, "P3 Button 2", SEQ_DEF_3(KEYCODE_RSHIFT, CODE_OR, JOYCODE_3_BUTTON2) },
602 { IPT_BUTTON3 | IPF_PLAYER3, "P3 Button 3", SEQ_DEF_3(KEYCODE_ENTER, CODE_OR, JOYCODE_3_BUTTON3) },
603 { IPT_BUTTON4 | IPF_PLAYER3, "P3 Button 4", SEQ_DEF_1(JOYCODE_3_BUTTON4) },
604
605 #ifdef MAME32JP
606 { IPT_CPS5 | IPF_PLAYER3, "P3 Button 1+2 (CPS)", SEQ_DEF_0 },
607 { IPT_CPS6 | IPF_PLAYER3, "P3 Button 2+3 (CPS)", SEQ_DEF_0 },
608 { IPT_CPS7 | IPF_PLAYER3, "P3 Button 1+2+3 (CPS)", SEQ_DEF_0 },
609 { IPT_SPEC | IPF_PLAYER3, "P3 Button 1+2", SEQ_DEF_0 },
610 #endif
611 { IPT_JOYSTICK_UP | IPF_PLAYER4, "P4 Up", SEQ_DEF_1(JOYCODE_4_UP) },
612 { IPT_JOYSTICK_DOWN | IPF_PLAYER4, "P4 Down", SEQ_DEF_1(JOYCODE_4_DOWN) },
613 { IPT_JOYSTICK_LEFT | IPF_PLAYER4, "P4 Left", SEQ_DEF_1(JOYCODE_4_LEFT) },
614 { IPT_JOYSTICK_RIGHT | IPF_PLAYER4, "P4 Right", SEQ_DEF_1(JOYCODE_4_RIGHT) },
615 { IPT_BUTTON1 | IPF_PLAYER4, "P4 Button 1", SEQ_DEF_1(JOYCODE_4_BUTTON1) },
616 { IPT_BUTTON2 | IPF_PLAYER4, "P4 Button 2", SEQ_DEF_1(JOYCODE_4_BUTTON2) },
617 { IPT_BUTTON3 | IPF_PLAYER4, "P4 Button 3", SEQ_DEF_1(JOYCODE_4_BUTTON3) },
618 { IPT_BUTTON4 | IPF_PLAYER4, "P4 Button 4", SEQ_DEF_1(JOYCODE_4_BUTTON4) },
619
620 #ifdef MAME32JP
621 { IPT_CPS5 | IPF_PLAYER4, "P4 Button 1+2 (CPS)", SEQ_DEF_0 },
622 { IPT_CPS6 | IPF_PLAYER4, "P4 Button 2+3 (CPS)", SEQ_DEF_0 },
623 { IPT_CPS7 | IPF_PLAYER4, "P4 Button 1+2+3 (CPS)", SEQ_DEF_0 },
624 { IPT_SPEC | IPF_PLAYER4, "P4 Button 1+2", SEQ_DEF_0 },
625 #endif
626 { IPT_PEDAL | IPF_PLAYER1, "Pedal 1", SEQ_DEF_3(KEYCODE_LCONTROL, CODE_OR, JOYCODE_1_BUTTON1) },
627 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER1, "P1 Auto Release <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
628 { IPT_PEDAL | IPF_PLAYER2, "Pedal 2", SEQ_DEF_3(KEYCODE_A, CODE_OR, JOYCODE_2_BUTTON1) },
629 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER2, "P2 Auto Release <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
630 { IPT_PEDAL | IPF_PLAYER3, "Pedal 3", SEQ_DEF_3(KEYCODE_RCONTROL, CODE_OR, JOYCODE_3_BUTTON1) },
631 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER3, "P3 Auto Release <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
632 { IPT_PEDAL | IPF_PLAYER4, "Pedal 4", SEQ_DEF_1(JOYCODE_4_BUTTON1) },
633 { (IPT_PEDAL+IPT_EXTENSION) | IPF_PLAYER4, "P4 Auto Release <Y/N>", SEQ_DEF_1(KEYCODE_Y) },
634
635 { IPT_PADDLE | IPF_PLAYER1, "Paddle", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
636 { (IPT_PADDLE | IPF_PLAYER1)+IPT_EXTENSION, "Paddle", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
637 { IPT_PADDLE | IPF_PLAYER2, "Paddle 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
638 { (IPT_PADDLE | IPF_PLAYER2)+IPT_EXTENSION, "Paddle 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
639 { IPT_PADDLE | IPF_PLAYER3, "Paddle 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
640 { (IPT_PADDLE | IPF_PLAYER3)+IPT_EXTENSION, "Paddle 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
641 { IPT_PADDLE | IPF_PLAYER4, "Paddle 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
642 { (IPT_PADDLE | IPF_PLAYER4)+IPT_EXTENSION, "Paddle 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
643 { IPT_PADDLE_V | IPF_PLAYER1, "Paddle V", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
644 { (IPT_PADDLE_V | IPF_PLAYER1)+IPT_EXTENSION, "Paddle V", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
645 { IPT_PADDLE_V | IPF_PLAYER2, "Paddle V 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
646 { (IPT_PADDLE_V | IPF_PLAYER2)+IPT_EXTENSION, "Paddle V 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
647 { IPT_PADDLE_V | IPF_PLAYER3, "Paddle V 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
648 { (IPT_PADDLE_V | IPF_PLAYER3)+IPT_EXTENSION, "Paddle V 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
649 { IPT_PADDLE_V | IPF_PLAYER4, "Paddle V 4", SEQ_DEF_1(JOYCODE_4_UP) },
650 { (IPT_PADDLE_V | IPF_PLAYER4)+IPT_EXTENSION, "Paddle V 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
651 { IPT_DIAL | IPF_PLAYER1, "Dial", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
652 { (IPT_DIAL | IPF_PLAYER1)+IPT_EXTENSION, "Dial", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
653 { IPT_DIAL | IPF_PLAYER2, "Dial 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
654 { (IPT_DIAL | IPF_PLAYER2)+IPT_EXTENSION, "Dial 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
655 { IPT_DIAL | IPF_PLAYER3, "Dial 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
656 { (IPT_DIAL | IPF_PLAYER3)+IPT_EXTENSION, "Dial 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
657 { IPT_DIAL | IPF_PLAYER4, "Dial 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
658 { (IPT_DIAL | IPF_PLAYER4)+IPT_EXTENSION, "Dial 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
659 { IPT_DIAL_V | IPF_PLAYER1, "Dial V", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
660 { (IPT_DIAL_V | IPF_PLAYER1)+IPT_EXTENSION, "Dial V", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
661 { IPT_DIAL_V | IPF_PLAYER2, "Dial V 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
662 { (IPT_DIAL_V | IPF_PLAYER2)+IPT_EXTENSION, "Dial V 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
663 { IPT_DIAL_V | IPF_PLAYER3, "Dial V 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
664 { (IPT_DIAL_V | IPF_PLAYER3)+IPT_EXTENSION, "Dial V 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
665 { IPT_DIAL_V | IPF_PLAYER4, "Dial V 4", SEQ_DEF_1(JOYCODE_4_UP) },
666 { (IPT_DIAL_V | IPF_PLAYER4)+IPT_EXTENSION, "Dial V 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
667
668 { IPT_TRACKBALL_X | IPF_PLAYER1, "Track X", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
669 { (IPT_TRACKBALL_X | IPF_PLAYER1)+IPT_EXTENSION, "Track X", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
670 { IPT_TRACKBALL_X | IPF_PLAYER2, "Track X 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
671 { (IPT_TRACKBALL_X | IPF_PLAYER2)+IPT_EXTENSION, "Track X 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
672 { IPT_TRACKBALL_X | IPF_PLAYER3, "Track X 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
673 { (IPT_TRACKBALL_X | IPF_PLAYER3)+IPT_EXTENSION, "Track X 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
674 { IPT_TRACKBALL_X | IPF_PLAYER4, "Track X 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
675 { (IPT_TRACKBALL_X | IPF_PLAYER4)+IPT_EXTENSION, "Track X 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
676
677 { IPT_TRACKBALL_Y | IPF_PLAYER1, "Track Y", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
678 { (IPT_TRACKBALL_Y | IPF_PLAYER1)+IPT_EXTENSION, "Track Y", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
679 { IPT_TRACKBALL_Y | IPF_PLAYER2, "Track Y 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
680 { (IPT_TRACKBALL_Y | IPF_PLAYER2)+IPT_EXTENSION, "Track Y 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
681 { IPT_TRACKBALL_Y | IPF_PLAYER3, "Track Y 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
682 { (IPT_TRACKBALL_Y | IPF_PLAYER3)+IPT_EXTENSION, "Track Y 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
683 { IPT_TRACKBALL_Y | IPF_PLAYER4, "Track Y 4", SEQ_DEF_1(JOYCODE_4_UP) },
684 { (IPT_TRACKBALL_Y | IPF_PLAYER4)+IPT_EXTENSION, "Track Y 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
685
686 { IPT_AD_STICK_X | IPF_PLAYER1, "AD Stick X", SEQ_DEF_3(KEYCODE_LEFT, CODE_OR, JOYCODE_1_LEFT) },
687 { (IPT_AD_STICK_X | IPF_PLAYER1)+IPT_EXTENSION, "AD Stick X", SEQ_DEF_3(KEYCODE_RIGHT, CODE_OR, JOYCODE_1_RIGHT) },
688 { IPT_AD_STICK_X | IPF_PLAYER2, "AD Stick X 2", SEQ_DEF_3(KEYCODE_D, CODE_OR, JOYCODE_2_LEFT) },
689 { (IPT_AD_STICK_X | IPF_PLAYER2)+IPT_EXTENSION, "AD Stick X 2", SEQ_DEF_3(KEYCODE_G, CODE_OR, JOYCODE_2_RIGHT) },
690 { IPT_AD_STICK_X | IPF_PLAYER3, "AD Stick X 3", SEQ_DEF_3(KEYCODE_J, CODE_OR, JOYCODE_3_LEFT) },
691 { (IPT_AD_STICK_X | IPF_PLAYER3)+IPT_EXTENSION, "AD Stick X 3", SEQ_DEF_3(KEYCODE_L, CODE_OR, JOYCODE_3_RIGHT) },
692 { IPT_AD_STICK_X | IPF_PLAYER4, "AD Stick X 4", SEQ_DEF_1(JOYCODE_4_LEFT) },
693 { (IPT_AD_STICK_X | IPF_PLAYER4)+IPT_EXTENSION, "AD Stick X 4", SEQ_DEF_1(JOYCODE_4_RIGHT) },
694
695 { IPT_AD_STICK_Y | IPF_PLAYER1, "AD Stick Y", SEQ_DEF_3(KEYCODE_UP, CODE_OR, JOYCODE_1_UP) },
696 { (IPT_AD_STICK_Y | IPF_PLAYER1)+IPT_EXTENSION, "AD Stick Y", SEQ_DEF_3(KEYCODE_DOWN, CODE_OR, JOYCODE_1_DOWN) },
697 { IPT_AD_STICK_Y | IPF_PLAYER2, "AD Stick Y 2", SEQ_DEF_3(KEYCODE_R, CODE_OR, JOYCODE_2_UP) },
698 { (IPT_AD_STICK_Y | IPF_PLAYER2)+IPT_EXTENSION, "AD Stick Y 2", SEQ_DEF_3(KEYCODE_F, CODE_OR, JOYCODE_2_DOWN) },
699 { IPT_AD_STICK_Y | IPF_PLAYER3, "AD Stick Y 3", SEQ_DEF_3(KEYCODE_I, CODE_OR, JOYCODE_3_UP) },
700 { (IPT_AD_STICK_Y | IPF_PLAYER3)+IPT_EXTENSION, "AD Stick Y 3", SEQ_DEF_3(KEYCODE_K, CODE_OR, JOYCODE_3_DOWN) },
701 { IPT_AD_STICK_Y | IPF_PLAYER4, "AD Stick Y 4", SEQ_DEF_1(JOYCODE_4_UP) },
702 { (IPT_AD_STICK_Y | IPF_PLAYER4)+IPT_EXTENSION, "AD Stick Y 4", SEQ_DEF_1(JOYCODE_4_DOWN) },
703
704 { IPT_UNKNOWN, "UNKNOWN", SEQ_DEF_0 },
705 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
706 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
707 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
708 { IPT_OSD_RESERVED, "", SEQ_DEF_0 },
709 { IPT_END, 0, SEQ_DEF_0 } /* returned when there is no match */
710 #endif
711 };
712
713 struct ipd inputport_defaults_backup[sizeof(inputport_defaults)/sizeof(struct ipd)];
714
715
716 struct ik *osd_input_keywords = NULL;
717
718 struct ik input_keywords[] =
719 {
720 { "KEYCODE_A", IKT_STD, KEYCODE_A },
721 { "KEYCODE_B", IKT_STD, KEYCODE_B },
722 { "KEYCODE_C", IKT_STD, KEYCODE_C },
723 { "KEYCODE_D", IKT_STD, KEYCODE_D },
724 { "KEYCODE_E", IKT_STD, KEYCODE_E },
725 { "KEYCODE_F", IKT_STD, KEYCODE_F },
726 { "KEYCODE_G", IKT_STD, KEYCODE_G },
727 { "KEYCODE_H", IKT_STD, KEYCODE_H },
728 { "KEYCODE_I", IKT_STD, KEYCODE_I },
729 { "KEYCODE_J", IKT_STD, KEYCODE_J },
730 { "KEYCODE_K", IKT_STD, KEYCODE_K },
731 { "KEYCODE_L", IKT_STD, KEYCODE_L },
732 { "KEYCODE_M", IKT_STD, KEYCODE_M },
733 { "KEYCODE_N", IKT_STD, KEYCODE_N },
734 { "KEYCODE_O", IKT_STD, KEYCODE_O },
735 { "KEYCODE_P", IKT_STD, KEYCODE_P },
736 { "KEYCODE_Q", IKT_STD, KEYCODE_Q },
737 { "KEYCODE_R", IKT_STD, KEYCODE_R },
738 { "KEYCODE_S", IKT_STD, KEYCODE_S },
739 { "KEYCODE_T", IKT_STD, KEYCODE_T },
740 { "KEYCODE_U", IKT_STD, KEYCODE_U },
741 { "KEYCODE_V", IKT_STD, KEYCODE_V },
742 { "KEYCODE_W", IKT_STD, KEYCODE_W },
743 { "KEYCODE_X", IKT_STD, KEYCODE_X },
744 { "KEYCODE_Y", IKT_STD, KEYCODE_Y },
745 { "KEYCODE_Z", IKT_STD, KEYCODE_Z },
746 { "KEYCODE_0", IKT_STD, KEYCODE_0 },
747 { "KEYCODE_1", IKT_STD, KEYCODE_1 },
748 { "KEYCODE_2", IKT_STD, KEYCODE_2 },
749 { "KEYCODE_3", IKT_STD, KEYCODE_3 },
750 { "KEYCODE_4", IKT_STD, KEYCODE_4 },
751 { "KEYCODE_5", IKT_STD, KEYCODE_5 },
752 { "KEYCODE_6", IKT_STD, KEYCODE_6 },
753 { "KEYCODE_7", IKT_STD, KEYCODE_7 },
754 { "KEYCODE_8", IKT_STD, KEYCODE_8 },
755 { "KEYCODE_9", IKT_STD, KEYCODE_9 },
756 { "KEYCODE_0_PAD", IKT_STD, KEYCODE_0_PAD },
757 { "KEYCODE_1_PAD", IKT_STD, KEYCODE_1_PAD },
758 { "KEYCODE_2_PAD", IKT_STD, KEYCODE_2_PAD },
759 { "KEYCODE_3_PAD", IKT_STD, KEYCODE_3_PAD },
760 { "KEYCODE_4_PAD", IKT_STD, KEYCODE_4_PAD },
761 { "KEYCODE_5_PAD", IKT_STD, KEYCODE_5_PAD },
762 { "KEYCODE_6_PAD", IKT_STD, KEYCODE_6_PAD },
763 { "KEYCODE_7_PAD", IKT_STD, KEYCODE_7_PAD },
764 { "KEYCODE_8_PAD", IKT_STD, KEYCODE_8_PAD },
765 { "KEYCODE_9_PAD", IKT_STD, KEYCODE_9_PAD },
766 { "KEYCODE_F1", IKT_STD, KEYCODE_F1 },
767 { "KEYCODE_F2", IKT_STD, KEYCODE_F2 },
768 { "KEYCODE_F3", IKT_STD, KEYCODE_F3 },
769 { "KEYCODE_F4", IKT_STD, KEYCODE_F4 },
770 { "KEYCODE_F5", IKT_STD, KEYCODE_F5 },
771 { "KEYCODE_F6", IKT_STD, KEYCODE_F6 },
772 { "KEYCODE_F7", IKT_STD, KEYCODE_F7 },
773 { "KEYCODE_F8", IKT_STD, KEYCODE_F8 },
774 { "KEYCODE_F9", IKT_STD, KEYCODE_F9 },
775 { "KEYCODE_F10", IKT_STD, KEYCODE_F10 },
776 { "KEYCODE_F11", IKT_STD, KEYCODE_F11 },
777 { "KEYCODE_F12", IKT_STD, KEYCODE_F12 },
778 { "KEYCODE_ESC", IKT_STD, KEYCODE_ESC },
779 { "KEYCODE_TILDE", IKT_STD, KEYCODE_TILDE },
780 { "KEYCODE_MINUS", IKT_STD, KEYCODE_MINUS },
781 { "KEYCODE_EQUALS", IKT_STD, KEYCODE_EQUALS },
782 { "KEYCODE_BACKSPACE", IKT_STD, KEYCODE_BACKSPACE },
783 { "KEYCODE_TAB", IKT_STD, KEYCODE_TAB },
784 { "KEYCODE_OPENBRACE", IKT_STD, KEYCODE_OPENBRACE },
785 { "KEYCODE_CLOSEBRACE", IKT_STD, KEYCODE_CLOSEBRACE },
786 { "KEYCODE_ENTER", IKT_STD, KEYCODE_ENTER },
787 { "KEYCODE_COLON", IKT_STD, KEYCODE_COLON },
788 { "KEYCODE_QUOTE", IKT_STD, KEYCODE_QUOTE },
789 { "KEYCODE_BACKSLASH", IKT_STD, KEYCODE_BACKSLASH },
790 { "KEYCODE_BACKSLASH2", IKT_STD, KEYCODE_BACKSLASH2 },
791 { "KEYCODE_COMMA", IKT_STD, KEYCODE_COMMA },
792 { "KEYCODE_STOP", IKT_STD, KEYCODE_STOP },
793 { "KEYCODE_SLASH", IKT_STD, KEYCODE_SLASH },
794 { "KEYCODE_SPACE", IKT_STD, KEYCODE_SPACE },
795 { "KEYCODE_INSERT", IKT_STD, KEYCODE_INSERT },
796 { "KEYCODE_DEL", IKT_STD, KEYCODE_DEL },
797 { "KEYCODE_HOME", IKT_STD, KEYCODE_HOME },
798 { "KEYCODE_END", IKT_STD, KEYCODE_END },
799 { "KEYCODE_PGUP", IKT_STD, KEYCODE_PGUP },
800 { "KEYCODE_PGDN", IKT_STD, KEYCODE_PGDN },
801 { "KEYCODE_LEFT", IKT_STD, KEYCODE_LEFT },
802 { "KEYCODE_RIGHT", IKT_STD, KEYCODE_RIGHT },
803 { "KEYCODE_UP", IKT_STD, KEYCODE_UP },
804 { "KEYCODE_DOWN", IKT_STD, KEYCODE_DOWN },
805 { "KEYCODE_SLASH_PAD", IKT_STD, KEYCODE_SLASH_PAD },
806 { "KEYCODE_ASTERISK", IKT_STD, KEYCODE_ASTERISK },
807 { "KEYCODE_MINUS_PAD", IKT_STD, KEYCODE_MINUS_PAD },
808 { "KEYCODE_PLUS_PAD", IKT_STD, KEYCODE_PLUS_PAD },
809 { "KEYCODE_DEL_PAD", IKT_STD, KEYCODE_DEL_PAD },
810 { "KEYCODE_ENTER_PAD", IKT_STD, KEYCODE_ENTER_PAD },
811 { "KEYCODE_PRTSCR", IKT_STD, KEYCODE_PRTSCR },
812 { "KEYCODE_PAUSE", IKT_STD, KEYCODE_PAUSE },
813 { "KEYCODE_LSHIFT", IKT_STD, KEYCODE_LSHIFT },
814 { "KEYCODE_RSHIFT", IKT_STD, KEYCODE_RSHIFT },
815 { "KEYCODE_LCONTROL", IKT_STD, KEYCODE_LCONTROL },
816 { "KEYCODE_RCONTROL", IKT_STD, KEYCODE_RCONTROL },
817 { "KEYCODE_LALT", IKT_STD, KEYCODE_LALT },
818 { "KEYCODE_RALT", IKT_STD, KEYCODE_RALT },
819 { "KEYCODE_SCRLOCK", IKT_STD, KEYCODE_SCRLOCK },
820 { "KEYCODE_NUMLOCK", IKT_STD, KEYCODE_NUMLOCK },
821 { "KEYCODE_CAPSLOCK", IKT_STD, KEYCODE_CAPSLOCK },
822 { "KEYCODE_LWIN", IKT_STD, KEYCODE_LWIN },
823 { "KEYCODE_RWIN", IKT_STD, KEYCODE_RWIN },
824 { "KEYCODE_MENU", IKT_STD, KEYCODE_MENU },
825
826 { "JOYCODE_1_LEFT", IKT_STD, JOYCODE_1_LEFT },
827 { "JOYCODE_1_RIGHT", IKT_STD, JOYCODE_1_RIGHT },
828 { "JOYCODE_1_UP", IKT_STD, JOYCODE_1_UP },
829 { "JOYCODE_1_DOWN", IKT_STD, JOYCODE_1_DOWN },
830 { "JOYCODE_1_BUTTON1", IKT_STD, JOYCODE_1_BUTTON1 },
831 { "JOYCODE_1_BUTTON2", IKT_STD, JOYCODE_1_BUTTON2 },
832 { "JOYCODE_1_BUTTON3", IKT_STD, JOYCODE_1_BUTTON3 },
833 { "JOYCODE_1_BUTTON4", IKT_STD, JOYCODE_1_BUTTON4 },
834 { "JOYCODE_1_BUTTON5", IKT_STD, JOYCODE_1_BUTTON5 },
835 { "JOYCODE_1_BUTTON6", IKT_STD, JOYCODE_1_BUTTON6 },
836 { "JOYCODE_1_START", IKT_STD, JOYCODE_1_START },
837 { "JOYCODE_1_SELECT", IKT_STD, JOYCODE_1_SELECT },
838 { "JOYCODE_2_LEFT", IKT_STD, JOYCODE_2_LEFT },
839 { "JOYCODE_2_RIGHT", IKT_STD, JOYCODE_2_RIGHT },
840 { "JOYCODE_2_UP", IKT_STD, JOYCODE_2_UP },
841 { "JOYCODE_2_DOWN", IKT_STD, JOYCODE_2_DOWN },
842 { "JOYCODE_2_BUTTON1", IKT_STD, JOYCODE_2_BUTTON1 },
843 { "JOYCODE_2_BUTTON2", IKT_STD, JOYCODE_2_BUTTON2 },
844 { "JOYCODE_2_BUTTON3", IKT_STD, JOYCODE_2_BUTTON3 },
845 { "JOYCODE_2_BUTTON4", IKT_STD, JOYCODE_2_BUTTON4 },
846 { "JOYCODE_2_BUTTON5", IKT_STD, JOYCODE_2_BUTTON5 },
847 { "JOYCODE_2_BUTTON6", IKT_STD, JOYCODE_2_BUTTON6 },
848 { "JOYCODE_2_START", IKT_STD, JOYCODE_2_START },
849 { "JOYCODE_2_SELECT", IKT_STD, JOYCODE_2_SELECT },
850 { "JOYCODE_3_LEFT", IKT_STD, JOYCODE_3_LEFT },
851 { "JOYCODE_3_RIGHT", IKT_STD, JOYCODE_3_RIGHT },
852 { "JOYCODE_3_UP", IKT_STD, JOYCODE_3_UP },
853 { "JOYCODE_3_DOWN", IKT_STD, JOYCODE_3_DOWN },
854 { "JOYCODE_3_BUTTON1", IKT_STD, JOYCODE_3_BUTTON1 },
855 { "JOYCODE_3_BUTTON2", IKT_STD, JOYCODE_3_BUTTON2 },
856 { "JOYCODE_3_BUTTON3", IKT_STD, JOYCODE_3_BUTTON3 },
857 { "JOYCODE_3_BUTTON4", IKT_STD, JOYCODE_3_BUTTON4 },
858 { "JOYCODE_3_BUTTON5", IKT_STD, JOYCODE_3_BUTTON5 },
859 { "JOYCODE_3_BUTTON6", IKT_STD, JOYCODE_3_BUTTON6 },
860 { "JOYCODE_3_START", IKT_STD, JOYCODE_3_START },
861 { "JOYCODE_3_SELECT", IKT_STD, JOYCODE_3_SELECT },
862 { "JOYCODE_4_LEFT", IKT_STD, JOYCODE_4_LEFT },
863 { "JOYCODE_4_RIGHT", IKT_STD, JOYCODE_4_RIGHT },
864 { "JOYCODE_4_UP", IKT_STD, JOYCODE_4_UP },
865 { "JOYCODE_4_DOWN", IKT_STD, JOYCODE_4_DOWN },
866 { "JOYCODE_4_BUTTON1", IKT_STD, JOYCODE_4_BUTTON1 },
867 { "JOYCODE_4_BUTTON2", IKT_STD, JOYCODE_4_BUTTON2 },
868 { "JOYCODE_4_BUTTON3", IKT_STD, JOYCODE_4_BUTTON3 },
869 { "JOYCODE_4_BUTTON4", IKT_STD, JOYCODE_4_BUTTON4 },
870 { "JOYCODE_4_BUTTON5", IKT_STD, JOYCODE_4_BUTTON5 },
871 { "JOYCODE_4_BUTTON6", IKT_STD, JOYCODE_4_BUTTON6 },
872 { "JOYCODE_4_START", IKT_STD, JOYCODE_4_START },
873 { "JOYCODE_4_SELECT", IKT_STD, JOYCODE_4_SELECT },
874
875 { "MOUSECODE_1_BUTTON1", IKT_STD, JOYCODE_MOUSE_1_BUTTON1 },
876 { "MOUSECODE_1_BUTTON2", IKT_STD, JOYCODE_MOUSE_1_BUTTON2 },
877 { "MOUSECODE_1_BUTTON3", IKT_STD, JOYCODE_MOUSE_1_BUTTON3 },
878
879 { "KEYCODE_NONE", IKT_STD, CODE_NONE },
880 { "CODE_NONE", IKT_STD, CODE_NONE },
881 { "CODE_OTHER", IKT_STD, CODE_OTHER },
882 { "CODE_DEFAULT", IKT_STD, CODE_DEFAULT },
883 { "CODE_PREVIOUS", IKT_STD, CODE_PREVIOUS },
884 { "CODE_NOT", IKT_STD, CODE_NOT },
885 { "CODE_OR", IKT_STD, CODE_OR },
886 { "!", IKT_STD, CODE_NOT },
887 { "|", IKT_STD, CODE_OR },
888
889 { "UI_CONFIGURE", IKT_IPT, IPT_UI_CONFIGURE },
890 { "UI_ON_SCREEN_DISPLAY", IKT_IPT, IPT_UI_ON_SCREEN_DISPLAY },
891 { "UI_PAUSE", IKT_IPT, IPT_UI_PAUSE },
892 { "UI_RESET_MACHINE", IKT_IPT, IPT_UI_RESET_MACHINE },
893 { "UI_SHOW_GFX", IKT_IPT, IPT_UI_SHOW_GFX },
894 { "UI_FRAMESKIP_DEC", IKT_IPT, IPT_UI_FRAMESKIP_DEC },
895 { "UI_FRAMESKIP_INC", IKT_IPT, IPT_UI_FRAMESKIP_INC },
896 { "UI_THROTTLE", IKT_IPT, IPT_UI_THROTTLE },
897 { "UI_SHOW_FPS", IKT_IPT, IPT_UI_SHOW_FPS },
898 { "UI_SHOW_PROFILER", IKT_IPT, IPT_UI_SHOW_PROFILER },
899 #ifdef MESS
900 { "UI_TOGGLE_UI", IKT_IPT, IPT_UI_TOGGLE_UI },
901 #endif
902 { "UI_SNAPSHOT", IKT_IPT, IPT_UI_SNAPSHOT },
903 { "UI_TOGGLE_CHEAT", IKT_IPT, IPT_UI_TOGGLE_CHEAT },
904 { "UI_UP", IKT_IPT, IPT_UI_UP },
905 { "UI_DOWN", IKT_IPT, IPT_UI_DOWN },
906 { "UI_LEFT", IKT_IPT, IPT_UI_LEFT },
907 { "UI_RIGHT", IKT_IPT, IPT_UI_RIGHT },
908 { "UI_SELECT", IKT_IPT, IPT_UI_SELECT },
909 { "UI_CANCEL", IKT_IPT, IPT_UI_CANCEL },
910 { "UI_PAN_UP", IKT_IPT, IPT_UI_PAN_UP },
911 { "UI_PAN_DOWN", IKT_IPT, IPT_UI_PAN_DOWN },
912 { "UI_PAN_LEFT", IKT_IPT, IPT_UI_PAN_LEFT },
913 { "UI_PAN_RIGHT", IKT_IPT, IPT_UI_PAN_RIGHT },
914 { "UI_TOGGLE_DEBUG", IKT_IPT, IPT_UI_TOGGLE_DEBUG },
915 { "UI_SAVE_STATE", IKT_IPT, IPT_UI_SAVE_STATE },
916 { "UI_LOAD_STATE", IKT_IPT, IPT_UI_LOAD_STATE },
917 { "UI_ADD_CHEAT", IKT_IPT, IPT_UI_ADD_CHEAT },
918 { "UI_DELETE_CHEAT", IKT_IPT, IPT_UI_DELETE_CHEAT },
919 { "UI_SAVE_CHEAT", IKT_IPT, IPT_UI_SAVE_CHEAT },
920 { "UI_WATCH_VALUE", IKT_IPT, IPT_UI_WATCH_VALUE },
921 { "UI_EDIT_CHEAT", IKT_IPT, IPT_UI_EDIT_CHEAT },
922 { "START1", IKT_IPT, IPT_START1 },
923 { "START2", IKT_IPT, IPT_START2 },
924 { "START3", IKT_IPT, IPT_START3 },
925 { "START4", IKT_IPT, IPT_START4 },
926 { "COIN1", IKT_IPT, IPT_COIN1 },
927 { "COIN2", IKT_IPT, IPT_COIN2 },
928 { "COIN3", IKT_IPT, IPT_COIN3 },
929 { "COIN4", IKT_IPT, IPT_COIN4 },
930 { "SERVICE1", IKT_IPT, IPT_SERVICE1 },
931 { "SERVICE2", IKT_IPT, IPT_SERVICE2 },
932 { "SERVICE3", IKT_IPT, IPT_SERVICE3 },
933 { "SERVICE4", IKT_IPT, IPT_SERVICE4 },
934 { "TILT", IKT_IPT, IPT_TILT },
935
936 { "P1_JOYSTICK_UP", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICK_UP },
937 { "P1_JOYSTICK_DOWN", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICK_DOWN },
938 { "P1_JOYSTICK_LEFT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICK_LEFT },
939 { "P1_JOYSTICK_RIGHT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICK_RIGHT },
940 { "P1_BUTTON1", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON1 },
941 { "P1_BUTTON2", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON2 },
942 { "P1_BUTTON3", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON3 },
943 { "P1_BUTTON4", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON4 },
944 { "P1_BUTTON5", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON5 },
945 { "P1_BUTTON6", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON6 },
946 { "P1_BUTTON7", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON7 },
947 { "P1_BUTTON8", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON8 },
948 { "P1_BUTTON9", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON9 },
949 { "P1_BUTTON10", IKT_IPT, IPF_PLAYER1 | IPT_BUTTON10 },
950 { "P1_JOYSTICKRIGHT_UP", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_UP },
951 { "P1_JOYSTICKRIGHT_DOWN", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_DOWN },
952 { "P1_JOYSTICKRIGHT_LEFT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_LEFT },
953 { "P1_JOYSTICKRIGHT_RIGHT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKRIGHT_RIGHT },
954 { "P1_JOYSTICKLEFT_UP", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKLEFT_UP },
955 { "P1_JOYSTICKLEFT_DOWN", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKLEFT_DOWN },
956 { "P1_JOYSTICKLEFT_LEFT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKLEFT_LEFT },
957 { "P1_JOYSTICKLEFT_RIGHT", IKT_IPT, IPF_PLAYER1 | IPT_JOYSTICKLEFT_RIGHT },
958
959 { "P2_JOYSTICK_UP", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICK_UP },
960 { "P2_JOYSTICK_DOWN", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICK_DOWN },
961 { "P2_JOYSTICK_LEFT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICK_LEFT },
962 { "P2_JOYSTICK_RIGHT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICK_RIGHT },
963 { "P2_BUTTON1", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON1 },
964 { "P2_BUTTON2", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON2 },
965 { "P2_BUTTON3", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON3 },
966 { "P2_BUTTON4", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON4 },
967 { "P2_BUTTON5", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON5 },
968 { "P2_BUTTON6", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON6 },
969 { "P2_BUTTON7", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON7 },
970 { "P2_BUTTON8", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON8 },
971 { "P2_BUTTON9", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON9 },
972 { "P2_BUTTON10", IKT_IPT, IPF_PLAYER2 | IPT_BUTTON10 },
973 { "P2_JOYSTICKRIGHT_UP", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKRIGHT_UP },
974 { "P2_JOYSTICKRIGHT_DOWN", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKRIGHT_DOWN },
975 { "P2_JOYSTICKRIGHT_LEFT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKRIGHT_LEFT },
976 { "P2_JOYSTICKRIGHT_RIGHT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKRIGHT_RIGHT },
977 { "P2_JOYSTICKLEFT_UP", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKLEFT_UP },
978 { "P2_JOYSTICKLEFT_DOWN", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKLEFT_DOWN },
979 { "P2_JOYSTICKLEFT_LEFT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKLEFT_LEFT },
980 { "P2_JOYSTICKLEFT_RIGHT", IKT_IPT, IPF_PLAYER2 | IPT_JOYSTICKLEFT_RIGHT },
981
982 { "P3_JOYSTICK_UP", IKT_IPT, IPF_PLAYER3 | IPT_JOYSTICK_UP },
983 { "P3_JOYSTICK_DOWN", IKT_IPT, IPF_PLAYER3 | IPT_JOYSTICK_DOWN },
984 { "P3_JOYSTICK_LEFT", IKT_IPT, IPF_PLAYER3 | IPT_JOYSTICK_LEFT },
985 { "P3_JOYSTICK_RIGHT", IKT_IPT, IPF_PLAYER3 | IPT_JOYSTICK_RIGHT },
986 { "P3_BUTTON1", IKT_IPT, IPF_PLAYER3 | IPT_BUTTON1 },
987 { "P3_BUTTON2", IKT_IPT, IPF_PLAYER3 | IPT_BUTTON2 },
988 { "P3_BUTTON3", IKT_IPT, IPF_PLAYER3 | IPT_BUTTON3 },
989 { "P3_BUTTON4", IKT_IPT, IPF_PLAYER3 | IPT_BUTTON4 },
990
991 { "P4_JOYSTICK_UP", IKT_IPT, IPF_PLAYER4 | IPT_JOYSTICK_UP },
992 { "P4_JOYSTICK_DOWN", IKT_IPT, IPF_PLAYER4 | IPT_JOYSTICK_DOWN },
993 { "P4_JOYSTICK_LEFT", IKT_IPT, IPF_PLAYER4 | IPT_JOYSTICK_LEFT },
994 { "P4_JOYSTICK_RIGHT", IKT_IPT, IPF_PLAYER4 | IPT_JOYSTICK_RIGHT },
995 { "P4_BUTTON1", IKT_IPT, IPF_PLAYER4 | IPT_BUTTON1 },
996 { "P4_BUTTON2", IKT_IPT, IPF_PLAYER4 | IPT_BUTTON2 },
997 { "P4_BUTTON3", IKT_IPT, IPF_PLAYER4 | IPT_BUTTON3 },
998 { "P4_BUTTON4", IKT_IPT, IPF_PLAYER4 | IPT_BUTTON4 },
999
1000 { "P1_PEDAL ", IKT_IPT, IPF_PLAYER1 | IPT_PEDAL },
1001 { "P1_PEDAL_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_PEDAL },
1002 { "P2_PEDAL", IKT_IPT, IPF_PLAYER2 | IPT_PEDAL },
1003 { "P2_PEDAL_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_PEDAL },
1004 { "P3_PEDAL", IKT_IPT, IPF_PLAYER3 | IPT_PEDAL },
1005 { "P3_PEDAL_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_PEDAL },
1006 { "P4_PEDAL", IKT_IPT, IPF_PLAYER4 | IPT_PEDAL },
1007 { "P4_PEDAL_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_PEDAL },
1008
1009 { "P1_PADDLE", IKT_IPT, IPF_PLAYER1 | IPT_PADDLE },
1010 { "P1_PADDLE_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_PADDLE },
1011 { "P2_PADDLE", IKT_IPT, IPF_PLAYER2 | IPT_PADDLE },
1012 { "P2_PADDLE_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_PADDLE },
1013 { "P3_PADDLE", IKT_IPT, IPF_PLAYER3 | IPT_PADDLE },
1014 { "P3_PADDLE_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_PADDLE },
1015 { "P4_PADDLE", IKT_IPT, IPF_PLAYER4 | IPT_PADDLE },
1016 { "P4_PADDLE_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_PADDLE },
1017 { "P1_PADDLE_V", IKT_IPT, IPF_PLAYER1 | IPT_PADDLE_V },
1018 { "P1_PADDLE_V_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_PADDLE_V },
1019 { "P2_PADDLE_V", IKT_IPT, IPF_PLAYER2 | IPT_PADDLE_V },
1020 { "P2_PADDLE_V_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_PADDLE_V },
1021 { "P3_PADDLE_V", IKT_IPT, IPF_PLAYER3 | IPT_PADDLE_V },
1022 { "P3_PADDLE_V_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_PADDLE_V },
1023 { "P4_PADDLE_V", IKT_IPT, IPF_PLAYER4 | IPT_PADDLE_V },
1024 { "P4_PADDLE_V_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_PADDLE_V },
1025
1026 { "P1_DIAL", IKT_IPT, IPF_PLAYER1 | IPT_DIAL },
1027 { "P1_DIAL_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_DIAL },
1028 { "P2_DIAL", IKT_IPT, IPF_PLAYER2 | IPT_DIAL },
1029 { "P2_DIAL_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_DIAL },
1030 { "P3_DIAL", IKT_IPT, IPF_PLAYER3 | IPT_DIAL },
1031 { "P3_DIAL_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_DIAL },
1032 { "P4_DIAL", IKT_IPT, IPF_PLAYER4 | IPT_DIAL },
1033 { "P4_DIAL_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_DIAL },
1034 { "P1_DIAL_V", IKT_IPT, IPF_PLAYER1 | IPT_DIAL_V },
1035 { "P1_DIAL_V_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_DIAL_V },
1036 { "P2_DIAL_V", IKT_IPT, IPF_PLAYER2 | IPT_DIAL_V },
1037 { "P2_DIAL_V_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_DIAL_V },
1038 { "P3_DIAL_V", IKT_IPT, IPF_PLAYER3 | IPT_DIAL_V },
1039 { "P3_DIAL_V_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_DIAL_V },
1040 { "P4_DIAL_V", IKT_IPT, IPF_PLAYER4 | IPT_DIAL_V },
1041 { "P4_DIAL_V_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_DIAL_V },
1042
1043 { "P1_TRACKBALL_X", IKT_IPT, IPF_PLAYER1 | IPT_TRACKBALL_X },
1044 { "P1_TRACKBALL_X_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_TRACKBALL_X },
1045 { "P2_TRACKBALL_X", IKT_IPT, IPF_PLAYER2 | IPT_TRACKBALL_X },
1046 { "P2_TRACKBALL_X_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_TRACKBALL_X },
1047 { "P3_TRACKBALL_X", IKT_IPT, IPF_PLAYER3 | IPT_TRACKBALL_X },
1048 { "P3_TRACKBALL_X_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_TRACKBALL_X },
1049 { "P4_TRACKBALL_X", IKT_IPT, IPF_PLAYER4 | IPT_TRACKBALL_X },
1050 { "P4_TRACKBALL_X_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_TRACKBALL_X },
1051
1052 { "P1_TRACKBALL_Y", IKT_IPT, IPF_PLAYER1 | IPT_TRACKBALL_Y },
1053 { "P1_TRACKBALL_Y_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_TRACKBALL_Y },
1054 { "P2_TRACKBALL_Y", IKT_IPT, IPF_PLAYER2 | IPT_TRACKBALL_Y },
1055 { "P2_TRACKBALL_Y_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_TRACKBALL_Y },
1056 { "P3_TRACKBALL_Y", IKT_IPT, IPF_PLAYER3 | IPT_TRACKBALL_Y },
1057 { "P3_TRACKBALL_Y_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_TRACKBALL_Y },
1058 { "P4_TRACKBALL_Y", IKT_IPT, IPF_PLAYER4 | IPT_TRACKBALL_Y },
1059 { "P4_TRACKBALL_Y_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_TRACKBALL_Y },
1060
1061 { "P1_AD_STICK_X", IKT_IPT, IPF_PLAYER1 | IPT_AD_STICK_X },
1062 { "P1_AD_STICK_X_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_AD_STICK_X },
1063 { "P2_AD_STICK_X", IKT_IPT, IPF_PLAYER2 | IPT_AD_STICK_X },
1064 { "P2_AD_STICK_X_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_AD_STICK_X },
1065 { "P3_AD_STICK_X", IKT_IPT, IPF_PLAYER3 | IPT_AD_STICK_X },
1066 { "P3_AD_STICK_X_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_AD_STICK_X },
1067 { "P4_AD_STICK_X", IKT_IPT, IPF_PLAYER4 | IPT_AD_STICK_X },
1068 { "P4_AD_STICK_X_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_AD_STICK_X },
1069
1070 { "P1_AD_STICK_Y", IKT_IPT, IPF_PLAYER1 | IPT_AD_STICK_Y },
1071 { "P1_AD_STICK_Y_EXT", IKT_IPT_EXT, IPF_PLAYER1 | IPT_AD_STICK_Y },
1072 { "P2_AD_STICK_Y", IKT_IPT, IPF_PLAYER2 | IPT_AD_STICK_Y },
1073 { "P2_AD_STICK_Y_EXT", IKT_IPT_EXT, IPF_PLAYER2 | IPT_AD_STICK_Y },
1074 { "P3_AD_STICK_Y", IKT_IPT, IPF_PLAYER3 | IPT_AD_STICK_Y },
1075 { "P3_AD_STICK_Y_EXT", IKT_IPT_EXT, IPF_PLAYER3 | IPT_AD_STICK_Y },
1076 { "P4_AD_STICK_Y", IKT_IPT, IPF_PLAYER4 | IPT_AD_STICK_Y },
1077 { "P4_AD_STICK_Y_EXT", IKT_IPT_EXT, IPF_PLAYER4 | IPT_AD_STICK_Y },
1078
1079 { "OSD_1", IKT_IPT, IPT_OSD_1 },
1080 { "OSD_2", IKT_IPT, IPT_OSD_2 },
1081 { "OSD_3", IKT_IPT, IPT_OSD_3 },
1082 { "OSD_4", IKT_IPT, IPT_OSD_4 },
1083
1084 { "UNKNOWN", IKT_IPT, IPT_UNKNOWN },
1085 { "END", IKT_IPT, IPT_END },
1086
1087 { "", 0, 0 }
1088 };
1089
1090 int num_ik = sizeof(input_keywords)/sizeof(struct ik);
1091
1092 /***************************************************************************/
1093 /* Generic IO */
1094
1095 static int readint(void *f,UINT32 *num)
1096 {
1097 unsigned i;
1098
1099 *num = 0;
1100 for (i = 0;i < sizeof(UINT32);i++)
1101 {
1102 unsigned char c;
1103
1104
1105 *num <<= 8;
1106 if (osd_fread(f,&c,1) != 1)
1107 return -1;
1108 *num |= c;
1109 }
1110
1111 return 0;
1112 }
1113
1114 static void writeint(void *f,UINT32 num)
1115 {
1116 unsigned i;
1117
1118 for (i = 0;i < sizeof(UINT32);i++)
1119 {
1120 unsigned char c;
1121
1122
1123 c = (num >> 8 * (sizeof(UINT32)-1)) & 0xff;
1124 osd_fwrite(f,&c,1);
1125 num <<= 8;
1126 }
1127 }
1128
1129 static int readword(void *f,UINT16 *num)
1130 {
1131 unsigned i;
1132 int res;
1133
1134 res = 0;
1135 for (i = 0;i < sizeof(UINT16);i++)
1136 {
1137 unsigned char c;
1138
1139
1140 res <<= 8;
1141 if (osd_fread(f,&c,1) != 1)
1142 return -1;
1143 res |= c;
1144 }
1145
1146 *num = res;
1147 return 0;
1148 }
1149
1150 static void writeword(void *f,UINT16 num)
1151 {
1152 unsigned i;
1153
1154 for (i = 0;i < sizeof(UINT16);i++)
1155 {
1156 unsigned char c;
1157
1158
1159 c = (num >> 8 * (sizeof(UINT16)-1)) & 0xff;
1160 osd_fwrite(f,&c,1);
1161 num <<= 8;
1162 }
1163 }
1164
1165 #ifndef NOLEGACY
1166 #include "legacy.h"
1167 #endif
1168
1169 static int seq_read_ver_8(void* f, InputSeq* seq)
1170 {
1171 int j,len;
1172 UINT32 i;
1173 UINT16 w;
1174
1175 if (readword(f,&w) != 0)
1176 return -1;
1177
1178 len = w;
1179 seq_set_0(seq);
1180 for(j=0;j<len;++j)
1181 {
1182 if (readint(f,&i) != 0)
1183 return -1;
1184 (*seq)[j] = savecode_to_code(i);
1185 }
1186
1187 return 0;
1188 }
1189
1190 static int seq_read(void* f, InputSeq* seq, int ver)
1191 {
1192 #ifdef NOLEGACY
1193 if (ver==8)
1194 return seq_read_ver_8(f,seq);
1195 #else
1196 switch (ver) {
1197 case 5 : return seq_read_ver_5(f,seq);
1198 case 6 : return seq_read_ver_6(f,seq);
1199 case 7 : return seq_read_ver_7(f,seq);
1200 case 8 : return seq_read_ver_8(f,seq);
1201 }
1202 #endif
1203 return -1;
1204 }
1205
1206 static void seq_write(void* f, InputSeq* seq)
1207 {
1208 int j,len;
1209 for(len=0;len<SEQ_MAX;++len)
1210 if ((*seq)[len] == CODE_NONE)
1211 break;
1212 writeword(f,len);
1213 for(j=0;j<len;++j)
1214 writeint(f, code_to_savecode( (*seq)[j] ));
1215 }
1216
1217 /***************************************************************************/
1218 /* Load */
1219
1220 static void load_default_keys(void)
1221 {
1222 void *f;
1223
1224
1225 #ifdef MAME32JP
1226 memset(autopressed, 0, MAX_INPUT_BITS);
1227 autofire_enable = 0;
1228
1229 if (options.autofiredelay <= 0)
1230 options.autofiredelay = 1;
1231 #endif
1232
1233 osd_customize_inputport_defaults(inputport_defaults);
1234 memcpy(inputport_defaults_backup,inputport_defaults,sizeof(inputport_defaults));
1235
1236 if ((f = osd_fopen("default",0,OSD_FILETYPE_CONFIG,0)) != 0)
1237 {
1238 char buf[8];
1239 int version;
1240
1241 /* read header */
1242 if (osd_fread(f,buf,8) != 8)
1243 goto getout;
1244
1245 if (memcmp(buf,MAMEDEFSTRING_V5,8) == 0)
1246 version = 5;
1247 else if (memcmp(buf,MAMEDEFSTRING_V6,8) == 0)
1248 version = 6;
1249 else if (memcmp(buf,MAMEDEFSTRING_V7,8) == 0)
1250 version = 7;
1251 else if (memcmp(buf,MAMEDEFSTRING_V8,8) == 0)
1252 version = 8;
1253 else
1254 goto getout; /* header invalid */
1255
1256 for (;;)
1257 {
1258 UINT32 type;
1259 InputSeq def_seq;
1260 InputSeq seq;
1261 int i;
1262
1263 if (readint(f,&type) != 0)
1264 goto getout;
1265
1266 if (seq_read(f,&def_seq,version)!=0)
1267 goto getout;
1268 if (seq_read(f,&seq,version)!=0)
1269 goto getout;
1270
1271 i = 0;
1272 while (inputport_defaults[i].type != IPT_END)
1273 {
1274 if (inputport_defaults[i].type == type)
1275 {
1276 /* load stored settings only if the default hasn't changed */
1277 if (seq_cmp(&inputport_defaults[i].seq,&def_seq)==0)
1278 seq_copy(&inputport_defaults[i].seq,&seq);
1279 }
1280
1281 i++;
1282 }
1283 }
1284
1285 getout:
1286 osd_fclose(f);
1287 }
1288 }
1289
1290 static void save_default_keys(void)
1291 {
1292 void *f;
1293
1294
1295 if ((f = osd_fopen("default",0,OSD_FILETYPE_CONFIG,1)) != 0)
1296 {
1297 int i;
1298
1299
1300 /* write header */
1301 osd_fwrite(f,MAMEDEFSTRING_V8,8);
1302
1303 i = 0;
1304 while (inputport_defaults[i].type != IPT_END)
1305 {
1306 if (inputport_defaults[i].type != IPT_OSD_RESERVED)
1307 {
1308 writeint(f,inputport_defaults[i].type);
1309
1310 seq_write(f,&inputport_defaults_backup[i].seq);
1311 seq_write(f,&inputport_defaults[i].seq);
1312 }
1313
1314 i++;
1315 }
1316
1317 osd_fclose(f);
1318 }
1319 memcpy(inputport_defaults,inputport_defaults_backup,sizeof(inputport_defaults_backup));
1320 }
1321
1322 static int input_port_read_ver_8(void *f,struct InputPort *in)
1323 {
1324 UINT32 i;
1325 UINT16 w;
1326 if (readint(f,&i) != 0)
1327 return -1;
1328 in->type = i;
1329
1330 if (readword(f,&w) != 0)
1331 return -1;
1332 in->mask = w;
1333
1334 if (readword(f,&w) != 0)
1335 return -1;
1336 in->default_value = w;
1337
1338 if (seq_read_ver_8(f,&in->seq) != 0)
1339 return -1;
1340
1341 return 0;
1342 }
1343
1344 static int input_port_read(void *f,struct InputPort *in, int ver)
1345 {
1346 #ifdef NOLEGACY
1347 if (ver==8)
1348 return input_port_read_ver_8(f,in);
1349 #else
1350 switch (ver) {
1351 case 5 : return input_port_read_ver_5(f,in);
1352 case 6 : return input_port_read_ver_6(f,in);
1353 case 7 : return input_port_read_ver_7(f,in);
1354 case 8 : return input_port_read_ver_8(f,in);
1355 }
1356 #endif
1357 return -1;
1358 }
1359
1360 static void input_port_write(void *f,struct InputPort *in)
1361 {
1362 writeint(f,in->type);
1363 writeword(f,in->mask);
1364 writeword(f,in->default_value);
1365 seq_write(f,&in->seq);
1366 }
1367
1368
1369 int load_input_port_settings(void)
1370 {
1371 void *f;
1372 #ifdef MAME_NET
1373 struct InputPort *in;
1374 int port, player;
1375 #endif /* MAME_NET */
1376
1377
1378 load_default_keys();
1379
1380 #ifdef MAME32JP
1381 volume_multiplier = 10 << 8;
1382 #endif
1383
1384 if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_CONFIG,0)) != 0)
1385 {
1386 #ifndef MAME_NET
1387 struct InputPort *in;
1388 #endif
1389 unsigned int total,savedtotal;
1390 char buf[8];
1391 int i;
1392 int version;
1393
1394 in = Machine->input_ports_default;
1395
1396 /* calculate the size of the array */
1397 total = 0;
1398 while (in->type != IPT_END)
1399 {
1400 total++;
1401 in++;
1402 }
1403
1404 /* read header */
1405 if (osd_fread(f,buf,8) != 8)
1406 goto getout;
1407
1408 if (memcmp(buf,MAMECFGSTRING_V5,8) == 0)
1409 version = 5;
1410 else if (memcmp(buf,MAMECFGSTRING_V6,8) == 0)
1411 version = 6;
1412 else if (memcmp(buf,MAMECFGSTRING_V7,8) == 0)
1413 version = 7;
1414 else if (memcmp(buf,MAMECFGSTRING_V8,8) == 0)
1415 version = 8;
1416 else
1417 goto getout; /* header invalid */
1418
1419 /* read array size */
1420 if (readint(f,&savedtotal) != 0)
1421 goto getout;
1422 if (total != savedtotal)
1423 goto getout; /* different size */
1424
1425 /* read the original settings and compare them with the ones defined in the driver */
1426 in = Machine->input_ports_default;
1427 while (in->type != IPT_END)
1428 {
1429 struct InputPort saved;
1430
1431 if (input_port_read(f,&saved,version) != 0)
1432 goto getout;
1433
1434 if (in->mask != saved.mask ||
1435 in->default_value != saved.default_value ||
1436 in->type != saved.type ||
1437 seq_cmp(&in->seq,&saved.seq) !=0 )
1438 goto getout; /* the default values are different */
1439
1440 in++;
1441 }
1442
1443 /* read the current settings */
1444 in = Machine->input_ports;
1445 while (in->type != IPT_END)
1446 {
1447 if (input_port_read(f,in,version) != 0)
1448 goto getout;
1449 in++;
1450 }
1451
1452 /* Clear the coin & ticket counters/flags - LBO 042898 */
1453 for (i = 0; i < COIN_COUNTERS; i ++)
1454 coins[i] = lastcoin[i] = coinlockedout[i] = 0;
1455 dispensed_tickets = 0;
1456
1457 /* read in the coin/ticket counters */
1458 for (i = 0; i < COIN_COUNTERS; i ++)
1459 {
1460 if (readint(f,&coins[i]) != 0)
1461 goto getout;
1462 }
1463 if (readint(f,&dispensed_tickets) != 0)
1464 goto getout;
1465
1466 mixer_read_config(f);
1467 #ifdef MAME32JP
1468 {
1469 INT32 n;
1470
1471 if (osd_fread(f, &n, sizeof(INT32)) != 0)
1472 volume_multiplier = n;
1473 }
1474 #endif
1475
1476 getout:
1477 osd_fclose(f);
1478 }
1479
1480 /* All analog ports need initialization */
1481 {
1482 int i;
1483 for (i = 0; i < MAX_INPUT_PORTS; i++)
1484 input_analog_init[i] = 1;
1485 }
1486 #ifdef MAME_NET
1487 /* Find out what port is used by what player and swap regular inputs */
1488 in = Machine->input_ports;
1489
1490 // if (in->type == IPT_END) return; /* nothing to do */
1491
1492 /* make sure the InputPort definition is correct */
1493 // if (in->type != IPT_PORT)
1494 // {
1495 // logerror("Error in InputPort definition: expecting PORT_START\n");
1496 // return;
1497 // }
1498 // else in++;
1499 in++;
1500
1501 /* scan all the input ports */
1502 port = 0;
1503 while (in->type != IPT_END && port < MAX_INPUT_PORTS)
1504 {
1505 /* now check the input bits. */
1506 while (in->type != IPT_END && in->type != IPT_PORT)
1507 {
1508 if ((in->type & ~IPF_MASK) != IPT_DIPSWITCH_SETTING && /* skip dipswitch definitions */
1509 (in->type & ~IPF_MASK) != IPT_EXTENSION && /* skip analog extension fields */
1510 (in->type & IPF_UNUSED) == 0 && /* skip unused bits */
1511 !(!options.cheat && (in->type & IPF_CHEAT)) && /* skip cheats if cheats disabled */
1512 (in->type & ~IPF_MASK) != IPT_VBLANK && /* skip vblank stuff */
1513 ((in->type & ~IPF_MASK) >= IPT_COIN1 && /* skip if coin input and it's locked out */
1514 (in->type & ~IPF_MASK) <= IPT_COIN4 &&
1515 coinlockedout[(in->type & ~IPF_MASK) - IPT_COIN1]))
1516 {
1517 player = 0;
1518 if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER2) player = 1;
1519 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER3) player = 2;
1520 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER4) player = 3;
1521
1522 if (((in->type & ~IPF_MASK) > IPT_ANALOG_START)
1523 && ((in->type & ~IPF_MASK) < IPT_ANALOG_END))
1524 {
1525 analog_player_port[port] = player;
1526 }
1527 if (((in->type & ~IPF_MASK) == IPT_BUTTON1) ||
1528 ((in->type & ~IPF_MASK) == IPT_BUTTON2) ||
1529 ((in->type & ~IPF_MASK) == IPT_BUTTON3) ||
1530 ((in->type & ~IPF_MASK) == IPT_BUTTON4) ||
1531 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_UP) ||
1532 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_DOWN) ||
1533 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_LEFT) ||
1534 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_RIGHT) ||
1535 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_UP) ||
1536 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_DOWN) ||
1537 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_LEFT) ||
1538 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_RIGHT) ||
1539 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_UP) ||
1540 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_DOWN) ||
1541 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_LEFT) ||
1542 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_RIGHT) ||
1543 ((in->type & ~IPF_MASK) == IPT_PADDLE) ||
1544 ((in->type & ~IPF_MASK) == IPT_DIAL) ||
1545 ((in->type & ~IPF_MASK) == IPT_TRACKBALL_X) ||
1546 ((in->type & ~IPF_MASK) == IPT_TRACKBALL_Y) ||
1547 ((in->type & ~IPF_MASK) == IPT_AD_STICK_X) ||
1548 ((in->type & ~IPF_MASK) == IPT_AD_STICK_Y))
1549 {
1550 switch (default_player)
1551 {
1552 case 0:
1553 /* do nothing */
1554 break;
1555 case 1:
1556 if (player == 0)
1557 {
1558 in->type &= ~IPF_PLAYER1;
1559 in->type |= IPF_PLAYER2;
1560 }
1561 else if (player == 1)
1562 {
1563 in->type &= ~IPF_PLAYER2;
1564 in->type |= IPF_PLAYER1;
1565 }
1566 break;
1567 case 2:
1568 if (player == 0)
1569 {
1570 in->type &= ~IPF_PLAYER1;
1571 in->type |= IPF_PLAYER3;
1572 }
1573 else if (player == 2)
1574 {
1575 in->type &= ~IPF_PLAYER3;
1576 in->type |= IPF_PLAYER1;
1577 }
1578 break;
1579 case 3:
1580 if (player == 0)
1581 {
1582 in->type &= ~IPF_PLAYER1;
1583 in->type |= IPF_PLAYER4;
1584 }
1585 else if (player == 3)
1586 {
1587 in->type &= ~IPF_PLAYER4;
1588 in->type |= IPF_PLAYER1;
1589 }
1590 break;
1591 }
1592 }
1593 }
1594 in++;
1595 }
1596 port++;
1597 if (in->type == IPT_PORT) in++;
1598 }
1599
1600 /* TODO: at this point the games should initialize peers to same as server */
1601
1602 #endif /* MAME_NET */
1603
1604 update_input_ports();
1605
1606 /* if we didn't find a saved config, return 0 so the main core knows that it */
1607 /* is the first time the game is run and it should diplay the disclaimer. */
1608 if (f) return 1;
1609 else return 0;
1610 }
1611
1612 /***************************************************************************/
1613 /* Save */
1614
1615 void save_input_port_settings(void)
1616 {
1617 void *f;
1618 #ifdef MAME_NET
1619 struct InputPort *in;
1620 int port, player;
1621
1622 /* Swap input port definitions back to defaults */
1623 in = Machine->input_ports;
1624
1625 if (in->type == IPT_END) return; /* nothing to do */
1626
1627 /* make sure the InputPort definition is correct */
1628 if (in->type != IPT_PORT)
1629 {
1630 logerror("Error in InputPort definition: expecting PORT_START\n");
1631 return;
1632 }
1633 else in++;
1634
1635 /* scan all the input ports */
1636 port = 0;
1637 while (in->type != IPT_END && port < MAX_INPUT_PORTS)
1638 {
1639 /* now check the input bits. */
1640 while (in->type != IPT_END && in->type != IPT_PORT)
1641 {
1642 if ((in->type & ~IPF_MASK) != IPT_DIPSWITCH_SETTING && /* skip dipswitch definitions */
1643 (in->type & ~IPF_MASK) != IPT_EXTENSION && /* skip analog extension fields */
1644 (in->type & IPF_UNUSED) == 0 && /* skip unused bits */
1645 !(!options.cheat && (in->type & IPF_CHEAT)) && /* skip cheats if cheats disabled */
1646 (in->type & ~IPF_MASK) != IPT_VBLANK && /* skip vblank stuff */
1647 ((in->type & ~IPF_MASK) >= IPT_COIN1 && /* skip if coin input and it's locked out */
1648 (in->type & ~IPF_MASK) <= IPT_COIN4 &&
1649 coinlockedout[(in->type & ~IPF_MASK) - IPT_COIN1]))
1650 {
1651 player = 0;
1652 if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER2) player = 1;
1653 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER3) player = 2;
1654 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER4) player = 3;
1655
1656 if (((in->type & ~IPF_MASK) == IPT_BUTTON1) ||
1657 ((in->type & ~IPF_MASK) == IPT_BUTTON2) ||
1658 ((in->type & ~IPF_MASK) == IPT_BUTTON3) ||
1659 ((in->type & ~IPF_MASK) == IPT_BUTTON4) ||
1660 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_UP) ||
1661 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_DOWN) ||
1662 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_LEFT) ||
1663 ((in->type & ~IPF_MASK) == IPT_JOYSTICK_RIGHT) ||
1664 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_UP) ||
1665 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_DOWN) ||
1666 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_LEFT) ||
1667 ((in->type & ~IPF_MASK) == IPT_JOYSTICKRIGHT_RIGHT) ||
1668 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_UP) ||
1669 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_DOWN) ||
1670 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_LEFT) ||
1671 ((in->type & ~IPF_MASK) == IPT_JOYSTICKLEFT_RIGHT) ||
1672 ((in->type & ~IPF_MASK) == IPT_PADDLE) ||
1673 ((in->type & ~IPF_MASK) == IPT_DIAL) ||
1674 ((in->type & ~IPF_MASK) == IPT_TRACKBALL_X) ||
1675 ((in->type & ~IPF_MASK) == IPT_TRACKBALL_Y) ||
1676 ((in->type & ~IPF_MASK) == IPT_AD_STICK_X) ||
1677 ((in->type & ~IPF_MASK) == IPT_AD_STICK_Y))
1678 {
1679 switch (default_player)
1680 {
1681 case 0:
1682 /* do nothing */
1683 analog_player_port[port] = player;
1684 break;
1685 case 1:
1686 if (player == 0)
1687 {
1688 in->type &= ~IPF_PLAYER1;
1689 in->type |= IPF_PLAYER2;
1690 analog_player_port[port] = 1;
1691 }
1692 else if (player == 1)
1693 {
1694 in->type &= ~IPF_PLAYER2;
1695 in->type |= IPF_PLAYER1;
1696 analog_player_port[port] = 0;
1697 }
1698 break;
1699 case 2:
1700 if (player == 0)
1701 {
1702 in->type &= ~IPF_PLAYER1;
1703 in->type |= IPF_PLAYER3;
1704 analog_player_port[port] = 2;
1705 }
1706 else if (player == 2)
1707 {
1708 in->type &= ~IPF_PLAYER3;
1709 in->type |= IPF_PLAYER1;
1710 analog_player_port[port] = 0;
1711 }
1712 break;
1713 case 3:
1714 if (player == 0)
1715 {
1716 in->type &= ~IPF_PLAYER1;
1717 in->type |= IPF_PLAYER4;
1718 analog_player_port[port] = 3;
1719 }
1720 else if (player == 3)
1721 {
1722 in->type &= ~IPF_PLAYER4;
1723 in->type |= IPF_PLAYER1;
1724 analog_player_port[port] = 0;
1725 }
1726 break;
1727 }
1728 }
1729 }
1730 in++;
1731 }
1732 port++;
1733 if (in->type == IPT_PORT) in++;
1734 }
1735 #endif /* MAME_NET */
1736
1737 save_default_keys();
1738
1739 if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_CONFIG,1)) != 0)
1740 {
1741 #ifndef MAME_NET
1742 struct InputPort *in;
1743 #endif /* MAME_NET */
1744 int total;
1745 int i;
1746
1747
1748 in = Machine->input_ports_default;
1749
1750 /* calculate the size of the array */
1751 total = 0;
1752 while (in->type != IPT_END)
1753 {
1754 total++;
1755 in++;
1756 }
1757
1758 /* write header */
1759 osd_fwrite(f,MAMECFGSTRING_V8,8);
1760 /* write array size */
1761 writeint(f,total);
1762 /* write the original settings as defined in the driver */
1763 in = Machine->input_ports_default;
1764 while (in->type != IPT_END)
1765 {
1766 input_port_write(f,in);
1767 in++;
1768 }
1769 /* write the current settings */
1770 in = Machine->input_ports;
1771 while (in->type != IPT_END)
1772 {
1773 input_port_write(f,in);
1774 in++;
1775 }
1776
1777 /* write out the coin/ticket counters for this machine - LBO 042898 */
1778 for (i = 0; i < COIN_COUNTERS; i ++)
1779 writeint(f,coins[i]);
1780 writeint(f,dispensed_tickets);
1781
1782 mixer_write_config(f);
1783 #ifdef MAME32JP
1784 osd_fwrite(f, &volume_multiplier, sizeof(INT32));
1785 #endif
1786 osd_fclose(f);
1787 }
1788 }
1789
1790
1791 #ifdef MAME32JP
1792 struct fix_name_t
1793 {
1794 const char *org_name;
1795 const char *jpn_name;
1796 };
1797
1798 static struct fix_name_t fix_port_names[] =
1799 {
1800 { "Pon", "�|��" },
1801 { "Chi", "�`�[" },
1802 { "Kan", "�J��" },
1803 { "Ron", "����" },
1804 { "Reach", "���[�`" },
1805
1806 { "P1 Pon", "P1 �|��" },
1807 { "P1 Chi", "P1 �`�[" },
1808 { "P1 Kan", "P1 �J��" },
1809 { "P1 Ron", "P1 ����" },
1810 { "P1 Reach", "P1 ���[�`" },
1811 // { "P1 Bet", "P1 �x�b�g" },
1812 { "P1 Small", "P1 �X���[��" },
1813 { "P1 Big", "P1 �r�b�O" },
1814 { "P1 Flip", "P1 �t���b�v" },
1815 { "P1 Double Up", "P1 �_�u���A�b�v" },
1816 { "P1 Take Score", "P1 �X�R�A�m�F" },
1817 { "P1 Last Chance", "P1 ���X�g�`�����X" },
1818
1819 { "P2 Pon", "P2 �|��" },
1820 { "P2 Chi", "P2 �`�[" },
1821 { "P2 Kan", "P2 �J��" },
1822 { "P2 Ron", "P2 ����" },
1823 { "P2 Reach", "P2 ���[�`" },
1824 // { "P2 Bet", "P2 �x�b�g" },
1825 { "P2 Small", "P2 �X���[��" },
1826 { "P2 Big", "P2 �r�b�O" },
1827 { "P2 Flip", "P2 �t���b�v" },
1828 { "P2 Double Up", "P2 �_�u���A�b�v" },
1829 { "P2 Take Score", "P2 �X�R�A�m�F" },
1830 { "P2 Last Chance", "P2 ���X�g�`�����X" },
1831
1832 #if 0
1833 { "Continue", "�R���e�B�j���[" },
1834 { "Allow Continue", "�R���e�B�j���[����" },
1835 { "Continue Play", "�R���e�B�j���[����" },
1836
1837 { "Country", "�n��" },
1838 { "Any", "�w������" },
1839 { "China", "����" },
1840 { "Domestic", "����" },
1841 { "England", "�C�M���X" },
1842 { "Germany", "�h�C�c" },
1843 { "Hong Kong", "���`" },
1844 { "Italy", "�C�^���A" },
1845 { "Japan", "���{" },
1846 { "Korea", "����" },
1847 { "Oversea", "�C�O" },
1848 { "Taiwan", "���p" },
1849 { "USA", "�A�����J" },
1850 { "World", "���E����" },
1851
1852 { "Game Language", "����" },
1853 { "Language", "����" },
1854 { "Language 1", "���� 1" },
1855 { "Language 2", "���� 2" },
1856 { "English", "�p��" },
1857 { "Foreign (NEED ROM)", "�O����(ROM���K�v)" },
1858 { "French", "�t�����X��" },
1859 { "German", "�h�C�c��" },
1860 { "Italian", "�C�^���A��" },
1861 { "Japanese", "���{��" },
1862 { "Nihongo", "���{��" },
1863 { "Spanish", "�X�y�C����" },
1864
1865 { "Play Time", "�v���C����" },
1866 { "Time", "����" },
1867 { "5 sec", "5�b" },
1868 { "10 sec", "10�b" },
1869 { "15 sec", "15�b" },
1870 { "20 sec", "20�b" },
1871 { "25 sec", "25�b" },
1872 { "30 sec", "30�b" },
1873 { "35 sec", "35�b" },
1874 { "40 sec", "40�b" },
1875 { "45 sec", "45�b" },
1876 { "50 sec", "50�b" },
1877 { "55 sec", "55�b" },
1878 { "60 sec", "60�b" },
1879 { "1 min", "1��" },
1880 { "2 min", "2��" },
1881 { "3 min", "3��" },
1882 { "4 min", "4��" },
1883 { "5 min", "5��" },
1884 { "6 min", "6��" },
1885 { "7 min", "7��" },
1886 { "8 min", "8��" },
1887 { "9 min", "9��" },
1888 { "10 min", "10��" },
1889 { "11 min", "11��" },
1890 { "12 min", "12��" },
1891 { "2 min/1 min", "2��/1��" },
1892 { "3 min/1.5 min", "3��/1.5��" },
1893
1894 { "None", "����" },
1895 { "Nothing", "����" },
1896 { "Infinite", "������" },
1897 { "Unlimited", "������" },
1898 { "Normal", "�W��" },
1899 { "Inverted", "���]" },
1900 { "Slow", "�x��" },
1901 { "Fast", "����" },
1902 { "Same", "����" },
1903 { "Individual", "����" },
1904 { "Horizontally", "����" },
1905 { "Vertically", "����" },
1906
1907 { "Bet Min", "�����x�b�g��" },
1908 { "Bet Max", "�����x�b�g��" },
1909
1910 { "Invulnerability", "���v��" },
1911 { "Ship Increase", "�@������" },
1912
1913 { "Max Players", "�����v���C���[��" },
1914
1915 { "Service Mode/Free Play", "�T�[�r�X���[�h/�t���[�v���C" },
1916
1917 { "Coin Chutes", "�R�C��������" },
1918 { "Coin Slot", "�R�C���X���b�g" },
1919 { "Disable All Coins", "���������R�C��������" },
1920
1921 { "First Bonus", "�{�[�i�X����" },
1922 { "Second Bonus", "�{�[�i�X2����" },
1923
1924 { "1st Bonus Life", "�{�[�i�X���C�t����" },
1925 { "2nd Bonus Life", "�{�[�i�X���C�t2����" },
1926
1927 { "Freeze", "�t���[�Y" },
1928 { "Cabinet Type", "�����^�C�v" },
1929 { "Upright 1", "�A�b�v���C�g1" },
1930 { "Upright 2", "�A�b�v���C�g2" },
1931 { "Throttle Lever", "�X���b�g�����o�[" },
1932 #endif
1933
1934 { 0, 0 }
1935 };
1936
1937 static const char *input_port_name_fix(const char *name)
1938 {
1939 int i = 0;
1940
1941 if (name == NULL)
1942 return name;
1943
1944 while (fix_port_names[i].org_name)
1945 {
1946 if (!stricmp(name, fix_port_names[i].org_name))
1947 return fix_port_names[i].jpn_name;
1948 i++;
1949 }
1950 return name;
1951 }
1952 #endif
1953
1954 /* Note that the following 3 routines have slightly different meanings with analog ports */
1955 const char *input_port_name(const struct InputPort *in)
1956 {
1957 int i;
1958 unsigned type;
1959
1960 #if defined(JAPANESE) && defined(MAME32JP)
1961 if (in->name != IP_NAME_DEFAULT) return input_port_name_fix(in->name);
1962 #else
1963 if (in->name != IP_NAME_DEFAULT) return in->name;
1964 #endif
1965
1966 i = 0;
1967
1968 if ((in->type & ~IPF_MASK) == IPT_EXTENSION)
1969 type = (in-1)->type & (~IPF_MASK | IPF_PLAYERMASK);
1970 else
1971 type = in->type & (~IPF_MASK | IPF_PLAYERMASK);
1972
1973 while (inputport_defaults[i].type != IPT_END &&
1974 inputport_defaults[i].type != type)
1975 i++;
1976
1977 if ((in->type & ~IPF_MASK) == IPT_EXTENSION)
1978 return inputport_defaults[i+1].name;
1979 else
1980 return inputport_defaults[i].name;
1981 }
1982
1983 InputSeq* input_port_type_seq(int type)
1984 {
1985 unsigned i;
1986
1987 i = 0;
1988
1989 while (inputport_defaults[i].type != IPT_END &&
1990 inputport_defaults[i].type != type)
1991 i++;
1992
1993 return &inputport_defaults[i].seq;
1994 }
1995
1996 InputSeq* input_port_seq(const struct InputPort *in)
1997 {
1998 int i,type;
1999
2000 static InputSeq ip_none = SEQ_DEF_1(CODE_NONE);
2001
2002 while (seq_get_1((InputSeq*)&in->seq) == CODE_PREVIOUS) in--;
2003
2004 if ((in->type & ~IPF_MASK) == IPT_EXTENSION)
2005 {
2006 type = (in-1)->type & (~IPF_MASK | IPF_PLAYERMASK);
2007 /* if port is disabled, or cheat with cheats disabled, return no key */
2008 if (((in-1)->type & IPF_UNUSED) || (!options.cheat && ((in-1)->type & IPF_CHEAT)))
2009 return &ip_none;
2010 }
2011 else
2012 {
2013 type = in->type & (~IPF_MASK | IPF_PLAYERMASK);
2014 /* if port is disabled, or cheat with cheats disabled, return no key */
2015 if ((in->type & IPF_UNUSED) || (!options.cheat && (in->type & IPF_CHEAT)))
2016 return &ip_none;
2017 }
2018
2019 if (seq_get_1((InputSeq*)&in->seq) != CODE_DEFAULT)
2020 return (InputSeq*)&in->seq;
2021
2022 i = 0;
2023
2024 while (inputport_defaults[i].type != IPT_END &&
2025 inputport_defaults[i].type != type)
2026 i++;
2027
2028 if ((in->type & ~IPF_MASK) == IPT_EXTENSION)
2029 return &inputport_defaults[i+1].seq;
2030 else
2031 return &inputport_defaults[i].seq;
2032 }
2033
2034 void update_analog_port(int port)
2035 {
2036 struct InputPort *in;
2037 int current, delta, type, sensitivity, min, max, default_value;
2038 int axis, is_stick, check_bounds;
2039 InputSeq* incseq;
2040 InputSeq* decseq;
2041 int keydelta;
2042 int player;
2043
2044 /* get input definition */
2045 in = input_analog[port];
2046
2047 /* if we're not cheating and this is a cheat-only port, bail */
2048 if (!options.cheat && (in->type & IPF_CHEAT)) return;
2049 type=(in->type & ~IPF_MASK);
2050
2051 decseq = input_port_seq(in);
2052 incseq = input_port_seq(in+1);
2053
2054 keydelta = IP_GET_DELTA(in);
2055
2056 switch (type)
2057 {
2058 case IPT_PADDLE:
2059 axis = X_AXIS; is_stick = 1; check_bounds = 1; break;
2060 case IPT_PADDLE_V:
2061 axis = Y_AXIS; is_stick = 1; check_bounds = 1; break;
2062 case IPT_DIAL:
2063 axis = X_AXIS; is_stick = 0; check_bounds = 0; break;
2064 case IPT_DIAL_V:
2065 axis = Y_AXIS; is_stick = 0; check_bounds = 0; break;
2066 case IPT_TRACKBALL_X:
2067 axis = X_AXIS; is_stick = 0; check_bounds = 0; break;
2068 case IPT_TRACKBALL_Y:
2069 axis = Y_AXIS; is_stick = 0; check_bounds = 0; break;
2070 case IPT_AD_STICK_X:
2071 axis = X_AXIS; is_stick = 1; check_bounds = 1; break;
2072 case IPT_AD_STICK_Y:
2073 axis = Y_AXIS; is_stick = 1; check_bounds = 1; break;
2074 case IPT_PEDAL:
2075 axis = Y_AXIS; is_stick = 0; check_bounds = 1; break;
2076 default:
2077 /* Use some defaults to prevent crash */
2078 axis = X_AXIS; is_stick = 0; check_bounds = 0;
2079 logerror("Oops, polling non analog device in update_analog_port()????\n");
2080 }
2081
2082
2083 sensitivity = IP_GET_SENSITIVITY(in);
2084 min = IP_GET_MIN(in);
2085 max = IP_GET_MAX(in);
2086 default_value = in->default_value * 100 / sensitivity;
2087 /* extremes can be either signed or unsigned */
2088 if (min > max)
2089 {
2090 if (in->mask > 0xff) min = min - 0x10000;
2091 else min = min - 0x100;
2092 }
2093
2094
2095 input_analog_previous_value[port] = input_analog_current_value[port];
2096
2097 /* if IPF_CENTER go back to the default position */
2098 /* sticks are handled later... */
2099 if ((in->type & IPF_CENTER) && (!is_stick))
2100 input_analog_current_value[port] = in->default_value * 100 / sensitivity;
2101
2102 current = input_analog_current_value[port];
2103
2104 delta = 0;
2105
2106 switch (in->type & IPF_PLAYERMASK)
2107 {
2108 case IPF_PLAYER2: player = 1; break;
2109 case IPF_PLAYER3: player = 2; break;
2110 case IPF_PLAYER4: player = 3; break;
2111 case IPF_PLAYER1: default: player = 0; break;
2112 }
2113
2114 if (axis == X_AXIS)
2115 delta = mouse_delta_x[player];
2116 else
2117 delta = mouse_delta_y[player];
2118
2119 if (seq_pressed(decseq)) delta -= keydelta;
2120
2121 if (type != IPT_PEDAL)
2122 {
2123 if (seq_pressed(incseq)) delta += keydelta;
2124 }
2125 else
2126 {
2127 /* is this cheesy or what? */
2128 if (!delta && seq_get_1(incseq) == KEYCODE_Y) delta += keydelta;
2129 delta = -delta;
2130 }
2131
2132 if (in->type & IPF_REVERSE) delta = -delta;
2133
2134 if (is_stick)
2135 {
2136 int new, prev;
2137
2138 /* center stick */
2139 if ((delta == 0) && (in->type & IPF_CENTER))
2140 {
2141 if (current > default_value)
2142 delta = -100 / sensitivity;
2143 if (current < default_value)
2144 delta = 100 / sensitivity;
2145 }
2146
2147 /* An analog joystick which is not at zero position (or has just */
2148 /* moved there) takes precedence over all other computations */
2149 /* analog_x/y holds values from -128 to 128 (yes, 128, not 127) */
2150
2151 if (axis == X_AXIS)
2152 {
2153 new = analog_current_x[player];
2154 prev = analog_previous_x[player];
2155 }
2156 else
2157 {
2158 new = analog_current_y[player];
2159 prev = analog_previous_y[player];
2160 }
2161
2162 if ((new != 0) || (new-prev != 0))
2163 {
2164 delta=0;
2165
2166 if (in->type & IPF_REVERSE)
2167 {
2168 new = -new;
2169 prev = -prev;
2170 }
2171
2172 /* apply sensitivity using a logarithmic scale */
2173 if (in->mask > 0xff)
2174 {
2175 if (new > 0)
2176 {
2177 current = (pow(new / 32768.0, 100.0 / sensitivity) * (max-in->default_value)
2178 + in->default_value) * 100 / sensitivity;
2179 }
2180 else
2181 {
2182 current = (pow(-new / 32768.0, 100.0 / sensitivity) * (min-in->default_value)
2183 + in->default_value) * 100 / sensitivity;
2184 }
2185 }
2186 else
2187 {
2188 if (new > 0)
2189 {
2190 current = (pow(new / 128.0, 100.0 / sensitivity) * (max-in->default_value)
2191 + in->default_value) * 100 / sensitivity;
2192 }
2193 else
2194 {
2195 current = (pow(-new / 128.0, 100.0 / sensitivity) * (min-in->default_value)
2196 + in->default_value) * 100 / sensitivity;
2197 }
2198 }
2199 }
2200 }
2201
2202 current += delta;
2203
2204 if (check_bounds)
2205 {
2206 int temp;
2207
2208 if (current >= 0)
2209 temp = (current * sensitivity + 50) / 100;
2210 else
2211 temp = (-current * sensitivity + 50) / -100;
2212
2213 if (temp < min)
2214 {
2215 if (min >= 0)
2216 current = (min * 100 + sensitivity/2) / sensitivity;
2217 else
2218 current = (-min * 100 + sensitivity/2) / -sensitivity;
2219 }
2220 if (temp > max)
2221 {
2222 if (max >= 0)
2223 current = (max * 100 + sensitivity/2) / sensitivity;
2224 else
2225 current = (-max * 100 + sensitivity/2) / -sensitivity;
2226 }
2227 }
2228
2229 input_analog_current_value[port] = current;
2230 }
2231
2232 static void scale_analog_port(int port)
2233 {
2234 struct InputPort *in;
2235 int delta,current,sensitivity;
2236
2237 profiler_mark(PROFILER_INPUT);
2238 in = input_analog[port];
2239 sensitivity = IP_GET_SENSITIVITY(in);
2240
2241 /* apply scaling fairly in both positive and negative directions */
2242 delta = input_analog_current_value[port] - input_analog_previous_value[port];
2243 if (delta >= 0)
2244 delta = cpu_scalebyfcount(delta);
2245 else
2246 delta = -cpu_scalebyfcount(-delta);
2247
2248 current = input_analog_previous_value[port] + delta;
2249 /* apply scaling fairly in both positive and negative directions */
2250 if (current >= 0)
2251 current = (current * sensitivity + 50) / 100;
2252 else
2253 current = (-current * sensitivity + 50) / -100;
2254
2255 input_port_value[port] &= ~in->mask;
2256 input_port_value[port] |= current & in->mask;
2257
2258 if (playback)
2259 readword(playback,&input_port_value[port]);
2260 if (record)
2261 writeword(record,input_port_value[port]);
2262 #ifdef MAME_NET
2263 if ( net_active() && (default_player != NET_SPECTATOR) )
2264 net_analog_sync((unsigned char *) input_port_value, port, analog_player_port, default_player);
2265 #endif /* MAME_NET */
2266 profiler_mark(PROFILER_END);
2267 }
2268
2269 #define MAX_JOYSTICKS 3
2270 #define MAX_PLAYERS 4
2271 static int mJoyCurrent[MAX_JOYSTICKS*MAX_PLAYERS];
2272 static int mJoyPrevious[MAX_JOYSTICKS*MAX_PLAYERS];
2273 static int mJoy4Way[MAX_JOYSTICKS*MAX_PLAYERS];
2274 /*
2275 The above "Joy" states contain packed bits:
2276 0001 up
2277 0010 down
2278 0100 left
2279 1000 right
2280 */
2281
2282 static void
2283 ScanJoysticks( struct InputPort *in )
2284 {
2285 int i;
2286 int port = 0;
2287
2288 /* Save old Joystick state. */
2289 memcpy( mJoyPrevious, mJoyCurrent, sizeof(mJoyPrevious) );
2290
2291 /* Initialize bits of mJoyCurrent to zero. */
2292 memset( mJoyCurrent, 0, sizeof(mJoyCurrent) );
2293
2294 /* Now iterate over the input port structure to populate mJoyCurrent. */
2295 while( in->type != IPT_END && port < MAX_INPUT_PORTS )
2296 {
2297 while (in->type != IPT_END && in->type != IPT_PORT)
2298 {
2299 if ((in->type & ~IPF_MASK) >= IPT_JOYSTICK_UP &&
2300 (in->type & ~IPF_MASK) <= IPT_JOYSTICKLEFT_RIGHT)
2301 {
2302 InputSeq* seq;
2303 seq = input_port_seq(in);
2304 if( seq_pressed(seq) )
2305 {
2306 int joynum,joydir,player;
2307 player = 0;
2308 if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER2)
2309 player = 1;
2310 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER3)
2311 player = 2;
2312 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER4)
2313 player = 3;
2314
2315 joynum = player * MAX_JOYSTICKS +
2316 ((in->type & ~IPF_MASK) - IPT_JOYSTICK_UP) / 4;
2317 joydir = ((in->type & ~IPF_MASK) - IPT_JOYSTICK_UP) % 4;
2318
2319 mJoyCurrent[joynum] |= 1<<joydir;
2320 }
2321 }
2322 in++;
2323 }
2324 port++;
2325 if (in->type == IPT_PORT) in++;
2326 }
2327
2328 /* Process the joystick states, to filter out illegal combinations of switches. */
2329 for( i=0; i<MAX_JOYSTICKS*MAX_PLAYERS; i++ )
2330 {
2331 if( (mJoyCurrent[i]&0x3)==0x3 ) /* both up and down are pressed */
2332 {
2333 mJoyCurrent[i]&=0xc; /* clear up and down */
2334 }
2335 if( (mJoyCurrent[i]&0xc)==0xc ) /* both left and right are pressed */
2336 {
2337 mJoyCurrent[i]&=0x3; /* clear left and right */
2338 }
2339
2340 /* Only update mJoy4Way if the joystick has moved. */
2341 if( mJoyCurrent[i]!=mJoyPrevious[i] )
2342 {
2343 mJoy4Way[i] = mJoyCurrent[i];
2344
2345 if( (mJoy4Way[i] & 0x3) && (mJoy4Way[i] & 0xc) )
2346 {
2347 /* If joystick is pointing at a diagonal, acknowledge that the player moved
2348 * the joystick by favoring a direction change. This minimizes frustration
2349 * when using a keyboard for input, and maximizes responsiveness.
2350 *
2351 * For example, if you are holding "left" then switch to "up" (where both left
2352 * and up are briefly pressed at the same time), we'll transition immediately
2353 * to "up."
2354 *
2355 * Under the old "sticky" key implentation, "up" wouldn't be triggered until
2356 * left was released.
2357 *
2358 * Zero any switches that didn't change from the previous to current state.
2359 */
2360 mJoy4Way[i] ^= (mJoy4Way[i] & mJoyPrevious[i]);
2361 }
2362
2363 if( (mJoy4Way[i] & 0x3) && (mJoy4Way[i] & 0xc) )
2364 {
2365 /* If we are still pointing at a diagonal, we are in an indeterminant state.
2366 *
2367 * This could happen if the player moved the joystick from the idle position directly
2368 * to a diagonal, or from one diagonal directly to an extreme diagonal.
2369 *
2370 * The chances of this happening with a keyboard are slim, but we still need to
2371 * constrain this case.
2372 *
2373 * For now, just resolve randomly.
2374 */
2375 if( rand()&1 )
2376 {
2377 mJoy4Way[i] &= 0x3; /* eliminate horizontal component */
2378 }
2379 else
2380 {
2381 mJoy4Way[i] &= 0xc; /* eliminate vertical component */
2382 }
2383 }
2384 }
2385 }
2386 } /* ScanJoysticks */
2387
2388 void update_input_ports(void)
2389 {
2390 int port,ib;
2391 struct InputPort *in;
2392
2393 #define MAX_INPUT_BITS 1024
2394 static int impulsecount[MAX_INPUT_BITS];
2395 static int waspressed[MAX_INPUT_BITS];
2396 static int pbwaspressed[MAX_INPUT_BITS];
2397
2398 #ifdef MAME_NET
2399 int player;
2400 #endif /* MAME_NET */
2401
2402
2403 profiler_mark(PROFILER_INPUT);
2404
2405 /* clear all the values before proceeding */
2406 for (port = 0;port < MAX_INPUT_PORTS;port++)
2407 {
2408 input_port_value[port] = 0;
2409 input_vblank[port] = 0;
2410 input_analog[port] = 0;
2411 }
2412
2413 in = Machine->input_ports;
2414 if (in->type == IPT_END) return; /* nothing to do */
2415
2416 /* make sure the InputPort definition is correct */
2417 if (in->type != IPT_PORT)
2418 {
2419 logerror("Error in InputPort definition: expecting PORT_START\n");
2420 return;
2421 }
2422 else
2423 {
2424 in++;
2425 }
2426
2427 ScanJoysticks( in ); /* populates mJoyCurrent[] */
2428
2429 /* scan all the input ports */
2430 port = 0;
2431 ib = 0;
2432 while (in->type != IPT_END && port < MAX_INPUT_PORTS)
2433 {
2434 struct InputPort *start;
2435 /* first of all, scan the whole input port definition and build the */
2436 /* default value. I must do it before checking for input because otherwise */
2437 /* multiple keys associated with the same input bit wouldn't work (the bit */
2438 /* would be reset to its default value by the second entry, regardless if */
2439 /* the key associated with the first entry was pressed) */
2440 start = in;
2441 while (in->type != IPT_END && in->type != IPT_PORT)
2442 {
2443 if ((in->type & ~IPF_MASK) != IPT_DIPSWITCH_SETTING && /* skip dipswitch definitions */
2444 (in->type & ~IPF_MASK) != IPT_EXTENSION) /* skip analog extension fields */
2445 {
2446 input_port_value[port] =
2447 (input_port_value[port] & ~in->mask) | (in->default_value & in->mask);
2448 #ifdef MAME_NET
2449 if ( net_active() )
2450 input_port_defaults[port] = input_port_value[port];
2451 #endif /* MAME_NET */
2452 }
2453
2454 in++;
2455 }
2456
2457 /* now get back to the beginning of the input port and check the input bits. */
2458 for (in = start;
2459 in->type != IPT_END && in->type != IPT_PORT;
2460 in++, ib++)
2461 {
2462 #ifdef MAME_NET
2463 player = 0;
2464 if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER2) player = 1;
2465 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER3) player = 2;
2466 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER4) player = 3;
2467 #endif /* MAME_NET */
2468 if ((in->type & ~IPF_MASK) != IPT_DIPSWITCH_SETTING && /* skip dipswitch definitions */
2469 (in->type & ~IPF_MASK) != IPT_EXTENSION) /* skip analog extension fields */
2470 {
2471 if ((in->type & ~IPF_MASK) == IPT_VBLANK)
2472 {
2473 input_vblank[port] ^= in->mask;
2474 input_port_value[port] ^= in->mask;
2475 if (Machine->drv->vblank_duration == 0)
2476 logerror("Warning: you are using IPT_VBLANK with vblank_duration = 0. You need to increase vblank_duration for IPT_VBLANK to work.\n");
2477 }
2478 /* If it's an analog control, handle it appropriately */
2479 else if (((in->type & ~IPF_MASK) > IPT_ANALOG_START)
2480 && ((in->type & ~IPF_MASK) < IPT_ANALOG_END )) /* LBO 120897 */
2481 {
2482 input_analog[port]=in;
2483 /* reset the analog port on first access */
2484 if (input_analog_init[port])
2485 {
2486 input_analog_init[port] = 0;
2487 input_analog_current_value[port] = input_analog_previous_value[port]
2488 = in->default_value * 100 / IP_GET_SENSITIVITY(in);
2489 }
2490 }
2491 else
2492 {
2493 InputSeq* seq;
2494 seq = input_port_seq(in);
2495 #ifdef MAME32JP
2496 if (auto_pressed(seq, in->type, ib))
2497 #else
2498 if (seq_pressed(seq))
2499 #endif
2500 {
2501 /* skip if coin input and it's locked out */
2502 if ((in->type & ~IPF_MASK) >= IPT_COIN1 &&
2503 (in->type & ~IPF_MASK) <= IPT_COIN4 &&
2504 coinlockedout[(in->type & ~IPF_MASK) - IPT_COIN1])
2505 {
2506 continue;
2507 }
2508
2509 /* if IPF_RESET set, reset the first CPU */
2510 if ((in->type & IPF_RESETCPU) && waspressed[ib] == 0 && !playback)
2511 {
2512 cpu_set_reset_line(0,PULSE_LINE);
2513 }
2514
2515 if (in->type & IPF_IMPULSE)
2516 {
2517 if (IP_GET_IMPULSE(in) == 0)
2518 logerror("error in input port definition: IPF_IMPULSE with length = 0\n");
2519 if (waspressed[ib] == 0)
2520 impulsecount[ib] = IP_GET_IMPULSE(in);
2521 /* the input bit will be toggled later */
2522 }
2523 else if (in->type & IPF_TOGGLE)
2524 {
2525 if (waspressed[ib] == 0)
2526 {
2527 in->default_value ^= in->mask;
2528 input_port_value[port] ^= in->mask;
2529 }
2530 }
2531 else if ((in->type & ~IPF_MASK) >= IPT_JOYSTICK_UP &&
2532 (in->type & ~IPF_MASK) <= IPT_JOYSTICKLEFT_RIGHT)
2533 {
2534 #ifndef MAME_NET
2535 int joynum,joydir,mask,player;
2536
2537
2538 player = 0;
2539 if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER2) player = 1;
2540 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER3) player = 2;
2541 else if ((in->type & IPF_PLAYERMASK) == IPF_PLAYER4) player = 3;
2542 #else
2543 int joynum,joydir,mask;
2544 #endif /* !MAME_NET */
2545 joynum = player * MAX_JOYSTICKS +
2546 ((in->type & ~IPF_MASK) - IPT_JOYSTICK_UP) / 4;
2547
2548 joydir = ((in->type & ~IPF_MASK) - IPT_JOYSTICK_UP) % 4;
2549
2550 mask = in->mask;
2551
2552 if( in->type & IPF_4WAY )
2553 {
2554 /* apply 4-way joystick constraint */
2555 if( ((mJoy4Way[joynum]>>joydir)&1) == 0 )
2556 {
2557 mask = 0;
2558 }
2559 }
2560 else
2561 {
2562 /* filter up+down and left+right */
2563 if( ((mJoyCurrent[joynum]>>joydir)&1) == 0 )
2564 {
2565 mask = 0;
2566 }
2567 }
2568
2569 input_port_value[port] ^= mask;
2570 } /* joystick */
2571 else
2572 {
2573 input_port_value[port] ^= in->mask;
2574 }
2575 waspressed[ib] = 1;
2576 }
2577 else
2578 waspressed[ib] = 0;
2579
2580 if ((in->type & IPF_IMPULSE) && impulsecount[ib] > 0)
2581 {
2582 impulsecount[ib]--;
2583 waspressed[ib] = 1;
2584 input_port_value[port] ^= in->mask;
2585 }
2586 }
2587 }
2588 }
2589
2590 port++;
2591 if (in->type == IPT_PORT) in++;
2592 }
2593
2594 if (playback)