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); mInputManager->setControllerEventCallback(this);
std::string file = userFileExists ? userFile : ""; 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()); adjustMouseRegion (window->getWidth(), window->getHeight());
loadKeyDefaults(); loadKeyDefaults();

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

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

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

Loading…
Cancel
Save