@@ -110,6 +110,13 @@ class DefaultRemapper final : public GamepadRemapper {
110
110
111
111
virtual void RemapAxisMoveEvent (uint32_t aIndex, uint32_t aAxis,
112
112
double aValue) const override {
113
+ if (GetAxisCount () <= aAxis) {
114
+ NS_WARNING (
115
+ nsPrintfCString (" Axis idx '%d' doesn't support in DefaultRemapper()." ,
116
+ aAxis)
117
+ .get());
118
+ return ;
119
+ }
113
120
RefPtr<GamepadPlatformService> service =
114
121
GamepadPlatformService::GetParentService ();
115
122
if (!service) {
@@ -120,6 +127,13 @@ class DefaultRemapper final : public GamepadRemapper {
120
127
121
128
virtual void RemapButtonEvent (uint32_t aIndex, uint32_t aButton,
122
129
bool aPressed) const override {
130
+ if (GetButtonCount () <= aButton) {
131
+ NS_WARNING (
132
+ nsPrintfCString (
133
+ " Button idx '%d' doesn't support in DefaultRemapper()." , aButton)
134
+ .get());
135
+ return ;
136
+ }
123
137
RefPtr<GamepadPlatformService> service =
124
138
GamepadPlatformService::GetParentService ();
125
139
if (!service) {
@@ -190,7 +204,7 @@ class ADT1Remapper final : public GamepadRemapper {
190
204
return ;
191
205
}
192
206
193
- if (GetButtonCount () <= aIndex ) {
207
+ if (GetButtonCount () <= aButton ) {
194
208
NS_WARNING (
195
209
nsPrintfCString (" Button idx '%d' doesn't support in ADT1Remapper()." ,
196
210
aButton)
@@ -263,7 +277,7 @@ class TwoAxesEightKeysRemapper final : public GamepadRemapper {
263
277
return ;
264
278
}
265
279
266
- if (GetButtonCount () <= aIndex ) {
280
+ if (GetButtonCount () <= aButton ) {
267
281
NS_WARNING (
268
282
nsPrintfCString (
269
283
" Button idx '%d' doesn't support in TwoAxesEightKeysRemapper()." ,
@@ -339,7 +353,7 @@ class StadiaControllerRemapper final : public GamepadRemapper {
339
353
return ;
340
354
}
341
355
342
- if (STADIA_BUTTON_COUNT <= aIndex ) {
356
+ if (STADIA_BUTTON_COUNT <= aButton ) {
343
357
NS_WARNING (
344
358
nsPrintfCString (
345
359
" Button idx '%d' doesn't support in StadiaControllerRemapper()." ,
@@ -531,7 +545,7 @@ class Dualshock4Remapper final : public GamepadRemapper {
531
545
BUTTON_INDEX_META,
532
546
DUALSHOCK_BUTTON_TOUCHPAD};
533
547
534
- if (buttonMapping.size () <= aIndex ) {
548
+ if (buttonMapping.size () <= aButton ) {
535
549
NS_WARNING (nsPrintfCString(
536
550
" Button idx '%d' doesn't support in Dualshock4Remapper()." ,
537
551
aButton)
@@ -609,7 +623,7 @@ class LogitechDInputRemapper final : public GamepadRemapper {
609
623
return ;
610
624
}
611
625
612
- if (GetButtonCount () <= aIndex ) {
626
+ if (GetButtonCount () <= aButton ) {
613
627
NS_WARNING (
614
628
nsPrintfCString (
615
629
" Button idx '%d' doesn't support in LogitechDInputRemapper()." ,
@@ -642,6 +656,13 @@ class SwitchJoyConRemapper final : public GamepadRemapper {
642
656
643
657
virtual void RemapAxisMoveEvent (uint32_t aIndex, uint32_t aAxis,
644
658
double aValue) const override {
659
+ if (GetAxisCount () <= aAxis) {
660
+ NS_WARNING (
661
+ nsPrintfCString (
662
+ " Axis idx '%d' doesn't support in SwitchJoyConRemapper()." , aAxis)
663
+ .get());
664
+ return ;
665
+ }
645
666
RefPtr<GamepadPlatformService> service =
646
667
GamepadPlatformService::GetParentService ();
647
668
if (!service) {
@@ -675,6 +696,13 @@ class SwitchProRemapper final : public GamepadRemapper {
675
696
676
697
virtual void RemapAxisMoveEvent (uint32_t aIndex, uint32_t aAxis,
677
698
double aValue) const override {
699
+ if (GetAxisCount () <= aAxis) {
700
+ NS_WARNING (
701
+ nsPrintfCString (
702
+ " Axis idx '%d' doesn't support in SwitchProRemapper()." , aAxis)
703
+ .get());
704
+ return ;
705
+ }
678
706
RefPtr<GamepadPlatformService> service =
679
707
GamepadPlatformService::GetParentService ();
680
708
if (!service) {
@@ -759,7 +787,7 @@ class NvShieldRemapper final : public GamepadRemapper {
759
787
return ;
760
788
}
761
789
762
- if (GetButtonCount () <= aIndex ) {
790
+ if (GetButtonCount () <= aButton ) {
763
791
NS_WARNING (
764
792
nsPrintfCString (
765
793
" Button idx '%d' doesn't support in NvShieldRemapper()." , aButton)
@@ -852,7 +880,7 @@ class NvShield2017Remapper final : public GamepadRemapper {
852
880
return ;
853
881
}
854
882
855
- if (GetButtonCount () <= aIndex ) {
883
+ if (GetButtonCount () <= aButton ) {
856
884
NS_WARNING (
857
885
nsPrintfCString (
858
886
" Button idx '%d' doesn't support in NvShield2017Remapper()." ,
@@ -936,7 +964,7 @@ class IBuffaloRemapper final : public GamepadRemapper {
936
964
return ;
937
965
}
938
966
939
- if (GetButtonCount () <= aIndex ) {
967
+ if (GetButtonCount () <= aButton ) {
940
968
NS_WARNING (
941
969
nsPrintfCString (
942
970
" Button idx '%d' doesn't support in IBuffaloRemapper()." , aButton)
@@ -1107,7 +1135,7 @@ class BoomN64PsxRemapper final : public GamepadRemapper {
1107
1135
BUTTON_INDEX_DPAD_UP, BUTTON_INDEX_DPAD_RIGHT,
1108
1136
BUTTON_INDEX_DPAD_DOWN, BUTTON_INDEX_DPAD_LEFT};
1109
1137
1110
- if (buttonMapping.size () <= aIndex ) {
1138
+ if (buttonMapping.size () <= aButton ) {
1111
1139
NS_WARNING (nsPrintfCString(
1112
1140
" Button idx '%d' doesn't support in BoomN64PsxRemapper()." ,
1113
1141
aButton)
@@ -1184,7 +1212,7 @@ class AnalogGamepadRemapper final : public GamepadRemapper {
1184
1212
return ;
1185
1213
}
1186
1214
1187
- if (GetButtonCount () <= aIndex ) {
1215
+ if (GetButtonCount () <= aButton ) {
1188
1216
NS_WARNING (
1189
1217
nsPrintfCString (
1190
1218
" Button idx '%d' doesn't support in AnalogGamepadRemapper()." ,
@@ -1280,7 +1308,7 @@ class RazerServalRemapper final : public GamepadRemapper {
1280
1308
return ;
1281
1309
}
1282
1310
1283
- if (GetButtonCount () <= aIndex ) {
1311
+ if (GetButtonCount () <= aButton ) {
1284
1312
NS_WARNING (
1285
1313
nsPrintfCString (
1286
1314
" Button idx '%d' doesn't support in RazerServalRemapper()." ,
@@ -1362,7 +1390,7 @@ class MogaProRemapper final : public GamepadRemapper {
1362
1390
return ;
1363
1391
}
1364
1392
1365
- if (GetButtonCount () <= aIndex ) {
1393
+ if (GetButtonCount () <= aButton ) {
1366
1394
NS_WARNING (
1367
1395
nsPrintfCString (
1368
1396
" Button idx '%d' doesn't support in MogaProRemapper()." , aButton)
@@ -1443,7 +1471,7 @@ class OnLiveWirelessRemapper final : public GamepadRemapper {
1443
1471
return ;
1444
1472
}
1445
1473
1446
- if (GetButtonCount () <= aIndex ) {
1474
+ if (GetButtonCount () <= aButton ) {
1447
1475
NS_WARNING (
1448
1476
nsPrintfCString (
1449
1477
" Button idx '%d' doesn't support in OnLiveWirelessRemapper()." ,
@@ -1524,7 +1552,7 @@ class OUYARemapper final : public GamepadRemapper {
1524
1552
return ;
1525
1553
}
1526
1554
1527
- if (GetButtonCount () <= aIndex ) {
1555
+ if (GetButtonCount () <= aButton ) {
1528
1556
NS_WARNING (
1529
1557
nsPrintfCString (" Button idx '%d' doesn't support in OUYARemapper()." ,
1530
1558
aButton)
0 commit comments