Merge with develop

This commit is contained in:
emb
2015-06-15 12:21:13 -05:00
6 changed files with 27 additions and 10 deletions

View File

@@ -41,6 +41,9 @@ exitOnFirstPageBack = yes
# enter 0 attract mode, otherwise enter the number of seconds to wait before enabling attract mode # enter 0 attract mode, otherwise enter the number of seconds to wait before enabling attract mode
attractModeTime = 45 attractModeTime = 45
# remember the last highlighted menu when re-entering a menu
rememberMenu = no
####################################### #######################################
# Base folders of media and ROM files # Base folders of media and ROM files
####################################### #######################################

View File

@@ -203,12 +203,13 @@ bool CollectionInfoBuilder::ImportBasicList(CollectionInfo * /*info*/, std::stri
return false; return false;
} }
std::string line; std::string line;
while(std::getline(includeStream, line)) while(std::getline(includeStream, line))
{ {
line = Utils::FilterComments(line);
if(list.find(line) == list.end())
if(!line.empty() && list.find(line) == list.end())
{ {
Item *i = new Item(); Item *i = new Item();

View File

@@ -117,12 +117,8 @@ bool Configuration::ParseLine(std::string keyPrefix, std::string line, int lineC
std::string delimiter = "="; std::string delimiter = "=";
// strip out any comments // strip out any comments
if((position = line.find("#")) != std::string::npos) line = Utils::FilterComments(line);
{
line = line.substr(0, position);
}
// unix only wants \n. Windows uses \r\n. Strip off the \r for unix.
line.erase( std::remove(line.begin(), line.end(), '\r'), line.end() );
if(line.empty() || (line.find_first_not_of(" \t\r") == std::string::npos)) if(line.empty() || (line.find_first_not_of(" \t\r") == std::string::npos))
{ {
retVal = true; retVal = true;

View File

@@ -393,6 +393,8 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
bool exit = false; bool exit = false;
RETROFE_STATE state = RETROFE_IDLE; RETROFE_STATE state = RETROFE_IDLE;
if (SDL_PollEvent(&e) == 0) return state; if (SDL_PollEvent(&e) == 0) return state;
bool rememberMenu = false;
Config.GetProperty("rememberMenu", rememberMenu);
if(e.type == SDL_KEYDOWN || e.type == SDL_KEYUP) if(e.type == SDL_KEYDOWN || e.type == SDL_KEYUP)
{ {
@@ -463,7 +465,7 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
mp.GetMenuItems(info); mp.GetMenuItems(info);
page->PushCollection(info); page->PushCollection(info);
if(LastMenuOffsets.find(NextPageItem->GetName()) != LastMenuOffsets.end()) if(rememberMenu && LastMenuOffsets.find(NextPageItem->GetName()) != LastMenuOffsets.end())
{ {
page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->GetName()]); page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->GetName()]);
} }

View File

@@ -54,6 +54,20 @@ std::string Utils::UppercaseFirst(std::string str)
return str; return str;
} }
std::string Utils::FilterComments(std::string line)
{
size_t position;
// strip out any comments
if((position = line.find("#")) != std::string::npos)
{
line = line.substr(0, position);
}
// unix only wants \n. Windows uses \r\n. Strip off the \r for unix.
line.erase( std::remove(line.begin(), line.end(), '\r'), line.end() );
return line;
}
std::string Utils::CombinePath(std::list<std::string> &paths) std::string Utils::CombinePath(std::list<std::string> &paths)
{ {

View File

@@ -33,6 +33,7 @@ public:
static bool FindMatchingFile(std::string prefix, std::vector<std::string> &extensions, std::string &file); static bool FindMatchingFile(std::string prefix, std::vector<std::string> &extensions, std::string &file);
static std::string ToLower(std::string str); static std::string ToLower(std::string str);
static std::string UppercaseFirst(std::string str); static std::string UppercaseFirst(std::string str);
static std::string FilterComments(std::string line);
//todo: there has to be a better way to do this //todo: there has to be a better way to do this
static std::string CombinePath(std::list<std::string> &paths); static std::string CombinePath(std::list<std::string> &paths);