diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index e92f29a..659210f 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -57,12 +57,14 @@ bool UserInput::initialize() MapKey("playlistDown", KeyCodePlaylistDown, false ); MapKey("playlistLeft", KeyCodePlaylistLeft, false ); MapKey("playlistRight", KeyCodePlaylistRight, false ); + MapKey("collectionUp", KeyCodeCollectionUp, false ); + MapKey("collectionDown", KeyCodeCollectionDown, false ); + MapKey("collectionLeft", KeyCodeCollectionLeft, false ); + MapKey("collectionRight", KeyCodeCollectionRight, false ); MapKey("pageDown", KeyCodePageDown, false ); MapKey("pageUp", KeyCodePageUp, false ); MapKey("letterDown", KeyCodeLetterDown, false); MapKey("letterUp", KeyCodeLetterUp, false); - MapKey("collectionUp", KeyCodeCollectionUp, false); - MapKey("collectionDown", KeyCodeCollectionDown, false); MapKey("favPlaylist", KeyCodeFavPlaylist, false); MapKey("nextPlaylist", KeyCodeNextPlaylist, false); MapKey("prevPlaylist", KeyCodePrevPlaylist, false); diff --git a/RetroFE/Source/Control/UserInput.h b/RetroFE/Source/Control/UserInput.h index 9cd793d..12559fd 100644 --- a/RetroFE/Source/Control/UserInput.h +++ b/RetroFE/Source/Control/UserInput.h @@ -39,14 +39,16 @@ public: KeyCodePlaylistDown, KeyCodePlaylistLeft, KeyCodePlaylistRight, + KeyCodeCollectionUp, + KeyCodeCollectionDown, + KeyCodeCollectionLeft, + KeyCodeCollectionRight, KeyCodeSelect, KeyCodeBack, KeyCodePageDown, KeyCodePageUp, KeyCodeLetterDown, KeyCodeLetterUp, - KeyCodeCollectionUp, - KeyCodeCollectionDown, KeyCodeFavPlaylist, KeyCodeNextPlaylist, KeyCodePrevPlaylist, diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 39d0e61..7f26ff7 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -682,175 +682,6 @@ void RetroFE::run( ) } break; - // Start exit animation - case RETROFE_COLLECTION_UP_REQUEST: - if ( !pages_.empty( ) && currentPage_->getMenuDepth( ) == 1) // Inside a collection with a different layout - { - currentPage_->stop( ); - m.clearPage( ); - menuMode_ = false; - state = RETROFE_COLLECTION_UP_EXIT; - } - else if ( currentPage_->getMenuDepth( ) > 1 ) // Inside a collection with the same layout - { - currentPage_->exitMenu( ); - state = RETROFE_COLLECTION_UP_EXIT; - } - else // Not in a collection - { - state = RETROFE_COLLECTION_UP_ENTER; - } - break; - - // Wait for the menu exit animation to finish - case RETROFE_COLLECTION_UP_EXIT: - if ( currentPage_->isIdle( ) ) - { - lastMenuOffsets_[currentPage_->getCollectionName( )] = currentPage_->getScrollOffsetIndex( ); - lastMenuPlaylists_[currentPage_->getCollectionName( )] = currentPage_->getPlaylistName( ); - if (currentPage_->getMenuDepth( ) == 1) // Inside a collection with a different layout - { - currentPage_->deInitialize( ); - delete currentPage_; - currentPage_ = pages_.top( ); - pages_.pop( ); - currentPage_->allocateGraphicsMemory( ); - } - else // Inside a collection with the same layout - { - currentPage_->popCollection( ); - } - config_.setProperty( "currentCollection", currentPage_->getCollectionName( ) ); - - bool rememberMenu = false; - config_.getProperty( "rememberMenu", rememberMenu ); - - std::string firstPlaylist = "all"; - config_.getProperty( "firstPlaylist", firstPlaylist ); - - if (rememberMenu && lastMenuPlaylists_.find( currentPage_->getCollectionName( ) ) != lastMenuPlaylists_.end( )) - { - currentPage_->selectPlaylist( lastMenuPlaylists_[currentPage_->getCollectionName( )] ); // Switch to last playlist - } - else - { - currentPage_->selectPlaylist( firstPlaylist ); - } - - if ( rememberMenu && lastMenuOffsets_.find( currentPage_->getCollectionName( ) ) != lastMenuOffsets_.end( ) ) - { - currentPage_->setScrollOffsetIndex( lastMenuOffsets_[currentPage_->getCollectionName( )] ); - } - - currentPage_->onNewItemSelected( ); - state = RETROFE_COLLECTION_UP_MENU_ENTER; - } - break; - - - // Start menu enter animation - case RETROFE_COLLECTION_UP_MENU_ENTER: - currentPage_->enterMenu( ); - state = RETROFE_COLLECTION_UP_ENTER; - break; - - - // Waiting for enter animation to stop - case RETROFE_COLLECTION_UP_ENTER: - if ( currentPage_->isIdle( ) ) - { - currentPage_->setScrolling(Page::ScrollDirectionForward); - currentPage_->scroll(true); - currentPage_->updateScrollPeriod( ); - state = RETROFE_COLLECTION_UP_SCROLL; - } - break; - - // Waiting for scrolling animation to stop - case RETROFE_COLLECTION_UP_SCROLL: - if ( currentPage_->isMenuIdle( ) ) - { - std::string attractModeSkipCollection = ""; - config_.getProperty( "attractModeSkipCollection", attractModeSkipCollection ); - // Check if we need to skip this collection in attract mode or if we can select it - if ( attractMode_ && currentPage_->getSelectedItem( )->name == attractModeSkipCollection ) - { - currentPage_->setScrolling(Page::ScrollDirectionForward); - currentPage_->scroll(true); - currentPage_->updateScrollPeriod( ); - } - else - { - RETROFE_STATE state_tmp = processUserInput( currentPage_ ); - if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) - { - state = RETROFE_COLLECTION_UP_REQUEST; - } - else if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) - { - state = RETROFE_COLLECTION_DOWN_REQUEST; - } - else - { - currentPage_->setScrolling(Page::ScrollDirectionIdle); // Stop scrolling - nextPageItem_ = currentPage_->getSelectedItem( ); - bool enterOnCollection = true; - config_.getProperty( "enterOnCollection", enterOnCollection ); - if ( currentPage_->getSelectedItem( )->leaf || (!attractMode_ && !enterOnCollection) ) // Current selection is a game or enterOnCollection is not set - { - state = RETROFE_HIGHLIGHT_REQUEST; - } - else // Current selection is a menu - { - state = RETROFE_COLLECTION_HIGHLIGHT_EXIT; - } - } - } - } - break; - - - // Start onHighlightExit animation - case RETROFE_COLLECTION_HIGHLIGHT_REQUEST: - currentPage_->highlightExit( ); - state = RETROFE_COLLECTION_HIGHLIGHT_EXIT; - break; - - // Wait for onHighlightExit animation to finish; load art - case RETROFE_COLLECTION_HIGHLIGHT_EXIT: - if (currentPage_->isIdle( )) - { - currentPage_->highlightLoadArt( ); - state = RETROFE_COLLECTION_HIGHLIGHT_LOAD_ART; - } - break; - - // Start onHighlightEnter animation - case RETROFE_COLLECTION_HIGHLIGHT_LOAD_ART: - currentPage_->highlightEnter( ); - state = RETROFE_COLLECTION_HIGHLIGHT_ENTER; - break; - - // Wait for onHighlightEnter animation to finish - case RETROFE_COLLECTION_HIGHLIGHT_ENTER: - if (currentPage_->isIdle( )) - { - RETROFE_STATE state_tmp = processUserInput( currentPage_ ); - if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) - { - state = RETROFE_COLLECTION_UP_REQUEST; - } - else if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) - { - state = RETROFE_COLLECTION_DOWN_REQUEST; - } - else - { - state = RETROFE_NEXT_PAGE_REQUEST; - } - } - break; - // Start exit animation case RETROFE_COLLECTION_DOWN_REQUEST: if ( !pages_.empty( ) && currentPage_->getMenuDepth( ) == 1) // Inside a collection with a different layout @@ -928,8 +759,8 @@ void RetroFE::run( ) case RETROFE_COLLECTION_DOWN_ENTER: if ( currentPage_->isIdle( ) ) { - currentPage_->setScrolling(Page::ScrollDirectionBack); - currentPage_->scroll(false); + currentPage_->setScrolling(Page::ScrollDirectionForward); + currentPage_->scroll(true); currentPage_->updateScrollPeriod( ); state = RETROFE_COLLECTION_DOWN_SCROLL; } @@ -939,16 +770,185 @@ void RetroFE::run( ) case RETROFE_COLLECTION_DOWN_SCROLL: if ( currentPage_->isMenuIdle( ) ) { - RETROFE_STATE state_tmp; - state_tmp = processUserInput( currentPage_ ); - if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) + std::string attractModeSkipCollection = ""; + config_.getProperty( "attractModeSkipCollection", attractModeSkipCollection ); + // Check if we need to skip this collection in attract mode or if we can select it + if ( attractMode_ && currentPage_->getSelectedItem( )->name == attractModeSkipCollection ) + { + currentPage_->setScrolling(Page::ScrollDirectionForward); + currentPage_->scroll(true); + currentPage_->updateScrollPeriod( ); + } + else + { + RETROFE_STATE state_tmp = processUserInput( currentPage_ ); + if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) + { + state = RETROFE_COLLECTION_DOWN_REQUEST; + } + else if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) + { + state = RETROFE_COLLECTION_UP_REQUEST; + } + else + { + currentPage_->setScrolling(Page::ScrollDirectionIdle); // Stop scrolling + nextPageItem_ = currentPage_->getSelectedItem( ); + bool enterOnCollection = true; + config_.getProperty( "enterOnCollection", enterOnCollection ); + if ( currentPage_->getSelectedItem( )->leaf || (!attractMode_ && !enterOnCollection) ) // Current selection is a game or enterOnCollection is not set + { + state = RETROFE_HIGHLIGHT_REQUEST; + } + else // Current selection is a menu + { + state = RETROFE_COLLECTION_HIGHLIGHT_EXIT; + } + } + } + } + break; + + + // Start onHighlightExit animation + case RETROFE_COLLECTION_HIGHLIGHT_REQUEST: + currentPage_->highlightExit( ); + state = RETROFE_COLLECTION_HIGHLIGHT_EXIT; + break; + + // Wait for onHighlightExit animation to finish; load art + case RETROFE_COLLECTION_HIGHLIGHT_EXIT: + if (currentPage_->isIdle( )) + { + currentPage_->highlightLoadArt( ); + state = RETROFE_COLLECTION_HIGHLIGHT_LOAD_ART; + } + break; + + // Start onHighlightEnter animation + case RETROFE_COLLECTION_HIGHLIGHT_LOAD_ART: + currentPage_->highlightEnter( ); + state = RETROFE_COLLECTION_HIGHLIGHT_ENTER; + break; + + // Wait for onHighlightEnter animation to finish + case RETROFE_COLLECTION_HIGHLIGHT_ENTER: + if (currentPage_->isIdle( )) + { + RETROFE_STATE state_tmp = processUserInput( currentPage_ ); + if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) + { + state = RETROFE_COLLECTION_DOWN_REQUEST; + } + else if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) { state = RETROFE_COLLECTION_UP_REQUEST; } - else if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) + else + { + state = RETROFE_NEXT_PAGE_REQUEST; + } + } + break; + + // Start exit animation + case RETROFE_COLLECTION_UP_REQUEST: + if ( !pages_.empty( ) && currentPage_->getMenuDepth( ) == 1) // Inside a collection with a different layout + { + currentPage_->stop( ); + m.clearPage( ); + menuMode_ = false; + state = RETROFE_COLLECTION_UP_EXIT; + } + else if ( currentPage_->getMenuDepth( ) > 1 ) // Inside a collection with the same layout + { + currentPage_->exitMenu( ); + state = RETROFE_COLLECTION_UP_EXIT; + } + else // Not in a collection + { + state = RETROFE_COLLECTION_UP_ENTER; + } + break; + + // Wait for the menu exit animation to finish + case RETROFE_COLLECTION_UP_EXIT: + if ( currentPage_->isIdle( ) ) + { + lastMenuOffsets_[currentPage_->getCollectionName( )] = currentPage_->getScrollOffsetIndex( ); + lastMenuPlaylists_[currentPage_->getCollectionName( )] = currentPage_->getPlaylistName( ); + if (currentPage_->getMenuDepth( ) == 1) // Inside a collection with a different layout + { + currentPage_->deInitialize( ); + delete currentPage_; + currentPage_ = pages_.top( ); + pages_.pop( ); + currentPage_->allocateGraphicsMemory( ); + } + else // Inside a collection with the same layout + { + currentPage_->popCollection( ); + } + config_.setProperty( "currentCollection", currentPage_->getCollectionName( ) ); + + bool rememberMenu = false; + config_.getProperty( "rememberMenu", rememberMenu ); + + std::string firstPlaylist = "all"; + config_.getProperty( "firstPlaylist", firstPlaylist ); + + if (rememberMenu && lastMenuPlaylists_.find( currentPage_->getCollectionName( ) ) != lastMenuPlaylists_.end( )) + { + currentPage_->selectPlaylist( lastMenuPlaylists_[currentPage_->getCollectionName( )] ); // Switch to last playlist + } + else + { + currentPage_->selectPlaylist( firstPlaylist ); + } + + if ( rememberMenu && lastMenuOffsets_.find( currentPage_->getCollectionName( ) ) != lastMenuOffsets_.end( ) ) + { + currentPage_->setScrollOffsetIndex( lastMenuOffsets_[currentPage_->getCollectionName( )] ); + } + + currentPage_->onNewItemSelected( ); + state = RETROFE_COLLECTION_UP_MENU_ENTER; + } + break; + + + // Start menu enter animation + case RETROFE_COLLECTION_UP_MENU_ENTER: + currentPage_->enterMenu( ); + state = RETROFE_COLLECTION_UP_ENTER; + break; + + + // Waiting for enter animation to stop + case RETROFE_COLLECTION_UP_ENTER: + if ( currentPage_->isIdle( ) ) + { + currentPage_->setScrolling(Page::ScrollDirectionBack); + currentPage_->scroll(false); + currentPage_->updateScrollPeriod( ); + state = RETROFE_COLLECTION_UP_SCROLL; + } + break; + + // Waiting for scrolling animation to stop + case RETROFE_COLLECTION_UP_SCROLL: + if ( currentPage_->isMenuIdle( ) ) + { + RETROFE_STATE state_tmp; + state_tmp = processUserInput( currentPage_ ); + if ( state_tmp == RETROFE_COLLECTION_DOWN_REQUEST ) { state = RETROFE_COLLECTION_DOWN_REQUEST; } + else if ( state_tmp == RETROFE_COLLECTION_UP_REQUEST ) + { + state = RETROFE_COLLECTION_UP_REQUEST; + } else { currentPage_->setScrolling(Page::ScrollDirectionIdle); // Stop scrolling @@ -1216,7 +1216,7 @@ void RetroFE::run( ) if (attractReturn == 2) // Change collection { attract_.reset( attract_.isSet( ) ); - state = RETROFE_COLLECTION_UP_REQUEST; + state = RETROFE_COLLECTION_DOWN_REQUEST; } } if ( menuMode_ ) @@ -1294,13 +1294,6 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) // Handle next/previous game inputs if ( page->isHorizontalScroll( ) ) { - if (input_.keystate(UserInput::KeyCodeLeft)) - { - attract_.reset( ); - page->setScrolling(Page::ScrollDirectionBack); - page->scroll(false); - page->updateScrollPeriod( ); - } if (input_.keystate(UserInput::KeyCodeRight)) { attract_.reset( ); @@ -1308,16 +1301,16 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) page->scroll(true); page->updateScrollPeriod( ); } - } - else - { - if (input_.keystate(UserInput::KeyCodeUp)) + else if (input_.keystate(UserInput::KeyCodeLeft)) { attract_.reset( ); page->setScrolling(Page::ScrollDirectionBack); page->scroll(false); page->updateScrollPeriod( ); } + } + else + { if (input_.keystate(UserInput::KeyCodeDown)) { attract_.reset( ); @@ -1325,6 +1318,13 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) page->scroll(true); page->updateScrollPeriod( ); } + else if (input_.keystate(UserInput::KeyCodeUp)) + { + attract_.reset( ); + page->setScrolling(Page::ScrollDirectionBack); + page->scroll(false); + page->updateScrollPeriod( ); + } } // Ignore other keys while the menu is scrolling @@ -1337,13 +1337,15 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) } // Handle Collection Up/Down keys - if (input_.keystate( UserInput::KeyCodeCollectionUp )) + if ((input_.keystate(UserInput::KeyCodeCollectionUp) && ( page->isHorizontalScroll( ) || !input_.keystate(UserInput::KeyCodeUp))) || + (input_.keystate(UserInput::KeyCodeCollectionLeft) && (!page->isHorizontalScroll( ) || !input_.keystate(UserInput::KeyCodeLeft)))) { attract_.reset( ); state = RETROFE_COLLECTION_UP_REQUEST; } - if (input_.keystate( UserInput::KeyCodeCollectionDown )) + if ((input_.keystate(UserInput::KeyCodeCollectionDown) && ( page->isHorizontalScroll( ) || !input_.keystate(UserInput::KeyCodeDown))) || + (input_.keystate(UserInput::KeyCodeCollectionRight) && (!page->isHorizontalScroll( ) || !input_.keystate(UserInput::KeyCodeRight)))) { attract_.reset( ); state = RETROFE_COLLECTION_DOWN_REQUEST; @@ -1507,6 +1509,14 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) !input_.keystate(UserInput::KeyCodeLeft) && !input_.keystate(UserInput::KeyCodeDown) && !input_.keystate(UserInput::KeyCodeRight) && + !input_.keystate(UserInput::KeyCodePlaylistUp) && + !input_.keystate(UserInput::KeyCodePlaylistLeft) && + !input_.keystate(UserInput::KeyCodePlaylistDown) && + !input_.keystate(UserInput::KeyCodePlaylistRight) && + !input_.keystate(UserInput::KeyCodeCollectionUp) && + !input_.keystate(UserInput::KeyCodeCollectionLeft) && + !input_.keystate(UserInput::KeyCodeCollectionDown) && + !input_.keystate(UserInput::KeyCodeCollectionRight) && !input_.keystate(UserInput::KeyCodePageUp) && !input_.keystate(UserInput::KeyCodePageDown) && !input_.keystate(UserInput::KeyCodeLetterUp) && diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index 292a3c1..77ca491 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 = "29"; +std::string retrofe_version_build = "30"; std::string Version::getString( )