From a53885a1a2b2cf3677f46c1c9e3398619fe56c15 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 12 Oct 2003 17:44:33 +0000 Subject: [PATCH] add joy mappings for NTPAD --- stepmania/src/InputMapper.cpp | 31 ++++++++++++++++++++++++++++--- stepmania/src/StepMania.cpp | 4 ++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 56db61e3eb..913523f91b 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -20,6 +20,7 @@ #include "PrefsManager.h" #include "RageInput.h" #include "arch/arch.h" +#include "regex.h" InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program @@ -71,7 +72,7 @@ void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped() struct AutoJoyMapping { Game game; - const char *szDeviceDescription; // reported by InputHandler + const char *szDriverRegex; // reported by InputHandler const char *szControllerName; // the product name of the controller struct { int iSlotIndex; // -1 == end marker @@ -198,6 +199,28 @@ const AutoJoyMapping g_AutoJoyMappings[] = {-1, -1, -1, false }, // end marker } }, + { + GAME_DANCE, + "NTPAD", + "NTPAD", + { + { 0, JOY_13, DANCE_BUTTON_LEFT, false }, + { 0, JOY_15, DANCE_BUTTON_RIGHT, false }, + { 0, JOY_16, DANCE_BUTTON_UP, false }, + { 0, JOY_14, DANCE_BUTTON_DOWN, false }, + { 1, JOY_1, DANCE_BUTTON_LEFT, false }, + { 1, JOY_3, DANCE_BUTTON_RIGHT, false }, + { 1, JOY_4, DANCE_BUTTON_UP, false }, + { 1, JOY_2, DANCE_BUTTON_DOWN, false }, + { 0, JOY_5, DANCE_BUTTON_UPLEFT, false }, + { 0, JOY_6, DANCE_BUTTON_UPRIGHT, false }, + { 1, JOY_7, DANCE_BUTTON_UPLEFT, false }, + { 1, JOY_8, DANCE_BUTTON_UPRIGHT, false }, + { 0, JOY_9, DANCE_BUTTON_BACK, false }, + { 0, JOY_10, DANCE_BUTTON_START, false }, + {-1, -1, -1, false }, // end marker + } + }, { GAME_DANCE, "XBOX Gamepad Plugin V0.01", @@ -280,7 +303,9 @@ void InputMapper::AutoMapJoysticksForCurrentGame() { const AutoJoyMapping& mapping = g_AutoJoyMappings[j]; - if( sDescription == mapping.szDeviceDescription ) + CString sDriverRegex = mapping.szDriverRegex; + Regex regex( sDriverRegex ); + if( regex.Compare(sDescription) ) { // // We have a mapping for this joystick @@ -290,7 +315,7 @@ void InputMapper::AutoMapJoysticksForCurrentGame() break; // stop mapping. We already mapped one device for each game controller. LOG->Info( "Applying default joystick mapping #%d for device '%s' (%s)", - iNumJoysticksMapped+1, mapping.szDeviceDescription, mapping.szControllerName ); + iNumJoysticksMapped+1, mapping.szDriverRegex, mapping.szControllerName ); for( int k=0; mapping.maps[k].iSlotIndex != -1; k++ ) { diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 53a850e0e0..27db5b3b69 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -357,8 +357,8 @@ static const CString D3DURL = "http://search.microsoft.com/gomsuri.asp?n=1&c=rp_ struct VideoCardDefaults { - char szDriverRegex[200]; - char szVideoRenderers[200]; + char *szDriverRegex; + char *szVideoRenderers; int iWidth; int iHeight; int iDisplayColor;