-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgp2x_psp.h
130 lines (104 loc) · 3.5 KB
/
gp2x_psp.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# ifndef __SDL_JOY_H__
# define __SDL_JOY_H__
# ifdef __cplusplus
extern "C" {
# endif
#include "global.h"
typedef struct gp2xCtrlData {
int Buttons;
u32 TimeStamp;
} gp2xCtrlData;
# define GP2X_CTRL_UP 0x00001
# define GP2X_CTRL_RIGHT 0x00002
# define GP2X_CTRL_DOWN 0x00004
# define GP2X_CTRL_LEFT 0x00008
# define GP2X_CTRL_TRIANGLE 0x00010
# define GP2X_CTRL_CIRCLE 0x00020
# define GP2X_CTRL_CROSS 0x00040
# define GP2X_CTRL_SQUARE 0x00080
# define GP2X_CTRL_SELECT 0x00100
# define GP2X_CTRL_START 0x00200
# define GP2X_CTRL_LTRIGGER 0x00400
# define GP2X_CTRL_RTRIGGER 0x00800
# define GP2X_CTRL_FIRE 0x01000
# define GP2X_CTRL_VOLUP 0x02000
# define GP2X_CTRL_VOLDOWN 0x04000
# define GP2X_CTRL_MASK 0x07fff
#if defined(WIZ_MODE) || defined(GP2X_MODE)
//gp2x buttons codes
#define GP2X_UP (0)
#define GP2X_DOWN (4)
#define GP2X_LEFT (2)
#define GP2X_RIGHT (6)
#define GP2X_UPLEFT (1)
#define GP2X_UPRIGHT (7)
#define GP2X_DOWNLEFT (3)
#define GP2X_DOWNRIGHT (5)
#define GP2X_A (12)
#define GP2X_B (13)
#define GP2X_X (14)
#define GP2X_Y (15)
#define GP2X_L (10)
#define GP2X_R (11)
#define GP2X_FIRE (18)
#define GP2X_START (9)
#define GP2X_SELECT (8)
#define GP2X_VOLUP (16)
#define GP2X_VOLDOWN (17)
#elif defined(DINGUX_MODE) || defined(GCW0_MODE)
#define GP2X_UP (103)
#define GP2X_DOWN (108)
#define GP2X_LEFT (105)
#define GP2X_RIGHT (106)
#define GP2X_UPLEFT (-1)
#define GP2X_UPRIGHT (-2)
#define GP2X_DOWNLEFT (-3)
#define GP2X_DOWNRIGHT (-4)
#define GP2X_A (42)
#define GP2X_B (29)
#define GP2X_X (56)
#define GP2X_Y (57)
#define GP2X_L (15)
#define GP2X_R (14)
#define GP2X_FIRE (-5)
#define GP2X_START (28)
#define GP2X_SELECT ( 1)
#define GP2X_VOLUP (-6)
#define GP2X_VOLDOWN (-7)
#else
//some keys of the keyboard to emulate gp2x
#define GP2X_UPLEFT 79 //SDLK_KP7
#define GP2X_UP 80 //SDLK_KP8
#define GP2X_UPRIGHT 81 //SDLK_KP9
#define GP2X_LEFT 83 //SDLK_KP4
#define GP2X_RIGHT 85 //SDLK_KP6
#define GP2X_DOWNLEFT 87 //SDLK_KP1
#define GP2X_DOWN 88 //SDLK_KP2
#define GP2X_DOWNRIGHT 89 //SDLK_KP3
#define GP2X_A 38 //SDLK_a
#define GP2X_B 40 //SDLK_d
#define GP2X_X 53 //SDLK_x
#define GP2X_Y 25 //SDLK_w
#define GP2X_L 46 //SDLK_l
#define GP2X_R 27 //SDLK_r
#define GP2X_FIRE 65 //SDLK_SPACE
#define GP2X_START 36 //SDLK_RETURN
#define GP2X_SELECT 39 //SDLK_s
#define GP2X_VOLUP 86 //SDLK_KP_PLUS
#define GP2X_VOLDOWN 82 //SDLK_KP_MINUS
#endif
#define GP2X_NOEVENT -1
#define DELAY_KEY_FIRST 250
#define DELAY_KEY_REPEAT 80
extern int gp2xCtrlReadBufferPositive(gp2xCtrlData* c, int v);
extern int gp2xCtrlPeekBufferPositive(gp2xCtrlData* c, int v);
extern void gp2xPowerSetClockFrequency(int freq);
extern int gp2xGetSoundVolume();
extern void gp2xDecreaseVolume();
extern void gp2xIncreaseVolume();
extern int gp2xInsmodMMUhack();
extern int gp2xRmmodMMUhack();
# ifdef __cplusplus
}
# endif
# endif