aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Orbis/4JLibs/inc/4J_Input.h
blob: 75960c5abc3e5814c3fd2aa743a7c84107f8b36d (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#pragma once
#include <pad.h>

#define	MAP_STYLE_0		0
#define	MAP_STYLE_1		1
#define	MAP_STYLE_2		2
#define MAP_STYLE_3		3 // Vita remote play map

#define PARTIAL_MAP_1   4 // Vita TV additional controls

#define	_360_JOY_BUTTON_A						0x00000001					
#define	_360_JOY_BUTTON_B						0x00000002
#define	_360_JOY_BUTTON_X						0x00000004
#define	_360_JOY_BUTTON_Y						0x00000008

#define	_360_JOY_BUTTON_START					0x00000010
#define	_360_JOY_BUTTON_BACK					0x00000020
#define	_360_JOY_BUTTON_RB						0x00000040
#define	_360_JOY_BUTTON_LB						0x00000080

#define	_360_JOY_BUTTON_RTHUMB					0x00000100
#define	_360_JOY_BUTTON_LTHUMB					0x00000200
#define	_360_JOY_BUTTON_DPAD_UP					0x00000400
#define	_360_JOY_BUTTON_DPAD_DOWN				0x00000800

#define	_360_JOY_BUTTON_DPAD_LEFT				0x00001000
#define	_360_JOY_BUTTON_DPAD_RIGHT				0x00002000
// fake digital versions of analog values				
#define	_360_JOY_BUTTON_LSTICK_RIGHT			0x00004000
#define	_360_JOY_BUTTON_LSTICK_LEFT				0x00008000

#define	_360_JOY_BUTTON_RSTICK_DOWN				0x00010000
#define	_360_JOY_BUTTON_RSTICK_UP				0x00020000
#define	_360_JOY_BUTTON_RSTICK_RIGHT			0x00040000
#define	_360_JOY_BUTTON_RSTICK_LEFT				0x00080000

#define	_360_JOY_BUTTON_LSTICK_DOWN				0x00100000
#define	_360_JOY_BUTTON_LSTICK_UP				0x00200000
#define	_360_JOY_BUTTON_RT						0x00400000
#define	_360_JOY_BUTTON_LT						0x00800000

// PS4 equivalents

#define	_PS4_JOY_BUTTON_X				_360_JOY_BUTTON_A			
#define	_PS4_JOY_BUTTON_O				_360_JOY_BUTTON_B			
#define	_PS4_JOY_BUTTON_SQUARE			_360_JOY_BUTTON_X			
#define	_PS4_JOY_BUTTON_TRIANGLE		_360_JOY_BUTTON_Y			
#define	_PS4_JOY_BUTTON_TOUCHPAD		_360_JOY_BUTTON_BACK
#define	_PS4_JOY_BUTTON_OPTIONS			_360_JOY_BUTTON_START	
#define	_PS4_JOY_BUTTON_R1				_360_JOY_BUTTON_RB			
#define	_PS4_JOY_BUTTON_L1				_360_JOY_BUTTON_LB			
#define	_PS4_JOY_BUTTON_R3				_360_JOY_BUTTON_RTHUMB		
#define	_PS4_JOY_BUTTON_L3				_360_JOY_BUTTON_LTHUMB		
#define	_PS4_JOY_BUTTON_DPAD_UP			_360_JOY_BUTTON_DPAD_UP		
#define	_PS4_JOY_BUTTON_DPAD_DOWN		_360_JOY_BUTTON_DPAD_DOWN	
#define	_PS4_JOY_BUTTON_DPAD_LEFT		_360_JOY_BUTTON_DPAD_LEFT	
#define	_PS4_JOY_BUTTON_DPAD_RIGHT		_360_JOY_BUTTON_DPAD_RIGHT	
#define	_PS4_JOY_BUTTON_LSTICK_RIGHT	_360_JOY_BUTTON_LSTICK_RIGHT
#define	_PS4_JOY_BUTTON_LSTICK_LEFT		_360_JOY_BUTTON_LSTICK_LEFT	
#define	_PS4_JOY_BUTTON_RSTICK_DOWN		_360_JOY_BUTTON_RSTICK_DOWN	
#define	_PS4_JOY_BUTTON_RSTICK_UP		_360_JOY_BUTTON_RSTICK_UP	
#define	_PS4_JOY_BUTTON_RSTICK_RIGHT	_360_JOY_BUTTON_RSTICK_RIGHT
#define	_PS4_JOY_BUTTON_RSTICK_LEFT		_360_JOY_BUTTON_RSTICK_LEFT	
#define	_PS4_JOY_BUTTON_LSTICK_DOWN		_360_JOY_BUTTON_LSTICK_DOWN	
#define	_PS4_JOY_BUTTON_LSTICK_UP		_360_JOY_BUTTON_LSTICK_UP	
#define	_PS4_JOY_BUTTON_R2				_360_JOY_BUTTON_RT			
#define	_PS4_JOY_BUTTON_L2				_360_JOY_BUTTON_LT			


































// Stick axis maps - to allow changes for SouthPaw in-game axis mapping
#define AXIS_MAP_LX								0
#define AXIS_MAP_LY								1
#define AXIS_MAP_RX								2
#define AXIS_MAP_RY								3

// Trigger map - to allow for swap triggers in-game
#define TRIGGER_MAP_0							0
#define TRIGGER_MAP_1							1

class StringTable;
// class C4JStringTable
// {
// public:
// 	LPCWSTR Lookup(LPCWSTR szId);
// 	LPCWSTR Lookup(UINT nIndex);
// 	void Clear();
// 	HRESULT Load(LPCWSTR szId);
// };

typedef struct _STRING_VERIFY_RESPONSE
{
	WORD wNumStrings;
	HRESULT *pStringResult;
} 
STRING_VERIFY_RESPONSE;

enum EKeyboardResult
{
	EKeyboard_Pending,
	EKeyboard_Cancelled,
	EKeyboard_ResultAccept,
	EKeyboard_ResultDecline,
};

class C_4JInput
{
public:
	enum EKeyboardResult
	{
		EKeyboard_Pending,
		EKeyboard_Cancelled,
		EKeyboard_ResultAccept,
		EKeyboard_ResultDecline,
	};

	enum EKeyboardMode
	{
		EKeyboardMode_Default,
		EKeyboardMode_Numeric,
		EKeyboardMode_Password,
		EKeyboardMode_Alphabet,
		EKeyboardMode_Full,
		EKeyboardMode_Alphabet_Extended,
		EKeyboardMode_IP_Address,
		EKeyboardMode_Phone
	};

	void				Initialise( int iInputStateC, unsigned char ucMapC,unsigned char ucActionC, unsigned char ucMenuActionC );
	void				Tick(void);
	void				SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiDeadzoneDigital ,unsigned int uiAnalogMovementRangeMax );
	void				SetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction,unsigned int uiActionVal);
	unsigned int		GetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction);
	void				SetJoypadMapVal(int iPad,unsigned char ucMap);
	unsigned char		GetJoypadMapVal(int iPad);
	void				SetJoypadSensitivity(int iPad, float fSensitivity);
	unsigned int		GetValue(int iPad,unsigned char ucAction, bool bRepeat=false);
	bool				ButtonPressed(int iPad,unsigned char ucAction=255); // toggled
	bool				ButtonReleased(int iPad,unsigned char ucAction); //toggled
	bool				ButtonDown(int iPad,unsigned char ucAction=255); // button held down
	// Functions to remap the axis and triggers for in-game (not menus) - SouthPaw, etc
	void				SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo);
	void				SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo);
	void				SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs); 
	void				SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam );
	FLOAT				GetIdleSeconds(int iPad);
	bool				IsPadConnected(int iPad);
	void				SetCircleCrossSwapped(bool swapped);
	bool				IsCircleCrossSwapped();

	// In-Game values which may have been remapped due to Southpaw, swap triggers, etc
	float				GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay=true);
	float				GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay=true);
	float				GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay=true);
	float				GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay=true);
	unsigned char		GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay=true);
	unsigned char		GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay=true);

	ScePadTouchData	*	GetTouchPadData(int iPad, bool bCheckMenuDisplay=true);

	void				SetMenuDisplayed(int iPad, bool bVal);

	C_4JInput::EKeyboardResult		RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
	void				DestroyKeyboard();
	void				GetText(uint16_t *UTF16String);

	// Remote play
	void SetLocalMultiplayer(bool inProgress);
	bool IsLocalMultiplayerAvailable();
	bool UsingRemoteVita();

	// Online check strings against offensive list - TCR 92
	// 	TCR # 092  CMTV Player Text String Verification 
	// 		Requirement Any player-entered text visible to another player on Xbox LIVE must be verified using the Xbox LIVE service before being transmitted. Text that is rejected by the Xbox LIVE service must not be displayed.
	// 
	// 		Remarks
	// 		This requirement applies to any player-entered string that can be exposed to other players on Xbox LIVE. It includes session names, content descriptions, text messages, tags, team names, mottos, comments, and so on.
	// 
	// 		Games may decide to not send the text, blank it out, or use generic text if the text was rejected by the Xbox LIVE service.
	// 
	// 		Games verify the text by calling the XStringVerify function.
	// 
	// 		Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat.
	// 
	// 		Intent Protect players from inappropriate language.
	bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam);
	void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam);
	void CancelAllVerifyInProgress(void);

	//bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput);
};

// Singleton
extern C_4JInput InputManager;