read gamecontrollerdb file location from settings file

celladd
Digmaster 10 years ago
parent a7a211860a
commit bb6ed06a4e

@ -135,8 +135,8 @@ namespace MWInput
mInputManager->setControllerEventCallback(this);
std::string file = userFileExists ? userFile : "";
mInputBinder = new ICS::InputControlSystem(file, true, this, NULL, A_Last);
std::string controllerdb = Settings::Manager::getString("gamecontrollerdb file", "Input");
mInputBinder = new ICS::InputControlSystem(file, true, this, NULL, controllerdb, A_Last);
adjustMouseRegion (window->getWidth(), window->getHeight());
loadKeyDefaults();

@ -30,7 +30,7 @@ namespace ICS
{
InputControlSystem::InputControlSystem(std::string file, bool active
, DetectingBindingListener* detectingBindingListener
, InputControlSystemLog* log, size_t channelCount)
, InputControlSystemLog* log, std::string controllerdb, size_t channelCount)
: mFileName(file)
, mDetectingBindingListener(detectingBindingListener)
, mDetectingBindingControl(NULL)
@ -279,14 +279,17 @@ namespace ICS
//Load controller mappings
#if SDL_VERSION_ATLEAST(2,0,2)
int res = SDL_GameControllerAddMappingsFromFile("resources/gamecontrollerdb.txt");
if(res == -1)
{
ICS_LOG(std::string("Error loading controller bindings: ")+SDL_GetError());
}
else
{
ICS_LOG(std::string("Loaded ")+boost::lexical_cast<std::string>(res)+" Game controller bindings");
if(!controllerdb.empty())
{
int res = SDL_GameControllerAddMappingsFromFile(controllerdb.c_str());
if(res == -1)
{
ICS_LOG(std::string("Error loading controller bindings: ")+SDL_GetError());
}
else
{
ICS_LOG(std::string("Loaded ")+boost::lexical_cast<std::string>(res)+" Game controller bindings");
}
}
#endif

@ -74,7 +74,8 @@ namespace ICS
InputControlSystem(std::string file = "", bool active = true
, DetectingBindingListener* detectingBindingListener = NULL
, InputControlSystemLog* log = NULL, size_t channelCount = 16);
, InputControlSystemLog* log = NULL, std::string controllerdb = ""
, size_t channelCount = 16);
~InputControlSystem();
std::string getFileName(){ return mFileName; };

@ -181,6 +181,8 @@ always run = false
allow third person zoom = false
gamecontrollerdb file = resources/gamecontrollerdb.txt
[Game]
# Always use the most powerful attack when striking with a weapon (chop, slash or thrust)
best attack = false

Loading…
Cancel
Save