/
Skylander.cpp
1339 lines (1229 loc) · 60.9 KB
/
Skylander.cpp
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2022 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Core/IOS/USB/Emulated/Skylander.h"
#include <map>
#include <mutex>
#include <vector>
#include "AudioCommon/AudioCommon.h"
#include "Common/Logging/Log.h"
#include "Common/Random.h"
#include "Common/StringUtil.h"
#include "Common/Timer.h"
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
#include "Core/System.h"
namespace IOS::HLE::USB
{
const std::map<const std::pair<const u16, const u16>, SkyData> list_skylanders = {
{{0, 0x0000}, {"Whirlwind", Game::SpyrosAdv, Element::Air}},
{{0, 0x1801}, {"Series 2 Whirlwind", Game::Giants, Element::Air}},
{{0, 0x1C02}, {"Polar Whirlwind", Game::Giants, Element::Air}},
{{0, 0x2805}, {"Horn Blast Whirlwind", Game::SwapForce, Element::Air}},
{{0, 0x3810}, {"Eon's Elite Whirlwind", Game::TrapTeam, Element::Air}},
{{1, 0x0000}, {"Sonic Boom", Game::SpyrosAdv, Element::Air}},
{{1, 0x1801}, {"Series 2 Sonic Boom", Game::Giants, Element::Air}},
{{2, 0x0000}, {"Warnado", Game::SpyrosAdv, Element::Air}},
{{2, 0x2206}, {"LightCore Warnado", Game::SwapForce, Element::Air}},
{{3, 0x0000}, {"Lightning Rod", Game::SpyrosAdv, Element::Air}},
{{3, 0x1801}, {"Series 2 Lightning Rod", Game::Giants, Element::Air}},
{{4, 0x0000}, {"Bash", Game::SpyrosAdv, Element::Earth}},
{{4, 0x1801}, {"Series 2 Bash", Game::Giants, Element::Earth}},
{{5, 0x0000}, {"Terrafin", Game::SpyrosAdv, Element::Earth}},
{{5, 0x1801}, {"Series 2 Terrafin", Game::Giants, Element::Earth}},
{{5, 0x2805}, {"Knockout Terrafin", Game::SwapForce, Element::Earth}},
{{5, 0x3810}, {"Eon's Elite Terrafin", Game::TrapTeam, Element::Earth}},
{{6, 0x0000}, {"Dino Rang", Game::SpyrosAdv, Element::Earth}},
{{6, 0x4810}, {"Eon's Elite Dino Rang", Game::Superchargers, Element::Earth}},
{{7, 0x0000}, {"Prism Break", Game::SpyrosAdv, Element::Earth}},
{{7, 0x1206}, {"LightCore Prism Break", Game::Giants, Element::Earth}},
{{7, 0x1801}, {"Series 2 Prism Break", Game::Giants, Element::Earth}},
{{7, 0x2805}, {"Hyper Beam Prism Break", Game::SwapForce, Element::Earth}},
{{8, 0x0000}, {"Sunburn", Game::SpyrosAdv, Element::Fire}},
{{9, 0x0000}, {"Eruptor", Game::SpyrosAdv, Element::Fire}},
{{9, 0x1206}, {"LightCore Eruptor", Game::Giants, Element::Fire}},
{{9, 0x1801}, {"Series 2 Eruptor", Game::Giants, Element::Fire}},
{{9, 0x2C02}, {"Volcanic Eruptor", Game::SwapForce, Element::Fire}},
{{9, 0x2805}, {"Lava Barf Eruptor", Game::SwapForce, Element::Fire}},
{{9, 0x3810}, {"Eon's Elite Eruptor", Game::TrapTeam, Element::Fire}},
{{10, 0x0000}, {"Ignitor", Game::SpyrosAdv, Element::Fire}},
{{10, 0x1801}, {"Series 2 Ignitor", Game::Giants, Element::Fire}},
{{10, 0x1C03}, {"Legendary Ignitor", Game::Giants, Element::Fire}},
{{11, 0x0000}, {"Flameslinger", Game::SpyrosAdv, Element::Fire}},
{{11, 0x1801}, {"Series 2 Flameslinger", Game::Giants, Element::Fire}},
{{12, 0x0000}, {"Zap", Game::SpyrosAdv, Element::Water}},
{{12, 0x1801}, {"Series 2 Zap", Game::Giants, Element::Water}},
{{13, 0x0000}, {"Wham Shell", Game::SpyrosAdv, Element::Water}},
{{13, 0x2206}, {"LightCore Wham Shell", Game::SwapForce, Element::Water}},
{{14, 0x0000}, {"Gill Grunt", Game::SpyrosAdv, Element::Water}},
{{14, 0x1801}, {"Series 2 Gill Grunt", Game::Giants, Element::Water}},
{{14, 0x2805}, {"Anchors Away Gill Grunt", Game::SwapForce, Element::Water}},
{{14, 0x3805}, {"Tidal Wave Gill Grunt", Game::TrapTeam, Element::Water}},
{{14, 0x3810}, {"Eon's Elite Gill Grunt", Game::TrapTeam, Element::Water}},
{{15, 0x0000}, {"Slam Bam", Game::SpyrosAdv, Element::Water}},
{{15, 0x1801}, {"Series 2 Slam Bam", Game::Giants, Element::Water}},
{{15, 0x1C03}, {"Legendary Slam Bam", Game::Giants, Element::Water}},
{{15, 0x4810}, {"Eon's Elite Slam Bam", Game::Superchargers, Element::Water}},
{{16, 0x0000}, {"Spyro", Game::SpyrosAdv, Element::Magic}},
{{16, 0x1801}, {"Series 2 Spyro", Game::Giants, Element::Magic}},
{{16, 0x2805}, {"Mega Ram Spyro", Game::SwapForce, Element::Magic}},
{{16, 0x2C02}, {"Dark Mega Ram Spyro", Game::SwapForce, Element::Magic}},
{{16, 0x3810}, {"Eon's Elite Spyro", Game::TrapTeam, Element::Magic}},
{{17, 0x0000}, {"Voodood", Game::SpyrosAdv, Element::Magic}},
{{17, 0x4810}, {"Eon's Elite Voodood", Game::Superchargers, Element::Magic}},
{{18, 0x0000}, {"Double Trouble", Game::SpyrosAdv, Element::Magic}},
{{18, 0x1801}, {"Series 2 Double Trouble", Game::Giants, Element::Magic}},
{{18, 0x1C02}, {"Royal Double Trouble", Game::Giants, Element::Magic}},
{{19, 0x0000}, {"Trigger Happy", Game::SpyrosAdv, Element::Tech}},
{{19, 0x1801}, {"Series 2 Trigger Happy", Game::Giants, Element::Tech}},
{{19, 0x2805}, {"Big Bang Trigger Happy", Game::SwapForce, Element::Tech}},
{{19, 0x2C02}, {"Springtime Trigger Happy", Game::SwapForce, Element::Tech}},
{{19, 0x3810}, {"Eon's Elite Trigger Happy", Game::TrapTeam, Element::Tech}},
{{20, 0x0000}, {"Drobot", Game::SpyrosAdv, Element::Tech}},
{{20, 0x1206}, {"LightCore Drobot", Game::Giants, Element::Tech}},
{{20, 0x1801}, {"Series 2 Drobot", Game::Giants, Element::Tech}},
{{21, 0x0000}, {"Drill Seargeant", Game::SpyrosAdv, Element::Tech}},
{{21, 0x1801}, {"Series 2 Drill Seargeant", Game::Giants, Element::Tech}},
{{22, 0x0000}, {"Boomer", Game::SpyrosAdv, Element::Tech}},
{{22, 0x4810}, {"Eon's Elite Boomer", Game::Superchargers, Element::Tech}},
{{23, 0x0000}, {"Wrecking Ball", Game::SpyrosAdv, Element::Magic}},
{{23, 0x1801}, {"Series 2 Wrecking Ball", Game::Giants, Element::Magic}},
{{24, 0x0000}, {"Camo", Game::SpyrosAdv, Element::Life}},
{{24, 0x2805}, {"Thorn Horn Camo", Game::SwapForce, Element::Life}},
{{25, 0x0000}, {"Zook", Game::SpyrosAdv, Element::Life}},
{{25, 0x1801}, {"Series 2 Zook", Game::Giants, Element::Life}},
{{25, 0x4810}, {"Eon's Elite Zook", Game::Superchargers, Element::Life}},
{{26, 0x0000}, {"Stealth Elf", Game::SpyrosAdv, Element::Life}},
{{26, 0x1801}, {"Series 2 Stealth Elf", Game::Giants, Element::Life}},
{{26, 0x1C03}, {"Legendary Stealth Elf", Game::Giants, Element::Life}},
{{26, 0x2C02}, {"Dark Stealth Elf", Game::SwapForce, Element::Life}},
{{26, 0x2805}, {"Ninja Stealth Elf", Game::SwapForce, Element::Life}},
{{26, 0x3810}, {"Eon's Elite Stealth Elf", Game::TrapTeam, Element::Life}},
{{27, 0x0000}, {"Stump Smash", Game::SpyrosAdv, Element::Life}},
{{27, 0x1801}, {"Series 2 Stump Smash", Game::Giants, Element::Life}},
{{28, 0x0000}, {"Dark Spyro", Game::SpyrosAdv, Element::Magic}},
{{29, 0x0000}, {"Hex", Game::SpyrosAdv, Element::Undead}},
{{29, 0x1206}, {"LightCore Hex", Game::Giants, Element::Undead}},
{{29, 0x1801}, {"Series 2 Hex", Game::Giants, Element::Undead}},
{{30, 0x0000}, {"Chop Chop", Game::SpyrosAdv, Element::Undead}},
{{30, 0x1801}, {"Series 2 Chop Chop", Game::Giants, Element::Undead}},
{{30, 0x2805}, {"Twin Blade Chop Chop", Game::SwapForce, Element::Undead}},
{{30, 0x3810}, {"Eon's Elite Chop Chop", Game::TrapTeam, Element::Undead}},
{{31, 0x0000}, {"Ghost Roaster", Game::SpyrosAdv, Element::Undead}},
{{31, 0x4810}, {"Eon's Elite Ghost Roaster", Game::Superchargers, Element::Undead}},
{{32, 0x0000}, {"Cynder", Game::SpyrosAdv, Element::Undead}},
{{32, 0x1801}, {"Series 2 Cynder", Game::Giants, Element::Undead}},
{{32, 0x2805}, {"Phantom Cynder", Game::SwapForce, Element::Undead}},
{{100, 0x0000}, {"Jet Vac", Game::Giants, Element::Air}},
{{100, 0x1206}, {"LightCore Jet Vac", Game::Giants, Element::Air}},
{{100, 0x1403}, {"Legendary Jet Vac", Game::Giants, Element::Air}},
{{100, 0x2805}, {"Turbo Jet Vac", Game::SwapForce, Element::Air}},
{{100, 0x3805}, {"Full Blast Jet Vac", Game::TrapTeam, Element::Air}},
{{101, 0x0000}, {"Swarm", Game::Giants, Element::Air}},
{{102, 0x0000}, {"Crusher", Game::Giants, Element::Earth}},
{{102, 0x1602}, {"Granite Crusher", Game::Giants, Element::Earth}},
{{103, 0x0000}, {"Flashwing", Game::Giants, Element::Earth}},
{{103, 0x1402}, {"Jade Flash Wing", Game::Giants, Element::Earth}},
{{103, 0x2206}, {"LightCore Flashwing", Game::SwapForce, Element::Earth}},
{{104, 0x0000}, {"Hot Head", Game::Giants, Element::Fire}},
{{105, 0x0000}, {"Hot Dog", Game::Giants, Element::Fire}},
{{105, 0x1402}, {"Molten Hot Dog", Game::Giants, Element::Fire}},
{{105, 0x2805}, {"Fire Bone Hot Dog", Game::SwapForce, Element::Fire}},
{{106, 0x0000}, {"Chill", Game::Giants, Element::Water}},
{{106, 0x1206}, {"LightCore Chill", Game::Giants, Element::Water}},
{{106, 0x1603}, {"Legendary LightCore Chill", Game::Giants, Element::Water}},
{{106, 0x2805}, {"Blizzard Chill", Game::SwapForce, Element::Water}},
{{107, 0x0000}, {"Thumpback", Game::Giants, Element::Water}},
{{108, 0x0000}, {"Pop Fizz", Game::Giants, Element::Magic}},
{{108, 0x1206}, {"LightCore Pop Fizz", Game::Giants, Element::Magic}},
{{108, 0x1402}, {"Punch Pop Fizz", Game::Giants, Element::Magic}},
{{108, 0x2805}, {"Super Gulp Pop Fizz", Game::SwapForce, Element::Magic}},
{{108, 0x3805}, {"Fizzy Frenzy Pop Fizz", Game::TrapTeam, Element::Magic}},
{{108, 0x3C02}, {"Love Potion Pop Fizz", Game::TrapTeam, Element::Magic}},
{{109, 0x0000}, {"Ninjini", Game::Giants, Element::Magic}},
{{109, 0x1602}, {"Scarlet Ninjini", Game::Giants, Element::Magic}},
{{110, 0x0000}, {"Bouncer", Game::Giants, Element::Tech}},
{{110, 0x1603}, {"Legendary Bouncer", Game::Giants, Element::Tech}},
{{111, 0x0000}, {"Sprocket", Game::Giants, Element::Tech}},
{{111, 0x2805}, {"Heavy Duty Sprocket", Game::SwapForce, Element::Tech}},
{{112, 0x0000}, {"Tree Rex", Game::Giants, Element::Life}},
{{112, 0x1602}, {"Gnarly Tree Rex", Game::Giants, Element::Life}},
{{113, 0x0000}, {"Shroomboom", Game::Giants, Element::Life}},
{{113, 0x1206}, {"LightCore Shroomboom", Game::Giants, Element::Life}},
{{113, 0x3805}, {"Sure Shot Shroomboom", Game::TrapTeam, Element::Life}},
{{114, 0x0000}, {"Eye Brawl", Game::Giants, Element::Undead}},
{{115, 0x0000}, {"Fright Rider", Game::Giants, Element::Undead}},
{{200, 0x0000}, {"Anvil Rain", Game::SpyrosAdv}},
{{201, 0x0000}, {"Hidden Treasure", Game::SpyrosAdv}},
{{201, 0x2000}, {"Platinum Hidden Treasure", Game::Giants}},
{{202, 0x0000}, {"Healing Elixir", Game::SpyrosAdv}},
{{203, 0x0000}, {"Ghost Pirate Swords", Game::SpyrosAdv}},
{{204, 0x0000}, {"Time Twist Hourglass", Game::SpyrosAdv}},
{{205, 0x0000}, {"Sky Iron Shield", Game::SpyrosAdv}},
{{206, 0x0000}, {"Winged Boots", Game::SpyrosAdv}},
{{207, 0x0000}, {"Sparx the Dragonfly", Game::SpyrosAdv}},
{{208, 0x0000}, {"Dragonfire Cannon", Game::Giants}},
{{208, 0x1602}, {"Golden Dragonfire Cannon", Game::Giants}},
{{209, 0x0000}, {"Scorpion Striker Catapult", Game::Giants}},
{{210, 0x3002}, {"Biter's Bane", Game::TrapTeam, Element::Magic}},
{{210, 0x3008}, {"Sorcerous Skull", Game::TrapTeam, Element::Magic}},
{{210, 0x300B}, {"Axe of Illusion", Game::TrapTeam, Element::Magic}},
{{210, 0x300E}, {"Arcane Hourglass", Game::TrapTeam, Element::Magic}},
{{210, 0x3012}, {"Spell Slapper", Game::TrapTeam, Element::Magic}},
{{210, 0x3014}, {"Rune Rocket", Game::TrapTeam, Element::Magic}},
{{211, 0x3001}, {"Tidal Tiki", Game::TrapTeam, Element::Water}},
{{211, 0x3002}, {"Wet Walter", Game::TrapTeam, Element::Water}},
{{211, 0x3006}, {"Flood Flask", Game::TrapTeam, Element::Water}},
{{211, 0x3406}, {"Legendary Flood Flask", Game::TrapTeam, Element::Water}},
{{211, 0x3007}, {"Soaking Staff", Game::TrapTeam, Element::Water}},
{{211, 0x300B}, {"Aqua Axe", Game::TrapTeam, Element::Water}},
{{211, 0x3016}, {"Frost Helm", Game::TrapTeam, Element::Water}},
{{212, 0x3003}, {"Breezy Bird", Game::TrapTeam, Element::Air}},
{{212, 0x3006}, {"Drafty Decanter", Game::TrapTeam, Element::Air}},
{{212, 0x300D}, {"Tempest Timer", Game::TrapTeam, Element::Air}},
{{212, 0x3010}, {"Cloudy Cobra", Game::TrapTeam, Element::Air}},
{{212, 0x3011}, {"Storm Warning", Game::TrapTeam, Element::Air}},
{{212, 0x3018}, {"Cyclone Saber", Game::TrapTeam, Element::Air}},
{{213, 0x3004}, {"Spirit Sphere", Game::TrapTeam, Element::Undead}},
{{213, 0x3404}, {"Legendary Spirit Sphere", Game::TrapTeam, Element::Undead}},
{{213, 0x3008}, {"Spectral Skull", Game::TrapTeam, Element::Undead}},
{{213, 0x3408}, {"Legendary Spectral Skull", Game::TrapTeam, Element::Undead}},
{{213, 0x300B}, {"Haunted Hatchet", Game::TrapTeam, Element::Undead}},
{{213, 0x300C}, {"Grim Gripper", Game::TrapTeam, Element::Undead}},
{{213, 0x3010}, {"Spooky Snake", Game::TrapTeam, Element::Undead}},
{{213, 0x3017}, {"Dream Piercer", Game::TrapTeam, Element::Undead}},
{{214, 0x3000}, {"Tech Totem", Game::TrapTeam, Element::Tech}},
{{214, 0x3007}, {"Automatic Angel", Game::TrapTeam, Element::Tech}},
{{214, 0x3009}, {"Factory Flower", Game::TrapTeam, Element::Tech}},
{{214, 0x300C}, {"Grabbing Gadget", Game::TrapTeam, Element::Tech}},
{{214, 0x3016}, {"Makers Mana", Game::TrapTeam, Element::Tech}},
{{214, 0x301A}, {"Topsy Techy", Game::TrapTeam, Element::Tech}},
{{215, 0x3005}, {"Eternal Flame", Game::TrapTeam, Element::Fire}},
{{215, 0x3009}, {"Fire Flower", Game::TrapTeam, Element::Fire}},
{{215, 0x3011}, {"Scorching Stopper", Game::TrapTeam, Element::Fire}},
{{215, 0x3012}, {"Searing Spinner", Game::TrapTeam, Element::Fire}},
{{215, 0x3017}, {"Spark Spear", Game::TrapTeam, Element::Fire}},
{{215, 0x301B}, {"Blazing Belch", Game::TrapTeam, Element::Fire}},
{{216, 0x3000}, {"Banded Boulder", Game::TrapTeam, Element::Earth}},
{{216, 0x3003}, {"Rock Hawk", Game::TrapTeam, Element::Earth}},
{{216, 0x300A}, {"Slag Hammer", Game::TrapTeam, Element::Earth}},
{{216, 0x300E}, {"Dust Of Time", Game::TrapTeam, Element::Earth}},
{{216, 0x3013}, {"Spinning Sandstorm", Game::TrapTeam, Element::Earth}},
{{216, 0x301A}, {"Rubble Trouble", Game::TrapTeam, Element::Earth}},
{{217, 0x3003}, {"Oak Eagle", Game::TrapTeam, Element::Life}},
{{217, 0x3005}, {"Emerald Energy", Game::TrapTeam, Element::Life}},
{{217, 0x300A}, {"Weed Whacker", Game::TrapTeam, Element::Life}},
{{217, 0x3010}, {"Seed Serpent", Game::TrapTeam, Element::Life}},
{{217, 0x3018}, {"Jade Blade", Game::TrapTeam, Element::Life}},
{{217, 0x301B}, {"Shrub Shrieker", Game::TrapTeam, Element::Life}},
{{218, 0x3000}, {"Dark Dagger", Game::TrapTeam}},
{{218, 0x3014}, {"Shadow Spider", Game::TrapTeam}},
{{218, 0x301A}, {"Ghastly Grimace", Game::TrapTeam}},
{{219, 0x3000}, {"Shining Ship", Game::TrapTeam}},
{{219, 0x300F}, {"Heavenly Hawk", Game::TrapTeam}},
{{219, 0x301B}, {"Beam Scream", Game::TrapTeam}},
{{220, 0x301E}, {"Kaos Trap", Game::TrapTeam}},
{{220, 0x351F}, {"Ultimate Kaos Trap", Game::TrapTeam}},
{{230, 0x0000}, {"Hand of Fate", Game::TrapTeam}},
{{230, 0x3403}, {"Legendary Hand of Fate", Game::TrapTeam}},
{{231, 0x0000}, {"Piggy Bank", Game::TrapTeam}},
{{232, 0x0000}, {"Rocket Ram", Game::TrapTeam}},
{{233, 0x0000}, {"Tiki Speaky", Game::TrapTeam}},
{{300, 0x0000}, {"Dragon's Peak", Game::SpyrosAdv}},
{{301, 0x0000}, {"Empire of Ice", Game::SpyrosAdv}},
{{302, 0x0000}, {"Pirate Seas", Game::SpyrosAdv}},
{{303, 0x0000}, {"Darklight Crypt", Game::SpyrosAdv}},
{{304, 0x0000}, {"Volcanic Vault", Game::SpyrosAdv}},
{{305, 0x0000}, {"Mirror of Mystery", Game::TrapTeam}},
{{306, 0x0000}, {"Nightmare Express", Game::TrapTeam}},
{{307, 0x0000}, {"Sunscraper Spire", Game::TrapTeam}},
{{308, 0x0000}, {"Midnight Museum", Game::TrapTeam}},
{{404, 0x0000}, {"Legendary Bash", Game::SpyrosAdv, Element::Earth}},
{{416, 0x0000}, {"Legendary Spyro", Game::SpyrosAdv, Element::Magic}},
{{419, 0x0000}, {"Legendary Trigger Happy", Game::SpyrosAdv, Element::Tech}},
{{430, 0x0000}, {"Legendary Chop Chop", Game::SpyrosAdv, Element::Undead}},
{{450, 0x0000}, {"Gusto", Game::TrapTeam, Element::Air}},
{{451, 0x0000}, {"Thunderbolt", Game::TrapTeam, Element::Air}},
{{452, 0x0000}, {"Fling Kong", Game::TrapTeam, Element::Air}},
{{453, 0x0000}, {"Blades", Game::TrapTeam, Element::Air}},
{{453, 0x3403}, {"Legendary Blades", Game::TrapTeam, Element::Air}},
{{454, 0x0000}, {"Wallop", Game::TrapTeam, Element::Earth}},
{{455, 0x0000}, {"Head Rush", Game::TrapTeam, Element::Earth}},
{{455, 0x3402}, {"Nitro Head Rush", Game::TrapTeam, Element::Earth}},
{{456, 0x0000}, {"Fist Bump", Game::TrapTeam, Element::Earth}},
{{457, 0x0000}, {"Rocky Roll", Game::TrapTeam, Element::Earth}},
{{458, 0x0000}, {"Wildfire", Game::TrapTeam, Element::Fire}},
{{458, 0x3402}, {"Dark Wildfire", Game::TrapTeam, Element::Fire}},
{{459, 0x0000}, {"Ka Boom", Game::TrapTeam, Element::Fire}},
{{460, 0x0000}, {"Trail Blazer", Game::TrapTeam, Element::Fire}},
{{461, 0x0000}, {"Torch", Game::TrapTeam, Element::Fire}},
{{462, 0x0000}, {"Snap Shot", Game::TrapTeam, Element::Water}},
{{462, 0x3402}, {"Dark Snap Shot", Game::TrapTeam, Element::Water}},
{{463, 0x0000}, {"Lob Star", Game::TrapTeam, Element::Water}},
{{463, 0x3402}, {"Winterfest Lob-Star", Game::TrapTeam, Element::Water}},
{{464, 0x0000}, {"Flip Wreck", Game::TrapTeam, Element::Water}},
{{465, 0x0000}, {"Echo", Game::TrapTeam, Element::Water}},
{{466, 0x0000}, {"Blastermind", Game::TrapTeam, Element::Magic}},
{{467, 0x0000}, {"Enigma", Game::TrapTeam, Element::Magic}},
{{468, 0x0000}, {"Deja Vu", Game::TrapTeam, Element::Magic}},
{{468, 0x3403}, {"Legendary Deja Vu", Game::TrapTeam, Element::Magic}},
{{469, 0x0000}, {"Cobra Cadabra", Game::TrapTeam, Element::Magic}},
{{469, 0x3402}, {"King Cobra Cadabra", Game::TrapTeam, Element::Magic}},
{{470, 0x0000}, {"Jawbreaker", Game::TrapTeam, Element::Tech}},
{{470, 0x3403}, {"Legendary Jawbreaker", Game::TrapTeam, Element::Tech}},
{{471, 0x0000}, {"Gearshift", Game::TrapTeam, Element::Tech}},
{{472, 0x0000}, {"Chopper", Game::TrapTeam, Element::Tech}},
{{473, 0x0000}, {"Tread Head", Game::TrapTeam, Element::Tech}},
{{474, 0x0000}, {"Bushwack", Game::TrapTeam, Element::Life}},
{{474, 0x3403}, {"Legendary Bushwack", Game::TrapTeam, Element::Life}},
{{475, 0x0000}, {"Tuff Luck", Game::TrapTeam, Element::Life}},
{{476, 0x0000}, {"Food Fight", Game::TrapTeam, Element::Life}},
{{476, 0x3402}, {"Dark Food Fight", Game::TrapTeam, Element::Life}},
{{477, 0x0000}, {"High Five", Game::TrapTeam, Element::Life}},
{{478, 0x0000}, {"Krypt King", Game::TrapTeam, Element::Undead}},
{{478, 0x3402}, {"Nitro Krypt King", Game::TrapTeam, Element::Undead}},
{{479, 0x0000}, {"Short Cut", Game::TrapTeam, Element::Undead}},
{{480, 0x0000}, {"Bat Spin", Game::TrapTeam, Element::Undead}},
{{481, 0x0000}, {"Funny Bone", Game::TrapTeam, Element::Undead}},
{{482, 0x0000}, {"Knight Light", Game::TrapTeam}},
{{483, 0x0000}, {"Spotlight", Game::TrapTeam}},
{{484, 0x0000}, {"Knight Mare", Game::TrapTeam}},
{{485, 0x0000}, {"Blackout", Game::TrapTeam}},
{{502, 0x0000}, {"Bop (Mini)", Game::TrapTeam, Element::Earth}},
{{503, 0x0000}, {"Spry (Mini)", Game::TrapTeam, Element::Magic}},
{{504, 0x0000}, {"Hijinx (Mini)", Game::TrapTeam, Element::Undead}},
{{505, 0x0000}, {"Terrabite (Sidekick)", Game::SpyrosAdv, Element::Earth}},
{{505, 0x3000}, {"Terrabite (Mini)", Game::TrapTeam, Element::Earth}},
{{506, 0x0000}, {"Breeze (Mini)", Game::TrapTeam, Element::Air}},
{{507, 0x0000}, {"Weeruptor (Mini)", Game::TrapTeam, Element::Fire}},
{{507, 0x3402}, {"Eggcellent Weeruptor (Mini)", Game::TrapTeam, Element::Fire}},
{{508, 0x0000}, {"Pet Vac (Mini)", Game::TrapTeam, Element::Air}},
{{508, 0x3402}, {"Power Punch Pet Vac (Mini)", Game::TrapTeam, Element::Air}},
{{509, 0x0000}, {"Small Fry (Mini)", Game::TrapTeam, Element::Fire}},
{{510, 0x0000}, {"Drobit (Mini)", Game::TrapTeam, Element::Tech}},
{{514, 0x0000}, {"Gill Runt (Sidekick)", Game::SpyrosAdv, Element::Water}},
{{514, 0x3000}, {"Gill Runt (Mini)", Game::TrapTeam, Element::Water}},
{{519, 0x0000}, {"Trigger Snappy (Sidekick)", Game::SpyrosAdv, Element::Tech}},
{{519, 0x3000}, {"Trigger Snappy (Mini)", Game::TrapTeam, Element::Tech}},
{{526, 0x0000}, {"Whisper Elf (Sidekick)", Game::SpyrosAdv, Element::Life}},
{{526, 0x3000}, {"Whisper Elf (Mini)", Game::TrapTeam, Element::Life}},
{{540, 0x0000}, {"Barkley (Sidekick)", Game::Giants, Element::Life}},
{{540, 0x3000}, {"Barkley (Mini)", Game::TrapTeam, Element::Life}},
{{540, 0x3402}, {"Gnarly Barkley (Mini)", Game::TrapTeam, Element::Life}},
{{541, 0x0000}, {"Thumpling (Sidekick)", Game::Giants, Element::Water}},
{{541, 0x3000}, {"Thumpling (Mini)", Game::TrapTeam, Element::Water}},
{{542, 0x0000}, {"Mini-Jini (Sidekick)", Game::Giants, Element::Magic}},
{{542, 0x3000}, {"Mini-Jini (Mini)", Game::TrapTeam, Element::Magic}},
{{543, 0x0000}, {"Eye Small (Sidekick)", Game::Giants, Element::Undead}},
{{543, 0x3000}, {"Eye Small (Mini)", Game::TrapTeam, Element::Undead}},
{{1000, 0x0000}, {"Boom Jet (Bottom)", Game::SwapForce, Element::Air}},
{{1001, 0x0000}, {"Free Ranger (Bottom)", Game::SwapForce, Element::Air}},
{{1001, 0x2403}, {"Legendary Free Ranger (Bottom)", Game::SwapForce, Element::Air}},
{{1002, 0x0000}, {"Rubble Rouser (Bottom)", Game::SwapForce, Element::Earth}},
{{1003, 0x0000}, {"Doom Stone (Bottom)", Game::SwapForce, Element::Earth}},
{{1004, 0x0000}, {"Blast Zone (Bottom)", Game::SwapForce, Element::Fire}},
{{1004, 0x2402}, {"Dark Blast Zone (Bottom)", Game::SwapForce, Element::Fire}},
{{1005, 0x0000}, {"Fire Kraken (Bottom)", Game::SwapForce, Element::Fire}},
{{1005, 0x2402}, {"Jade Fire Kraken (Bottom)", Game::SwapForce, Element::Fire}},
{{1006, 0x0000}, {"Stink Bomb (Bottom)", Game::SwapForce, Element::Life}},
{{1007, 0x0000}, {"Grilla Drilla (Bottom)", Game::SwapForce, Element::Life}},
{{1008, 0x0000}, {"Hoot Loop (Bottom)", Game::SwapForce, Element::Magic}},
{{1008, 0x2402}, {"Enchanted Hoot Loop (Bottom)", Game::SwapForce, Element::Magic}},
{{1009, 0x0000}, {"Trap Shadow (Bottom)", Game::SwapForce, Element::Magic}},
{{1010, 0x0000}, {"Magna Charge (Bottom)", Game::SwapForce, Element::Tech}},
{{1010, 0x2402}, {"Nitro Magna Charge (Bottom)", Game::SwapForce, Element::Tech}},
{{1011, 0x0000}, {"Spy Rise (Bottom)", Game::SwapForce, Element::Tech}},
{{1012, 0x0000}, {"Night Shift (Bottom)", Game::SwapForce, Element::Undead}},
{{1012, 0x2403}, {"Legendary Night Shift (Bottom)", Game::SwapForce, Element::Undead}},
{{1013, 0x0000}, {"Rattle Shake (Bottom)", Game::SwapForce, Element::Undead}},
{{1013, 0x2402}, {"Quick Draw Rattle Shake (Bottom)", Game::SwapForce, Element::Undead}},
{{1014, 0x0000}, {"Freeze Blade (Bottom)", Game::SwapForce, Element::Water}},
{{1014, 0x2402}, {"Nitro Freeze Blade (Bottom)", Game::SwapForce, Element::Water}},
{{1015, 0x0000}, {"Wash Buckler (Bottom)", Game::SwapForce, Element::Water}},
{{1015, 0x2402}, {"Dark Wash Buckler (Bottom)", Game::SwapForce, Element::Water}},
{{2000, 0x0000}, {"Boom Jet (Top)", Game::SwapForce, Element::Air}},
{{2001, 0x0000}, {"Free Ranger (Top)", Game::SwapForce, Element::Air}},
{{2001, 0x2403}, {"Legendary Free Ranger (Top)", Game::SwapForce, Element::Air}},
{{2002, 0x0000}, {"Rubble Rouser (Top)", Game::SwapForce, Element::Earth}},
{{2003, 0x0000}, {"Doom Stone (Top)", Game::SwapForce, Element::Earth}},
{{2004, 0x0000}, {"Blast Zone (Top)", Game::SwapForce, Element::Fire}},
{{2004, 0x2402}, {"Dark Blast Zone (Top)", Game::SwapForce, Element::Fire}},
{{2005, 0x0000}, {"Fire Kraken (Top)", Game::SwapForce, Element::Fire}},
{{2005, 0x2402}, {"Jade Fire Kraken (Top)", Game::SwapForce, Element::Fire}},
{{2006, 0x0000}, {"Stink Bomb (Top)", Game::SwapForce, Element::Life}},
{{2007, 0x0000}, {"Grilla Drilla (Top)", Game::SwapForce, Element::Life}},
{{2008, 0x0000}, {"Hoot Loop (Top)", Game::SwapForce, Element::Magic}},
{{2008, 0x2402}, {"Enchanted Hoot Loop (Top)", Game::SwapForce, Element::Magic}},
{{2009, 0x0000}, {"Trap Shadow (Top)", Game::SwapForce, Element::Magic}},
{{2010, 0x0000}, {"Magna Charge (Top)", Game::SwapForce, Element::Tech}},
{{2010, 0x2402}, {"Nitro Magna Charge (Top)", Game::SwapForce, Element::Tech}},
{{2011, 0x0000}, {"Spy Rise (Top)", Game::SwapForce, Element::Tech}},
{{2012, 0x0000}, {"Night Shift (Top)", Game::SwapForce, Element::Undead}},
{{2012, 0x2403}, {"Legendary Night Shift (Top)", Game::SwapForce, Element::Undead}},
{{2013, 0x0000}, {"Rattle Shake (Top)", Game::SwapForce, Element::Undead}},
{{2013, 0x2402}, {"Quick Draw Rattle Shake (Top)", Game::SwapForce, Element::Undead}},
{{2014, 0x0000}, {"Freeze Blade (Top)", Game::SwapForce, Element::Water}},
{{2014, 0x2402}, {"Nitro Freeze Blade (Top)", Game::SwapForce, Element::Water}},
{{2015, 0x0000}, {"Wash Buckler (Top)", Game::SwapForce, Element::Water}},
{{2015, 0x2402}, {"Dark Wash Buckler (Top)", Game::SwapForce, Element::Water}},
{{3000, 0x0000}, {"Scratch", Game::SwapForce, Element::Air}},
{{3001, 0x0000}, {"Pop Thorn", Game::SwapForce, Element::Air}},
{{3002, 0x0000}, {"Slobber Tooth", Game::SwapForce, Element::Earth}},
{{3002, 0x2402}, {"Dark Slobber Tooth", Game::SwapForce, Element::Earth}},
{{3003, 0x0000}, {"Scorp", Game::SwapForce, Element::Earth}},
{{3004, 0x0000}, {"Fryno", Game::SwapForce, Element::Fire}},
{{3004, 0x3805}, {"Hog Wild Fryno", Game::SwapForce, Element::Fire}},
{{3005, 0x0000}, {"Smolderdash", Game::SwapForce, Element::Fire}},
{{3005, 0x2206}, {"LightCore Smolderdash", Game::SwapForce, Element::Fire}},
{{3006, 0x0000}, {"Bumble Blast", Game::SwapForce, Element::Life}},
{{3006, 0x2206}, {"LightCore Bumble Blast", Game::SwapForce, Element::Life}},
{{3006, 0x2402}, {"Jolly Bumble Blast", Game::SwapForce, Element::Life}},
{{3007, 0x0000}, {"Zoo Lou", Game::SwapForce, Element::Life}},
{{3007, 0x2403}, {"Legendary Zoo Lou", Game::SwapForce, Element::Life}},
{{3008, 0x0000}, {"Dune Bug", Game::SwapForce, Element::Magic}},
{{3009, 0x0000}, {"Star Strike", Game::SwapForce, Element::Magic}},
{{3009, 0x2206}, {"LightCore Star Strike", Game::SwapForce, Element::Magic}},
{{3009, 0x2602}, {"Enchanted Star Strike", Game::SwapForce, Element::Magic}},
{{3010, 0x0000}, {"Countdown", Game::SwapForce, Element::Tech}},
{{3010, 0x2206}, {"LightCore Countdown", Game::SwapForce, Element::Tech}},
{{3010, 0x2402}, {"Kickoff Countdown", Game::SwapForce, Element::Tech}},
{{3011, 0x0000}, {"Wind Up", Game::SwapForce, Element::Tech}},
{{3011, 0x2404}, {"Gear Head VVind Up", Game::SwapForce, Element::Tech}},
{{3012, 0x0000}, {"Roller Brawl", Game::SwapForce, Element::Undead}},
{{3013, 0x0000}, {"Grim Creeper", Game::SwapForce, Element::Undead}},
{{3013, 0x2206}, {"LightCore Grim Creeper", Game::SwapForce, Element::Undead}},
{{3013, 0x2603}, {"Legendary Grim Creeper", Game::SwapForce, Element::Undead}},
{{3014, 0x0000}, {"Rip Tide", Game::SwapForce, Element::Water}},
{{3015, 0x0000}, {"Punk Shock", Game::SwapForce, Element::Water}},
{{3200, 0x0000}, {"Battle Hammer", Game::SwapForce}},
{{3201, 0x0000}, {"Sky Diamond", Game::SwapForce}},
{{3202, 0x0000}, {"Platinum Sheep", Game::SwapForce}},
{{3203, 0x0000}, {"Groove Machine", Game::SwapForce}},
{{3204, 0x0000}, {"UFO Hat", Game::SwapForce}},
{{3220, 0x0000}, {"Jet Stream", Game::Superchargers, Element::Air}},
{{3221, 0x0000}, {"Tomb Buggy", Game::Superchargers, Element::Undead}},
{{3222, 0x0000}, {"Reef Ripper", Game::Superchargers, Element::Water}},
{{3223, 0x0000}, {"Burn Cycle", Game::Superchargers, Element::Fire}},
{{3224, 0x0000}, {"Hot Streak", Game::Superchargers, Element::Fire}},
{{3224, 0x4004}, {"E3 Hot Streak", Game::Superchargers, Element::Fire}},
{{3224, 0x4402}, {"Dark Hot Streak", Game::Superchargers, Element::Fire}},
{{3224, 0x441E}, {"Golden Hot Streak", Game::Superchargers, Element::Fire}},
{{3225, 0x0000}, {"Shark Tank", Game::Superchargers, Element::Earth}},
{{3226, 0x0000}, {"Thump Truck", Game::Superchargers, Element::Earth}},
{{3227, 0x0000}, {"Crypt Crusher", Game::Superchargers, Element::Undead}},
{{3228, 0x0000}, {"Stealth Stinger", Game::Superchargers, Element::Life}},
{{3228, 0x4402}, {"Nitro Stealth Stinger", Game::Superchargers, Element::Life}},
{{3231, 0x0000}, {"Dive Bomber", Game::Superchargers, Element::Water}},
{{3231, 0x4402}, {"Spring Ahead Dive Bomber", Game::Superchargers, Element::Water}},
{{3232, 0x0000}, {"Sky Slicer", Game::Superchargers, Element::Air}},
{{3233, 0x0000}, {"Clown Cruiser", Game::Superchargers, Element::Air}},
{{3233, 0x4402}, {"Dark Clown Cruiser", Game::Superchargers, Element::Air}},
{{3234, 0x0000}, {"Gold Rusher", Game::Superchargers, Element::Tech}},
{{3234, 0x4402}, {"Power Blue Gold Rusher", Game::Superchargers, Element::Tech}},
{{3235, 0x0000}, {"Shield Striker", Game::Superchargers, Element::Tech}},
{{3236, 0x0000}, {"Sun Runner", Game::Superchargers}},
{{3236, 0x4403}, {"Legendary Sun Runner", Game::Superchargers}},
{{3237, 0x0000}, {"Sea Shadow", Game::Superchargers}},
{{3237, 0x4402}, {"Dark Sea Shadow", Game::Superchargers}},
{{3238, 0x0000}, {"Splatter Splasher", Game::Superchargers, Element::Magic}},
{{3238, 0x4402}, {"Power Blue Splatter Splasher", Game::Superchargers, Element::Magic}},
{{3239, 0x0000}, {"Soda Skimmer", Game::Superchargers, Element::Magic}},
{{3239, 0x4402}, {"Nitro Soda Skimmer", Game::Superchargers, Element::Magic}},
{{3240, 0x0000}, {"Barrel Blaster", Game::Superchargers, Element::Tech}},
{{3240, 0x4402}, {"Dark Barrel Blaster", Game::Superchargers, Element::Tech}},
{{3241, 0x0000}, {"Buzz Wing", Game::Superchargers, Element::Life}},
{{3300, 0x0000}, {"Sheep Wreck Island", Game::SwapForce}},
{{3301, 0x0000}, {"Tower of Time", Game::SwapForce}},
{{3302, 0x0000}, {"Fiery Forge", Game::SwapForce}},
{{3303, 0x0000}, {"Arkeyan Crossbow", Game::SwapForce}},
{{3400, 0x0000}, {"Fiesta", Game::Superchargers, Element::Undead}},
{{3400, 0x4515}, {"Frightful Fiesta", Game::Superchargers, Element::Undead}},
{{3401, 0x0000}, {"High Volt", Game::Superchargers, Element::Tech}},
{{3402, 0x0000}, {"Splat", Game::Superchargers, Element::Magic}},
{{3402, 0x4502}, {"Power Blue Splat", Game::Superchargers, Element::Magic}},
{{3406, 0x0000}, {"Stormblade", Game::Superchargers, Element::Air}},
{{3406, 0x4502}, {"Dark Stormblade", Game::Superchargers, Element::Air}},
{{3411, 0x0000}, {"Smash Hit", Game::Superchargers, Element::Earth}},
{{3411, 0x4502}, {"Steel Plated Smash Hit", Game::Superchargers, Element::Earth}},
{{3412, 0x0000}, {"Spitfire", Game::Superchargers, Element::Fire}},
{{3412, 0x4502}, {"Dark Spitfire", Game::Superchargers, Element::Fire}},
{{3413, 0x0000}, {"Hurricane Jet Vac", Game::Superchargers, Element::Air}},
{{3413, 0x4503}, {"Legendary Hurricane Jet Vac", Game::Superchargers, Element::Air}},
{{3414, 0x0000}, {"Double Dare Trigger Happy", Game::Superchargers, Element::Tech}},
{{3414, 0x4502}, {"Power Blue Double Dare Trigger Happy", Game::Superchargers, Element::Tech}},
{{3415, 0x0000}, {"Super Shot Stealth Elf", Game::Superchargers, Element::Life}},
{{3415, 0x4502}, {"Dark Super Shot Stealth Elf", Game::Superchargers, Element::Life}},
{{3416, 0x0000}, {"Shark Shooter Terrafin", Game::Superchargers, Element::Earth}},
{{3417, 0x0000}, {"Bone Bash Roller Brawl", Game::Superchargers, Element::Undead}},
{{3417, 0x4503}, {"Legendary Bone Bash Roller Brawl", Game::Superchargers, Element::Undead}},
{{3420, 0x0000}, {"Big Bubble Pop Fizz", Game::Superchargers, Element::Magic}},
{{3420, 0x450E}, {"Birthday Bash Big Bubble Pop Fizz", Game::Superchargers, Element::Magic}},
{{3421, 0x0000}, {"Lava Lance Eruptor", Game::Superchargers, Element::Fire}},
{{3422, 0x0000}, {"Deep Dive Gill Grunt", Game::Superchargers, Element::Water}},
{{3423, 0x0000}, {"Turbo Charge Donkey Kong", Game::Superchargers, Element::Life}},
{{3423, 0x4502}, {"Dark Turbo Charge Donkey Kong", Game::Superchargers, Element::Life}},
{{3424, 0x0000}, {"Hammer Slam Bowser", Game::Superchargers, Element::Fire}},
{{3424, 0x4502}, {"Dark Hammer Slam Bowser", Game::Superchargers, Element::Fire}},
{{3425, 0x0000}, {"Dive-Clops", Game::Superchargers, Element::Water}},
{{3425, 0x450E}, {"Missile-Tow Dive-Clops", Game::Superchargers, Element::Water}},
{{3426, 0x0000}, {"Astroblast", Game::Superchargers}},
{{3426, 0x4503}, {"Legendary Astroblast", Game::Superchargers}},
{{3427, 0x0000}, {"Nightfall", Game::Superchargers}},
{{3428, 0x0000}, {"Thrillipede", Game::Superchargers, Element::Life}},
{{3428, 0x450D}, {"Eggcited Thrillipede", Game::Superchargers, Element::Life}},
{{3500, 0x0000}, {"Sky Trophy", Game::Superchargers}},
{{3501, 0x0000}, {"Land Trophy", Game::Superchargers}},
{{3502, 0x0000}, {"Sea Trophy", Game::Superchargers}},
{{3503, 0x0000}, {"Kaos Trophy", Game::Superchargers}}};
SkylanderUSB::SkylanderUSB(EmulationKernel& ios, const std::string& device_name) : m_ios(ios)
{
m_vid = 0x1430;
m_pid = 0x150;
m_id = (static_cast<u64>(m_vid) << 32 | static_cast<u64>(m_pid) << 16 | static_cast<u64>(9) << 8 |
static_cast<u64>(1));
m_device_descriptor = DeviceDescriptor{0x12, 0x1, 0x200, 0x0, 0x0, 0x0, 0x40,
0x1430, 0x150, 0x100, 0x1, 0x2, 0x0, 0x1};
m_config_descriptor.emplace_back(ConfigDescriptor{0x9, 0x2, 0x29, 0x1, 0x1, 0x0, 0x80, 0xFA});
m_interface_descriptor.emplace_back(
InterfaceDescriptor{0x9, 0x4, 0x0, 0x0, 0x2, 0x3, 0x0, 0x0, 0x0});
m_endpoint_descriptor.emplace_back(EndpointDescriptor{0x7, 0x5, 0x81, 0x3, 0x40, 0x1});
m_endpoint_descriptor.emplace_back(EndpointDescriptor{0x7, 0x5, 0x2, 0x3, 0x40, 0x1});
}
SkylanderUSB::~SkylanderUSB() = default;
DeviceDescriptor SkylanderUSB::GetDeviceDescriptor() const
{
return m_device_descriptor;
}
std::vector<ConfigDescriptor> SkylanderUSB::GetConfigurations() const
{
return m_config_descriptor;
}
std::vector<InterfaceDescriptor> SkylanderUSB::GetInterfaces(u8 config) const
{
return m_interface_descriptor;
}
std::vector<EndpointDescriptor> SkylanderUSB::GetEndpoints(u8 config, u8 interface, u8 alt) const
{
return m_endpoint_descriptor;
}
bool SkylanderUSB::Attach()
{
if (m_device_attached)
{
return true;
}
DEBUG_LOG_FMT(IOS_USB, "[{:04x}:{:04x}] Opening device", m_vid, m_pid);
m_device_attached = true;
return true;
}
bool SkylanderUSB::AttachAndChangeInterface(const u8 interface)
{
if (!Attach())
return false;
if (interface != m_active_interface)
return ChangeInterface(interface) == 0;
return true;
}
int SkylanderUSB::CancelTransfer(const u8 endpoint)
{
INFO_LOG_FMT(IOS_USB, "[{:04x}:{:04x} {}] Cancelling transfers (endpoint {:#x})", m_vid, m_pid,
m_active_interface, endpoint);
return IPC_SUCCESS;
}
int SkylanderUSB::ChangeInterface(const u8 interface)
{
DEBUG_LOG_FMT(IOS_USB, "[{:04x}:{:04x} {}] Changing interface to {}", m_vid, m_pid,
m_active_interface, interface);
m_active_interface = interface;
return 0;
}
int SkylanderUSB::GetNumberOfAltSettings(u8 interface)
{
return 0;
}
int SkylanderUSB::SetAltSetting(u8 alt_setting)
{
return 0;
}
// Skylander Portal control transfers are handled via this method, if a transfer requires a
// response, then we request that data from the "Portal" and queue it to be responded to via the
// Interrupt Response, references can be found via:
// https://marijnkneppers.dev/posts
// https://github.com/tresni/PoweredPortals/wiki/USB-Protocols
// https://pastebin.com/EqtTRzeF
int SkylanderUSB::SubmitTransfer(std::unique_ptr<CtrlMessage> cmd)
{
DEBUG_LOG_FMT(IOS_USB,
"[{:04x}:{:04x} {}] Control: bRequestType={:02x} bRequest={} wValue={:04x}"
" wIndex={:04x} wLength={:04x}",
m_vid, m_pid, m_active_interface, cmd->request_type, cmd->request, cmd->value,
cmd->index, cmd->length);
// If not HID Host to Device type, return invalid
if (cmd->request_type != 0x21)
return IPC_EINVAL;
// Data to be sent back via the control transfer immediately
std::array<u8, 64> control_response = {};
s32 expected_count = 0;
u64 expected_time_us = 100;
// Non 0x09 Requests are handled here - no portal data is requested
if (cmd->request != 0x09)
{
switch (cmd->request)
{
// Get Interface
case 0x0A:
expected_count = 8;
break;
// Set Interface
case 0x0B:
expected_count = 8;
break;
default:
ERROR_LOG_FMT(IOS_USB, "Unhandled Request {}", cmd->request);
break;
}
}
else
{
// Skylander Portal Requests
auto& system = m_ios.GetSystem();
auto& memory = system.GetMemory();
u8* buf = memory.GetPointerForRange(cmd->data_address, cmd->length);
if (cmd->length == 0 || buf == nullptr)
{
ERROR_LOG_FMT(IOS_USB, "Skylander command invalid");
return IPC_EINVAL;
}
// Data to be queued to be sent back via the Interrupt Transfer (if needed)
std::array<u8, 64> interrupt_response = {};
// The first byte of the Control Request is always a char for Skylanders
switch (buf[0])
{
case 'A':
{
// Activation
// Command { 'A', (00 | 01), 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'A', (00 | 01),
// ff, 77, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00 }
// The 2nd byte of the command is whether to activate (0x01) or deactivate (0x00) the
// portal. The response echos back the activation byte as the 2nd byte of the response. The
// 3rd and 4th bytes of the response appear to vary from wired to wireless. On wired
// portals, the bytes appear to always be ff 77. On wireless portals, during activation the
// 3rd byte appears to count down from ff (possibly a battery power indication) and during
// deactivation ed and eb responses have been observed. The 4th byte appears to always be 00
// for wireless portals.
// Wii U Wireless: 41 01 f4 00 41 00 ed 00 41 01 f4 00 41 00 eb 00 41 01 f3 00 41 00 ed 00
if (cmd->length == 2)
{
control_response = {buf[0], buf[1]};
interrupt_response = {0x41, buf[1], 0xFF, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
m_queries.push(interrupt_response);
expected_count = 10;
system.GetSkylanderPortal().Activate();
}
break;
}
case 'C':
{
// Color
// Command { 'C', 12, 34, 56, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'C', 12, 34, 56, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00 }
// The 3 bytes {12, 34, 56} are RGB values.
// This command should set the color of the LED in the portal, however this appears
// deprecated in most of the recent portals. On portals that do not have LEDs, this command
// is silently ignored and do not require a response.
if (cmd->length == 4)
{
system.GetSkylanderPortal().SetLEDs(0x01, buf[1], buf[2], buf[3]);
control_response = {0x43, buf[1], buf[2], buf[3]};
expected_count = 12;
}
break;
}
case 'J':
{
// Sided color
// The 2nd byte is the side
// 0x00: right
// 0x02: left
// The 3rd, 4th and 5th bytes are red, green and blue
// The 6th and 7th bytes form a little-endian short for how long the fade duration should be
// in milliseconds.
// For example, 500 milliseconds becomes 0xF4, 0x01
// are 0x00, 0x01 and 0x07. Custom commands show that the higher this value the longer the
// duration.
// Empty J response is sent after the fade is completed.
if (cmd->length == 7)
{
control_response = {buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]};
expected_count = 15;
interrupt_response = {buf[0]};
m_queries.push(interrupt_response);
system.GetSkylanderPortal().SetLEDs(buf[1], buf[2], buf[3], buf[4]);
}
break;
}
case 'L':
{
// Light
// This command is used while playing audio through the portal
// The 2nd bytes is the position
// 0x00: right
// 0x01: trap led
// 0x02: left
// The 3rd, 4th and 5th bytes are red, green and blue
// the trap led is white-only
// increasing or decreasing the values results in a brighter or dimmer light
if (cmd->length == 5)
{
control_response = {buf[0], buf[1], buf[2], buf[3], buf[4]};
expected_count = 13;
u8 side = buf[1];
if (side == 0x02)
{
side = 0x04;
}
system.GetSkylanderPortal().SetLEDs(side, buf[2], buf[3], buf[4]);
}
break;
}
case 'M':
{
// Audio Firmware version
// Respond with version obtained from Trap Team wired portal
if (cmd->length == 2)
{
control_response = {buf[0], buf[1]};
expected_count = 10;
interrupt_response = {buf[0], buf[1], 0x00, 0x19};
m_queries.push(interrupt_response);
}
break;
}
// Query
// Command { 'Q', 10, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'Q', 10, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00 }
// In the command the 2nd byte indicates which Skylander to query data
// from. Index starts at 0x10 for the 1st Skylander (as reported in the Status command.) The
// 16th Skylander indexed would be 0x20. The 3rd byte indicate which block to read from.
// A response with the 2nd byte of 0x01 indicates an error in the read. Otherwise, the
// response indicates the Skylander's index in the 2nd byte, the block read in the 3rd byte,
// data (16 bytes) is contained in bytes 4-19.
// A Skylander has 64 blocks of data indexed from 0x00 to 0x3f. SwapForce characters have 2
// character indexes, these may not be sequential.
case 'Q':
{
if (cmd->length == 3)
{
const u8 sky_num = buf[1] & 0xF;
const u8 block = buf[2];
system.GetSkylanderPortal().QueryBlock(sky_num, block, interrupt_response.data());
m_queries.push(interrupt_response);
control_response = {buf[0], buf[1], buf[2]};
expected_count = 11;
}
break;
}
case 'R':
{
// Ready
// Command { 'R', 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'R', 02, 0a, 03, 02, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00 }
// The 4 byte sequence after the R (0x52) is unknown, but appears consistent based on device
// type.
if (cmd->length == 2)
{
control_response = {0x52, 0x00};
interrupt_response = {0x52, 0x02, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
m_queries.push(interrupt_response);
expected_count = 10;
}
break;
}
// Status
// Command { 'S', 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'S', 55, 00, 00, 55, 3e,
// (00|01), 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00 }
// Status is the default command. If you open the HID device and
// activate the portal, you will get status outputs.
// The 4 bytes {55, 00, 00, 55} are the status of characters on the portal. The 4 bytes are
// treated as a 32-bit binary array. Each unique Skylander placed on a board is represented
// by 2 bits starting with the first Skylander in the least significant bit. This bit is
// present whenever the Skylandar is added or present on the portal. When the Skylander is
// added to the board, both bits are set in the next status message as a one-time signal.
// When a Skylander is removed from the board, only the most significant bit of the 2 bits
// is set.
// Different portals can track a different number of RFID tags. The Wii Wireless portal
// tracks 4, the Wired portal can track 8. The maximum number of unique Skylanders tracked
// at any time is 16, after which new Skylanders appear to cycle unused bits.
// Certain Skylanders, e.g. SwapForce Skylanders, are represented as 2 ID in the bit array.
// This may be due to the presence of 2 RFIDs, one for each half of the Skylander.
// The 6th byte {3e} is a counter and increments by one. It will roll over when reaching
// {ff}.
// The purpose of the (00\|01) byte at the 7th position appear to indicate if the portal has
// been activated: {01} when active and {00} when deactivated.
case 'S':
{
if (cmd->length == 1)
{
// The Status interrupt responses are automatically handled via the GetStatus method
control_response = {buf[0]};
expected_count = 9;
}
break;
}
case 'V':
{
if (cmd->length == 4)
{
control_response = {buf[0], buf[1], buf[2], buf[3]};
expected_count = 12;
}
break;
}
// Write
// Command { 'W', 10, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }
// Response { 'W', 00, 00, 00, 00, 00,
// 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
// 00, 00, 00, 00 }
// In the command the 2nd byte indicates which Skylander to query data from. Index starts at
// 0x10 for the 1st Skylander (as reported in the Status command.) The 16th Skylander
// indexed would be 0x20.
// 3rd byte is the block to write to.
// Bytes 4 - 19 ({ 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f }) are the
// data to write.
// The response does not appear to return the id of the Skylander being written, the 2nd
// byte is 0x00; however, the 3rd byte echos the block that was written (0x00 in example
// above.)
case 'W':
{
if (cmd->length == 19)
{
const u8 sky_num = buf[1] & 0xF;
const u8 block = buf[2];
system.GetSkylanderPortal().WriteBlock(sky_num, block, &buf[3], interrupt_response.data());
m_queries.push(interrupt_response);
control_response = {buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13],
buf[14], buf[15], buf[16], buf[17], buf[18]};
expected_count = 27;
}
break;
}
default:
ERROR_LOG_FMT(IOS_USB, "Unhandled Skylander Portal Query: {}", buf[0]);
break;
}
}
if (expected_count == 0)
return IPC_EINVAL;
ScheduleTransfer(std::move(cmd), control_response, expected_count, expected_time_us);
return 0;
}
int SkylanderUSB::SubmitTransfer(std::unique_ptr<BulkMessage> cmd)
{
DEBUG_LOG_FMT(IOS_USB, "[{:04x}:{:04x} {}] Bulk: length={} endpoint={}", m_vid, m_pid,
m_active_interface, cmd->length, cmd->endpoint);
return 0;
}
// When an Interrupt Message is received by the Skylander Portal from the console,
// it needs to respond with either the status of the console if there are no Control Messages that
// require a response, or with the relevant response data that is requested from the Control
// Message.
int SkylanderUSB::SubmitTransfer(std::unique_ptr<IntrMessage> cmd)
{
DEBUG_LOG_FMT(IOS_USB, "[{:04x}:{:04x} {}] Interrupt: length={} endpoint={}", m_vid, m_pid,
m_active_interface, cmd->length, cmd->endpoint);
auto& system = m_ios.GetSystem();
auto& memory = system.GetMemory();
u8* buf = memory.GetPointerForRange(cmd->data_address, cmd->length);
if (cmd->length == 0 || buf == nullptr)
{
ERROR_LOG_FMT(IOS_USB, "Skylander command invalid");
return IPC_EINVAL;
}
std::array<u8, 64> interrupt_response = {};
s32 expected_count;
u64 expected_time_us;
// Audio requests are 64 bytes long, are the only Interrupt requests longer than 32 bytes,
// echo the request as the response and respond immediately
if (cmd->length > 32 && cmd->length <= 64)
{
// Play audio through Portal Mixer
// Audio is unsigned 16 bit, supplied as 64 bytes which is 32 samples
SoundStream* sound_stream = system.GetSoundStream();
sound_stream->GetMixer()->PushSkylanderPortalSamples(buf, cmd->length / 2);
std::array<u8, 64> audio_interrupt_response = {};
u8* audio_buf = audio_interrupt_response.data();
memcpy(audio_buf, buf, cmd->length);
expected_time_us = 0;
expected_count = cmd->length;
ScheduleTransfer(std::move(cmd), audio_interrupt_response, expected_count, expected_time_us);
return 0;
}
// If some data was requested from the Control Message, then the Interrupt message needs to
// respond with that data. Check if the queries queue is empty
if (!m_queries.empty())
{
interrupt_response = m_queries.front();
m_queries.pop();
// This needs to happen after ~22 milliseconds
expected_time_us = 22000;
}
// If there is no relevant data to respond with, respond with the currentstatus of the Portal
else
{
interrupt_response = system.GetSkylanderPortal().GetStatus();
expected_time_us = 2000;
}
expected_count = 32;
ScheduleTransfer(std::move(cmd), interrupt_response, expected_count, expected_time_us);
return 0;
}
int SkylanderUSB::SubmitTransfer(std::unique_ptr<IsoMessage> cmd)
{
DEBUG_LOG_FMT(IOS_USB, "[{:04x}:{:04x} {}] Isochronous: length={} endpoint={} num_packets={}",
m_vid, m_pid, m_active_interface, cmd->length, cmd->endpoint, cmd->num_packets);
return 0;
}
void SkylanderUSB::ScheduleTransfer(std::unique_ptr<TransferCommand> command,
const std::array<u8, 64>& data, s32 expected_count,
u64 expected_time_us)
{
command->FillBuffer(data.data(), expected_count);
command->ScheduleTransferCompletion(expected_count, expected_time_us);
}
void Skylander::Save()
{
if (!sky_file)
return;
sky_file.Seek(0, File::SeekOrigin::Begin);
sky_file.WriteBytes(data.data(), 0x40 * 0x10);
}
void SkylanderPortal::Activate()
{
std::lock_guard lock(sky_mutex);
if (m_activated)
{
// If the portal was already active no change is needed
return;
}
// If not we need to advertise change to all the figures present on the portal
for (auto& s : skylanders)
{
if (s.status & 1)
{
s.queued_status.push(Skylander::ADDED);
s.queued_status.push(Skylander::READY);
}
}
m_activated = true;
}
void SkylanderPortal::Deactivate()
{
std::lock_guard lock(sky_mutex);