-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinput.h
59 lines (45 loc) · 1.35 KB
/
input.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
/*
BootMii - a Free Software replacement for the Nintendo/BroadOn bootloader.
Requires mini.
Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
Copyright (C) 2009 John Kelley <wiidev@kelley.ca>
Copyright (C) 2009 bLAStY <blasty@bootmii.org>
# This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
#ifndef __INPUT_H__
#define __INPUT_H__
#include "powerpc.h"
#define PAD_BUTTON_LEFT 0x0001
#define PAD_BUTTON_RIGHT 0x0002
#define PAD_BUTTON_DOWN 0x0004
#define PAD_BUTTON_UP 0x0008
#define PAD_TRIGGER_Z 0x0010
#define PAD_TRIGGER_R 0x0020
#define PAD_TRIGGER_L 0x0040
// unused 0x0080
#define PAD_BUTTON_A 0x0100
#define PAD_BUTTON_B 0x0200
#define PAD_BUTTON_X 0x0400
#define PAD_BUTTON_Y 0x0800
#define PAD_BUTTON_START 0x1000
#define PAD_ANY 0x1F7F
#define GPIO_POWER PAD_BUTTON_DOWN
#define GPIO_RESET PAD_BUTTON_UP
#define GPIO_EJECT PAD_BUTTON_A
// button long presses
#define GPIO_RESET_LP PAD_BUTTON_A
#define INPUT_WAIT_CYCLE_DELAY 20000
typedef struct {
u16 btns_held;
u16 btns_up;
u16 btns_down;
s8 x, y, cx, cy;
u8 l, r;
} GC_Pad;
void input_init(void);
u16 pad_read(GC_Pad *pad, int chan);
u16 gpio_read(void);
u16 input_read(void);
u16 input_wait(void);
#endif