/
InputManager.cpp
84 lines (72 loc) · 1.67 KB
/
InputManager.cpp
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
/**
* Wii64 - InputManager.cpp
* Copyright (C) 2009 sepp256
*
* Wii64 homepage: http://www.emulatemii.com
* email address: sepp256@gmail.com
*
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
* cence as published by the Free Software Foundation; either
* version 2 of the Licence, or any later version.
*
* This program is distributed in the hope that it will be use-
* ful, but WITHOUT ANY WARRANTY; without even the implied war-
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
**/
#include "InputManager.h"
#include "FocusManager.h"
#include "CursorManager.h"
#include "../main/wii64config.h"
extern char shutdown;
extern int stop;
namespace menu {
void PowerCallback();
void ResetCallback();
Input::Input()
{
PAD_SetSamplingRate(pollRate);
PAD_Init();
#ifdef HW_RVL
WPAD_Init();
WPAD_SetVRes(WPAD_CHAN_ALL, 640, 480);
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
SYS_SetPowerCallback(PowerCallback);
#endif
SYS_SetResetCallback(ResetCallback);
}
Input::~Input()
{
}
void Input::refreshInput()
{
PAD_ScanPads();
#ifdef HW_RVL
WPAD_ScanPads();
#endif
}
#ifdef HW_RVL
WPADData* Input::getWpad()
{
return WPAD_Data(0);
}
#endif
void Input::clearInputData()
{
Focus::getInstance().clearInputData();
Cursor::getInstance().clearInputData();
}
void PowerCallback()
{
shutdown = 1;
stop = 1;
}
void ResetCallback()
{
stop = 1;
PAD_Recalibrate(PAD_CHAN0_BIT | PAD_CHAN1_BIT | PAD_CHAN2_BIT | PAD_CHAN3_BIT);
}
} //namespace menu