OpenBarnyard
 
Loading...
Searching...
No Matches
TInputDeviceController Class Referenceabstract

#include <TInputDeviceController.h>

Inheritance diagram for TInputDeviceController:
TInputDevice TObject TNodeList< T >::TNode TInputDXDeviceController TInputDeviceController_XInput TInputWiinDeviceController

Public Types

enum  VIBRATION_ACTUATOR
 
- Public Types inherited from TInputDevice
using EventEmitter = TInputInterface::EventEmitter
 
using Doodad = TINT
 
- Public Types inherited from TObject
enum  { IsTObject = TTRUE }
 

Public Member Functions

 TDECLARE_CLASS (TInputDeviceController, TInputDevice)
 
 TInputDeviceController ()
 
 ~TInputDeviceController ()
 
virtual TBOOL GetDoodadProperties (Doodad a_iDoodad, DoodadProperties &a_rProperties) const override
 
virtual const TCHARGetButtonFromDoodad (Doodad a_iDoodad) const override
 
virtual TBOOL IsDown (Doodad a_iDoodad) const override
 
virtual void SetVibration (VIBRATION_ACTUATOR a_eActuator, TFLOAT a_fValue)
 
virtual TBOOL WasDown (Doodad a_iDoodad) const
 
virtual void Unknown1 ()=0
 
virtual TBOOL Unknown2 ()
 
virtual TINT ProcessVirtualButtons (EventEmitter &a_rEmitter, float a_fDeltaTime)
 
- Public Member Functions inherited from TInputDevice
 TDECLARE_CLASS (TInputDevice, TObject)
 
 TInputDevice ()
 
 ~TInputDevice ()=default
 
virtual TBOOL Acquire ()=0
 
virtual TBOOL Unacquire ()=0
 
virtual void Release ()=0
 
virtual void Update (TFLOAT deltaTime)=0
 
virtual TBOOL Flush ()
 
virtual TINT ProcessEvents (EventEmitter &emitter, TFLOAT deltaTime)=0
 
virtual TINT GetButtonCount () const =0
 
virtual TINT GetAxisCount () const =0
 
virtual TBOOL StartRepeat (Doodad a_iDoodad, TFLOAT a_fFirstRepeatTime, TFLOAT a_fRepeatTime)
 
virtual void StopRepeat (Doodad a_iDoodad)
 
virtual void StopAllRepeats ()
 
virtual TBOOL IsForceFeedbackDevice ()
 
virtual TINT GetAxisInt (Doodad a_iDoodad, TINT axis) const =0
 
virtual TINT GetAxisInt2 (Doodad a_iDoodad, TINT axis) const
 
virtual TFLOAT GetAxisFloat (Doodad a_iDoodad, TINT axis) const =0
 
virtual TFLOAT GetAxisFloat2 (Doodad a_iDoodad, TINT axis) const
 
virtual TBOOL IsEnabled () const =0
 
virtual void ThrowRepeatEvent (EventEmitter &emitter, RepeatInfo *repeatInfo, TFLOAT deltaTime)
 
TBOOL IsAcquired () const
 
void SetAcquired (TBOOL a_bAcquired)
 
TInputInterfaceGetInputInterface ()
 
void SetInputInterface (TInputInterface *a_pInterface)
 
- Public Member Functions inherited from TObject
virtual Toshi::TClass * GetClass ()
 
virtual void Delete ()
 
virtual ~TObject ()
 
TBOOL IsExactly (TClass *a_pClass)
 
TBOOL IsA (TClass *a_pClass)
 
- Public Member Functions inherited from TNodeList< T >::TNode
constexpr TNode ()
 
constexpr TNode (const TNode &a_rcNode)
 
 TNode (TNode &&a_rNode)
 
T * Next () const
 
T * Prev () const
 
void Remove ()
 
void SetList (TNodeList *list)
 
TNodeListGetList () const
 
TBOOL IsLinked () const
 

Static Public Attributes

static constexpr TUINT NUM_BUTTONS = 8
 
- Static Public Attributes inherited from TInputDevice
static constexpr TINT INPUT_DEVICE_MOUSE_BUTTONS = 3
 
static constexpr TINT INPUT_DEVICE_MOUSE_WHEEL = 4
 
- Static Public Attributes inherited from TObject
static constexpr Toshi::TClass * PARENTCLASS = TNULL
 
static constinit Toshi::TClass ms_oClass = Toshi::TClass( "TObject", TObject::CreateTObject, TObject::CreateTObjectInPlace, TObject::InitialiseClass, TObject::DeinitialiseClass, 0, 2, sizeof( TObject ), alignof( TObject ) )
 

Additional Inherited Members

- Static Public Member Functions inherited from TInputDevice
static TInputDevice ** GetRegisteredDevices ()
 
static TUINT GetNumRegisteredDevices ()
 
- Static Public Member Functions inherited from TObject
static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static TFORCEINLINE TClassGetClassStatic ()
 
- Protected Member Functions inherited from TInputDevice
TINT ProcessRepeats (EventEmitter &a_rEmitter, TFLOAT a_fDeltaTime)
 
- Protected Attributes inherited from TInputDevice
TUINT m_uiDeviceIndex
 
TArray< RepeatInfom_Repeats
 
TArray< void * > m_Array2
 
TBOOL m_bUnknown
 
TBOOL m_bIsAcquired
 
TInputInterfacem_pInputInterface
 
- Protected Attributes inherited from TNodeList< T >::TNode
friend TNodeList
 
TNodeListm_pList
 
T * m_pNext
 
T * m_pPrev
 
- Static Protected Attributes inherited from TInputDevice
static constexpr TUINT MAX_DEVICE_COUNT = 14
 
static TInputDevices_aDevices [MAX_DEVICE_COUNT]
 
static TUINT s_uiDeviceCount
 

Detailed Description

Definition at line 17 of file TInputDeviceController.h.

Member Enumeration Documentation

◆ VIBRATION_ACTUATOR

Definition at line 25 of file TInputDeviceController.h.

26 {
27
28 };

Constructor & Destructor Documentation

◆ TInputDeviceController()

TInputDeviceController::TInputDeviceController ( )

Definition at line 15 of file TInputDeviceController.cpp.

16{
17 m_CurrentState = new TBOOL[ NUM_BUTTONS ];
18 m_OldState = new TBOOL[ NUM_BUTTONS ];
19 TUtil::MemClear( m_CurrentState, sizeof( *m_CurrentState ) * NUM_BUTTONS );
20 TUtil::MemClear( m_OldState, sizeof( *m_OldState ) * NUM_BUTTONS );
21}
bool TBOOL
Definition Typedefs.h:6
static constexpr TUINT NUM_BUTTONS
static void MemClear(void *ptr, TSIZE size)
Definition TUtil.h:91

◆ ~TInputDeviceController()

TInputDeviceController::~TInputDeviceController ( )

Definition at line 24 of file TInputDeviceController.cpp.

25{
26}

Member Function Documentation

◆ GetButtonFromDoodad()

const TCHAR * TInputDeviceController::GetButtonFromDoodad ( Doodad a_iDoodad) const
overridevirtual

Implements TInputDevice.

Definition at line 49 of file TInputDeviceController.cpp.

50{
51 // TODO: Create constants for doodads
52
53 switch ( a_iDoodad )
54 {
55 case 0x10001:
56 return "BUTTON_DPAD_UP";
57 case 0x10002:
58 return "BUTTON_DPAD_RIGHT";
59 case 0x10003:
60 return "BUTTON_DPAD_DOWN";
61 case 0x10004:
62 return "BUTTON_DPAD_LEFT";
63 case 0x10005:
64 return "BUTTON_SELECT";
65 case 0x10006:
66 return "BUTTON_START";
67 case 0x10007:
68 return "BUTTON_STICK_LEFT";
69 case 0x10008:
70 return "BUTTON_STICK_RIGHT";
71 case 0x10009:
72 return "BUTTON_CONTEXT_1";
73 case 0x1000a:
74 return "BUTTON_CONTEXT_2";
75 case 0x1000b:
76 return "BUTTON_CONTEXT_3";
77 case 0x1000c:
78 return "BUTTON_CONTEXT_4";
79 case 0x1000d:
80 return "BUTTON_SHOULDER_LEFT_1";
81 case 0x1000e:
82 return "BUTTON_SHOULDER_LEFT_2";
83 case 0x1000f:
84 return "BUTTON_SHOULDER_RIGHT_1";
85 case 0x10010:
86 return "BUTTON_SHOULDER_RIGHT_2";
87 case 0x10011:
88 return "VIRTBTN_STICK_LEFT_UP";
89 case 0x10012:
90 return "VIRTBTN_STICK_LEFT_RIGHT";
91 case 0x10013:
92 return "VIRTBTN_STICK_LEFT_DOWN";
93 case 0x10014:
94 return "VIRTBTN_STICK_LEFT_LEFT";
95 case 0x10015:
96 return "VIRTBTN_STICK_RIGHT_UP";
97 case 0x10016:
98 return "VIRTBTN_STICK_RIGHT_RIGHT";
99 case 0x10017:
100 return "VIRTBTN_STICK_RIGHT_DOWN";
101 case 0x10018:
102 return "VIRTBTN_STICK_RIGHT_LEFT";
103 case 0x10019:
104 return "STICK_LEFT";
105 case 0x1001a:
106 return "STICK_RIGHT";
107 case 0x1001b:
108 return "VIRTSTK_DPAD";
109 default:
110 return "UNKNOWN";
111 }
112}

◆ GetDoodadProperties()

TBOOL TInputDeviceController::GetDoodadProperties ( Doodad a_iDoodad,
DoodadProperties & a_rProperties ) const
overridevirtual

Implements TInputDevice.

Definition at line 29 of file TInputDeviceController.cpp.

30{
31 if ( a_iDoodad < 0x10000 || 0x1001b < a_iDoodad )
32 {
33 return TFALSE;
34 }
35
36 if ( a_iDoodad != 0x10019 && a_iDoodad != 0x1001a && a_iDoodad != 0x1001b )
37 {
38 a_rProperties.m_iUnk = 0;
39 a_rProperties.m_bFlag = TFALSE;
40 return TTRUE;
41 }
42
43 a_rProperties.m_iUnk = 2;
44 a_rProperties.m_bFlag = TTRUE;
45 return TTRUE;
46}
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25

◆ IsDown()

TBOOL TInputDeviceController::IsDown ( Doodad a_iDoodad) const
overridevirtual

Implements TInputDevice.

Definition at line 115 of file TInputDeviceController.cpp.

116{
117 switch ( a_iDoodad )
118 {
119 case 0x10011:
120 return m_CurrentState[ 0 ];
121 case 0x10012:
122 return m_CurrentState[ 1 ];
123 case 0x10013:
124 return m_CurrentState[ 2 ];
125 case 0x10014:
126 return m_CurrentState[ 3 ];
127 case 0x10015:
128 return m_CurrentState[ 4 ];
129 case 0x10016:
130 return m_CurrentState[ 5 ];
131 case 0x10017:
132 return m_CurrentState[ 6 ];
133 case 0x10018:
134 return m_CurrentState[ 7 ];
135 default:
136 return TFALSE;
137 }
138}

◆ ProcessVirtualButtons()

TINT TInputDeviceController::ProcessVirtualButtons ( EventEmitter & a_rEmitter,
float a_fDeltaTime )
virtual

Definition at line 176 of file TInputDeviceController.cpp.

177{
178 TINT iNumProcessed = 0;
179
180 for ( TINT i = 0; i < NUM_BUTTONS; i++ )
181 {
182 if ( m_CurrentState[ i ] != m_OldState[ i ] )
183 {
184 a_rEmitter.Throw(
185 TInputInterface::InputEvent(
186 this,
187 0x10011 + i,
188 m_CurrentState[ i ] == TTRUE ?
191 )
192 );
193
194 iNumProcessed += 1;
195 }
196 }
197
198 a_rEmitter.Throw(
199 TInputInterface::InputEvent(
200 this,
201 0x1001B,
203 m_fMag1,
204 m_fMag2
205 )
206 );
207
208 return iNumProcessed + 1;
209}
int TINT
Definition Typedefs.h:7

◆ SetVibration()

void TInputDeviceController::SetVibration ( VIBRATION_ACTUATOR a_eActuator,
TFLOAT a_fValue )
virtual

Definition at line 140 of file TInputDeviceController.cpp.

141{
142}

◆ TDECLARE_CLASS()

TInputDeviceController::TDECLARE_CLASS ( TInputDeviceController ,
TInputDevice  )

◆ Unknown1()

virtual void TInputDeviceController::Unknown1 ( )
pure virtual

◆ Unknown2()

TBOOL TInputDeviceController::Unknown2 ( )
virtual

Definition at line 170 of file TInputDeviceController.cpp.

171{
172 return TTRUE;
173}

◆ WasDown()

TBOOL TInputDeviceController::WasDown ( Doodad a_iDoodad) const
virtual

Definition at line 145 of file TInputDeviceController.cpp.

146{
147 switch ( a_iDoodad )
148 {
149 case 0x10011:
150 return m_OldState[ 0 ];
151 case 0x10012:
152 return m_OldState[ 1 ];
153 case 0x10013:
154 return m_OldState[ 2 ];
155 case 0x10014:
156 return m_OldState[ 3 ];
157 case 0x10015:
158 return m_OldState[ 4 ];
159 case 0x10016:
160 return m_OldState[ 5 ];
161 case 0x10017:
162 return m_OldState[ 6 ];
163 case 0x10018:
164 return m_OldState[ 7 ];
165 default:
166 return TFALSE;
167 }
168}

Member Data Documentation

◆ NUM_BUTTONS

TUINT TInputDeviceController::NUM_BUTTONS = 8
staticconstexpr

Definition at line 23 of file TInputDeviceController.h.


The documentation for this class was generated from the following files: