diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index 89eb3b5..b5e0ecc 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -76,6 +76,7 @@ bool UserInput::initialize() MapKey("random", KeyCodeRandom, false); MapKey("menu", KeyCodeMenu, false); MapKey("reboot", KeyCodeReboot, false); + MapKey("saveFirstPlaylist", KeyCodeSaveFirstPlaylist, false); bool retVal = true; diff --git a/RetroFE/Source/Control/UserInput.h b/RetroFE/Source/Control/UserInput.h index c280811..417632b 100644 --- a/RetroFE/Source/Control/UserInput.h +++ b/RetroFE/Source/Control/UserInput.h @@ -63,6 +63,7 @@ public: KeyCodeHideItem, KeyCodeQuit, KeyCodeReboot, + KeyCodeSaveFirstPlaylist, KeyCodeMax }; diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index b759a3e..b2cd03b 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -74,6 +74,7 @@ RetroFE::RetroFE( Configuration &c ) menuMode_ = false; attractMode_ = false; attractModePlaylistCollectionNumber_ = 0; + firstPlaylist_ = "all"; } @@ -459,9 +460,8 @@ bool RetroFE::run( ) currentPage_->pushCollection(info); - std::string firstPlaylist = "all"; - config_.getProperty( "firstPlaylist", firstPlaylist ); - currentPage_->selectPlaylist( firstPlaylist ); + config_.getProperty( "firstPlaylist", firstPlaylist_ ); + currentPage_->selectPlaylist( firstPlaylist_ ); currentPage_->onNewItemSelected( ); currentPage_->reallocateMenuSpritePoints( ); @@ -1556,6 +1556,16 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) reboot_ = true; state = RETROFE_QUIT_REQUEST; } + + else if (input_.keystate(UserInput::KeyCodeSaveFirstPlaylist)) + { + attract_.reset( ); + if ( page->getMenuDepth( ) == 1 ) + { + firstPlaylist_ = page->getPlaylistName( ); + saveRetroFEState( ); + } + } } // Check if we're done scrolling @@ -1768,3 +1778,21 @@ CollectionInfo *RetroFE::getMenuCollection( std::string collectionName ) collection->playlists["all"] = &collection->items; return collection; } + + +void RetroFE::saveRetroFEState( ) +{ + std::string file = Utils::combinePath(Configuration::absolutePath, "settings_saved.conf"); + Logger::write(Logger::ZONE_INFO, "RetroFE", "Saving settings_saved.conf"); + std::ofstream filestream; + try + { + filestream.open(file.c_str()); + filestream << "firstPlaylist = " << firstPlaylist_ << std::endl; + filestream.close(); + } + catch(std::exception &) + { + Logger::write(Logger::ZONE_ERROR, "RetroFE", "Save failed: " + file); + } +} diff --git a/RetroFE/Source/RetroFE.h b/RetroFE/Source/RetroFE.h index fac2af7..15788bc 100644 --- a/RetroFE/Source/RetroFE.h +++ b/RetroFE/Source/RetroFE.h @@ -117,6 +117,7 @@ private: void update( float dt, bool scrollActive ); CollectionInfo *getCollection( std::string collectionName ); CollectionInfo *getMenuCollection( std::string collectionName ); + void saveRetroFEState( ); Configuration &config_; DB *db_; @@ -136,6 +137,7 @@ private: bool attractMode_; int attractModePlaylistCollectionNumber_; bool reboot_; + std::string firstPlaylist_; std::map lastMenuOffsets_; std::map lastMenuPlaylists_; diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index 3d4632e..d973095 100644 --- a/RetroFE/Source/Version.cpp +++ b/RetroFE/Source/Version.cpp @@ -21,7 +21,7 @@ std::string retrofe_version_major = "0"; std::string retrofe_version_minor = "9"; -std::string retrofe_version_build = "35"; +std::string retrofe_version_build = "36"; std::string Version::getString( )