Merge remote-tracking branch 'remotes/ZDoom/gzdoom/staging' into gzd_staging
This commit is contained in:
commit
9e0bf90be6
177 changed files with 4290 additions and 12626 deletions
|
|
@ -104,6 +104,9 @@ public:
|
|||
virtual bool IsAxisMapDefault(int axis);
|
||||
virtual bool IsAxisScaleDefault(int axis);
|
||||
|
||||
virtual bool GetEnabled();
|
||||
virtual void SetEnabled(bool enabled);
|
||||
|
||||
virtual void SetDefaultConfig();
|
||||
virtual FString GetIdentifier();
|
||||
|
||||
|
|
@ -165,6 +168,7 @@ private:
|
|||
TArray<DigitalButton> m_buttons;
|
||||
TArray<DigitalButton> m_POVs;
|
||||
|
||||
bool m_enabled;
|
||||
bool m_useAxesPolling;
|
||||
|
||||
io_object_t m_notification;
|
||||
|
|
@ -279,6 +283,7 @@ IOKitJoystick::IOKitJoystick(const io_object_t device)
|
|||
: m_interface(CreateDeviceInterface(device))
|
||||
, m_queue(CreateDeviceQueue(m_interface))
|
||||
, m_sensitivity(DEFAULT_SENSITIVITY)
|
||||
, m_enabled(true)
|
||||
, m_useAxesPolling(true)
|
||||
, m_notification(0)
|
||||
{
|
||||
|
|
@ -430,6 +435,17 @@ bool IOKitJoystick::IsAxisScaleDefault(int axis)
|
|||
: true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool IOKitJoystick::GetEnabled()
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
void IOKitJoystick::SetEnabled(bool enabled)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
#undef IS_AXIS_VALID
|
||||
|
||||
void IOKitJoystick::SetDefaultConfig()
|
||||
|
|
@ -547,7 +563,7 @@ void IOKitJoystick::Update()
|
|||
|
||||
if (kIOReturnSuccess == eventResult)
|
||||
{
|
||||
if (use_joystick)
|
||||
if (use_joystick && m_enabled)
|
||||
{
|
||||
ProcessAxis(event) || ProcessButton(event) || ProcessPOV(event);
|
||||
}
|
||||
|
|
@ -557,7 +573,7 @@ void IOKitJoystick::Update()
|
|||
Printf(TEXTCOLOR_RED "IOHIDQueueInterface::getNextEvent() failed with code 0x%08X\n", eventResult);
|
||||
}
|
||||
|
||||
ProcessAxes();
|
||||
if(m_enabled) ProcessAxes();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
class SDLInputJoystick: public IJoystickConfig
|
||||
{
|
||||
public:
|
||||
SDLInputJoystick(int DeviceIndex) : DeviceIndex(DeviceIndex), Multiplier(1.0f)
|
||||
SDLInputJoystick(int DeviceIndex) : DeviceIndex(DeviceIndex), Multiplier(1.0f) , Enabled(true)
|
||||
{
|
||||
Device = SDL_JoystickOpen(DeviceIndex);
|
||||
if(Device != NULL)
|
||||
|
|
@ -154,6 +154,17 @@ public:
|
|||
Axes.Push(info);
|
||||
}
|
||||
}
|
||||
|
||||
bool GetEnabled()
|
||||
{
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
void SetEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
FString GetIdentifier()
|
||||
{
|
||||
char id[16];
|
||||
|
|
@ -248,9 +259,12 @@ protected:
|
|||
SDL_Joystick *Device;
|
||||
|
||||
float Multiplier;
|
||||
bool Enabled;
|
||||
TArray<AxisInfo> Axes;
|
||||
int NumAxes;
|
||||
int NumHats;
|
||||
|
||||
friend class SDLInputJoystickManager;
|
||||
};
|
||||
const EJoyAxis SDLInputJoystick::DefaultAxes[5] = {JOYAXIS_Side, JOYAXIS_Forward, JOYAXIS_Pitch, JOYAXIS_Yaw, JOYAXIS_Up};
|
||||
|
||||
|
|
@ -291,7 +305,7 @@ public:
|
|||
void ProcessInput() const
|
||||
{
|
||||
for(unsigned int i = 0;i < Joysticks.Size();++i)
|
||||
Joysticks[i]->ProcessInput();
|
||||
if(Joysticks[i]->Enabled) Joysticks[i]->ProcessInput();
|
||||
}
|
||||
protected:
|
||||
TArray<SDLInputJoystick *> Joysticks;
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
struct timeval tv;
|
||||
int retval;
|
||||
char k;
|
||||
bool stdin_eof = false;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -265,7 +266,10 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
tv.tv_usec = 500000;
|
||||
|
||||
FD_ZERO (&rfds);
|
||||
FD_SET (STDIN_FILENO, &rfds);
|
||||
if (!stdin_eof)
|
||||
{
|
||||
FD_SET (STDIN_FILENO, &rfds);
|
||||
}
|
||||
|
||||
retval = select (1, &rfds, NULL, NULL, &tv);
|
||||
|
||||
|
|
@ -281,13 +285,21 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (read (STDIN_FILENO, &k, 1) == 1)
|
||||
else
|
||||
{
|
||||
// Check input on stdin
|
||||
if (k == 'q' || k == 'Q')
|
||||
ssize_t amt = read (STDIN_FILENO, &k, 1); // Check input on stdin
|
||||
if (amt == 0)
|
||||
{
|
||||
fprintf (stderr, "\nNetwork game synchronization aborted.");
|
||||
return false;
|
||||
// EOF. Stop reading
|
||||
stdin_eof = true;
|
||||
}
|
||||
else if (amt == 1)
|
||||
{
|
||||
if (k == 'q' || k == 'Q')
|
||||
{
|
||||
fprintf (stderr, "\nNetwork game synchronization aborted.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,9 @@ public:
|
|||
bool IsAxisMapDefault(int axis);
|
||||
bool IsAxisScaleDefault(int axis);
|
||||
|
||||
bool GetEnabled();
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
void SetDefaultConfig();
|
||||
FString GetIdentifier();
|
||||
|
||||
|
|
@ -219,6 +222,8 @@ protected:
|
|||
DIOBJECTDATAFORMAT *Objects;
|
||||
DIDATAFORMAT DataFormat;
|
||||
|
||||
bool Enabled;
|
||||
|
||||
static BOOL CALLBACK EnumObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef);
|
||||
void OrderAxes();
|
||||
bool ReorderAxisPair(const GUID &x, const GUID &y, int pos);
|
||||
|
|
@ -297,6 +302,7 @@ FDInputJoystick::FDInputJoystick(const GUID *instance, FString &name)
|
|||
Instance = *instance;
|
||||
Name = name;
|
||||
Marked = false;
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -410,7 +416,7 @@ void FDInputJoystick::ProcessInput()
|
|||
{
|
||||
hr = Device->Acquire();
|
||||
}
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr) || !Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -984,6 +990,28 @@ bool FDInputJoystick::IsAxisScaleDefault(int axis)
|
|||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FDInputJoystick :: GetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool FDInputJoystick::GetEnabled()
|
||||
{
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FDInputJoystick :: SetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FDInputJoystick::SetEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FDInputJoystick :: IsAxisMapDefault
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ protected:
|
|||
void PostKeyEvent(int keynum, INTBOOL down, bool foreground);
|
||||
};
|
||||
|
||||
class NOVTABLE FJoystickCollection : public FInputDevice
|
||||
class FJoystickCollection : public FInputDevice
|
||||
{
|
||||
public:
|
||||
virtual void AddAxes(float axes[NUM_JOYAXIS]) = 0;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,9 @@ public:
|
|||
bool IsAxisMapDefault(int axis);
|
||||
bool IsAxisScaleDefault(int axis);
|
||||
|
||||
bool GetEnabled();
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
void SetDefaultConfig();
|
||||
FString GetIdentifier();
|
||||
|
||||
|
|
@ -153,6 +156,7 @@ protected:
|
|||
bool Connected;
|
||||
bool Marked;
|
||||
bool Active;
|
||||
bool Enabled;
|
||||
|
||||
void Attached();
|
||||
void Detached();
|
||||
|
|
@ -376,6 +380,7 @@ FRawPS2Controller::FRawPS2Controller(HANDLE handle, EAdapterType type, int seque
|
|||
ControllerNumber = controller;
|
||||
Sequence = sequence;
|
||||
DeviceID = devid;
|
||||
Enabled = true;
|
||||
|
||||
// The EMS USB2 controller provides attachment status. The others do not.
|
||||
Connected = (Descriptors[type].ControllerStatus < 0);
|
||||
|
|
@ -849,6 +854,28 @@ bool FRawPS2Controller::IsAxisScaleDefault(int axis)
|
|||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FRawPS2Controller :: GetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool FRawPS2Controller::GetEnabled()
|
||||
{
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FRawPS2Controller :: SetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FRawPS2Controller::SetEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FRawPS2Controller :: IsAxisMapDefault
|
||||
|
|
@ -972,7 +999,7 @@ bool FRawPS2Manager::ProcessRawInput(RAWINPUT *raw, int code)
|
|||
{
|
||||
if (Devices[i]->Handle == raw->header.hDevice)
|
||||
{
|
||||
if (Devices[i]->ProcessInput(&raw->data.hid, code))
|
||||
if (Devices[i]->Enabled && Devices[i]->ProcessInput(&raw->data.hid, code))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ public:
|
|||
bool IsAxisMapDefault(int axis);
|
||||
bool IsAxisScaleDefault(int axis);
|
||||
|
||||
bool GetEnabled();
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
void SetDefaultConfig();
|
||||
FString GetIdentifier();
|
||||
|
||||
|
|
@ -138,6 +141,7 @@ protected:
|
|||
DWORD LastPacketNumber;
|
||||
int LastButtons;
|
||||
bool Connected;
|
||||
bool Enabled;
|
||||
|
||||
void Attached();
|
||||
void Detached();
|
||||
|
|
@ -221,6 +225,7 @@ FXInputController::FXInputController(int index)
|
|||
{
|
||||
Index = index;
|
||||
Connected = false;
|
||||
Enabled = true;
|
||||
M_LoadJoystickConfig(this);
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +274,7 @@ void FXInputController::ProcessInput()
|
|||
{
|
||||
Attached();
|
||||
}
|
||||
if (state.dwPacketNumber == LastPacketNumber)
|
||||
if (state.dwPacketNumber == LastPacketNumber || !Enabled)
|
||||
{ // Nothing has changed since last time.
|
||||
return;
|
||||
}
|
||||
|
|
@ -628,6 +633,28 @@ bool FXInputController::IsAxisScaleDefault(int axis)
|
|||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FXInputController :: GetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool FXInputController::GetEnabled()
|
||||
{
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FXInputController :: SetEnabled
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FXInputController::SetEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FXInputController :: IsAxisMapDefault
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue