CCController-linux-win32.cpp 198 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945
  1. /****************************************************************************
  2. Copyright (c) 2014 cocos2d-x.org
  3. Copyright (c) 2014-2016 Chukong Technologies Inc.
  4. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  5. Copyright (c) 2017 Wilson E. Alvarez <wilson.e.alvarez1@gmail.com>
  6. http://www.cocos2d-x.org
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. ****************************************************************************/
  23. #include "base/CCController.h"
  24. #if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
  25. #include <functional>
  26. #include "base/ccMacros.h"
  27. #include "base/CCDirector.h"
  28. #include "base/CCScheduler.h"
  29. #include "base/CCEventController.h"
  30. #include "glfw3.h"
  31. NS_CC_BEGIN
  32. class CC_DLL ControllerImpl
  33. {
  34. public:
  35. ControllerImpl()
  36. {
  37. //FIXME: Once GLFW 3.3 is bundled with cocos2d-x and no extra
  38. //controllers have been added here, remove all the code here. If
  39. //extra controllers were added, make sure to add them to the SDL
  40. //Controller Database at
  41. //https://github.com/gabomdq/SDL_GameControllerDB which GLFW uses
  42. //for providing the new gamepad API. We are going to map the GLFW
  43. //game pad events to Controller::Key key codes.
  44. // Note: the controllers input profile were taken from the
  45. // RetroArch joypad autoconfig project at:
  46. // https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udev
  47. // The configuration files were parsed into C++ code with:
  48. // https://github.com/Rubonnek/retroarch-joypad-config-to-cpp-mapper
  49. // which provides the following mapping from the RetroArch
  50. // configuration variables towards the cocos2d::Controller::Key key
  51. // codes. Hardware-wise, the mapping goes from a theoretical SNES
  52. // controller with extra joysticks and shoulder buttons, towards an
  53. // Xbox-like controller which is widely common on mobile phones.
  54. // RetroArch variable -> Cocos2D-X equivalent
  55. // input_a_btn -> Controller::Key::BUTTON_B
  56. // input_b_btn -> Controller::Key::BUTTON_A
  57. // input_down_btn -> Controller::Key::BUTTON_DPAD_DOWN
  58. // input_l2_axis -> Controller::Key::AXIS_LEFT_TRIGGER
  59. // input_l3_btn -> Controller::Key::BUTTON_LEFT_THUMBSTICK
  60. // input_l_btn -> Controller::Key::BUTTON_LEFT_SHOULDER
  61. // input_l_x_minus_axis -> Controller::Key::JOYSTICK_LEFT_X
  62. // input_l_y_minus_axis -> Controller::Key::JOYSTICK_LEFT_Y
  63. // input_left_btn -> Controller::Key::BUTTON_DPAD_LEFT
  64. // input_r2_axis -> Controller::Key::AXIS_RIGHT_TRIGGER
  65. // input_r3_btn -> Controller::Key::BUTTON_RIGHT_THUMBSTICK
  66. // input_r_btn -> Controller::Key::BUTTON_RIGHT_SHOULDER
  67. // input_r_x_minus_axis -> Controller::Key::JOYSTICK_RIGHT_X
  68. // input_r_y_minus_axis -> Controller::Key::JOYSTICK_RIGHT_Y
  69. // input_right_btn -> Controller::Key::BUTTON_DPAD_RIGHT
  70. // input_select_btn -> Controller::Key::BUTTON_SELECT
  71. // input_start_btn -> Controller::Key::BUTTON_START
  72. // input_up_btn -> Controller::Key::BUTTON_DPAD_UP
  73. // input_x_btn -> Controller::Key::BUTTON_Y
  74. // input_y_btn -> Controller::Key::BUTTON_X
  75. // Preliminary support is added for 169 controllers, but on some
  76. // cases the mapping provided might not be correct and has to be
  77. // manually adjusted.
  78. // Create the necessary variables:
  79. std::string deviceName = "2Axes 11Keys Game Pad";
  80. std::unordered_map<int,int> buttonInputMap;
  81. std::unordered_map<int,int> axisInputMap;
  82. // Map the controller inputs to Controller::Key codes
  83. buttonInputMap[2] = Controller::Key::BUTTON_A;
  84. buttonInputMap[3] = Controller::Key::BUTTON_X;
  85. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  86. buttonInputMap[9] = Controller::Key::BUTTON_START;
  87. buttonInputMap[1] = Controller::Key::BUTTON_B;
  88. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  89. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  90. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  91. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  92. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  93. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  94. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  95. // Add the controller profile to the map
  96. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  97. // Prepare variables:
  98. deviceName = "8Bitdo FC30 GamePad";
  99. buttonInputMap.clear();
  100. axisInputMap.clear();
  101. // Map the controller inputs to Controller::Key codes
  102. buttonInputMap[1] = Controller::Key::BUTTON_A;
  103. buttonInputMap[4] = Controller::Key::BUTTON_X;
  104. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  105. buttonInputMap[11] = Controller::Key::BUTTON_START;
  106. buttonInputMap[0] = Controller::Key::BUTTON_B;
  107. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  108. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  109. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  110. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  111. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  112. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  113. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  114. // Add the controller profile to the map
  115. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  116. // Prepare variables:
  117. deviceName = "8Bitdo FC30 II";
  118. buttonInputMap.clear();
  119. axisInputMap.clear();
  120. // Map the controller inputs to Controller::Key codes
  121. buttonInputMap[1] = Controller::Key::BUTTON_A;
  122. buttonInputMap[4] = Controller::Key::BUTTON_X;
  123. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  124. buttonInputMap[11] = Controller::Key::BUTTON_START;
  125. buttonInputMap[0] = Controller::Key::BUTTON_B;
  126. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  127. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  128. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  129. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  130. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  131. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  132. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  133. // Add the controller profile to the map
  134. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  135. // Prepare variables:
  136. deviceName = "8Bitdo FC30 II Joystick";
  137. buttonInputMap.clear();
  138. axisInputMap.clear();
  139. // Map the controller inputs to Controller::Key codes
  140. buttonInputMap[1] = Controller::Key::BUTTON_A;
  141. buttonInputMap[4] = Controller::Key::BUTTON_X;
  142. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  143. buttonInputMap[11] = Controller::Key::BUTTON_START;
  144. buttonInputMap[0] = Controller::Key::BUTTON_B;
  145. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  146. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  147. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  148. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  149. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  150. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  151. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  152. // Add the controller profile to the map
  153. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  154. // Prepare variables:
  155. deviceName = "FC30 FC30 Joystick";
  156. buttonInputMap.clear();
  157. axisInputMap.clear();
  158. // Map the controller inputs to Controller::Key codes
  159. buttonInputMap[1] = Controller::Key::BUTTON_A;
  160. buttonInputMap[4] = Controller::Key::BUTTON_X;
  161. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  162. buttonInputMap[11] = Controller::Key::BUTTON_START;
  163. buttonInputMap[0] = Controller::Key::BUTTON_B;
  164. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  165. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  166. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  167. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  168. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  169. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  170. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  171. // Add the controller profile to the map
  172. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  173. // Prepare variables:
  174. deviceName = "8Bitdo NES30 GamePad";
  175. buttonInputMap.clear();
  176. axisInputMap.clear();
  177. // Map the controller inputs to Controller::Key codes
  178. buttonInputMap[1] = Controller::Key::BUTTON_A;
  179. buttonInputMap[4] = Controller::Key::BUTTON_X;
  180. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  181. buttonInputMap[11] = Controller::Key::BUTTON_START;
  182. buttonInputMap[0] = Controller::Key::BUTTON_B;
  183. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  184. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  185. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  186. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  187. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  188. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  189. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  190. // Add the controller profile to the map
  191. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  192. // Prepare variables:
  193. deviceName = "8Bitdo NES30 GamePad Joystick";
  194. buttonInputMap.clear();
  195. axisInputMap.clear();
  196. // Map the controller inputs to Controller::Key codes
  197. buttonInputMap[1] = Controller::Key::BUTTON_A;
  198. buttonInputMap[4] = Controller::Key::BUTTON_X;
  199. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  200. buttonInputMap[11] = Controller::Key::BUTTON_START;
  201. buttonInputMap[0] = Controller::Key::BUTTON_B;
  202. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  203. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  204. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  205. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  206. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  207. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  208. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  209. // Add the controller profile to the map
  210. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  211. // Prepare variables:
  212. deviceName = "NES30 NES30 Joystick";
  213. buttonInputMap.clear();
  214. axisInputMap.clear();
  215. // Map the controller inputs to Controller::Key codes
  216. buttonInputMap[1] = Controller::Key::BUTTON_A;
  217. buttonInputMap[4] = Controller::Key::BUTTON_X;
  218. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  219. buttonInputMap[11] = Controller::Key::BUTTON_START;
  220. buttonInputMap[0] = Controller::Key::BUTTON_B;
  221. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  222. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  223. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  224. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  225. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  226. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  227. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  228. // Add the controller profile to the map
  229. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  230. // Prepare variables:
  231. deviceName = "8Bitdo SFC30 GamePad";
  232. buttonInputMap.clear();
  233. axisInputMap.clear();
  234. // Map the controller inputs to Controller::Key codes
  235. buttonInputMap[1] = Controller::Key::BUTTON_A;
  236. buttonInputMap[4] = Controller::Key::BUTTON_X;
  237. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  238. buttonInputMap[11] = Controller::Key::BUTTON_START;
  239. buttonInputMap[0] = Controller::Key::BUTTON_B;
  240. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  241. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  242. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  243. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  244. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  245. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  246. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  247. // Add the controller profile to the map
  248. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  249. // Prepare variables:
  250. deviceName = "8Bitdo SFC30 GamePad Joystick";
  251. buttonInputMap.clear();
  252. axisInputMap.clear();
  253. // Map the controller inputs to Controller::Key codes
  254. buttonInputMap[1] = Controller::Key::BUTTON_A;
  255. buttonInputMap[4] = Controller::Key::BUTTON_X;
  256. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  257. buttonInputMap[11] = Controller::Key::BUTTON_START;
  258. buttonInputMap[0] = Controller::Key::BUTTON_B;
  259. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  260. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  261. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  262. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  263. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  264. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  265. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  266. // Add the controller profile to the map
  267. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  268. // Prepare variables:
  269. deviceName = "SFC30 SFC30 Joystick";
  270. buttonInputMap.clear();
  271. axisInputMap.clear();
  272. // Map the controller inputs to Controller::Key codes
  273. buttonInputMap[1] = Controller::Key::BUTTON_A;
  274. buttonInputMap[4] = Controller::Key::BUTTON_X;
  275. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  276. buttonInputMap[11] = Controller::Key::BUTTON_START;
  277. buttonInputMap[0] = Controller::Key::BUTTON_B;
  278. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  279. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  280. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  281. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  282. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  283. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  284. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  285. // Add the controller profile to the map
  286. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  287. // Prepare variables:
  288. deviceName = "8Bitdo SNES30 GamePad";
  289. buttonInputMap.clear();
  290. axisInputMap.clear();
  291. // Map the controller inputs to Controller::Key codes
  292. buttonInputMap[1] = Controller::Key::BUTTON_A;
  293. buttonInputMap[4] = Controller::Key::BUTTON_X;
  294. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  295. buttonInputMap[11] = Controller::Key::BUTTON_START;
  296. buttonInputMap[0] = Controller::Key::BUTTON_B;
  297. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  298. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  299. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  300. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  301. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  302. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  303. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  304. // Add the controller profile to the map
  305. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  306. // Prepare variables:
  307. deviceName = "8Bitdo SNES30 GamePad Joystick";
  308. buttonInputMap.clear();
  309. axisInputMap.clear();
  310. // Map the controller inputs to Controller::Key codes
  311. buttonInputMap[1] = Controller::Key::BUTTON_A;
  312. buttonInputMap[4] = Controller::Key::BUTTON_X;
  313. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  314. buttonInputMap[11] = Controller::Key::BUTTON_START;
  315. buttonInputMap[0] = Controller::Key::BUTTON_B;
  316. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  317. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  318. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  319. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  320. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  321. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  322. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  323. // Add the controller profile to the map
  324. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  325. // Prepare variables:
  326. deviceName = "SNES30 SNES30 Joy ";
  327. buttonInputMap.clear();
  328. axisInputMap.clear();
  329. // Map the controller inputs to Controller::Key codes
  330. buttonInputMap[1] = Controller::Key::BUTTON_A;
  331. buttonInputMap[4] = Controller::Key::BUTTON_X;
  332. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  333. buttonInputMap[11] = Controller::Key::BUTTON_START;
  334. buttonInputMap[0] = Controller::Key::BUTTON_B;
  335. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  336. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  337. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  338. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  339. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  340. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  341. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  342. // Add the controller profile to the map
  343. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  344. // Prepare variables:
  345. deviceName = "8Bitdo Joy";
  346. buttonInputMap.clear();
  347. axisInputMap.clear();
  348. // Map the controller inputs to Controller::Key codes
  349. buttonInputMap[11] = Controller::Key::BUTTON_A;
  350. buttonInputMap[14] = Controller::Key::BUTTON_X;
  351. buttonInputMap[21] = Controller::Key::BUTTON_SELECT;
  352. buttonInputMap[22] = Controller::Key::BUTTON_START;
  353. buttonInputMap[12] = Controller::Key::BUTTON_B;
  354. buttonInputMap[15] = Controller::Key::BUTTON_Y;
  355. buttonInputMap[17] = Controller::Key::BUTTON_LEFT_SHOULDER;
  356. buttonInputMap[18] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  357. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  358. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  359. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  360. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  361. // Add the controller profile to the map
  362. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  363. // Prepare variables:
  364. deviceName = "8Bitdo JoyStick 8Bitdo Joy ";
  365. buttonInputMap.clear();
  366. axisInputMap.clear();
  367. // Map the controller inputs to Controller::Key codes
  368. buttonInputMap[1] = Controller::Key::BUTTON_A;
  369. buttonInputMap[0] = Controller::Key::BUTTON_X;
  370. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  371. buttonInputMap[9] = Controller::Key::BUTTON_START;
  372. buttonInputMap[2] = Controller::Key::BUTTON_B;
  373. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  374. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  375. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  376. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  377. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  378. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  379. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  380. // Add the controller profile to the map
  381. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  382. // Prepare variables:
  383. deviceName = "8Bitdo N64 GamePad";
  384. buttonInputMap.clear();
  385. axisInputMap.clear();
  386. // Map the controller inputs to Controller::Key codes
  387. buttonInputMap[1] = Controller::Key::BUTTON_A;
  388. buttonInputMap[11] = Controller::Key::BUTTON_START;
  389. buttonInputMap[0] = Controller::Key::BUTTON_B;
  390. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  391. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  392. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  393. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  394. // Add the controller profile to the map
  395. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  396. // Prepare variables:
  397. deviceName = "8Bitdo N64 8Bitdo N64 ";
  398. buttonInputMap.clear();
  399. axisInputMap.clear();
  400. // Map the controller inputs to Controller::Key codes
  401. buttonInputMap[1] = Controller::Key::BUTTON_A;
  402. buttonInputMap[11] = Controller::Key::BUTTON_START;
  403. buttonInputMap[0] = Controller::Key::BUTTON_B;
  404. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  405. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  406. axisInputMap[5] = Controller::Key::BUTTON_DPAD_LEFT;
  407. axisInputMap[4] = Controller::Key::BUTTON_DPAD_RIGHT;
  408. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  409. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  410. // Add the controller profile to the map
  411. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  412. // Prepare variables:
  413. deviceName = "8Bitdo FC30 Pro";
  414. buttonInputMap.clear();
  415. axisInputMap.clear();
  416. // Map the controller inputs to Controller::Key codes
  417. buttonInputMap[1] = Controller::Key::BUTTON_A;
  418. buttonInputMap[4] = Controller::Key::BUTTON_X;
  419. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  420. buttonInputMap[11] = Controller::Key::BUTTON_START;
  421. buttonInputMap[0] = Controller::Key::BUTTON_B;
  422. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  423. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  424. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  425. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  426. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  427. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  428. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  429. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  430. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  431. // Add the controller profile to the map
  432. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  433. // Prepare variables:
  434. deviceName = "8Bitdo FC30 Pro 8Bitdo FC30 Pro";
  435. buttonInputMap.clear();
  436. axisInputMap.clear();
  437. // Map the controller inputs to Controller::Key codes
  438. buttonInputMap[1] = Controller::Key::BUTTON_A;
  439. buttonInputMap[4] = Controller::Key::BUTTON_X;
  440. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  441. buttonInputMap[11] = Controller::Key::BUTTON_START;
  442. buttonInputMap[0] = Controller::Key::BUTTON_B;
  443. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  444. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  445. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  446. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  447. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  448. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  449. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  450. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  451. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  452. axisInputMap[7] = Controller::Key::BUTTON_DPAD_UP;
  453. //axisInputMap[7] = Controller::Key::BUTTON_DPAD_DOWN;
  454. axisInputMap[5] = Controller::Key::BUTTON_DPAD_LEFT;
  455. axisInputMap[4] = Controller::Key::BUTTON_DPAD_RIGHT;
  456. // Add the controller profile to the map
  457. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  458. // Prepare variables:
  459. deviceName = "8Bitdo NES30 Pro";
  460. buttonInputMap.clear();
  461. axisInputMap.clear();
  462. // Map the controller inputs to Controller::Key codes
  463. buttonInputMap[1] = Controller::Key::BUTTON_A;
  464. buttonInputMap[4] = Controller::Key::BUTTON_X;
  465. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  466. buttonInputMap[11] = Controller::Key::BUTTON_START;
  467. buttonInputMap[0] = Controller::Key::BUTTON_B;
  468. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  469. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  470. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  471. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  472. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  473. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  474. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  475. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  476. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  477. // Add the controller profile to the map
  478. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  479. // Prepare variables:
  480. deviceName = "8Bitdo NES30 Pro Joystick";
  481. buttonInputMap.clear();
  482. axisInputMap.clear();
  483. // Map the controller inputs to Controller::Key codes
  484. buttonInputMap[1] = Controller::Key::BUTTON_A;
  485. buttonInputMap[4] = Controller::Key::BUTTON_X;
  486. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  487. buttonInputMap[11] = Controller::Key::BUTTON_START;
  488. buttonInputMap[0] = Controller::Key::BUTTON_B;
  489. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  490. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  491. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  492. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  493. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  494. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  495. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  496. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  497. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  498. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  499. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  500. // Add the controller profile to the map
  501. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  502. // Prepare variables:
  503. deviceName = "8Bitdo NES30 Pro 8Bitdo NES30 Pro";
  504. buttonInputMap.clear();
  505. axisInputMap.clear();
  506. // Map the controller inputs to Controller::Key codes
  507. buttonInputMap[1] = Controller::Key::BUTTON_A;
  508. buttonInputMap[4] = Controller::Key::BUTTON_X;
  509. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  510. buttonInputMap[11] = Controller::Key::BUTTON_START;
  511. buttonInputMap[0] = Controller::Key::BUTTON_B;
  512. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  513. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  514. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  515. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  516. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  517. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  518. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  519. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  520. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  521. axisInputMap[7] = Controller::Key::BUTTON_DPAD_UP;
  522. //axisInputMap[7] = Controller::Key::BUTTON_DPAD_DOWN;
  523. axisInputMap[5] = Controller::Key::BUTTON_DPAD_LEFT;
  524. axisInputMap[4] = Controller::Key::BUTTON_DPAD_RIGHT;
  525. // Add the controller profile to the map
  526. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  527. // Prepare variables:
  528. deviceName = "8Bitdo Zero GamePad";
  529. buttonInputMap.clear();
  530. axisInputMap.clear();
  531. // Map the controller inputs to Controller::Key codes
  532. buttonInputMap[0] = Controller::Key::BUTTON_A;
  533. buttonInputMap[3] = Controller::Key::BUTTON_X;
  534. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  535. buttonInputMap[11] = Controller::Key::BUTTON_START;
  536. buttonInputMap[1] = Controller::Key::BUTTON_B;
  537. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  538. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  539. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  540. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  541. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  542. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  543. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  544. // Add the controller profile to the map
  545. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  546. // Prepare variables:
  547. deviceName = "raphnet.net (S)NES Atari USB";
  548. buttonInputMap.clear();
  549. axisInputMap.clear();
  550. // Map the controller inputs to Controller::Key codes
  551. buttonInputMap[5] = Controller::Key::BUTTON_SELECT;
  552. buttonInputMap[9] = Controller::Key::BUTTON_START;
  553. buttonInputMap[4] = Controller::Key::BUTTON_B;
  554. buttonInputMap[1] = Controller::Key::BUTTON_A;
  555. buttonInputMap[8] = Controller::Key::BUTTON_Y;
  556. buttonInputMap[0] = Controller::Key::BUTTON_X;
  557. buttonInputMap[3] = Controller::Key::BUTTON_LEFT_SHOULDER;
  558. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  559. // Add the controller profile to the map
  560. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  561. // Prepare variables:
  562. deviceName = "ACRUX QuanBa Arcade JoyStick 1008";
  563. buttonInputMap.clear();
  564. axisInputMap.clear();
  565. // Map the controller inputs to Controller::Key codes
  566. buttonInputMap[1] = Controller::Key::BUTTON_A;
  567. buttonInputMap[2] = Controller::Key::BUTTON_X;
  568. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  569. buttonInputMap[9] = Controller::Key::BUTTON_START;
  570. buttonInputMap[0] = Controller::Key::BUTTON_B;
  571. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  572. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  573. buttonInputMap[4] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  574. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  575. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  576. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  577. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  578. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  579. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  580. // Add the controller profile to the map
  581. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  582. // Prepare variables:
  583. deviceName = "Afterglow controller for PS3";
  584. buttonInputMap.clear();
  585. axisInputMap.clear();
  586. // Map the controller inputs to Controller::Key codes
  587. buttonInputMap[1] = Controller::Key::BUTTON_A;
  588. buttonInputMap[0] = Controller::Key::BUTTON_X;
  589. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  590. buttonInputMap[9] = Controller::Key::BUTTON_START;
  591. buttonInputMap[2] = Controller::Key::BUTTON_B;
  592. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  593. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  594. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  595. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  596. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  597. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  598. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  599. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  600. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  601. // Add the controller profile to the map
  602. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  603. // Prepare variables:
  604. deviceName = "Afterglow Gamepad for Xbox 360";
  605. buttonInputMap.clear();
  606. axisInputMap.clear();
  607. // Map the controller inputs to Controller::Key codes
  608. buttonInputMap[1] = Controller::Key::BUTTON_A;
  609. buttonInputMap[3] = Controller::Key::BUTTON_X;
  610. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  611. buttonInputMap[7] = Controller::Key::BUTTON_START;
  612. buttonInputMap[0] = Controller::Key::BUTTON_B;
  613. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  614. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  615. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  616. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  617. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  618. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  619. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  620. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  621. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  622. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  623. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  624. // Add the controller profile to the map
  625. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  626. // Prepare variables:
  627. deviceName = "BLISS-BOX 4PLAY PORT";
  628. buttonInputMap.clear();
  629. axisInputMap.clear();
  630. // Map the controller inputs to Controller::Key codes
  631. buttonInputMap[5] = Controller::Key::BUTTON_A;
  632. buttonInputMap[4] = Controller::Key::BUTTON_X;
  633. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  634. buttonInputMap[9] = Controller::Key::BUTTON_START;
  635. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_UP;
  636. buttonInputMap[15] = Controller::Key::BUTTON_DPAD_DOWN;
  637. buttonInputMap[16] = Controller::Key::BUTTON_DPAD_LEFT;
  638. buttonInputMap[17] = Controller::Key::BUTTON_DPAD_RIGHT;
  639. buttonInputMap[7] = Controller::Key::BUTTON_B;
  640. buttonInputMap[6] = Controller::Key::BUTTON_Y;
  641. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  642. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  643. buttonInputMap[18] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  644. buttonInputMap[19] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  645. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  646. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  647. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  648. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  649. // Add the controller profile to the map
  650. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  651. // Prepare variables:
  652. deviceName = "ControlBlock Arcade Gamepad";
  653. buttonInputMap.clear();
  654. axisInputMap.clear();
  655. // Map the controller inputs to Controller::Key codes
  656. buttonInputMap[1] = Controller::Key::BUTTON_A;
  657. buttonInputMap[5] = Controller::Key::BUTTON_X;
  658. buttonInputMap[11] = Controller::Key::BUTTON_SELECT;
  659. buttonInputMap[10] = Controller::Key::BUTTON_START;
  660. buttonInputMap[0] = Controller::Key::BUTTON_B;
  661. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  662. buttonInputMap[2] = Controller::Key::BUTTON_LEFT_SHOULDER;
  663. buttonInputMap[3] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  664. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  665. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  666. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  667. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  668. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  669. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  670. // Add the controller profile to the map
  671. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  672. // Prepare variables:
  673. deviceName = "ControlBlock SNES Gamepad";
  674. buttonInputMap.clear();
  675. axisInputMap.clear();
  676. // Map the controller inputs to Controller::Key codes
  677. buttonInputMap[1] = Controller::Key::BUTTON_A;
  678. buttonInputMap[3] = Controller::Key::BUTTON_X;
  679. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  680. buttonInputMap[7] = Controller::Key::BUTTON_START;
  681. buttonInputMap[0] = Controller::Key::BUTTON_B;
  682. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  683. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  684. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  685. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  686. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  687. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  688. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  689. // Add the controller profile to the map
  690. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  691. // Prepare variables:
  692. deviceName = "ShanWan USB WirelessGamepad ";
  693. buttonInputMap.clear();
  694. axisInputMap.clear();
  695. // Map the controller inputs to Controller::Key codes
  696. buttonInputMap[2] = Controller::Key::BUTTON_A;
  697. buttonInputMap[3] = Controller::Key::BUTTON_X;
  698. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  699. buttonInputMap[9] = Controller::Key::BUTTON_START;
  700. buttonInputMap[1] = Controller::Key::BUTTON_B;
  701. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  702. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  703. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  704. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  705. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  706. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  707. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  708. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  709. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  710. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  711. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  712. // Add the controller profile to the map
  713. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  714. // Prepare variables:
  715. deviceName = "DragonRise Inc. Generic USB Joystick ";
  716. buttonInputMap.clear();
  717. axisInputMap.clear();
  718. // Map the controller inputs to Controller::Key codes
  719. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  720. buttonInputMap[1] = Controller::Key::BUTTON_B;
  721. buttonInputMap[2] = Controller::Key::BUTTON_A;
  722. buttonInputMap[3] = Controller::Key::BUTTON_X;
  723. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  724. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  725. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  726. buttonInputMap[9] = Controller::Key::BUTTON_START;
  727. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  728. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  729. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  730. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  731. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  732. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  733. // Add the controller profile to the map
  734. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  735. // Prepare variables:
  736. deviceName = "DragonRise Inc. PC TWIN SHOCK Gamepad";
  737. buttonInputMap.clear();
  738. axisInputMap.clear();
  739. // Map the controller inputs to Controller::Key codes
  740. buttonInputMap[2] = Controller::Key::BUTTON_A;
  741. buttonInputMap[3] = Controller::Key::BUTTON_X;
  742. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  743. buttonInputMap[9] = Controller::Key::BUTTON_START;
  744. buttonInputMap[1] = Controller::Key::BUTTON_B;
  745. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  746. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  747. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  748. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  749. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  750. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  751. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  752. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  753. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  754. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  755. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  756. // Add the controller profile to the map
  757. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  758. // Prepare variables:
  759. deviceName = "Performance Designed Products EA SPORTS Controller for PS3";
  760. buttonInputMap.clear();
  761. axisInputMap.clear();
  762. // Map the controller inputs to Controller::Key codes
  763. buttonInputMap[1] = Controller::Key::BUTTON_A;
  764. buttonInputMap[0] = Controller::Key::BUTTON_X;
  765. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  766. buttonInputMap[9] = Controller::Key::BUTTON_START;
  767. buttonInputMap[2] = Controller::Key::BUTTON_B;
  768. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  769. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  770. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  771. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  772. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  773. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  774. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  775. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  776. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  777. // Add the controller profile to the map
  778. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  779. // Prepare variables:
  780. deviceName = "USB GAMEPAD 8116";
  781. buttonInputMap.clear();
  782. axisInputMap.clear();
  783. // Map the controller inputs to Controller::Key codes
  784. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  785. buttonInputMap[9] = Controller::Key::BUTTON_START;
  786. buttonInputMap[0] = Controller::Key::BUTTON_B;
  787. buttonInputMap[1] = Controller::Key::BUTTON_A;
  788. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  789. buttonInputMap[3] = Controller::Key::BUTTON_X;
  790. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  791. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  792. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  793. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  794. axisInputMap[4] = Controller::Key::AXIS_LEFT_TRIGGER;
  795. //axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  796. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  797. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  798. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  799. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  800. // Add the controller profile to the map
  801. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  802. // Prepare variables:
  803. deviceName = "G27 Racing Wheel";
  804. buttonInputMap.clear();
  805. axisInputMap.clear();
  806. // Map the controller inputs to Controller::Key codes
  807. buttonInputMap[11] = Controller::Key::BUTTON_SELECT;
  808. buttonInputMap[8] = Controller::Key::BUTTON_START;
  809. buttonInputMap[2] = Controller::Key::BUTTON_B;
  810. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  811. buttonInputMap[7] = Controller::Key::BUTTON_LEFT_SHOULDER;
  812. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  813. buttonInputMap[21] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  814. buttonInputMap[19] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  815. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  816. axisInputMap[5] = Controller::Key::JOYSTICK_LEFT_Y;
  817. //axisInputMap[0] = Controller::Key::JOYSTICK_RIGHT_X;
  818. //axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  819. // Add the controller profile to the map
  820. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  821. // Prepare variables:
  822. deviceName = "Gamegirl Controller";
  823. buttonInputMap.clear();
  824. axisInputMap.clear();
  825. // Map the controller inputs to Controller::Key codes
  826. buttonInputMap[0] = Controller::Key::BUTTON_B;
  827. buttonInputMap[1] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  828. buttonInputMap[2] = Controller::Key::BUTTON_LEFT_SHOULDER;
  829. buttonInputMap[3] = Controller::Key::BUTTON_DPAD_UP;
  830. buttonInputMap[4] = Controller::Key::BUTTON_SELECT;
  831. buttonInputMap[5] = Controller::Key::BUTTON_X;
  832. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  833. buttonInputMap[7] = Controller::Key::BUTTON_Y;
  834. buttonInputMap[8] = Controller::Key::BUTTON_DPAD_RIGHT;
  835. buttonInputMap[9] = Controller::Key::BUTTON_START;
  836. buttonInputMap[10] = Controller::Key::BUTTON_A;
  837. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  838. // Add the controller profile to the map
  839. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  840. // Prepare variables:
  841. deviceName = "Gamtec.,Ltd SmartJoy PLUS Adapter";
  842. buttonInputMap.clear();
  843. axisInputMap.clear();
  844. // Map the controller inputs to Controller::Key codes
  845. buttonInputMap[2] = Controller::Key::BUTTON_A;
  846. buttonInputMap[3] = Controller::Key::BUTTON_X;
  847. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  848. buttonInputMap[8] = Controller::Key::BUTTON_START;
  849. buttonInputMap[1] = Controller::Key::BUTTON_B;
  850. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  851. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  852. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  853. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  854. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  855. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  856. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  857. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  858. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  859. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  860. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  861. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  862. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  863. // Add the controller profile to the map
  864. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  865. // Prepare variables:
  866. deviceName = "Gasia Co.,Ltd PS(R) Gamepad";
  867. buttonInputMap.clear();
  868. axisInputMap.clear();
  869. // Map the controller inputs to Controller::Key codes
  870. buttonInputMap[14] = Controller::Key::BUTTON_A;
  871. buttonInputMap[15] = Controller::Key::BUTTON_X;
  872. buttonInputMap[0] = Controller::Key::BUTTON_SELECT;
  873. buttonInputMap[3] = Controller::Key::BUTTON_START;
  874. buttonInputMap[4] = Controller::Key::BUTTON_DPAD_UP;
  875. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  876. buttonInputMap[7] = Controller::Key::BUTTON_DPAD_LEFT;
  877. buttonInputMap[5] = Controller::Key::BUTTON_DPAD_RIGHT;
  878. buttonInputMap[13] = Controller::Key::BUTTON_B;
  879. buttonInputMap[12] = Controller::Key::BUTTON_Y;
  880. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  881. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  882. buttonInputMap[1] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  883. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  884. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  885. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  886. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  887. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  888. // Add the controller profile to the map
  889. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  890. // Prepare variables:
  891. deviceName = "GEN GAME S3";
  892. buttonInputMap.clear();
  893. axisInputMap.clear();
  894. // Map the controller inputs to Controller::Key codes
  895. buttonInputMap[9] = Controller::Key::BUTTON_A;
  896. buttonInputMap[12] = Controller::Key::BUTTON_X;
  897. buttonInputMap[19] = Controller::Key::BUTTON_SELECT;
  898. buttonInputMap[20] = Controller::Key::BUTTON_START;
  899. buttonInputMap[10] = Controller::Key::BUTTON_B;
  900. buttonInputMap[13] = Controller::Key::BUTTON_Y;
  901. buttonInputMap[15] = Controller::Key::BUTTON_LEFT_SHOULDER;
  902. buttonInputMap[16] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  903. buttonInputMap[22] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  904. buttonInputMap[23] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  905. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  906. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  907. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  908. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  909. // Add the controller profile to the map
  910. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  911. // Prepare variables:
  912. deviceName = "Generic X-Box pad";
  913. buttonInputMap.clear();
  914. axisInputMap.clear();
  915. // Map the controller inputs to Controller::Key codes
  916. buttonInputMap[0] = Controller::Key::BUTTON_A;
  917. buttonInputMap[2] = Controller::Key::BUTTON_X;
  918. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  919. buttonInputMap[7] = Controller::Key::BUTTON_START;
  920. buttonInputMap[1] = Controller::Key::BUTTON_B;
  921. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  922. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  923. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  924. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  925. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  926. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  927. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  928. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  929. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  930. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  931. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  932. // Add the controller profile to the map
  933. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  934. // Prepare variables:
  935. deviceName = "ShanWan Gioteck PS3 Wired Controller";
  936. buttonInputMap.clear();
  937. axisInputMap.clear();
  938. // Map the controller inputs to Controller::Key codes
  939. buttonInputMap[2] = Controller::Key::BUTTON_A;
  940. buttonInputMap[3] = Controller::Key::BUTTON_X;
  941. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  942. buttonInputMap[9] = Controller::Key::BUTTON_START;
  943. buttonInputMap[1] = Controller::Key::BUTTON_B;
  944. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  945. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  946. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  947. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  948. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  949. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  950. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  951. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  952. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  953. // Add the controller profile to the map
  954. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  955. // Prepare variables:
  956. deviceName = "Gravis Destroyer Tiltpad";
  957. buttonInputMap.clear();
  958. axisInputMap.clear();
  959. // Map the controller inputs to Controller::Key codes
  960. buttonInputMap[1] = Controller::Key::BUTTON_A;
  961. buttonInputMap[0] = Controller::Key::BUTTON_X;
  962. buttonInputMap[4] = Controller::Key::BUTTON_SELECT;
  963. buttonInputMap[5] = Controller::Key::BUTTON_START;
  964. buttonInputMap[2] = Controller::Key::BUTTON_B;
  965. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  966. //buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  967. //buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  968. //buttonInputMap[4] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  969. //buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  970. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  971. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  972. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  973. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  974. // Add the controller profile to the map
  975. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  976. // Prepare variables:
  977. deviceName = "GreenAsia Inc. USB Joystick ";
  978. buttonInputMap.clear();
  979. axisInputMap.clear();
  980. // Map the controller inputs to Controller::Key codes
  981. buttonInputMap[2] = Controller::Key::BUTTON_A;
  982. buttonInputMap[3] = Controller::Key::BUTTON_X;
  983. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  984. buttonInputMap[9] = Controller::Key::BUTTON_START;
  985. buttonInputMap[1] = Controller::Key::BUTTON_B;
  986. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  987. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  988. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  989. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  990. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  991. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  992. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  993. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  994. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  995. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  996. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  997. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  998. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  999. // Add the controller profile to the map
  1000. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1001. // Prepare variables:
  1002. deviceName = "GreenAsia Inc. USB Joystick ";
  1003. buttonInputMap.clear();
  1004. axisInputMap.clear();
  1005. // Map the controller inputs to Controller::Key codes
  1006. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1007. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1008. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1009. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1010. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1011. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1012. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1013. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1014. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1015. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1016. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1017. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1018. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1019. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1020. // Add the controller profile to the map
  1021. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1022. // Prepare variables:
  1023. deviceName = "HJZ Mayflash WiiU Pro Game Controller Adapter";
  1024. buttonInputMap.clear();
  1025. axisInputMap.clear();
  1026. // Map the controller inputs to Controller::Key codes
  1027. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1028. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1029. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1030. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1031. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1032. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1033. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1034. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1035. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1036. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1037. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1038. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1039. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1040. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1041. // Add the controller profile to the map
  1042. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1043. // Prepare variables:
  1044. deviceName = "HORI CO.,LTD. Fighting Commander 4";
  1045. buttonInputMap.clear();
  1046. axisInputMap.clear();
  1047. // Map the controller inputs to Controller::Key codes
  1048. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1049. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1050. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1051. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1052. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1053. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1054. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1055. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1056. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1057. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1058. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1059. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1060. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1061. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  1062. // Add the controller profile to the map
  1063. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1064. // Prepare variables:
  1065. deviceName = "HORI CO.,LTD. Fighting Commander";
  1066. buttonInputMap.clear();
  1067. axisInputMap.clear();
  1068. // Map the controller inputs to Controller::Key codes
  1069. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1070. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1071. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1072. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1073. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1074. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1075. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1076. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1077. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1078. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1079. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1080. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1081. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1082. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1083. // Add the controller profile to the map
  1084. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1085. // Prepare variables:
  1086. deviceName = "Hori Fighting Stick EX2";
  1087. buttonInputMap.clear();
  1088. axisInputMap.clear();
  1089. // Map the controller inputs to Controller::Key codes
  1090. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1091. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1092. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1093. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1094. buttonInputMap[0] = Controller::Key::BUTTON_B;
  1095. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  1096. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1097. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1098. // Add the controller profile to the map
  1099. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1100. // Prepare variables:
  1101. deviceName = "HORI CO.,LTD. Fighting Stick mini 4";
  1102. buttonInputMap.clear();
  1103. axisInputMap.clear();
  1104. // Map the controller inputs to Controller::Key codes
  1105. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1106. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1107. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1108. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1109. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1110. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1111. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1112. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1113. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1114. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1115. // Add the controller profile to the map
  1116. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1117. // Prepare variables:
  1118. deviceName = "HORIPAD ONE";
  1119. buttonInputMap.clear();
  1120. axisInputMap.clear();
  1121. // Map the controller inputs to Controller::Key codes
  1122. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1123. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1124. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1125. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1126. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1127. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1128. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1129. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1130. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1131. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1132. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1133. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1134. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1135. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1136. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1137. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1138. // Add the controller profile to the map
  1139. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1140. // Prepare variables:
  1141. deviceName = "HORI CO.,LTD PAD A";
  1142. buttonInputMap.clear();
  1143. axisInputMap.clear();
  1144. // Map the controller inputs to Controller::Key codes
  1145. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1146. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1147. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1148. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1149. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1150. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1151. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1152. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1153. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1154. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1155. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1156. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1157. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1158. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1159. // Add the controller profile to the map
  1160. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1161. // Prepare variables:
  1162. deviceName = "HORI CO.,LTD. REAL ARCADE PRO.3";
  1163. buttonInputMap.clear();
  1164. axisInputMap.clear();
  1165. // Map the controller inputs to Controller::Key codes
  1166. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1167. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1168. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1169. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1170. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1171. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1172. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1173. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1174. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1175. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1176. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1177. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1178. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1179. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1180. // Add the controller profile to the map
  1181. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1182. // Prepare variables:
  1183. deviceName = "HORI CO.,LTD. Real Arcade Pro.4";
  1184. buttonInputMap.clear();
  1185. axisInputMap.clear();
  1186. // Map the controller inputs to Controller::Key codes
  1187. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1188. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1189. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1190. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1191. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1192. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1193. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1194. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1195. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1196. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1197. // Add the controller profile to the map
  1198. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1199. // Prepare variables:
  1200. deviceName = "BUFFALO BSGP1601 Series ";
  1201. buttonInputMap.clear();
  1202. axisInputMap.clear();
  1203. // Map the controller inputs to Controller::Key codes
  1204. buttonInputMap[5] = Controller::Key::BUTTON_A;
  1205. buttonInputMap[4] = Controller::Key::BUTTON_X;
  1206. buttonInputMap[14] = Controller::Key::BUTTON_SELECT;
  1207. buttonInputMap[15] = Controller::Key::BUTTON_START;
  1208. buttonInputMap[3] = Controller::Key::BUTTON_B;
  1209. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  1210. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1211. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1212. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1213. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1214. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1215. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1216. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1217. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1218. // Add the controller profile to the map
  1219. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1220. // Prepare variables:
  1221. deviceName = "USB,2-axis 8-button gamepad";
  1222. buttonInputMap.clear();
  1223. axisInputMap.clear();
  1224. // Map the controller inputs to Controller::Key codes
  1225. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1226. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1227. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1228. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1229. buttonInputMap[0] = Controller::Key::BUTTON_B;
  1230. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  1231. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1232. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1233. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1234. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1235. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1236. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1237. // Add the controller profile to the map
  1238. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1239. // Prepare variables:
  1240. deviceName = "ION iCade";
  1241. buttonInputMap.clear();
  1242. axisInputMap.clear();
  1243. // Map the controller inputs to Controller::Key codes
  1244. buttonInputMap[9] = Controller::Key::BUTTON_A;
  1245. buttonInputMap[6] = Controller::Key::BUTTON_X;
  1246. buttonInputMap[5] = Controller::Key::BUTTON_SELECT;
  1247. buttonInputMap[4] = Controller::Key::BUTTON_START;
  1248. buttonInputMap[0] = Controller::Key::BUTTON_DPAD_UP;
  1249. buttonInputMap[3] = Controller::Key::BUTTON_DPAD_DOWN;
  1250. buttonInputMap[1] = Controller::Key::BUTTON_DPAD_LEFT;
  1251. buttonInputMap[2] = Controller::Key::BUTTON_DPAD_RIGHT;
  1252. buttonInputMap[8] = Controller::Key::BUTTON_B;
  1253. buttonInputMap[7] = Controller::Key::BUTTON_Y;
  1254. buttonInputMap[11] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1255. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1256. // Add the controller profile to the map
  1257. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1258. // Prepare variables:
  1259. deviceName = "ipega classic gamepad";
  1260. buttonInputMap.clear();
  1261. axisInputMap.clear();
  1262. // Map the controller inputs to Controller::Key codes
  1263. buttonInputMap[19] = Controller::Key::BUTTON_SELECT;
  1264. buttonInputMap[20] = Controller::Key::BUTTON_START;
  1265. buttonInputMap[10] = Controller::Key::BUTTON_B;
  1266. buttonInputMap[13] = Controller::Key::BUTTON_Y;
  1267. buttonInputMap[9] = Controller::Key::BUTTON_A;
  1268. buttonInputMap[12] = Controller::Key::BUTTON_X;
  1269. buttonInputMap[15] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1270. buttonInputMap[16] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1271. buttonInputMap[22] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1272. buttonInputMap[23] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1273. axisInputMap[5] = Controller::Key::AXIS_LEFT_TRIGGER;
  1274. axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1275. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1276. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1277. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1278. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1279. // Add the controller profile to the map
  1280. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1281. // Prepare variables:
  1282. deviceName = "Jess Tech Colour Rumble Pad";
  1283. buttonInputMap.clear();
  1284. axisInputMap.clear();
  1285. // Map the controller inputs to Controller::Key codes
  1286. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1287. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1288. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1289. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1290. buttonInputMap[3] = Controller::Key::BUTTON_B;
  1291. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  1292. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1293. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1294. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1295. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1296. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1297. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1298. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1299. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  1300. // Add the controller profile to the map
  1301. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1302. // Prepare variables:
  1303. deviceName = "Jess Tech Dual Analog Rumble Pad";
  1304. buttonInputMap.clear();
  1305. axisInputMap.clear();
  1306. // Map the controller inputs to Controller::Key codes
  1307. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1308. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1309. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1310. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1311. buttonInputMap[3] = Controller::Key::BUTTON_B;
  1312. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  1313. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1314. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1315. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1316. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1317. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1318. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1319. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1320. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  1321. // Add the controller profile to the map
  1322. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1323. // Prepare variables:
  1324. deviceName = "kadevice.com KADE - Kick Ass Dynamic Encoder";
  1325. buttonInputMap.clear();
  1326. axisInputMap.clear();
  1327. // Map the controller inputs to Controller::Key codes
  1328. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1329. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1330. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1331. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1332. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1333. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1334. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1335. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1336. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1337. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1338. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1339. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1340. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1341. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1342. // Add the controller profile to the map
  1343. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1344. // Prepare variables:
  1345. deviceName = "Logic3 Controller";
  1346. buttonInputMap.clear();
  1347. axisInputMap.clear();
  1348. // Map the controller inputs to Controller::Key codes
  1349. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1350. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1351. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1352. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1353. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1354. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1355. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1356. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1357. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1358. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1359. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1360. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1361. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1362. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1363. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1364. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1365. // Add the controller profile to the map
  1366. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1367. // Prepare variables:
  1368. deviceName = "Logitech ChillStream PS3/USB Corded Gamepad";
  1369. buttonInputMap.clear();
  1370. axisInputMap.clear();
  1371. // Map the controller inputs to Controller::Key codes
  1372. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1373. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1374. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1375. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1376. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1377. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1378. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1379. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1380. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1381. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1382. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1383. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1384. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1385. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1386. // Add the controller profile to the map
  1387. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1388. // Prepare variables:
  1389. deviceName = "Logitech Logitech Cordless RumblePad 2";
  1390. buttonInputMap.clear();
  1391. axisInputMap.clear();
  1392. // Map the controller inputs to Controller::Key codes
  1393. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1394. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1395. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1396. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1397. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1398. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1399. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1400. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1401. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1402. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1403. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1404. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1405. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1406. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1407. // Add the controller profile to the map
  1408. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1409. // Prepare variables:
  1410. deviceName = "Logitech Logitech Dual Action";
  1411. buttonInputMap.clear();
  1412. axisInputMap.clear();
  1413. // Map the controller inputs to Controller::Key codes
  1414. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1415. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1416. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1417. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1418. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1419. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1420. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1421. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1422. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1423. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1424. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1425. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1426. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1427. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1428. // Add the controller profile to the map
  1429. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1430. // Prepare variables:
  1431. deviceName = "Logitech Gamepad F310";
  1432. buttonInputMap.clear();
  1433. axisInputMap.clear();
  1434. // Map the controller inputs to Controller::Key codes
  1435. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1436. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1437. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1438. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1439. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1440. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1441. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1442. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1443. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1444. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1445. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1446. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1447. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1448. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1449. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1450. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1451. // Add the controller profile to the map
  1452. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1453. // Prepare variables:
  1454. deviceName = "Logitech Gamepad F510";
  1455. buttonInputMap.clear();
  1456. axisInputMap.clear();
  1457. // Map the controller inputs to Controller::Key codes
  1458. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1459. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1460. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1461. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1462. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1463. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1464. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1465. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1466. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1467. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1468. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1469. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1470. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1471. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1472. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1473. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1474. // Add the controller profile to the map
  1475. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1476. // Prepare variables:
  1477. deviceName = "Logitech Gamepad F710";
  1478. buttonInputMap.clear();
  1479. axisInputMap.clear();
  1480. // Map the controller inputs to Controller::Key codes
  1481. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1482. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1483. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1484. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1485. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1486. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1487. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1488. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1489. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1490. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1491. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1492. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1493. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1494. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1495. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1496. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1497. // Add the controller profile to the map
  1498. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1499. // Prepare variables:
  1500. deviceName = "Logitech Logitech(R) Precision(TM) Gamepad";
  1501. buttonInputMap.clear();
  1502. axisInputMap.clear();
  1503. // Map the controller inputs to Controller::Key codes
  1504. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1505. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1506. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1507. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1508. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1509. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1510. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1511. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1512. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1513. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1514. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1515. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1516. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1517. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1518. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1519. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_Y;
  1520. //axisInputMap[0] = Controller::Key::JOYSTICK_RIGHT_X;
  1521. //axisInputMap[0] = Controller::Key::JOYSTICK_RIGHT_Y;
  1522. // Add the controller profile to the map
  1523. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1524. // Prepare variables:
  1525. deviceName = "Logitech Logitech RumblePad 2 USB";
  1526. buttonInputMap.clear();
  1527. axisInputMap.clear();
  1528. // Map the controller inputs to Controller::Key codes
  1529. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1530. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1531. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1532. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1533. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1534. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1535. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1536. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1537. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1538. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1539. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1540. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1541. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1542. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1543. axisInputMap[4] = Controller::Key::JOYSTICK_LEFT_X;
  1544. //axisInputMap[4] = Controller::Key::JOYSTICK_LEFT_Y;
  1545. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1546. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1547. // Add the controller profile to the map
  1548. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1549. // Prepare variables:
  1550. deviceName = "Logitech WingMan Action Pad";
  1551. buttonInputMap.clear();
  1552. axisInputMap.clear();
  1553. // Map the controller inputs to Controller::Key codes
  1554. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1555. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1556. buttonInputMap[8] = Controller::Key::BUTTON_START;
  1557. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1558. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  1559. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1560. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1561. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1562. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1563. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1564. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1565. // Add the controller profile to the map
  1566. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1567. // Prepare variables:
  1568. deviceName = "Mad catz Inc. Mad Catz FightPad PRO PS3";
  1569. buttonInputMap.clear();
  1570. axisInputMap.clear();
  1571. // Map the controller inputs to Controller::Key codes
  1572. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1573. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1574. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1575. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1576. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1577. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1578. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1579. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1580. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1581. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1582. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1583. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1584. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1585. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1586. // Add the controller profile to the map
  1587. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1588. // Prepare variables:
  1589. deviceName = "Mad catz Inc. Mad Catz FightPad PRO PS4";
  1590. buttonInputMap.clear();
  1591. axisInputMap.clear();
  1592. // Map the controller inputs to Controller::Key codes
  1593. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1594. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1595. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1596. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1597. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1598. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1599. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1600. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1601. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1602. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1603. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1604. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1605. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1606. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  1607. // Add the controller profile to the map
  1608. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1609. // Prepare variables:
  1610. deviceName = "Mad Catz FightStick TE2+ PS3";
  1611. buttonInputMap.clear();
  1612. axisInputMap.clear();
  1613. // Map the controller inputs to Controller::Key codes
  1614. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1615. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1616. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1617. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1618. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1619. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1620. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1621. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1622. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1623. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1624. // Add the controller profile to the map
  1625. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1626. // Prepare variables:
  1627. deviceName = "Mad Catz FightStick TE2+ PS4";
  1628. buttonInputMap.clear();
  1629. axisInputMap.clear();
  1630. // Map the controller inputs to Controller::Key codes
  1631. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1632. buttonInputMap[0] = Controller::Key::BUTTON_X;
  1633. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1634. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1635. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1636. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1637. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1638. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1639. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1640. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1641. // Add the controller profile to the map
  1642. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1643. // Prepare variables:
  1644. deviceName = "Mad Catz Wired Xbox 360 Controller (SFIV)";
  1645. buttonInputMap.clear();
  1646. axisInputMap.clear();
  1647. // Map the controller inputs to Controller::Key codes
  1648. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1649. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1650. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1651. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1652. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1653. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1654. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1655. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1656. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1657. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1658. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1659. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1660. // Add the controller profile to the map
  1661. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1662. // Prepare variables:
  1663. deviceName = "Mad Catz Xbox 360 Controller";
  1664. buttonInputMap.clear();
  1665. axisInputMap.clear();
  1666. // Map the controller inputs to Controller::Key codes
  1667. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1668. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1669. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1670. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1671. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1672. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1673. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1674. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1675. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1676. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1677. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1678. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1679. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1680. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1681. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1682. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1683. // Add the controller profile to the map
  1684. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1685. // Prepare variables:
  1686. deviceName = " MAYFLASH Arcade Fightstick F300";
  1687. buttonInputMap.clear();
  1688. axisInputMap.clear();
  1689. // Map the controller inputs to Controller::Key codes
  1690. buttonInputMap[1] = Controller::Key::BUTTON_A;
  1691. buttonInputMap[4] = Controller::Key::BUTTON_X;
  1692. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  1693. buttonInputMap[11] = Controller::Key::BUTTON_START;
  1694. buttonInputMap[0] = Controller::Key::BUTTON_B;
  1695. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1696. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1697. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1698. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1699. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1700. // Add the controller profile to the map
  1701. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1702. // Prepare variables:
  1703. deviceName = "MAYFLASH Arcade Fightstick F300";
  1704. buttonInputMap.clear();
  1705. axisInputMap.clear();
  1706. // Map the controller inputs to Controller::Key codes
  1707. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1708. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1709. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1710. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1711. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1712. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1713. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1714. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1715. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1716. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1717. // Add the controller profile to the map
  1718. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1719. // Prepare variables:
  1720. deviceName = "HuiJia USB GamePad";
  1721. buttonInputMap.clear();
  1722. axisInputMap.clear();
  1723. // Map the controller inputs to Controller::Key codes
  1724. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1725. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1726. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1727. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_UP;
  1728. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  1729. buttonInputMap[15] = Controller::Key::BUTTON_DPAD_LEFT;
  1730. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_RIGHT;
  1731. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1732. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1733. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1734. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1735. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1736. axisInputMap[3] = Controller::Key::AXIS_LEFT_TRIGGER;
  1737. axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1738. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1739. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1740. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_X;
  1741. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  1742. // Add the controller profile to the map
  1743. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1744. // Prepare variables:
  1745. deviceName = "Mega World Thrustmaster dual analog 3.2";
  1746. buttonInputMap.clear();
  1747. axisInputMap.clear();
  1748. // Map the controller inputs to Controller::Key codes
  1749. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1750. buttonInputMap[1] = Controller::Key::BUTTON_X;
  1751. buttonInputMap[11] = Controller::Key::BUTTON_SELECT;
  1752. buttonInputMap[10] = Controller::Key::BUTTON_START;
  1753. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1754. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1755. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1756. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1757. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1758. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1759. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1760. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1761. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  1762. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  1763. // Add the controller profile to the map
  1764. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1765. // Prepare variables:
  1766. deviceName = "Mega World USB 2-Axis 8-Button Gamepad";
  1767. buttonInputMap.clear();
  1768. axisInputMap.clear();
  1769. // Map the controller inputs to Controller::Key codes
  1770. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1771. buttonInputMap[1] = Controller::Key::BUTTON_X;
  1772. buttonInputMap[5] = Controller::Key::BUTTON_SELECT;
  1773. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1774. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1775. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1776. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1777. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1778. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1779. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1780. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1781. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1782. // Add the controller profile to the map
  1783. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1784. // Prepare variables:
  1785. deviceName = "Microntek USB Joystick ";
  1786. buttonInputMap.clear();
  1787. axisInputMap.clear();
  1788. // Map the controller inputs to Controller::Key codes
  1789. buttonInputMap[2] = Controller::Key::BUTTON_A;
  1790. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1791. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  1792. buttonInputMap[9] = Controller::Key::BUTTON_START;
  1793. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1794. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1795. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1796. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1797. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1798. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1799. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1800. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1801. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1802. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1803. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1804. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1805. // Add the controller profile to the map
  1806. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1807. // Prepare variables:
  1808. deviceName = "Microsoft SideWinder Dual Strike USB version 1.0";
  1809. buttonInputMap.clear();
  1810. axisInputMap.clear();
  1811. // Map the controller inputs to Controller::Key codes
  1812. buttonInputMap[3] = Controller::Key::BUTTON_A;
  1813. buttonInputMap[1] = Controller::Key::BUTTON_X;
  1814. buttonInputMap[5] = Controller::Key::BUTTON_SELECT;
  1815. buttonInputMap[4] = Controller::Key::BUTTON_START;
  1816. buttonInputMap[2] = Controller::Key::BUTTON_B;
  1817. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  1818. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1819. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1820. // Add the controller profile to the map
  1821. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1822. // Prepare variables:
  1823. deviceName = "Microsoft® Microsoft® SideWinder® Game Pad USB";
  1824. buttonInputMap.clear();
  1825. axisInputMap.clear();
  1826. // Map the controller inputs to Controller::Key codes
  1827. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1828. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1829. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  1830. buttonInputMap[8] = Controller::Key::BUTTON_START;
  1831. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1832. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  1833. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1834. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1835. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1836. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1837. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1838. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1839. // Add the controller profile to the map
  1840. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1841. // Prepare variables:
  1842. deviceName = "Microsoft® Microsoft® SideWinder® Plug & Play Game Pad";
  1843. buttonInputMap.clear();
  1844. axisInputMap.clear();
  1845. // Map the controller inputs to Controller::Key codes
  1846. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1847. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1848. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1849. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1850. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1851. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1852. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  1853. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  1854. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  1855. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  1856. // Add the controller profile to the map
  1857. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1858. // Prepare variables:
  1859. deviceName = "Microsoft X-Box 360 pad";
  1860. buttonInputMap.clear();
  1861. axisInputMap.clear();
  1862. // Map the controller inputs to Controller::Key codes
  1863. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1864. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1865. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1866. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1867. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1868. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1869. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1870. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1871. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1872. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1873. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1874. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1875. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1876. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1877. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1878. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1879. // Add the controller profile to the map
  1880. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1881. // Prepare variables:
  1882. deviceName = "Microsoft X-Box One Elite pad";
  1883. buttonInputMap.clear();
  1884. axisInputMap.clear();
  1885. // Map the controller inputs to Controller::Key codes
  1886. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1887. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1888. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1889. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1890. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1891. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1892. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1893. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1894. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1895. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1896. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1897. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1898. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1899. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1900. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1901. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1902. // Add the controller profile to the map
  1903. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1904. // Prepare variables:
  1905. deviceName = "Microsoft X-Box One pad";
  1906. buttonInputMap.clear();
  1907. axisInputMap.clear();
  1908. // Map the controller inputs to Controller::Key codes
  1909. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1910. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1911. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1912. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1913. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1914. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1915. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1916. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1917. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1918. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1919. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1920. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1921. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1922. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1923. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1924. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1925. // Add the controller profile to the map
  1926. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1927. // Prepare variables:
  1928. deviceName = "Microsoft X-Box One pad (Firmware 2015)";
  1929. buttonInputMap.clear();
  1930. axisInputMap.clear();
  1931. // Map the controller inputs to Controller::Key codes
  1932. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1933. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1934. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1935. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1936. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1937. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1938. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1939. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1940. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1941. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1942. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1943. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1944. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1945. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1946. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1947. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1948. // Add the controller profile to the map
  1949. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1950. // Prepare variables:
  1951. deviceName = "Microsoft X-Box One S pad";
  1952. buttonInputMap.clear();
  1953. axisInputMap.clear();
  1954. // Map the controller inputs to Controller::Key codes
  1955. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1956. buttonInputMap[2] = Controller::Key::BUTTON_X;
  1957. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1958. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1959. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1960. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  1961. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1962. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1963. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1964. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1965. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1966. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1967. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1968. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1969. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1970. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1971. // Add the controller profile to the map
  1972. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1973. // Prepare variables:
  1974. deviceName = "Microsoft X-Box pad (Japan)";
  1975. buttonInputMap.clear();
  1976. axisInputMap.clear();
  1977. // Map the controller inputs to Controller::Key codes
  1978. buttonInputMap[0] = Controller::Key::BUTTON_A;
  1979. buttonInputMap[3] = Controller::Key::BUTTON_X;
  1980. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  1981. buttonInputMap[7] = Controller::Key::BUTTON_START;
  1982. buttonInputMap[1] = Controller::Key::BUTTON_B;
  1983. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  1984. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  1985. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  1986. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  1987. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  1988. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  1989. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  1990. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  1991. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  1992. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  1993. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  1994. // Add the controller profile to the map
  1995. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  1996. // Prepare variables:
  1997. deviceName = "Microsoft X-Box pad v1 (US)";
  1998. buttonInputMap.clear();
  1999. axisInputMap.clear();
  2000. // Map the controller inputs to Controller::Key codes
  2001. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2002. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2003. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2004. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2005. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2006. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  2007. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2008. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2009. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2010. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2011. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  2012. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2013. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2014. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2015. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2016. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2017. // Add the controller profile to the map
  2018. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2019. // Prepare variables:
  2020. deviceName = "Microsoft X-Box pad v2 (US)";
  2021. buttonInputMap.clear();
  2022. axisInputMap.clear();
  2023. // Map the controller inputs to Controller::Key codes
  2024. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2025. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2026. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2027. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2028. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2029. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  2030. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2031. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2032. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2033. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2034. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  2035. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2036. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2037. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2038. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2039. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2040. // Add the controller profile to the map
  2041. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2042. // Prepare variables:
  2043. deviceName = "MOCUTE-032_B43-0F1E";
  2044. buttonInputMap.clear();
  2045. axisInputMap.clear();
  2046. // Map the controller inputs to Controller::Key codes
  2047. buttonInputMap[13] = Controller::Key::BUTTON_A;
  2048. buttonInputMap[15] = Controller::Key::BUTTON_X;
  2049. //buttonInputMap[] = Controller::Key::BUTTON_SELECT;
  2050. buttonInputMap[21] = Controller::Key::BUTTON_START;
  2051. buttonInputMap[12] = Controller::Key::BUTTON_B;
  2052. buttonInputMap[14] = Controller::Key::BUTTON_Y;
  2053. buttonInputMap[19] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2054. buttonInputMap[17] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2055. //buttonInputMap[] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2056. //buttonInputMap[] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2057. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2058. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2059. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2060. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2061. //axisInputMap[] = Controller::Key::JOYSTICK_LEFT_X;
  2062. //axisInputMap[] = Controller::Key::JOYSTICK_LEFT_Y;
  2063. //axisInputMap[] = Controller::Key::JOYSTICK_RIGHT_X;
  2064. //axisInputMap[] = Controller::Key::JOYSTICK_RIGHT_Y;
  2065. // Add the controller profile to the map
  2066. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2067. // Prepare variables:
  2068. deviceName = "MOSIC SPEED-LINK Competition Pro ";
  2069. buttonInputMap.clear();
  2070. axisInputMap.clear();
  2071. // Map the controller inputs to Controller::Key codes
  2072. buttonInputMap[0] = Controller::Key::BUTTON_B;
  2073. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2074. buttonInputMap[1] = Controller::Key::BUTTON_START;
  2075. buttonInputMap[3] = Controller::Key::BUTTON_SELECT;
  2076. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2077. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2078. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2079. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2080. // Add the controller profile to the map
  2081. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2082. // Prepare variables:
  2083. deviceName = "MOSIC USB 2A8K GamePad ";
  2084. buttonInputMap.clear();
  2085. axisInputMap.clear();
  2086. // Map the controller inputs to Controller::Key codes
  2087. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2088. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2089. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2090. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2091. buttonInputMap[3] = Controller::Key::BUTTON_B;
  2092. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  2093. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2094. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2095. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2096. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2097. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2098. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2099. // Add the controller profile to the map
  2100. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2101. // Prepare variables:
  2102. deviceName = "WiseGroup.,Ltd MP-8800 Quad USB Joypad";
  2103. buttonInputMap.clear();
  2104. axisInputMap.clear();
  2105. // Map the controller inputs to Controller::Key codes
  2106. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2107. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2108. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  2109. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2110. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2111. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2112. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2113. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2114. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2115. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2116. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2117. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2118. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2119. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2120. // Add the controller profile to the map
  2121. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2122. // Prepare variables:
  2123. deviceName = "WiseGroup.,Ltd MP-8866 Dual USB Joypad";
  2124. buttonInputMap.clear();
  2125. axisInputMap.clear();
  2126. // Map the controller inputs to Controller::Key codes
  2127. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2128. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2129. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  2130. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2131. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2132. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2133. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2134. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2135. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2136. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2137. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2138. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2139. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2140. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2141. // Add the controller profile to the map
  2142. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2143. // Prepare variables:
  2144. deviceName = "MY-POWER CO.,LTD. 2In1 USB Joystick";
  2145. buttonInputMap.clear();
  2146. axisInputMap.clear();
  2147. // Map the controller inputs to Controller::Key codes
  2148. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2149. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2150. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2151. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2152. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2153. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2154. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2155. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2156. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2157. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2158. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2159. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2160. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2161. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2162. // Add the controller profile to the map
  2163. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2164. // Prepare variables:
  2165. deviceName = "Nintendo Clovercon - controller1";
  2166. buttonInputMap.clear();
  2167. axisInputMap.clear();
  2168. // Map the controller inputs to Controller::Key codes
  2169. buttonInputMap[0] = Controller::Key::BUTTON_B;
  2170. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2171. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  2172. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2173. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2174. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2175. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2176. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2177. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  2178. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_RIGHT;
  2179. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  2180. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  2181. // Add the controller profile to the map
  2182. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2183. // Prepare variables:
  2184. deviceName = "Nintendo Clovercon - controller2";
  2185. buttonInputMap.clear();
  2186. axisInputMap.clear();
  2187. // Map the controller inputs to Controller::Key codes
  2188. buttonInputMap[0] = Controller::Key::BUTTON_B;
  2189. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2190. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  2191. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2192. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2193. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2194. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2195. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2196. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  2197. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_RIGHT;
  2198. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  2199. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  2200. // Add the controller profile to the map
  2201. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2202. // Prepare variables:
  2203. deviceName = "Nintendo Wii Remote Pro Controller";
  2204. buttonInputMap.clear();
  2205. axisInputMap.clear();
  2206. // Map the controller inputs to Controller::Key codes
  2207. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2208. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2209. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2210. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2211. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  2212. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  2213. buttonInputMap[15] = Controller::Key::BUTTON_DPAD_LEFT;
  2214. buttonInputMap[16] = Controller::Key::BUTTON_DPAD_RIGHT;
  2215. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2216. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  2217. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2218. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2219. buttonInputMap[11] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2220. buttonInputMap[12] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2221. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2222. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2223. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2224. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2225. // Add the controller profile to the map
  2226. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2227. // Prepare variables:
  2228. deviceName = "Nintendo Wii Remote";
  2229. buttonInputMap.clear();
  2230. axisInputMap.clear();
  2231. // Map the controller inputs to Controller::Key codes
  2232. buttonInputMap[4] = Controller::Key::BUTTON_A;
  2233. buttonInputMap[7] = Controller::Key::BUTTON_X;
  2234. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  2235. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2236. buttonInputMap[2] = Controller::Key::BUTTON_DPAD_UP;
  2237. buttonInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2238. buttonInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2239. buttonInputMap[3] = Controller::Key::BUTTON_DPAD_RIGHT;
  2240. buttonInputMap[5] = Controller::Key::BUTTON_B;
  2241. buttonInputMap[6] = Controller::Key::BUTTON_Y;
  2242. // Add the controller profile to the map
  2243. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2244. // Prepare variables:
  2245. deviceName = "Nintendo Wii Remote Classic Controller";
  2246. buttonInputMap.clear();
  2247. axisInputMap.clear();
  2248. // Map the controller inputs to Controller::Key codes
  2249. buttonInputMap[5] = Controller::Key::BUTTON_A;
  2250. buttonInputMap[7] = Controller::Key::BUTTON_X;
  2251. buttonInputMap[14] = Controller::Key::BUTTON_SELECT;
  2252. buttonInputMap[13] = Controller::Key::BUTTON_START;
  2253. buttonInputMap[0] = Controller::Key::BUTTON_DPAD_UP;
  2254. buttonInputMap[3] = Controller::Key::BUTTON_DPAD_DOWN;
  2255. buttonInputMap[1] = Controller::Key::BUTTON_DPAD_LEFT;
  2256. buttonInputMap[2] = Controller::Key::BUTTON_DPAD_RIGHT;
  2257. buttonInputMap[4] = Controller::Key::BUTTON_B;
  2258. buttonInputMap[6] = Controller::Key::BUTTON_Y;
  2259. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2260. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2261. // Add the controller profile to the map
  2262. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2263. // Prepare variables:
  2264. deviceName = "NVIDIA Corporation NVIDIA Controller v01.04";
  2265. buttonInputMap.clear();
  2266. axisInputMap.clear();
  2267. // Map the controller inputs to Controller::Key codes
  2268. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2269. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2270. buttonInputMap[6] = Controller::Key::BUTTON_START;
  2271. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2272. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2273. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2274. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2275. buttonInputMap[7] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2276. buttonInputMap[8] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2277. axisInputMap[5] = Controller::Key::AXIS_LEFT_TRIGGER;
  2278. axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2279. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2280. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2281. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2282. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2283. // Add the controller profile to the map
  2284. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2285. // Prepare variables:
  2286. deviceName = "NVIDIA Corporation NVIDIA Controller v01.03";
  2287. buttonInputMap.clear();
  2288. axisInputMap.clear();
  2289. // Map the controller inputs to Controller::Key codes
  2290. buttonInputMap[4] = Controller::Key::BUTTON_A;
  2291. buttonInputMap[6] = Controller::Key::BUTTON_X;
  2292. buttonInputMap[3] = Controller::Key::BUTTON_SELECT;
  2293. buttonInputMap[11] = Controller::Key::BUTTON_START;
  2294. buttonInputMap[5] = Controller::Key::BUTTON_B;
  2295. buttonInputMap[7] = Controller::Key::BUTTON_Y;
  2296. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2297. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2298. buttonInputMap[12] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2299. buttonInputMap[13] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2300. axisInputMap[5] = Controller::Key::AXIS_LEFT_TRIGGER;
  2301. axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2302. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2303. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2304. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2305. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2306. // Add the controller profile to the map
  2307. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2308. // Prepare variables:
  2309. deviceName = "OUYA Game Controller";
  2310. buttonInputMap.clear();
  2311. axisInputMap.clear();
  2312. // Map the controller inputs to Controller::Key codes
  2313. buttonInputMap[3] = Controller::Key::BUTTON_A;
  2314. buttonInputMap[4] = Controller::Key::BUTTON_X;
  2315. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  2316. buttonInputMap[10] = Controller::Key::BUTTON_START;
  2317. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_UP;
  2318. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_DOWN;
  2319. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_LEFT;
  2320. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_RIGHT;
  2321. buttonInputMap[6] = Controller::Key::BUTTON_B;
  2322. buttonInputMap[5] = Controller::Key::BUTTON_Y;
  2323. buttonInputMap[7] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2324. buttonInputMap[8] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2325. //buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2326. //buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2327. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2328. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2329. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2330. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2331. // Add the controller profile to the map
  2332. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2333. // Prepare variables:
  2334. deviceName = "USB,4-Axis,12-Button with POV";
  2335. buttonInputMap.clear();
  2336. axisInputMap.clear();
  2337. // Map the controller inputs to Controller::Key codes
  2338. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2339. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2340. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2341. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2342. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2343. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2344. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2345. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2346. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2347. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2348. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2349. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2350. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2351. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2352. // Add the controller profile to the map
  2353. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2354. // Prepare variables:
  2355. deviceName = "playsega controller";
  2356. buttonInputMap.clear();
  2357. axisInputMap.clear();
  2358. // Map the controller inputs to Controller::Key codes
  2359. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2360. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2361. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2362. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2363. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  2364. buttonInputMap[3] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2365. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2366. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2367. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2368. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2369. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2370. // Add the controller profile to the map
  2371. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2372. // Prepare variables:
  2373. deviceName = "PLAYSTATION(R)3Conteroller-PANHAI";
  2374. buttonInputMap.clear();
  2375. axisInputMap.clear();
  2376. // Map the controller inputs to Controller::Key codes
  2377. buttonInputMap[14] = Controller::Key::BUTTON_A;
  2378. buttonInputMap[15] = Controller::Key::BUTTON_X;
  2379. buttonInputMap[0] = Controller::Key::BUTTON_SELECT;
  2380. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2381. buttonInputMap[4] = Controller::Key::BUTTON_DPAD_UP;
  2382. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  2383. buttonInputMap[7] = Controller::Key::BUTTON_DPAD_LEFT;
  2384. buttonInputMap[5] = Controller::Key::BUTTON_DPAD_RIGHT;
  2385. buttonInputMap[13] = Controller::Key::BUTTON_B;
  2386. buttonInputMap[12] = Controller::Key::BUTTON_Y;
  2387. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2388. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2389. buttonInputMap[1] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2390. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2391. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2392. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2393. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2394. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2395. // Add the controller profile to the map
  2396. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2397. // Prepare variables:
  2398. deviceName = "Pro Controller";
  2399. buttonInputMap.clear();
  2400. axisInputMap.clear();
  2401. // Map the controller inputs to Controller::Key codes
  2402. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2403. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2404. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2405. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2406. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2407. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2408. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2409. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2410. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2411. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2412. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2413. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2414. // Add the controller profile to the map
  2415. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2416. // Prepare variables:
  2417. deviceName = "Qnyx Snes Replica";
  2418. buttonInputMap.clear();
  2419. axisInputMap.clear();
  2420. // Map the controller inputs to Controller::Key codes
  2421. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2422. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2423. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2424. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2425. //buttonInputMap[] = Controller::Key::BUTTON_DPAD_UP;
  2426. //buttonInputMap[] = Controller::Key::BUTTON_DPAD_DOWN;
  2427. //buttonInputMap[] = Controller::Key::BUTTON_DPAD_LEFT;
  2428. //buttonInputMap[] = Controller::Key::BUTTON_DPAD_RIGHT;
  2429. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2430. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2431. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2432. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2433. //buttonInputMap[] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2434. //buttonInputMap[] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2435. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2436. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2437. //axisInputMap[] = Controller::Key::JOYSTICK_RIGHT_X;
  2438. //axisInputMap[] = Controller::Key::JOYSTICK_RIGHT_Y;
  2439. // Add the controller profile to the map
  2440. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2441. // Prepare variables:
  2442. deviceName = "raphnet.net 4nes4snes";
  2443. buttonInputMap.clear();
  2444. axisInputMap.clear();
  2445. // Map the controller inputs to Controller::Key codes
  2446. buttonInputMap[4] = Controller::Key::BUTTON_START;
  2447. buttonInputMap[5] = Controller::Key::BUTTON_SELECT;
  2448. buttonInputMap[6] = Controller::Key::BUTTON_A;
  2449. buttonInputMap[7] = Controller::Key::BUTTON_B;
  2450. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2451. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2452. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2453. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2454. // Add the controller profile to the map
  2455. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2456. // Prepare variables:
  2457. deviceName = "raphnet.net Saturn_Adapter_2.0";
  2458. buttonInputMap.clear();
  2459. axisInputMap.clear();
  2460. // Map the controller inputs to Controller::Key codes
  2461. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2462. buttonInputMap[1] = Controller::Key::BUTTON_X;
  2463. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2464. buttonInputMap[5] = Controller::Key::BUTTON_B;
  2465. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2466. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2467. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2468. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2469. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2470. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2471. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2472. // Add the controller profile to the map
  2473. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2474. // Prepare variables:
  2475. deviceName = "Razer Serval";
  2476. buttonInputMap.clear();
  2477. axisInputMap.clear();
  2478. // Map the controller inputs to Controller::Key codes
  2479. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2480. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2481. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2482. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2483. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2484. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2485. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2486. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2487. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2488. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2489. axisInputMap[5] = Controller::Key::AXIS_LEFT_TRIGGER;
  2490. axisInputMap[4] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2491. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2492. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2493. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2494. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2495. // Add the controller profile to the map
  2496. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2497. // Prepare variables:
  2498. deviceName = "Retrolink Nintento 64 Classic USB";
  2499. buttonInputMap.clear();
  2500. axisInputMap.clear();
  2501. // Map the controller inputs to Controller::Key codes
  2502. buttonInputMap[8] = Controller::Key::BUTTON_A;
  2503. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2504. buttonInputMap[6] = Controller::Key::BUTTON_B;
  2505. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2506. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2507. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2508. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2509. // Add the controller profile to the map
  2510. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2511. // Prepare variables:
  2512. deviceName = "retronicdesign.com Sega Joypad Adapter v3.0";
  2513. buttonInputMap.clear();
  2514. axisInputMap.clear();
  2515. // Map the controller inputs to Controller::Key codes
  2516. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2517. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2518. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2519. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2520. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2521. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2522. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2523. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2524. // Add the controller profile to the map
  2525. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2526. // Prepare variables:
  2527. deviceName = "RetroUSB.com RetroPad";
  2528. buttonInputMap.clear();
  2529. axisInputMap.clear();
  2530. // Map the controller inputs to Controller::Key codes
  2531. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2532. buttonInputMap[2] = Controller::Key::BUTTON_SELECT;
  2533. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2534. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2535. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2536. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2537. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2538. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2539. // Add the controller profile to the map
  2540. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2541. // Prepare variables:
  2542. deviceName = "RetroUSB.com SNES RetroPort";
  2543. buttonInputMap.clear();
  2544. axisInputMap.clear();
  2545. // Map the controller inputs to Controller::Key codes
  2546. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2547. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2548. buttonInputMap[2] = Controller::Key::BUTTON_SELECT;
  2549. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2550. buttonInputMap[5] = Controller::Key::BUTTON_B;
  2551. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  2552. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2553. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2554. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2555. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2556. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2557. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2558. // Add the controller profile to the map
  2559. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2560. // Prepare variables:
  2561. deviceName = "Rock Candy Gamepad for PS3";
  2562. buttonInputMap.clear();
  2563. axisInputMap.clear();
  2564. // Map the controller inputs to Controller::Key codes
  2565. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2566. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2567. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2568. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2569. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2570. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2571. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2572. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2573. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2574. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2575. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2576. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2577. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2578. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2579. // Add the controller profile to the map
  2580. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2581. // Prepare variables:
  2582. deviceName = "Saitek Cyborg Rumble Pad";
  2583. buttonInputMap.clear();
  2584. axisInputMap.clear();
  2585. // Map the controller inputs to Controller::Key codes
  2586. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2587. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2588. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2589. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2590. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2591. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2592. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2593. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2594. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  2595. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2596. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2597. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2598. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2599. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2600. // Add the controller profile to the map
  2601. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2602. // Prepare variables:
  2603. deviceName = "SAITEK P880";
  2604. buttonInputMap.clear();
  2605. axisInputMap.clear();
  2606. // Map the controller inputs to Controller::Key codes
  2607. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2608. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2609. buttonInputMap[4] = Controller::Key::BUTTON_SELECT;
  2610. buttonInputMap[5] = Controller::Key::BUTTON_START;
  2611. buttonInputMap[3] = Controller::Key::BUTTON_B;
  2612. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  2613. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2614. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2615. buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2616. buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2617. axisInputMap[5] = Controller::Key::BUTTON_DPAD_UP;
  2618. //axisInputMap[5] = Controller::Key::BUTTON_DPAD_DOWN;
  2619. axisInputMap[4] = Controller::Key::BUTTON_DPAD_LEFT;
  2620. //axisInputMap[4] = Controller::Key::BUTTON_DPAD_RIGHT;
  2621. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2622. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2623. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2624. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  2625. // Add the controller profile to the map
  2626. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2627. // Prepare variables:
  2628. deviceName = "Saitek P990 Dual Analog Pad";
  2629. buttonInputMap.clear();
  2630. axisInputMap.clear();
  2631. // Map the controller inputs to Controller::Key codes
  2632. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2633. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2634. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  2635. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2636. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2637. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2638. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2639. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2640. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2641. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2642. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2643. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2644. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2645. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2646. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2647. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  2648. // Add the controller profile to the map
  2649. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2650. // Prepare variables:
  2651. deviceName = "Saitek PLC Saitek P2600 Rumble Force Pad";
  2652. buttonInputMap.clear();
  2653. axisInputMap.clear();
  2654. // Map the controller inputs to Controller::Key codes
  2655. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2656. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2657. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  2658. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2659. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2660. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2661. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2662. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2663. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2664. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2665. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2666. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  2667. // Add the controller profile to the map
  2668. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2669. // Prepare variables:
  2670. deviceName = "Saitek Saitek X52 Flight Control System";
  2671. buttonInputMap.clear();
  2672. axisInputMap.clear();
  2673. // Map the controller inputs to Controller::Key codes
  2674. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2675. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2676. buttonInputMap[30] = Controller::Key::BUTTON_SELECT;
  2677. buttonInputMap[6] = Controller::Key::BUTTON_START;
  2678. buttonInputMap[0] = Controller::Key::BUTTON_B;
  2679. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2680. buttonInputMap[18] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2681. buttonInputMap[16] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2682. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2683. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2684. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_X;
  2685. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  2686. // Add the controller profile to the map
  2687. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2688. // Prepare variables:
  2689. deviceName = "Samsung Game Pad EI-GP20";
  2690. buttonInputMap.clear();
  2691. axisInputMap.clear();
  2692. // Map the controller inputs to Controller::Key codes
  2693. buttonInputMap[11] = Controller::Key::BUTTON_A;
  2694. buttonInputMap[14] = Controller::Key::BUTTON_X;
  2695. buttonInputMap[21] = Controller::Key::BUTTON_SELECT;
  2696. buttonInputMap[22] = Controller::Key::BUTTON_START;
  2697. buttonInputMap[12] = Controller::Key::BUTTON_B;
  2698. buttonInputMap[15] = Controller::Key::BUTTON_Y;
  2699. buttonInputMap[17] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2700. buttonInputMap[18] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2701. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2702. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2703. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2704. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2705. // Add the controller profile to the map
  2706. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2707. // Prepare variables:
  2708. deviceName = "CYPRESS USB Gamepad";
  2709. buttonInputMap.clear();
  2710. axisInputMap.clear();
  2711. // Map the controller inputs to Controller::Key codes
  2712. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2713. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2714. buttonInputMap[8] = Controller::Key::BUTTON_START;
  2715. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2716. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2717. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2718. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2719. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2720. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2721. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2722. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2723. // Add the controller profile to the map
  2724. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2725. // Prepare variables:
  2726. deviceName = "Smartjoy Family Super Smartjoy 2";
  2727. buttonInputMap.clear();
  2728. axisInputMap.clear();
  2729. // Map the controller inputs to Controller::Key codes
  2730. buttonInputMap[2] = Controller::Key::BUTTON_A;
  2731. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2732. buttonInputMap[4] = Controller::Key::BUTTON_SELECT;
  2733. buttonInputMap[5] = Controller::Key::BUTTON_START;
  2734. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2735. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  2736. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2737. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2738. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2739. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2740. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2741. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2742. // Add the controller profile to the map
  2743. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2744. // Prepare variables:
  2745. deviceName = "SNES-to-Gamepad Device";
  2746. buttonInputMap.clear();
  2747. axisInputMap.clear();
  2748. // Map the controller inputs to Controller::Key codes
  2749. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2750. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2751. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2752. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2753. buttonInputMap[0] = Controller::Key::BUTTON_B;
  2754. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  2755. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2756. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2757. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2758. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2759. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2760. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2761. // Add the controller profile to the map
  2762. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2763. // Prepare variables:
  2764. deviceName = "PLAYSTATION(R)3 Controller";
  2765. buttonInputMap.clear();
  2766. axisInputMap.clear();
  2767. // Map the controller inputs to Controller::Key codes
  2768. buttonInputMap[14] = Controller::Key::BUTTON_A;
  2769. buttonInputMap[15] = Controller::Key::BUTTON_X;
  2770. buttonInputMap[0] = Controller::Key::BUTTON_SELECT;
  2771. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2772. buttonInputMap[4] = Controller::Key::BUTTON_DPAD_UP;
  2773. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  2774. buttonInputMap[7] = Controller::Key::BUTTON_DPAD_LEFT;
  2775. buttonInputMap[5] = Controller::Key::BUTTON_DPAD_RIGHT;
  2776. buttonInputMap[13] = Controller::Key::BUTTON_B;
  2777. buttonInputMap[12] = Controller::Key::BUTTON_Y;
  2778. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2779. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2780. buttonInputMap[1] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2781. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2782. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2783. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2784. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2785. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2786. // Add the controller profile to the map
  2787. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2788. // Prepare variables:
  2789. deviceName = "Sony Computer Entertainment Wireless Controller";
  2790. buttonInputMap.clear();
  2791. axisInputMap.clear();
  2792. // Map the controller inputs to Controller::Key codes
  2793. buttonInputMap[14] = Controller::Key::BUTTON_A;
  2794. buttonInputMap[15] = Controller::Key::BUTTON_X;
  2795. buttonInputMap[0] = Controller::Key::BUTTON_SELECT;
  2796. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2797. buttonInputMap[4] = Controller::Key::BUTTON_DPAD_UP;
  2798. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  2799. buttonInputMap[7] = Controller::Key::BUTTON_DPAD_LEFT;
  2800. buttonInputMap[5] = Controller::Key::BUTTON_DPAD_RIGHT;
  2801. buttonInputMap[13] = Controller::Key::BUTTON_B;
  2802. buttonInputMap[12] = Controller::Key::BUTTON_Y;
  2803. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2804. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2805. buttonInputMap[1] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2806. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2807. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2808. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2809. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2810. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2811. // Add the controller profile to the map
  2812. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2813. // Prepare variables:
  2814. deviceName = "Sony PLAYSTATION(R)3 Controller";
  2815. buttonInputMap.clear();
  2816. axisInputMap.clear();
  2817. // Map the controller inputs to Controller::Key codes
  2818. buttonInputMap[14] = Controller::Key::BUTTON_A;
  2819. buttonInputMap[15] = Controller::Key::BUTTON_X;
  2820. buttonInputMap[0] = Controller::Key::BUTTON_SELECT;
  2821. buttonInputMap[3] = Controller::Key::BUTTON_START;
  2822. buttonInputMap[4] = Controller::Key::BUTTON_DPAD_UP;
  2823. buttonInputMap[6] = Controller::Key::BUTTON_DPAD_DOWN;
  2824. buttonInputMap[7] = Controller::Key::BUTTON_DPAD_LEFT;
  2825. buttonInputMap[5] = Controller::Key::BUTTON_DPAD_RIGHT;
  2826. buttonInputMap[13] = Controller::Key::BUTTON_B;
  2827. buttonInputMap[12] = Controller::Key::BUTTON_Y;
  2828. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2829. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2830. buttonInputMap[1] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2831. buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2832. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2833. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2834. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2835. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2836. // Add the controller profile to the map
  2837. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2838. // Prepare variables:
  2839. deviceName = "Wireless Controller";
  2840. buttonInputMap.clear();
  2841. axisInputMap.clear();
  2842. // Map the controller inputs to Controller::Key codes
  2843. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2844. buttonInputMap[3] = Controller::Key::BUTTON_X;
  2845. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2846. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2847. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2848. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  2849. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2850. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2851. buttonInputMap[11] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2852. buttonInputMap[12] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2853. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2854. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2855. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2856. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2857. // Add the controller profile to the map
  2858. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2859. // Prepare variables:
  2860. deviceName = "Sony Interactive Entertainment Wireless Controller";
  2861. buttonInputMap.clear();
  2862. axisInputMap.clear();
  2863. // Map the controller inputs to Controller::Key codes
  2864. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2865. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2866. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2867. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2868. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2869. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2870. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2871. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2872. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2873. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2874. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2875. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2876. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2877. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  2878. // Add the controller profile to the map
  2879. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2880. // Prepare variables:
  2881. deviceName = "Steam Controller";
  2882. buttonInputMap.clear();
  2883. axisInputMap.clear();
  2884. // Map the controller inputs to Controller::Key codes
  2885. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2886. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2887. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2888. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2889. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2890. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2891. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2892. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2893. //buttonInputMap[0] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2894. //buttonInputMap[2] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2895. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2896. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2897. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2898. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2899. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  2900. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2901. axisInputMap[6] = Controller::Key::JOYSTICK_LEFT_X;
  2902. axisInputMap[7] = Controller::Key::JOYSTICK_LEFT_Y;
  2903. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  2904. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  2905. // Add the controller profile to the map
  2906. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2907. // Prepare variables:
  2908. deviceName = "Street Fighter IV FightPad";
  2909. buttonInputMap.clear();
  2910. axisInputMap.clear();
  2911. // Map the controller inputs to Controller::Key codes
  2912. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2913. buttonInputMap[2] = Controller::Key::BUTTON_X;
  2914. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  2915. buttonInputMap[7] = Controller::Key::BUTTON_START;
  2916. buttonInputMap[1] = Controller::Key::BUTTON_B;
  2917. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2918. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2919. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  2920. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  2921. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  2922. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  2923. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2924. //axisInputMap[DPad Up] = Controller::Key::BUTTON_DPAD_UP;
  2925. //axisInputMap[DPad Down] = Controller::Key::BUTTON_DPAD_DOWN;
  2926. //axisInputMap[DPad Left] = Controller::Key::BUTTON_DPAD_LEFT;
  2927. //axisInputMap[DPad Right] = Controller::Key::BUTTON_DPAD_RIGHT;
  2928. //axisInputMap[Right Trigger] = Controller::Key::AXIS_RIGHT_TRIGGER;
  2929. // Add the controller profile to the map
  2930. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2931. // Prepare variables:
  2932. deviceName = "Thrustmaster Dual Trigger 3-in-1";
  2933. buttonInputMap.clear();
  2934. axisInputMap.clear();
  2935. // Map the controller inputs to Controller::Key codes
  2936. buttonInputMap[1] = Controller::Key::BUTTON_A;
  2937. buttonInputMap[0] = Controller::Key::BUTTON_X;
  2938. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2939. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2940. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2941. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2942. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2943. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2944. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2945. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2946. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2947. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2948. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2949. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  2950. // Add the controller profile to the map
  2951. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2952. // Prepare variables:
  2953. deviceName = "THRUSTMASTER FireStorm Dual Analog 2";
  2954. buttonInputMap.clear();
  2955. axisInputMap.clear();
  2956. // Map the controller inputs to Controller::Key codes
  2957. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2958. buttonInputMap[1] = Controller::Key::BUTTON_X;
  2959. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2960. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2961. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2962. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2963. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2964. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2965. //buttonInputMap[8] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2966. //buttonInputMap[9] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2967. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2968. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2969. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2970. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2971. // Add the controller profile to the map
  2972. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2973. // Prepare variables:
  2974. deviceName = "THRUSTMASTER FireStorm Dual Power 2 ";
  2975. buttonInputMap.clear();
  2976. axisInputMap.clear();
  2977. // Map the controller inputs to Controller::Key codes
  2978. buttonInputMap[0] = Controller::Key::BUTTON_A;
  2979. buttonInputMap[1] = Controller::Key::BUTTON_X;
  2980. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  2981. buttonInputMap[9] = Controller::Key::BUTTON_START;
  2982. buttonInputMap[2] = Controller::Key::BUTTON_B;
  2983. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  2984. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  2985. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  2986. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  2987. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  2988. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  2989. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  2990. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  2991. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  2992. // Add the controller profile to the map
  2993. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  2994. // Prepare variables:
  2995. deviceName = "Thrustmaster T Mini";
  2996. buttonInputMap.clear();
  2997. axisInputMap.clear();
  2998. // Map the controller inputs to Controller::Key codes
  2999. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3000. buttonInputMap[1] = Controller::Key::BUTTON_X;
  3001. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3002. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3003. buttonInputMap[2] = Controller::Key::BUTTON_B;
  3004. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3005. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3006. buttonInputMap[6] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3007. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3008. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3009. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3010. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3011. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3012. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3013. // Add the controller profile to the map
  3014. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3015. // Prepare variables:
  3016. deviceName = "Thrustmaster T Mini Wireless";
  3017. buttonInputMap.clear();
  3018. axisInputMap.clear();
  3019. // Map the controller inputs to Controller::Key codes
  3020. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3021. buttonInputMap[0] = Controller::Key::BUTTON_X;
  3022. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3023. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3024. buttonInputMap[2] = Controller::Key::BUTTON_B;
  3025. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3026. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3027. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3028. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3029. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3030. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3031. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3032. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3033. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3034. // Add the controller profile to the map
  3035. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3036. // Prepare variables:
  3037. deviceName = "THRUSTMASTER Top Gun Fox 2 Pro ";
  3038. buttonInputMap.clear();
  3039. axisInputMap.clear();
  3040. // Map the controller inputs to Controller::Key codes
  3041. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3042. buttonInputMap[6] = Controller::Key::BUTTON_X;
  3043. buttonInputMap[0] = Controller::Key::BUTTON_B;
  3044. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3045. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3046. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3047. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3048. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3049. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3050. // Add the controller profile to the map
  3051. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3052. // Prepare variables:
  3053. deviceName = "PC Game Controller ";
  3054. buttonInputMap.clear();
  3055. axisInputMap.clear();
  3056. // Map the controller inputs to Controller::Key codes
  3057. buttonInputMap[4] = Controller::Key::BUTTON_A;
  3058. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3059. buttonInputMap[5] = Controller::Key::BUTTON_B;
  3060. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3061. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3062. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3063. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3064. // Add the controller profile to the map
  3065. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3066. // Prepare variables:
  3067. deviceName = "TOMMO NEOGEOX Arcade Stick";
  3068. buttonInputMap.clear();
  3069. axisInputMap.clear();
  3070. // Map the controller inputs to Controller::Key codes
  3071. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3072. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3073. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3074. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3075. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3076. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  3077. // Add the controller profile to the map
  3078. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3079. // Prepare variables:
  3080. deviceName = "Toodles 2008 ChImp PC/PS3 Controller";
  3081. buttonInputMap.clear();
  3082. axisInputMap.clear();
  3083. // Map the controller inputs to Controller::Key codes
  3084. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3085. buttonInputMap[0] = Controller::Key::BUTTON_X;
  3086. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3087. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3088. buttonInputMap[2] = Controller::Key::BUTTON_B;
  3089. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3090. buttonInputMap[5] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3091. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3092. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3093. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3094. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3095. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3096. // Add the controller profile to the map
  3097. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3098. // Prepare variables:
  3099. deviceName = "Twin USB Joystick";
  3100. buttonInputMap.clear();
  3101. axisInputMap.clear();
  3102. // Map the controller inputs to Controller::Key codes
  3103. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3104. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3105. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3106. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3107. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3108. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3109. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3110. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3111. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3112. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3113. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3114. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3115. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3116. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3117. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3118. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3119. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3120. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  3121. // Add the controller profile to the map
  3122. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3123. // Prepare variables:
  3124. deviceName = "USB,2-axis 8-button gamepad ";
  3125. buttonInputMap.clear();
  3126. axisInputMap.clear();
  3127. // Map the controller inputs to Controller::Key codes
  3128. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3129. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3130. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  3131. buttonInputMap[7] = Controller::Key::BUTTON_START;
  3132. buttonInputMap[0] = Controller::Key::BUTTON_B;
  3133. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  3134. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3135. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3136. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3137. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3138. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3139. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3140. // Add the controller profile to the map
  3141. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3142. // Prepare variables:
  3143. deviceName = "USB gamepad ";
  3144. buttonInputMap.clear();
  3145. axisInputMap.clear();
  3146. // Map the controller inputs to Controller::Key codes
  3147. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3148. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3149. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3150. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3151. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3152. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3153. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3154. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3155. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3156. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3157. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3158. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3159. // Add the controller profile to the map
  3160. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3161. // Prepare variables:
  3162. deviceName = "USB Gamepad ";
  3163. buttonInputMap.clear();
  3164. axisInputMap.clear();
  3165. // Map the controller inputs to Controller::Key codes
  3166. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3167. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3168. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3169. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3170. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3171. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3172. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3173. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3174. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3175. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3176. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3177. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3178. // Add the controller profile to the map
  3179. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3180. // Prepare variables:
  3181. deviceName = "usb gamepad ";
  3182. buttonInputMap.clear();
  3183. axisInputMap.clear();
  3184. // Map the controller inputs to Controller::Key codes
  3185. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3186. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3187. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3188. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3189. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3190. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3191. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3192. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3193. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3194. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3195. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3196. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3197. // Add the controller profile to the map
  3198. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3199. // Prepare variables:
  3200. deviceName = "USB Joystick ";
  3201. buttonInputMap.clear();
  3202. axisInputMap.clear();
  3203. // Map the controller inputs to Controller::Key codes
  3204. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3205. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3206. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3207. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3208. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3209. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3210. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3211. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3212. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3213. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3214. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3215. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3216. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3217. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3218. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3219. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3220. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3221. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  3222. // Add the controller profile to the map
  3223. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3224. // Prepare variables:
  3225. deviceName = "USB Vibration Joystick";
  3226. buttonInputMap.clear();
  3227. axisInputMap.clear();
  3228. // Map the controller inputs to Controller::Key codes
  3229. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3230. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3231. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3232. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3233. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_UP;
  3234. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  3235. buttonInputMap[15] = Controller::Key::BUTTON_DPAD_LEFT;
  3236. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_RIGHT;
  3237. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3238. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3239. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3240. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3241. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3242. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3243. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3244. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3245. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3246. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  3247. // Add the controller profile to the map
  3248. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3249. // Prepare variables:
  3250. deviceName = "Venom Limited PS3/PS4 Arcade Joystick";
  3251. buttonInputMap.clear();
  3252. axisInputMap.clear();
  3253. // Map the controller inputs to Controller::Key codes
  3254. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3255. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3256. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3257. buttonInputMap[2] = Controller::Key::BUTTON_B;
  3258. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3259. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3260. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3261. buttonInputMap[0] = Controller::Key::BUTTON_X;
  3262. // Add the controller profile to the map
  3263. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3264. // Prepare variables:
  3265. deviceName = "Wii U GameCube Adapter Port 1";
  3266. buttonInputMap.clear();
  3267. axisInputMap.clear();
  3268. // Map the controller inputs to Controller::Key codes
  3269. buttonInputMap[3] = Controller::Key::BUTTON_A;
  3270. buttonInputMap[2] = Controller::Key::BUTTON_X;
  3271. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  3272. buttonInputMap[7] = Controller::Key::BUTTON_START;
  3273. buttonInputMap[8] = Controller::Key::BUTTON_DPAD_UP;
  3274. buttonInputMap[9] = Controller::Key::BUTTON_DPAD_DOWN;
  3275. buttonInputMap[10] = Controller::Key::BUTTON_DPAD_LEFT;
  3276. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_RIGHT;
  3277. buttonInputMap[0] = Controller::Key::BUTTON_B;
  3278. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  3279. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3280. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3281. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3282. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  3283. // Add the controller profile to the map
  3284. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3285. // Prepare variables:
  3286. deviceName = "WiseGroup.,Ltd SmartJoy Dual PLUS Adapter";
  3287. buttonInputMap.clear();
  3288. axisInputMap.clear();
  3289. // Map the controller inputs to Controller::Key codes
  3290. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3291. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3292. buttonInputMap[9] = Controller::Key::BUTTON_SELECT;
  3293. buttonInputMap[8] = Controller::Key::BUTTON_START;
  3294. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_UP;
  3295. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  3296. buttonInputMap[15] = Controller::Key::BUTTON_DPAD_LEFT;
  3297. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_RIGHT;
  3298. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3299. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3300. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3301. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3302. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3303. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3304. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3305. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3306. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3307. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3308. //axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3309. //axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3310. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3311. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3312. // Add the controller profile to the map
  3313. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3314. // Prepare variables:
  3315. deviceName = "Xarcade-to-Gamepad Device";
  3316. buttonInputMap.clear();
  3317. axisInputMap.clear();
  3318. // Map the controller inputs to Controller::Key codes
  3319. buttonInputMap[3] = Controller::Key::BUTTON_A;
  3320. buttonInputMap[0] = Controller::Key::BUTTON_X;
  3321. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3322. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3323. buttonInputMap[4] = Controller::Key::BUTTON_B;
  3324. buttonInputMap[1] = Controller::Key::BUTTON_Y;
  3325. buttonInputMap[2] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3326. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3327. axisInputMap[1] = Controller::Key::BUTTON_DPAD_UP;
  3328. //axisInputMap[1] = Controller::Key::BUTTON_DPAD_DOWN;
  3329. axisInputMap[0] = Controller::Key::BUTTON_DPAD_LEFT;
  3330. //axisInputMap[0] = Controller::Key::BUTTON_DPAD_RIGHT;
  3331. // Add the controller profile to the map
  3332. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3333. // Prepare variables:
  3334. deviceName = "Xbox 360 Wireless Receiver";
  3335. buttonInputMap.clear();
  3336. axisInputMap.clear();
  3337. // Map the controller inputs to Controller::Key codes
  3338. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3339. buttonInputMap[2] = Controller::Key::BUTTON_X;
  3340. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  3341. buttonInputMap[7] = Controller::Key::BUTTON_START;
  3342. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  3343. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  3344. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  3345. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_RIGHT;
  3346. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3347. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3348. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3349. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3350. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3351. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3352. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  3353. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  3354. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3355. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3356. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3357. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  3358. // Add the controller profile to the map
  3359. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3360. // Prepare variables:
  3361. deviceName = "Xbox 360 Wireless Receiver (XBOX)";
  3362. buttonInputMap.clear();
  3363. axisInputMap.clear();
  3364. // Map the controller inputs to Controller::Key codes
  3365. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3366. buttonInputMap[2] = Controller::Key::BUTTON_X;
  3367. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  3368. buttonInputMap[7] = Controller::Key::BUTTON_START;
  3369. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  3370. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  3371. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  3372. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_RIGHT;
  3373. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3374. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3375. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3376. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3377. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3378. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3379. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  3380. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  3381. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3382. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3383. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3384. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  3385. // Add the controller profile to the map
  3386. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3387. // Prepare variables:
  3388. deviceName = "Wireless Xbox 360 Controller";
  3389. buttonInputMap.clear();
  3390. axisInputMap.clear();
  3391. // Map the controller inputs to Controller::Key codes
  3392. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3393. buttonInputMap[2] = Controller::Key::BUTTON_X;
  3394. buttonInputMap[6] = Controller::Key::BUTTON_SELECT;
  3395. buttonInputMap[7] = Controller::Key::BUTTON_START;
  3396. buttonInputMap[13] = Controller::Key::BUTTON_DPAD_UP;
  3397. buttonInputMap[14] = Controller::Key::BUTTON_DPAD_DOWN;
  3398. buttonInputMap[11] = Controller::Key::BUTTON_DPAD_LEFT;
  3399. buttonInputMap[12] = Controller::Key::BUTTON_DPAD_RIGHT;
  3400. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3401. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3402. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3403. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3404. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3405. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3406. axisInputMap[2] = Controller::Key::AXIS_LEFT_TRIGGER;
  3407. axisInputMap[5] = Controller::Key::AXIS_RIGHT_TRIGGER;
  3408. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3409. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3410. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3411. axisInputMap[4] = Controller::Key::JOYSTICK_RIGHT_Y;
  3412. // Add the controller profile to the map
  3413. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3414. // Prepare variables:
  3415. deviceName = "Xbox Gamepad (userspace driver)";
  3416. buttonInputMap.clear();
  3417. axisInputMap.clear();
  3418. // Map the controller inputs to Controller::Key codes
  3419. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3420. buttonInputMap[2] = Controller::Key::BUTTON_X;
  3421. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3422. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3423. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3424. buttonInputMap[3] = Controller::Key::BUTTON_Y;
  3425. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3426. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3427. buttonInputMap[11] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3428. buttonInputMap[12] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3429. axisInputMap[5] = Controller::Key::BUTTON_DPAD_UP;
  3430. //axisInputMap[5] = Controller::Key::BUTTON_DPAD_DOWN;
  3431. axisInputMap[4] = Controller::Key::BUTTON_DPAD_LEFT;
  3432. //axisInputMap[4] = Controller::Key::BUTTON_DPAD_RIGHT;
  3433. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3434. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3435. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3436. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3437. // Add the controller profile to the map
  3438. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3439. // Prepare variables:
  3440. deviceName = "SL-6566";
  3441. buttonInputMap.clear();
  3442. axisInputMap.clear();
  3443. // Map the controller inputs to Controller::Key codes
  3444. buttonInputMap[1] = Controller::Key::BUTTON_A;
  3445. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3446. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3447. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3448. buttonInputMap[0] = Controller::Key::BUTTON_B;
  3449. buttonInputMap[2] = Controller::Key::BUTTON_Y;
  3450. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3451. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3452. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3453. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3454. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3455. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3456. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3457. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3458. // Add the controller profile to the map
  3459. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3460. // Prepare variables:
  3461. deviceName = "Gamesir-G3s";
  3462. buttonInputMap.clear();
  3463. axisInputMap.clear();
  3464. // Map the controller inputs to Controller::Key codes
  3465. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3466. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3467. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  3468. buttonInputMap[11] = Controller::Key::BUTTON_START;
  3469. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3470. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  3471. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3472. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3473. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3474. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3475. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3476. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3477. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3478. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3479. // Add the controller profile to the map
  3480. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3481. // Prepare variables:
  3482. deviceName = "xiaoji Gamesir-G3s 1.02";
  3483. buttonInputMap.clear();
  3484. axisInputMap.clear();
  3485. // Map the controller inputs to Controller::Key codes
  3486. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3487. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3488. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  3489. buttonInputMap[11] = Controller::Key::BUTTON_START;
  3490. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3491. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  3492. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3493. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3494. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3495. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3496. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3497. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3498. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3499. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3500. // Add the controller profile to the map
  3501. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3502. // Prepare variables:
  3503. deviceName = "Gamesir-G3v";
  3504. buttonInputMap.clear();
  3505. axisInputMap.clear();
  3506. // Map the controller inputs to Controller::Key codes
  3507. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3508. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3509. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  3510. buttonInputMap[11] = Controller::Key::BUTTON_START;
  3511. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3512. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  3513. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3514. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3515. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3516. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3517. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3518. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3519. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3520. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3521. // Add the controller profile to the map
  3522. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3523. // Prepare variables:
  3524. deviceName = "xiaoji Gamesir-G3v 1.00";
  3525. buttonInputMap.clear();
  3526. axisInputMap.clear();
  3527. // Map the controller inputs to Controller::Key codes
  3528. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3529. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3530. buttonInputMap[10] = Controller::Key::BUTTON_SELECT;
  3531. buttonInputMap[11] = Controller::Key::BUTTON_START;
  3532. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3533. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  3534. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3535. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3536. buttonInputMap[13] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3537. buttonInputMap[14] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3538. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3539. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3540. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3541. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3542. // Add the controller profile to the map
  3543. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3544. // Prepare variables:
  3545. deviceName = "小米蓝牙手柄";
  3546. buttonInputMap.clear();
  3547. axisInputMap.clear();
  3548. // Map the controller inputs to Controller::Key codes
  3549. buttonInputMap[4] = Controller::Key::BUTTON_A;
  3550. buttonInputMap[7] = Controller::Key::BUTTON_X;
  3551. buttonInputMap[14] = Controller::Key::BUTTON_SELECT;
  3552. buttonInputMap[15] = Controller::Key::BUTTON_START;
  3553. buttonInputMap[5] = Controller::Key::BUTTON_B;
  3554. buttonInputMap[8] = Controller::Key::BUTTON_Y;
  3555. buttonInputMap[10] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3556. buttonInputMap[11] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3557. buttonInputMap[17] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3558. buttonInputMap[18] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3559. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3560. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3561. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3562. axisInputMap[5] = Controller::Key::JOYSTICK_RIGHT_Y;
  3563. // Add the controller profile to the map
  3564. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3565. // Prepare variables:
  3566. deviceName = "USB Game Device";
  3567. buttonInputMap.clear();
  3568. axisInputMap.clear();
  3569. // Map the controller inputs to Controller::Key codes
  3570. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3571. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3572. buttonInputMap[8] = Controller::Key::BUTTON_SELECT;
  3573. buttonInputMap[9] = Controller::Key::BUTTON_START;
  3574. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3575. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3576. buttonInputMap[4] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3577. buttonInputMap[5] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3578. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3579. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3580. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3581. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  3582. // Add the controller profile to the map
  3583. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3584. // Prepare variables:
  3585. deviceName = "Zeemote: SteelSeries FREE";
  3586. buttonInputMap.clear();
  3587. axisInputMap.clear();
  3588. // Map the controller inputs to Controller::Key codes
  3589. buttonInputMap[0] = Controller::Key::BUTTON_A;
  3590. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3591. buttonInputMap[12] = Controller::Key::BUTTON_SELECT;
  3592. buttonInputMap[11] = Controller::Key::BUTTON_START;
  3593. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3594. buttonInputMap[4] = Controller::Key::BUTTON_Y;
  3595. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3596. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3597. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3598. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3599. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_X;
  3600. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_Y;
  3601. // Add the controller profile to the map
  3602. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3603. // Prepare variables:
  3604. deviceName = "Zeroplus PS Vibration Feedback Converter ";
  3605. buttonInputMap.clear();
  3606. axisInputMap.clear();
  3607. // Map the controller inputs to Controller::Key codes
  3608. buttonInputMap[2] = Controller::Key::BUTTON_A;
  3609. buttonInputMap[3] = Controller::Key::BUTTON_X;
  3610. buttonInputMap[11] = Controller::Key::BUTTON_SELECT;
  3611. buttonInputMap[8] = Controller::Key::BUTTON_START;
  3612. buttonInputMap[1] = Controller::Key::BUTTON_B;
  3613. buttonInputMap[0] = Controller::Key::BUTTON_Y;
  3614. buttonInputMap[6] = Controller::Key::BUTTON_LEFT_SHOULDER;
  3615. buttonInputMap[7] = Controller::Key::BUTTON_RIGHT_SHOULDER;
  3616. buttonInputMap[9] = Controller::Key::BUTTON_LEFT_THUMBSTICK;
  3617. buttonInputMap[10] = Controller::Key::BUTTON_RIGHT_THUMBSTICK;
  3618. axisInputMap[0] = Controller::Key::JOYSTICK_LEFT_X;
  3619. axisInputMap[1] = Controller::Key::JOYSTICK_LEFT_Y;
  3620. axisInputMap[3] = Controller::Key::JOYSTICK_RIGHT_X;
  3621. axisInputMap[2] = Controller::Key::JOYSTICK_RIGHT_Y;
  3622. // Add the controller profile to the map
  3623. s_controllerProfiles.insert(std::make_pair(deviceName, std::make_pair(buttonInputMap, axisInputMap)));
  3624. }
  3625. ~ControllerImpl()
  3626. {
  3627. // If there are any controllers connected that were not deleted at the end of execution, delete them.
  3628. // This wil prevent any memory leaks showing up in valgrind
  3629. for ( auto& controller : Controller::s_allController )
  3630. {
  3631. delete controller;
  3632. }
  3633. Controller::s_allController.clear();
  3634. }
  3635. static ControllerImpl* getInstance()
  3636. {
  3637. static ControllerImpl instance;
  3638. return &instance;
  3639. }
  3640. static std::vector<Controller*>::iterator findController(int deviceId)
  3641. {
  3642. // When controllers are disconnected, GLFW cannot provide their names. We only get their deviceId.
  3643. auto iter = std::find_if(Controller::s_allController.begin(), Controller::s_allController.end(),
  3644. [&](Controller* controller)
  3645. {
  3646. return deviceId == controller->_deviceId;
  3647. }
  3648. );
  3649. return iter;
  3650. }
  3651. static void onConnected(const std::string& deviceName, int deviceId)
  3652. {
  3653. // Check whether the controller is already registered
  3654. auto iter = findController(deviceId);
  3655. if (iter != Controller::s_allController.end())
  3656. return;
  3657. // It's a new controller being connected.
  3658. auto controller = new cocos2d::Controller();
  3659. controller->_deviceId = deviceId;
  3660. controller->_deviceName = deviceName;
  3661. Controller::s_allController.push_back(controller);
  3662. // Check if we already have an available input controller profile. If so, attach it it to the controller.
  3663. for (const auto & it : s_controllerProfiles)
  3664. {
  3665. if ( deviceName.compare(it.first) == 0 )
  3666. {
  3667. // Found controller profile. Attach it to the controller:
  3668. CCLOG("ControllerImpl: Found input profile for controller: %s", deviceName.c_str());
  3669. controller->_buttonInputMap = it.second.first;
  3670. controller->_axisInputMap = it.second.second;
  3671. // Show a one-time warning in debug mode for every button that's currently not matched in the input profile.
  3672. // This will let the developers know that the mapping must be included in the constructor of ControllerImpl located above.
  3673. #ifdef COCOS2D_DEBUG
  3674. int count;
  3675. glfwGetJoystickButtons(deviceId, &count);
  3676. for ( int i = 0; i < count; ++i )
  3677. {
  3678. // Check the mapping of each button:
  3679. const auto & it = controller->_buttonInputMap.find(i);
  3680. if ( it == controller->_buttonInputMap.end() )
  3681. {
  3682. CCLOG("ControllerImpl: Could not find a button input mapping for controller \"%s\", and keyCode \"%d\". This keyCode will not match any from Controller::Key", controller->getDeviceName().c_str(), i);
  3683. }
  3684. }
  3685. glfwGetJoystickAxes(deviceId, &count);
  3686. for ( int i = 0; i < count; ++i )
  3687. {
  3688. // Check the mapping of each axis
  3689. const auto & it = controller->_axisInputMap.find(i);
  3690. if ( it == controller->_axisInputMap.end() )
  3691. {
  3692. CCLOG("ControllerImpl: Could not find an axis input mapping for controller \"%s\", and keyCode \"%d\". This keyCode will not match any from Controller::Key", controller->getDeviceName().c_str(), i);
  3693. }
  3694. }
  3695. #endif
  3696. break;
  3697. }
  3698. }
  3699. // Show a warning if the controller input profile is non-existent:
  3700. #ifdef COCOS2D_DEBUG
  3701. if ( controller->_buttonInputMap.empty() )
  3702. {
  3703. CCLOG("ControllerImpl: Could not find a button input map for controller: %s", deviceName.c_str());
  3704. }
  3705. if ( controller->_axisInputMap.empty() )
  3706. {
  3707. CCLOG("ControllerImpl: Could not find an axis input map for controller: %s", deviceName.c_str());
  3708. }
  3709. #endif
  3710. controller->onConnected();
  3711. }
  3712. static void onDisconnected(int deviceId)
  3713. {
  3714. // Check whether the controller is already registered
  3715. auto iter = findController(deviceId);
  3716. if (iter == Controller::s_allController.end())
  3717. {
  3718. CCLOGERROR("ControllerImpl Error: Could not find the controller!");
  3719. return;
  3720. }
  3721. (*iter)->onDisconnected();
  3722. Controller::s_allController.erase(iter);
  3723. }
  3724. static void onButtonEvent(int deviceId, int keyCode, bool isPressed, float value, bool isAnalog)
  3725. {
  3726. auto iter = findController(deviceId);
  3727. if (iter == Controller::s_allController.end())
  3728. {
  3729. CCLOG("ControllerImpl::onButtonEvent: new controller detected. Registering...");
  3730. onConnected(glfwGetJoystickName(deviceId), deviceId);
  3731. iter = findController(deviceId);
  3732. }
  3733. (*iter)->onButtonEvent(keyCode, isPressed, value, isAnalog);
  3734. }
  3735. static void onAxisEvent(int deviceId, int axisCode, float value, bool isAnalog)
  3736. {
  3737. auto iter = findController(deviceId);
  3738. if (iter == Controller::s_allController.end())
  3739. {
  3740. CCLOG("ControllerImpl::onAxisEvent: new controller detected. Registering...");
  3741. onConnected(glfwGetJoystickName(deviceId), deviceId);
  3742. iter = findController(deviceId);
  3743. }
  3744. (*iter)->onAxisEvent(axisCode, value, isAnalog);
  3745. }
  3746. static void handleConnectionsAndDisconnections(int deviceId, int event)
  3747. {
  3748. // glfw supports up to 16 game controllers
  3749. // Handle game controller connections and disconnections
  3750. if ( event == GLFW_CONNECTED )
  3751. {
  3752. onConnected(glfwGetJoystickName(deviceId), deviceId);
  3753. }
  3754. else if ( event == GLFW_DISCONNECTED )
  3755. {
  3756. ControllerImpl::getInstance()->onDisconnected(deviceId);
  3757. }
  3758. #ifdef COCOS2D_DEBUG
  3759. else
  3760. {
  3761. CCLOG("ControllerImpl: Unhandled GLFW joystick event: %d", event);
  3762. }
  3763. #endif
  3764. }
  3765. void update(float /*dt*/)
  3766. {
  3767. for (int deviceId = GLFW_JOYSTICK_1; deviceId <= GLFW_JOYSTICK_LAST; ++deviceId)
  3768. {
  3769. if ( glfwJoystickPresent(deviceId) )
  3770. {
  3771. auto controller = Controller::getControllerByDeviceId(deviceId);
  3772. // Poll game controller button presses
  3773. int count;
  3774. const unsigned char* buttonArray = glfwGetJoystickButtons(deviceId, &count);
  3775. for ( int i = 0; i < count; ++i )
  3776. {
  3777. // Map the button to the Controller:Key keys from the controller profile if it's available:
  3778. int keyCode = i;
  3779. const auto & it = controller->_buttonInputMap.find(keyCode);
  3780. if ( it != controller->_buttonInputMap.end() )
  3781. {
  3782. keyCode = it->second;
  3783. }
  3784. ControllerImpl::onButtonEvent(deviceId, keyCode, buttonArray[i] == GLFW_PRESS, 0, false);
  3785. }
  3786. // Poll game controller joystick axis
  3787. const float * axisArray = glfwGetJoystickAxes(deviceId, &count);
  3788. for ( int i = 0; i < count; ++i )
  3789. {
  3790. // Map the axis to the Controller:Key keys from the controller profile if it's available:
  3791. int keyCode = i;
  3792. const auto & it = controller->_axisInputMap.find(keyCode);
  3793. if ( it != controller->_axisInputMap.end() )
  3794. {
  3795. keyCode = it->second;
  3796. }
  3797. ControllerImpl::onAxisEvent(deviceId, keyCode, axisArray[i], true);
  3798. }
  3799. }
  3800. }
  3801. }
  3802. private:
  3803. //FIXME: Once GLFW 3.3 is bundled with cocos2d-x, remove these
  3804. //controller profiles and all the related code. We will only need to
  3805. //provide a mapping from the GLFW gamepad key codes to the
  3806. //Controller::Key keycodes. So far an std::unordered_map<int,int>
  3807. //should suffice.
  3808. static std::map<std::string, std::pair< std::unordered_map<int, int>, std::unordered_map<int, int> > > s_controllerProfiles;
  3809. };
  3810. std::map<std::string, std::pair< std::unordered_map<int, int>, std::unordered_map<int, int> > > ControllerImpl::s_controllerProfiles;
  3811. void Controller::startDiscoveryController()
  3812. {
  3813. // Check for existing josyticks and register them as cocos2d::Controller:
  3814. for (int deviceId = GLFW_JOYSTICK_1; deviceId <= GLFW_JOYSTICK_LAST; ++deviceId)
  3815. {
  3816. if (glfwJoystickPresent(deviceId))
  3817. {
  3818. int axis_count, button_count;
  3819. glfwGetJoystickAxes(deviceId, &axis_count);
  3820. glfwGetJoystickButtons(deviceId, &button_count);
  3821. const char* name = glfwGetJoystickName(deviceId);
  3822. ControllerImpl::onConnected(name, deviceId);
  3823. }
  3824. }
  3825. // GFLW sends events when a joystick is connected and disconnected only.
  3826. // These events need to be filtered:
  3827. glfwSetJoystickCallback(ControllerImpl::handleConnectionsAndDisconnections);
  3828. // Poll the joystick axis and buttons
  3829. Director::getInstance()->getScheduler()->scheduleUpdate(ControllerImpl::getInstance(), 0, false);
  3830. }
  3831. void Controller::stopDiscoveryController()
  3832. {
  3833. Director::getInstance()->getScheduler()->unscheduleUpdate(ControllerImpl::getInstance());
  3834. glfwSetJoystickCallback(nullptr);
  3835. // Also remove all the connected controllers:
  3836. for ( auto& controller : Controller::s_allController )
  3837. {
  3838. delete controller;
  3839. }
  3840. Controller::s_allController.clear();
  3841. }
  3842. void Controller::registerListeners()
  3843. {
  3844. }
  3845. bool Controller::isConnected() const
  3846. {
  3847. // If there is a controller instance, it means that the controller is connected.
  3848. // If a controller is disconnected, the instance will be destroyed.
  3849. // Thus, always returns true for this method.
  3850. return true;
  3851. }
  3852. Controller::Controller()
  3853. : _controllerTag(TAG_UNSET)
  3854. , _impl(nullptr)
  3855. , _connectEvent(nullptr)
  3856. , _keyEvent(nullptr)
  3857. , _axisEvent(nullptr)
  3858. {
  3859. init();
  3860. }
  3861. Controller::~Controller()
  3862. {
  3863. delete _connectEvent;
  3864. delete _keyEvent;
  3865. delete _axisEvent;
  3866. }
  3867. NS_CC_END
  3868. #endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)