20 proto native
void ChangeGameFocus(
int add,
int input_device = -1);
27 proto native
void ResetGameFocus(
int input_device = -1);
34 proto native
bool HasGameFocus(
int input_device = -1);
37 proto native
int GetActionGroupsCount();
38 proto native
int GetActionGroupSize(
int group_index);
39 proto
int GetActionGroupName(
int group_index, out
string name);
40 proto
int GetActionDesc(
int action_index, out
string desc);
50 proto native
float LocalValue_ID(
int action,
bool check_focus =
true);
51 proto native
float LocalValue(
string action,
bool check_focus =
true);
61 proto native
bool LocalPress_ID(
int action,
bool check_focus =
true);
62 proto native
bool LocalPress(
string action,
bool check_focus =
true);
71 proto native
bool LocalRelease_ID(
int action,
bool check_focus =
true);
72 proto native
bool LocalRelease(
string action,
bool check_focus =
true);
81 proto native
bool LocalHold_ID(
int action,
bool check_focus =
true);
82 proto native
bool LocalHold(
string action,
bool check_focus =
true);
91 proto native
bool LocalDbl_ID(
int action,
bool check_focus =
true);
92 proto native
bool LocalDbl(
string action,
bool check_focus =
true);
101 proto native
void DisableKey(
int key);
104 proto native
void EnableMouseAndKeyboard(
bool enable);
106 proto native
bool IsEnabledMouseAndKeyboard();
109 proto native
void EnableGamepad(
bool enable);
114 proto native
bool IsEnabledGamepad();
119 proto native
bool IsEnabledMouseAndKeyboardEvenOnServer();
125 proto native
bool IsMouseConnected();
126 proto native
bool IsKeyboardConnected();
129 proto native
int GetCurrentProfile();
131 proto native
void GetCurrentProfileActionKeys(
int action_index, out
TIntArray keys);
135 proto native
int GetProfilesCount();
137 proto native
int SetProfile(
int index);
141 proto native
int GetDevicesCount();
142 proto
int GetDeviceName(
int device_index, out
string name);
143 proto native
int IsDeviceXInput(
int device_index);
144 proto native
int IsDeviceEnabled(
int device_index);
145 proto native
void SetDeviceEnabled(
int device_index,
bool enabled);
148 proto
bool GetGamepadThumbDirection(
GamepadButton thumbButton, out
float angle, out
float value);
151 proto native
void ResetActiveGamepad();
152 proto native
void SelectActiveGamepad(
int gamepad);
153 proto native
void GetGamepadList(out
array<int> gamepads);
154 proto
void GetGamepadUser(
int gamepad, out
BiosUser user);
161 proto native
bool IsActiveGamepadSelected();
164 bool IsAnyInputDeviceActive()
166 return IsActiveGamepadSelected() || IsMouseConnected() || IsKeyboardConnected();
173 bool AreAllAllowedInputDevicesActive(out
array<int> unavailableDeviceList = null)
176 bool gamepad = IsActiveGamepadSelected();
177 bool mouse = IsMouseConnected();
178 bool keyboard = IsKeyboardConnected();
181 if (
g_Game.GetGameState() != DayZGameState.IN_GAME)
183 MnKEnabled = IsEnabledMouseAndKeyboard();
185 else if (
g_Game.GetGameState() != DayZGameState.MAIN_MENU)
187 MnKEnabled = IsEnabledMouseAndKeyboardEvenOnServer();
199 FillUnavailableDeviceArray(EUAINPUT_DEVICE_CONTROLLER,unavailableDeviceList);
209 FillUnavailableDeviceArray(EUAINPUT_DEVICE_MOUSE,unavailableDeviceList);
214 FillUnavailableDeviceArray(EUAINPUT_DEVICE_KEYBOARD,unavailableDeviceList);
219 FillUnavailableDeviceArray(EUAINPUT_DEVICE_CONTROLLER,unavailableDeviceList);
226 void FillUnavailableDeviceArray(
int device, inout
array<int> filler)
230 filler.Insert(device);
235 void UpdateConnectedInputDeviceList()
237 g_Game.GetConnectedInputDeviceList().Clear();
239 if (IsActiveGamepadSelected())
240 g_Game.GetConnectedInputDeviceList().Insert(EUAINPUT_DEVICE_CONTROLLER);
241 if (IsMouseConnected())
242 g_Game.GetConnectedInputDeviceList().Insert(EUAINPUT_DEVICE_MOUSE);
243 if (IsKeyboardConnected())
244 g_Game.GetConnectedInputDeviceList().Insert(EUAINPUT_DEVICE_KEYBOARD);
261 void OnGamepadConnected(
int gamepad)
268 GetGamepadUser( gamepad, user );
269 if (user && user ==
g_Game.GetUserManager().GetSelectedUser())
271 SelectActiveGamepad(gamepad);
274 mission.GetOnInputDeviceConnected().Invoke(EUAINPUT_DEVICE_CONTROLLER);
279 if (gamepad ==
g_Game.GetPreviousGamepad())
281 SelectActiveGamepad(
g_Game.GetPreviousGamepad());
284 mission.GetOnInputDeviceConnected().Invoke(EUAINPUT_DEVICE_CONTROLLER);
290 void OnGamepadDisconnected(
int gamepad)
295 if (IsInactiveGamepadOrUserSelected(gamepad))
297 UpdateConnectedInputDeviceList();
301 DayZLoadState state =
g_Game.GetLoadState();
302 if (state != DayZLoadState.MAIN_MENU_START && state != DayZLoadState.MAIN_MENU_USER_SELECT)
306 mission.GetOnInputDeviceDisconnected().Invoke(EUAINPUT_DEVICE_CONTROLLER);
313 void OnGamepadIdentification(
int gamepad)
320 DayZLoadState state =
g_Game.GetLoadState();
322 UpdateConnectedInputDeviceList();
323 SelectActiveGamepad(gamepad);
324 g_Game.SelectUser(gamepad);
325 g_Game.SetPreviousGamepad(gamepad);
327 if (state == DayZLoadState.MAIN_MENU_START || state == DayZLoadState.MAIN_MENU_USER_SELECT)
334 mission.GetOnInputDeviceConnected().Invoke(EUAINPUT_DEVICE_CONTROLLER);
341 GetGamepadList( gamepads );
342 for(
int i = 0; i < gamepads.Count(); i++ )
345 GetGamepadUser( gamepads[i], user2 );
352 bool IsInactiveGamepadOrUserSelected(
int gamepad = -1 )
357 #ifdef PLATFORM_CONSOLE
358 if (!
g_Game.GetUserManager())
361 return !IsActiveGamepadSelected();
365 GetGamepadUser( gamepad, user );
366 return (user ==
g_Game.GetUserManager().GetSelectedUser());
374 void OnMouseConnected()
379 UpdateConnectedInputDeviceList();
382 DayZLoadState state =
g_Game.GetLoadState();
383 if (state != DayZLoadState.MAIN_MENU_START && state != DayZLoadState.MAIN_MENU_USER_SELECT)
385 g_Game.GetMission().GetOnInputDeviceConnected().Invoke(EUAINPUT_DEVICE_MOUSE);
392 void OnMouseDisconnected()
397 UpdateConnectedInputDeviceList();
400 DayZLoadState state =
g_Game.GetLoadState();
401 if (state != DayZLoadState.MAIN_MENU_START && state != DayZLoadState.MAIN_MENU_USER_SELECT)
403 g_Game.GetMission().GetOnInputDeviceDisconnected().Invoke(EUAINPUT_DEVICE_MOUSE);
410 void OnKeyboardConnected()
415 UpdateConnectedInputDeviceList();
418 DayZLoadState state =
g_Game.GetLoadState();
419 if (state != DayZLoadState.MAIN_MENU_START && state != DayZLoadState.MAIN_MENU_USER_SELECT)
421 g_Game.GetMission().GetOnInputDeviceConnected().Invoke(EUAINPUT_DEVICE_KEYBOARD);
428 void OnKeyboardDisconnected()
433 UpdateConnectedInputDeviceList();
436 DayZLoadState state =
g_Game.GetLoadState();
437 if (state != DayZLoadState.MAIN_MENU_START && state != DayZLoadState.MAIN_MENU_USER_SELECT)
439 g_Game.GetMission().GetOnInputDeviceDisconnected().Invoke(EUAINPUT_DEVICE_KEYBOARD);
452 g_Game.GetMission().GetOnInputDeviceChanged().Invoke(inputDevice);