-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQRetroInput.cpp
More file actions
634 lines (569 loc) · 16.4 KB
/
Copy pathQRetroInput.cpp
File metadata and controls
634 lines (569 loc) · 16.4 KB
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
#include <QRetroCommon.h>
#include <QRetroInput.h>
void QRetroInputJoypad::poll(void)
{
uint16_t bitmask = 0;
if (m_AnalogStickToDigitalPad)
{
m_Buttons[RETRO_DEVICE_ID_JOYPAD_UP] |= analogToDigital(RETRO_DEVICE_ID_JOYPAD_UP);
m_Buttons[RETRO_DEVICE_ID_JOYPAD_DOWN] |= analogToDigital(RETRO_DEVICE_ID_JOYPAD_DOWN);
m_Buttons[RETRO_DEVICE_ID_JOYPAD_LEFT] |= analogToDigital(RETRO_DEVICE_ID_JOYPAD_LEFT);
m_Buttons[RETRO_DEVICE_ID_JOYPAD_RIGHT] |= analogToDigital(RETRO_DEVICE_ID_JOYPAD_RIGHT);
}
/* Turbo: on each alternating poll, suppress any held buttons that have
* turbo enabled so they appear released to the core. */
m_TurboPhase = !m_TurboPhase;
if (m_Turbo && !m_TurboPhase)
{
for (int i = 0; i <= RETRO_DEVICE_ID_JOYPAD_R3; i++)
if (m_Turbo & (1 << i))
m_Buttons[i] = 0;
}
/* Force-held buttons: OR into m_Buttons after turbo so they bypass
* turbo suppression. */
if (m_ForcedButtons)
for (int i = 0; i <= RETRO_DEVICE_ID_JOYPAD_R3; i++)
m_Buttons[i] |= static_cast<int16_t>((m_ForcedButtons >> i) & 1);
/* Update the input bitmask, even if reporting not to support it. */
for (int i = 0; i <= RETRO_DEVICE_ID_JOYPAD_R3; i++)
bitmask |= m_Buttons[i] ? (1 << i) : 0;
m_Bitmask = static_cast<int16_t>(bitmask);
}
bool QRetroInputJoypad::analogToDigital(unsigned id) const
{
int16_t threshold = static_cast<int16_t>(m_AnalogDigitalThreshold * 32767);
switch (id)
{
case RETRO_DEVICE_ID_JOYPAD_UP:
return m_Sticks[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] < -threshold;
case RETRO_DEVICE_ID_JOYPAD_DOWN:
return m_Sticks[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] > threshold;
case RETRO_DEVICE_ID_JOYPAD_LEFT:
return m_Sticks[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] < -threshold;
case RETRO_DEVICE_ID_JOYPAD_RIGHT:
return m_Sticks[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] > threshold;
default:
return false;
}
}
int16_t QRetroInputJoypad::analogButton(unsigned id)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return 0;
else
return m_Buttons[id];
}
void QRetroInputJoypad::setAnalogButton(unsigned id, int16_t value)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return;
else
m_Buttons[id] = value;
}
bool QRetroInputJoypad::digitalButton(unsigned id)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return 0;
return m_Buttons[id] > m_AnalogButtonDeadzone;
}
void QRetroInputJoypad::setDigitalButton(unsigned id, bool value)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return;
else
m_Buttons[id] = value;
}
bool QRetroInputJoypad::forcedButton(unsigned id) const
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return false;
return m_ForcedButtons & (1u << id);
}
void QRetroInputJoypad::setForcedButton(unsigned id, bool value)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return;
if (value)
m_ForcedButtons |= static_cast<uint16_t>(1u << id);
else
m_ForcedButtons &= static_cast<uint16_t>(~(1u << id));
}
bool QRetroInputJoypad::turbo(unsigned id) const
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return false;
return m_Turbo & (1 << id);
}
void QRetroInputJoypad::setTurbo(unsigned id, bool value)
{
if (id > RETRO_DEVICE_ID_JOYPAD_R3)
return;
if (value)
m_Turbo |= static_cast<uint16_t>(1 << id);
else
m_Turbo &= static_cast<uint16_t>(~(1 << id));
}
int16_t QRetroInputJoypad::analogStick(unsigned index, unsigned id)
{
if (index > RETRO_DEVICE_INDEX_ANALOG_RIGHT || id > RETRO_DEVICE_ID_ANALOG_Y)
return 0;
else
return m_Sticks[index][id];
}
void QRetroInputJoypad::setAnalogStick(unsigned index, unsigned id, int16_t value)
{
if (index > RETRO_DEVICE_INDEX_ANALOG_RIGHT || id > RETRO_DEVICE_ID_ANALOG_Y)
return;
else
m_Sticks[index][id] = value;
}
void QRetroInputJoypad::setInputMethods(unsigned method)
{
m_InputMethods = method;
}
#define QRETRO_DEFAULT_MAP_JOYPAD(a, b) \
m_KeyboardMaps.push_back( \
{ { a, -1 }, { { 0, RETRO_DEVICE_JOYPAD, 0, b, true }, { -1, 0, 0, 0, 0 } } })
#define QRETRO_DEFAULT_MAP_ANALOG(a, b, c, d) \
m_KeyboardMaps.push_back( \
{ { a, -1 }, { { 0, RETRO_DEVICE_ANALOG, b, c, d }, { -1, 0, 0, 0, 0 } } })
QRetroInput::QRetroInput(QObject *parent)
{
setParent(parent);
for (unsigned i = 0; i < m_MaxUsers; i++)
m_Joypads[i].setPort(i);
/* Setup default P1 keyboard controls */
/* Digital buttons */
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_UP, RETRO_DEVICE_ID_JOYPAD_UP);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_DOWN, RETRO_DEVICE_ID_JOYPAD_DOWN);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_LEFT, RETRO_DEVICE_ID_JOYPAD_LEFT);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_RIGHT, RETRO_DEVICE_ID_JOYPAD_RIGHT);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_z, RETRO_DEVICE_ID_JOYPAD_B);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_x, RETRO_DEVICE_ID_JOYPAD_A);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_a, RETRO_DEVICE_ID_JOYPAD_Y);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_s, RETRO_DEVICE_ID_JOYPAD_X);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_SPACE, RETRO_DEVICE_ID_JOYPAD_SELECT);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_RETURN, RETRO_DEVICE_ID_JOYPAD_START);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_q, RETRO_DEVICE_ID_JOYPAD_L);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_w, RETRO_DEVICE_ID_JOYPAD_R);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_t, RETRO_DEVICE_ID_JOYPAD_L3);
QRETRO_DEFAULT_MAP_JOYPAD(RETROK_y, RETRO_DEVICE_ID_JOYPAD_R3);
/* Analog sticks */
QRETRO_DEFAULT_MAP_ANALOG(RETROK_UP, 0, RETRO_DEVICE_ID_ANALOG_Y, -32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_DOWN, 0, RETRO_DEVICE_ID_ANALOG_Y, 32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_LEFT, 0, RETRO_DEVICE_ID_ANALOG_X, -32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_RIGHT, 0, RETRO_DEVICE_ID_ANALOG_X, 32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_i, 1, RETRO_DEVICE_ID_ANALOG_Y, -32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_k, 1, RETRO_DEVICE_ID_ANALOG_Y, 32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_j, 1, RETRO_DEVICE_ID_ANALOG_X, -32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_l, 1, RETRO_DEVICE_ID_ANALOG_X, 32767);
/* Analog triggers; full and half press */
QRETRO_DEFAULT_MAP_ANALOG(RETROK_e, 2, RETRO_DEVICE_ID_JOYPAD_L2, 32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_r, 2, RETRO_DEVICE_ID_JOYPAD_R2, 32767);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_e, 2, RETRO_DEVICE_ID_JOYPAD_L2, 32767 / 2);
QRETRO_DEFAULT_MAP_ANALOG(RETROK_r, 2, RETRO_DEVICE_ID_JOYPAD_R2, 32767 / 2);
}
void QRetroInput::poll(void)
{
/* Update backend state first. */
if (m_Backend)
m_Backend->poll();
/* Check keyboard macros, which may also update m_Buttons. */
if (m_UseMaps)
for (const auto &map : m_KeyboardMaps)
{
auto button = &map.buttons[0];
auto key = &map.keys[0];
bool pressed = true;
for (unsigned i = 0; i < QRETRO_INPUT_MAPPING_MAX; i++)
{
if (*key <= RETROK_UNKNOWN)
break;
pressed &= m_Keys[*key];
key++;
}
for (unsigned i = 0; i < QRETRO_INPUT_MAPPING_MAX; i++)
{
if (button->port < 0)
break;
switch (button->device)
{
case RETRO_DEVICE_JOYPAD:
m_Joypads[button->port].setDigitalButton(
button->id, pressed ? button->value : !button->value);
break;
case RETRO_DEVICE_ANALOG:
if (button->index != RETRO_DEVICE_INDEX_ANALOG_BUTTON)
{
if (pressed)
m_Joypads[button->port].setAnalogStick(
button->index, button->id, static_cast<int16_t>(button->value));
else if (m_Joypads[button->port].analogStick(button->index, button->id) ==
button->value)
m_Joypads[button->port].setAnalogStick(button->index, button->id, 0);
}
else
m_Joypads[button->port].setAnalogButton(button->id, pressed ? button->value : 0);
break;
}
button++;
}
}
/* Snapshot all button state into the bitmask now that every input source
* (hardware backend + keyboard macros) has had a chance to update m_Buttons. */
for (unsigned i = 0; i < m_MaxUsers; i++)
m_Joypads[i].poll();
}
int16_t QRetroInput::state(unsigned port, unsigned device, unsigned index, unsigned id)
{
if (port < m_MaxUsers)
{
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
return m_SupportsBitmasks ? m_Joypads[port].bitmask() : 0;
else
return m_Joypads[port].digitalButton(id);
case RETRO_DEVICE_ANALOG:
if (index == RETRO_DEVICE_INDEX_ANALOG_BUTTON)
return m_Joypads[port].analogButton(id);
else
return m_Joypads[port].analogStick(index, id);
}
}
return 0;
}
bool QRetroInputJoypad::analogStickToDigitalPad(void)
{
return m_AnalogStickToDigitalPad;
}
void QRetroInputJoypad::setAnalogStickToDigitalPad(bool on)
{
m_AnalogStickToDigitalPad = on;
}
float QRetroInputJoypad::analogDigitalThreshold(void)
{
return m_AnalogDigitalThreshold;
}
void QRetroInputJoypad::setAnalogDigitalThreshold(float t)
{
m_AnalogDigitalThreshold = t;
}
int16_t QRetroInputJoypad::analogStickDeadzone(void)
{
return m_AnalogStickDeadzone;
}
void QRetroInputJoypad::setAnalogStickDeadzone(int16_t dz)
{
m_AnalogStickDeadzone = dz;
}
int16_t QRetroInputJoypad::bitmask(void)
{
return m_Bitmask;
}
bool QRetroInputJoypad::digitalPadToAnalogStick(void)
{
return m_DigitalPadToAnalogStick;
}
void QRetroInputJoypad::setDigitalPadToAnalogStick(bool on)
{
m_DigitalPadToAnalogStick = on;
}
uint16_t QRetroInputJoypad::rumbleStrong(void)
{
return m_RumbleStrong;
}
uint16_t QRetroInputJoypad::rumbleWeak(void)
{
return m_RumbleWeak;
}
void QRetroInputJoypad::setRumbleStrong(uint16_t v)
{
m_RumbleStrong = v;
}
void QRetroInputJoypad::setRumbleWeak(uint16_t v)
{
m_RumbleWeak = v;
}
bool QRetroInputJoypad::accelEnabled(void)
{
return m_AccelState == SensorEnabled;
}
unsigned QRetroInputJoypad::accelRate(void)
{
return m_AccelRate;
}
float QRetroInputJoypad::accelX(void)
{
return m_Accel[0];
}
float QRetroInputJoypad::accelY(void)
{
return m_Accel[1];
}
float QRetroInputJoypad::accelZ(void)
{
return m_Accel[2];
}
void QRetroInputJoypad::setAccelRate(unsigned v)
{
m_AccelRate = v;
}
void QRetroInputJoypad::setAccelState(QRetroInputJoypad::SensorState v)
{
m_AccelState = v;
}
void QRetroInputJoypad::setAccelX(float v)
{
m_Accel[0] = v;
}
void QRetroInputJoypad::setAccelY(float v)
{
m_Accel[1] = v;
}
void QRetroInputJoypad::setAccelZ(float v)
{
m_Accel[2] = v;
}
bool QRetroInputJoypad::gyroEnabled(void)
{
return m_GyroState == SensorEnabled;
}
unsigned QRetroInputJoypad::gyroRate(void)
{
return m_GyroRate;
}
float QRetroInputJoypad::gyroX(void)
{
return m_Gyro[0];
}
float QRetroInputJoypad::gyroY(void)
{
return m_Gyro[1];
}
float QRetroInputJoypad::gyroZ(void)
{
return m_Gyro[2];
}
void QRetroInputJoypad::setGyroRate(unsigned v)
{
m_GyroRate = v;
}
void QRetroInputJoypad::setGyroState(QRetroInputJoypad::SensorState v)
{
m_GyroState = v;
}
void QRetroInputJoypad::setGyroX(float v)
{
m_Gyro[0] = v;
}
void QRetroInputJoypad::setGyroY(float v)
{
m_Gyro[1] = v;
}
void QRetroInputJoypad::setGyroZ(float v)
{
m_Gyro[2] = v;
}
unsigned QRetroInputJoypad::inputMethods(void)
{
return m_InputMethods;
}
unsigned QRetroInputJoypad::port(void)
{
return m_Port;
}
void QRetroInputJoypad::setPort(unsigned port)
{
m_Port = port;
}
void QRetroInput::setBackend(QRetroInputBackend *backend)
{
m_Backend = backend;
}
QRetroInputBackend *QRetroInput::backend()
{
return m_Backend;
}
int16_t QRetroInput::analogButtonDeadzone(void)
{
return m_AnalogButtonDeadzone;
}
void QRetroInput::setAnalogButtonDeadzone(int16_t dz)
{
m_AnalogButtonDeadzone = dz;
}
bool QRetroInput::key(retro_key key)
{
return m_Keys[key];
}
void QRetroInput::setKey(retro_key key, bool down)
{
m_Keys[key] = down;
}
const std::vector<QRetroControllerPort> &QRetroInput::controllerPorts(void) const
{
return m_ControllerPorts;
}
void QRetroInput::setControllerPortDevice(void (*fn)(unsigned, unsigned))
{
m_SetControllerPortDevice = fn;
}
void QRetroInput::setControllerInfo(const retro_controller_info *info)
{
m_ControllerPorts.clear();
if (!info)
return;
for (const retro_controller_info *ci = info; ci->types; ci++)
{
QRetroControllerPort port;
for (unsigned i = 0; i < ci->num_types; i++)
port.types.push_back({ ci->types[i].desc ? ci->types[i].desc : "", ci->types[i].id });
if (!port.types.empty())
port.selectedId = port.types[0].id;
m_ControllerPorts.push_back(std::move(port));
}
if (m_SetControllerPortDevice)
for (unsigned p = 0; p < m_ControllerPorts.size(); p++)
m_SetControllerPortDevice(p, m_ControllerPorts[p].selectedId);
}
unsigned QRetroInput::selectedControllerType(unsigned port) const
{
return port < m_ControllerPorts.size() ? m_ControllerPorts[port].selectedId : RETRO_DEVICE_JOYPAD;
}
void QRetroInput::setSelectedControllerType(unsigned port, unsigned id)
{
if (port < m_ControllerPorts.size())
{
m_ControllerPorts[port].selectedId = id;
if (m_SetControllerPortDevice)
m_SetControllerPortDevice(port, id);
}
}
unsigned QRetroInput::maxUsers(void)
{
return m_MaxUsers;
}
void QRetroInput::setMaxUsers(unsigned max)
{
m_MaxUsers = max;
}
bool QRetroInput::supportsBitmasks(void)
{
return m_SupportsBitmasks;
}
void QRetroInput::setSupportsBitmasks(bool supports)
{
m_SupportsBitmasks = supports;
}
bool QRetroInput::useMaps(void)
{
return m_UseMaps;
}
void QRetroInput::setUseMaps(bool use)
{
m_UseMaps = use;
}
bool QRetroInput::setRumble(unsigned port, retro_rumble_effect effect, uint16_t strength)
{
if (port < m_MaxUsers)
{
switch (effect)
{
case RETRO_RUMBLE_STRONG:
m_Joypads[port].setRumbleStrong(strength);
break;
case RETRO_RUMBLE_WEAK:
m_Joypads[port].setRumbleWeak(strength);
break;
/* No default to encourage a warning if more rumble types are added */
case RETRO_RUMBLE_DUMMY:
return false;
}
}
return m_Backend ? m_Backend->setRumble(port, effect, strength) : false;
}
bool QRetroInput::setSensorState(unsigned port, retro_sensor_action action, unsigned rate)
{
if (port < m_MaxUsers)
{
switch (action)
{
case RETRO_SENSOR_ACCELEROMETER_ENABLE:
m_Joypads[port].setAccelState(QRetroInputJoypad::SensorEnabled);
m_Joypads[port].setAccelRate(rate);
break;
case RETRO_SENSOR_ACCELEROMETER_DISABLE:
m_Joypads[port].setAccelState(QRetroInputJoypad::SensorDisabled);
break;
case RETRO_SENSOR_GYROSCOPE_ENABLE:
m_Joypads[port].setGyroState(QRetroInputJoypad::SensorEnabled);
m_Joypads[port].setGyroRate(rate);
break;
case RETRO_SENSOR_GYROSCOPE_DISABLE:
m_Joypads[port].setGyroState(QRetroInputJoypad::SensorDisabled);
break;
/* No default to encourage a warning if more sensor actions are added */
case RETRO_SENSOR_ILLUMINANCE_ENABLE:
case RETRO_SENSOR_ILLUMINANCE_DISABLE:
case RETRO_SENSOR_DUMMY:
return false;
}
}
return m_Backend ? m_Backend->setSensorState(port, action, rate) : false;
}
float QRetroInput::getSensorInput(unsigned port, unsigned id)
{
if (port >= m_MaxUsers)
return 0.0f;
QRetroInputJoypad &jp = m_Joypads[port];
switch (id)
{
case RETRO_SENSOR_ACCELEROMETER_X:
return jp.accelX();
case RETRO_SENSOR_ACCELEROMETER_Y:
return jp.accelY();
case RETRO_SENSOR_ACCELEROMETER_Z:
return jp.accelZ();
case RETRO_SENSOR_GYROSCOPE_X:
return jp.gyroX();
case RETRO_SENSOR_GYROSCOPE_Y:
return jp.gyroY();
case RETRO_SENSOR_GYROSCOPE_Z:
return jp.gyroZ();
default:
return 0.0f;
}
}
bool QRetroInput::backendHandlesSensor(unsigned port, unsigned id) const
{
if (port >= m_MaxUsers || !m_Backend)
return false;
return m_Backend->sensorActive(port, id);
}
const std::vector<QRetroInputDescriptor> &QRetroInput::inputDescriptors(void) const
{
return m_InputDescriptors;
}
void QRetroInput::setInputDescriptors(const retro_input_descriptor *desc)
{
m_InputDescriptors.clear();
if (!desc)
return;
for (; desc->description; desc++)
m_InputDescriptors.push_back(
{ desc->port, desc->device, desc->index, desc->id, desc->description });
}
uint64_t QRetroInput::deviceCapabilities(void) const
{
return m_DeviceCapabilities;
}
void QRetroInput::setDeviceCapabilities(uint64_t caps)
{
m_DeviceCapabilities = caps;
}
QRetroInputJoypad *QRetroInput::joypads()
{
return m_Joypads;
}