Merge remote-tracking branch 'retropie/master' into retropie-master

This commit is contained in:
Jools Wills 2015-10-03 20:23:53 +01:00
commit ecc1552990
2 changed files with 24 additions and 9 deletions

View file

@ -66,7 +66,7 @@ std::string FileData::getCleanName() const
if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO)) if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO))
stem = PlatformIds::getCleanMameName(stem.c_str()); stem = PlatformIds::getCleanMameName(stem.c_str());
return removeParenthesis(stem); return stem;
} }
const std::string& FileData::getThumbnailPath() const const std::string& FileData::getThumbnailPath() const

View file

@ -8,11 +8,15 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include "Util.h" #include "Util.h"
#include <boost/filesystem.hpp>
#include <boost/locale.hpp>
#define HOLD_TIME 1000 #define HOLD_TIME 1000
using namespace Eigen; using namespace Eigen;
namespace fs = boost::filesystem;
GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun, const std::function<void()>& doneCallback) : GuiComponent(window), mFirstRun(firstRun), GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun, const std::function<void()>& doneCallback) : GuiComponent(window), mFirstRun(firstRun),
mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5)) mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5))
{ {
@ -100,15 +104,26 @@ void GuiDetectDevice::update(int deltaTime)
{ {
if(mHoldingConfig) if(mHoldingConfig)
{ {
mHoldTime -= deltaTime; // If ES starts and if a known device is connected after startup skip controller configuration
const float t = (float)mHoldTime / HOLD_TIME; if(mFirstRun && fs::exists(InputManager::getConfigPath()) && InputManager::getInstance()->getNumConfiguredDevices() > 0)
unsigned int c = (unsigned char)(t * 255);
mDeviceHeld->setColor((c << 24) | (c << 16) | (c << 8) | 0xFF);
if(mHoldTime <= 0)
{ {
// picked one! InputManager::getInstance()->doOnFinish(); // execute possible onFinish commands
mWindow->pushGui(new GuiInputConfig(mWindow, mHoldingConfig, true, mDoneCallback)); if(mDoneCallback)
delete this; mDoneCallback();
delete this; // delete GUI element
}
else
{
mHoldTime -= deltaTime;
const float t = (float)mHoldTime / HOLD_TIME;
unsigned int c = (unsigned char)(t * 255);
mDeviceHeld->setColor((c << 24) | (c << 16) | (c << 8) | 0xFF);
if(mHoldTime <= 0)
{
// picked one!
mWindow->pushGui(new GuiInputConfig(mWindow, mHoldingConfig, true, mDoneCallback));
delete this;
}
} }
} }
} }