Commit 18379911 authored by digitalLumberjack's avatar digitalLumberjack

input management for configgen

parent dd2aa836
......@@ -111,13 +111,9 @@ void SystemData::launchGame(Window* window, FileData* game)
AudioManager::getInstance()->deinit();
VolumeControl::getInstance()->deinit();
LOG(LogInfo) << "Attempting to configure emulator...";
if(InputManager::getInstance()->configureEmulators(this->mName)){
LOG(LogInfo) << "Emulator configuration OK";
}else {
LOG(LogInfo) << "Emulator configuration error";
}
std::string controlersConfig = InputManager::getInstance()->configureEmulators();
LOG(LogInfo) << "Controllers config : " << controlersConfig;
window->deinit();
......@@ -129,6 +125,7 @@ void SystemData::launchGame(Window* window, FileData* game)
const std::string rom_raw = fs::path(game->getPath()).make_preferred().string();
command = strreplace(command, "%ROM%", rom);
command = strreplace(command, "%CONTROLERSCONFIG%", rom);
command = strreplace(command, "%BASENAME%", basename);
command = strreplace(command, "%ROM_RAW%", rom_raw);
......
......@@ -396,9 +396,9 @@ std::string InputManager::getDeviceGUIDString(int deviceId)
return std::string(guid);
}
bool InputManager::configureEmulators(const std::string& systemName) {
std::string InputManager::configureEmulators() {
std::stringstream command;
command << Settings::getInstance()->getString("GenerateInputConfigScript") << " ";
// command << Settings::getInstance()->getString("GenerateInputConfigScript") << " ";
// 1 recuperer les configurated
......@@ -458,14 +458,14 @@ bool InputManager::configureEmulators(const std::string& systemName) {
}
if(playerInputConfig != NULL){
command << " " << playerInputConfig->getDeviceGUIDString() << " " << playerInputConfig->getDeviceIndex() << " \"" << playerInputConfig->getDeviceName() << "\"";
}else {
command << "-p" << player+1 << "index " << playerInputConfig->getDeviceIndex() << " -p" << player+1 << "guid " << playerInputConfig->getDeviceGUIDString() << " p" << player+1 << "name " << " \"" << playerInputConfig->getDeviceName() << "\"";
}/*else {
command << " " << "DEFAULT" << " -1 DEFAULTDONOTFINDMEINCOMMAND";
}
}*/
}
//LOG(LogInfo) << "I have for "<< "INPUT P" << player << " a configname : " << playerConfigName;
command << " \"" << systemName << "\"" ;
//command << " \"" << systemName << "\"" ;
LOG(LogInfo) << "Configure emulators command : " << command.str().c_str();
return system(command.str().c_str()) == 0;
return command.str();
}
......@@ -56,7 +56,7 @@ public:
InputConfig* getInputConfigByDevice(int deviceId);
bool parseEvent(const SDL_Event& ev, Window* window);
bool configureEmulators(const std::string& systemName);
std::string configureEmulators();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment