1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* gameplaySP
*
* Copyright (C) 2006 Exophase <exophase@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef INPUT_H
#define INPUT_H
#include "libretro.h"
typedef enum
{
BUTTON_L = 0x200,
BUTTON_R = 0x100,
BUTTON_DOWN = 0x80,
BUTTON_UP = 0x40,
BUTTON_LEFT = 0x20,
BUTTON_RIGHT = 0x10,
BUTTON_START = 0x08,
BUTTON_SELECT = 0x04,
BUTTON_B = 0x02,
BUTTON_A = 0x01,
BUTTON_NONE = 0x00
} input_buttons_type;
typedef struct
{
unsigned retropad ;
input_buttons_type gba;
} map;
static const map btn_map[] = {
{ RETRO_DEVICE_ID_JOYPAD_L, BUTTON_L },
{ RETRO_DEVICE_ID_JOYPAD_R, BUTTON_R },
{ RETRO_DEVICE_ID_JOYPAD_Y, BUTTON_L },
{ RETRO_DEVICE_ID_JOYPAD_X, BUTTON_R },
{ RETRO_DEVICE_ID_JOYPAD_DOWN, BUTTON_DOWN },
{ RETRO_DEVICE_ID_JOYPAD_UP, BUTTON_UP },
{ RETRO_DEVICE_ID_JOYPAD_LEFT, BUTTON_LEFT },
{ RETRO_DEVICE_ID_JOYPAD_RIGHT, BUTTON_RIGHT },
{ RETRO_DEVICE_ID_JOYPAD_START, BUTTON_START },
{ RETRO_DEVICE_ID_JOYPAD_SELECT, BUTTON_SELECT },
{ RETRO_DEVICE_ID_JOYPAD_B, BUTTON_B },
{ RETRO_DEVICE_ID_JOYPAD_A, BUTTON_A }
};
void init_input(void);
u32 update_input(void);
void input_write_savestate(void);
void input_read_savestate(void);
#endif
|