Skip to content
Permalink
Browse files

Fix button maps refreshing from disk during wizard

  • Loading branch information...
garbear committed Oct 11, 2016
1 parent 1cf4ae4 commit 121ea70e235b6c371902e94293b74cce93f50dd5
Showing with 11 additions and 3 deletions.
  1. +10 −3 src/storage/ButtonMap.cpp
  2. +1 −0 src/storage/ButtonMap.h
@@ -35,14 +35,16 @@ using namespace JOYSTICK;
CButtonMap::CButtonMap(const std::string& strResourcePath) :
m_strResourcePath(strResourcePath),
m_device(std::move(std::make_shared<CDevice>())),
m_timestamp(-1)
m_timestamp(-1),
m_bModified(false)
{
}

CButtonMap::CButtonMap(const std::string& strResourcePath, const DevicePtr& device) :
m_strResourcePath(strResourcePath),
m_device(device),
m_timestamp(-1)
m_timestamp(-1),
m_bModified(false)
{
}

@@ -53,7 +55,9 @@ bool CButtonMap::IsValid(void) const

const ButtonMap& CButtonMap::GetButtonMap()
{
Refresh();
if (!m_bModified)
Refresh();

return m_buttonMap;
}

@@ -85,13 +89,16 @@ void CButtonMap::MapFeatures(const std::string& controllerId, const FeatureVecto
{
return lhs.Name() < rhs.Name();
});

m_bModified = true;
}

bool CButtonMap::SaveButtonMap()
{
if (Save())
{
m_timestamp = P8PLATFORM::GetTimeMs();
m_bModified = false;
return true;
}

@@ -64,5 +64,6 @@ namespace JOYSTICK

private:
int64_t m_timestamp;
bool m_bModified;
};
}

0 comments on commit 121ea70

Please sign in to comment.
You can’t perform that action at this time.