From 63f4894c2e1c17b9df9a1da3baf8e8b1b9232ec5 Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Sat, 18 Apr 2020 14:16:03 +0200 Subject: [PATCH] Added playlistUp/Down/Left/Right button support to allow playlist selection running contra from menu selection. --- RetroFE/Source/Control/UserInput.cpp | 4 + RetroFE/Source/Control/UserInput.h | 4 + RetroFE/Source/RetroFE.cpp | 215 +++++++++++++-------------- RetroFE/Source/Version.cpp | 2 +- 4 files changed, 110 insertions(+), 115 deletions(-) diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index d64cb8b..e92f29a 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -53,6 +53,10 @@ bool UserInput::initialize() { // Optional keys + MapKey("playlistUp", KeyCodePlaylistUp, false ); + MapKey("playlistDown", KeyCodePlaylistDown, false ); + MapKey("playlistLeft", KeyCodePlaylistLeft, false ); + MapKey("playlistRight", KeyCodePlaylistRight, false ); MapKey("pageDown", KeyCodePageDown, false ); MapKey("pageUp", KeyCodePageUp, false ); MapKey("letterDown", KeyCodeLetterDown, false); diff --git a/RetroFE/Source/Control/UserInput.h b/RetroFE/Source/Control/UserInput.h index 8664d5a..9cd793d 100644 --- a/RetroFE/Source/Control/UserInput.h +++ b/RetroFE/Source/Control/UserInput.h @@ -35,6 +35,10 @@ public: KeyCodeDown, KeyCodeLeft, KeyCodeRight, + KeyCodePlaylistUp, + KeyCodePlaylistDown, + KeyCodePlaylistLeft, + KeyCodePlaylistRight, KeyCodeSelect, KeyCodeBack, KeyCodePageDown, diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index be8c549..39d0e61 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -1342,131 +1342,118 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) attract_.reset( ); state = RETROFE_COLLECTION_UP_REQUEST; } + if (input_.keystate( UserInput::KeyCodeCollectionDown )) { attract_.reset( ); state = RETROFE_COLLECTION_DOWN_REQUEST; } - if ( menuMode_ || ( - !input_.keystate(UserInput::KeyCodePageUp) && - !input_.keystate(UserInput::KeyCodePageDown) && - !input_.keystate(UserInput::KeyCodeLetterUp) && - !input_.keystate(UserInput::KeyCodeLetterDown) && - !input_.keystate(UserInput::KeyCodeCollectionUp) && - !input_.keystate(UserInput::KeyCodeCollectionDown) && - !input_.keystate(UserInput::KeyCodeFavPlaylist) && - !input_.keystate(UserInput::KeyCodeNextPlaylist) && - !input_.keystate(UserInput::KeyCodePrevPlaylist) && - !input_.keystate(UserInput::KeyCodeCyclePlaylist) && - !input_.keystate(UserInput::KeyCodeNextCyclePlaylist) && - !input_.keystate(UserInput::KeyCodePrevCyclePlaylist) && - !input_.keystate(UserInput::KeyCodeAddPlaylist) && - !input_.keystate(UserInput::KeyCodeRemovePlaylist) && - !input_.keystate(UserInput::KeyCodeRandom) && - !input_.keystate(UserInput::KeyCodeMenu)) ) + if (input_.keystate(UserInput::KeyCodePageUp)) { - keyLastTime_ = 0; - keyDelayTime_= 0.3f; + attract_.reset( ); + page->pageScroll(Page::ScrollDirectionBack); + state = RETROFE_MENUJUMP_REQUEST; } - else if ( (currentTime_ - keyLastTime_) > keyDelayTime_ || keyLastTime_ == 0 ) + if (input_.keystate(UserInput::KeyCodePageDown)) { - keyLastTime_ = currentTime_; - keyDelayTime_-= .05f; - if ( keyDelayTime_< 0.1f ) keyDelayTime_= 0.1f; + attract_.reset( ); + page->pageScroll(Page::ScrollDirectionForward); + state = RETROFE_MENUJUMP_REQUEST; + } - if (input_.keystate(UserInput::KeyCodePageUp)) - { - attract_.reset( ); - page->pageScroll(Page::ScrollDirectionBack); - state = RETROFE_MENUJUMP_REQUEST; - } - if (input_.keystate(UserInput::KeyCodePageDown)) - { - attract_.reset( ); - page->pageScroll(Page::ScrollDirectionForward); - state = RETROFE_MENUJUMP_REQUEST; - } - if (input_.keystate(UserInput::KeyCodeLetterUp)) - { - attract_.reset( ); - bool cfwLetterSub; - config_.getProperty( "cfwLetterSub", cfwLetterSub ); - if (cfwLetterSub && page->hasSubs()) - page->cfwLetterSubScroll(Page::ScrollDirectionBack); - else - page->letterScroll(Page::ScrollDirectionBack); - state = RETROFE_MENUJUMP_REQUEST; - } - if (input_.keystate(UserInput::KeyCodeLetterDown)) - { - attract_.reset( ); - bool cfwLetterSub; - config_.getProperty( "cfwLetterSub", cfwLetterSub ); - if (cfwLetterSub && page->hasSubs()) - page->cfwLetterSubScroll(Page::ScrollDirectionForward); - else - page->letterScroll(Page::ScrollDirectionForward); - state = RETROFE_MENUJUMP_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeFavPlaylist) ) - { - attract_.reset( ); - page->favPlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeNextPlaylist) ) - { - attract_.reset( ); - page->nextPlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodePrevPlaylist) ) - { - attract_.reset( ); - page->prevPlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) || - input_.keystate(UserInput::KeyCodeNextCyclePlaylist) ) - { - attract_.reset( ); - std::string cycleString; - config_.getProperty( "cyclePlaylist", cycleString ); - std::vector cycleVector; - Utils::listToVector( cycleString, cycleVector, ',' ); - page->nextCyclePlaylist( cycleVector ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodePrevCyclePlaylist) ) - { - attract_.reset( ); - std::string cycleString; - config_.getProperty( "cyclePlaylist", cycleString ); - std::vector cycleVector; - Utils::listToVector( cycleString, cycleVector, ',' ); - page->prevCyclePlaylist( cycleVector ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeRemovePlaylist) ) - { - attract_.reset( ); - page->removePlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeAddPlaylist) ) - { - attract_.reset( ); - page->addPlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; - } - if ( input_.keystate(UserInput::KeyCodeRandom) ) - { - attract_.reset( ); - page->selectRandom( ); - state = RETROFE_MENUJUMP_REQUEST; - } + if (input_.keystate(UserInput::KeyCodeLetterUp)) + { + attract_.reset( ); + bool cfwLetterSub; + config_.getProperty( "cfwLetterSub", cfwLetterSub ); + if (cfwLetterSub && page->hasSubs()) + page->cfwLetterSubScroll(Page::ScrollDirectionBack); + else + page->letterScroll(Page::ScrollDirectionBack); + state = RETROFE_MENUJUMP_REQUEST; + } + + if (input_.keystate(UserInput::KeyCodeLetterDown)) + { + attract_.reset( ); + bool cfwLetterSub; + config_.getProperty( "cfwLetterSub", cfwLetterSub ); + if (cfwLetterSub && page->hasSubs()) + page->cfwLetterSubScroll(Page::ScrollDirectionForward); + else + page->letterScroll(Page::ScrollDirectionForward); + state = RETROFE_MENUJUMP_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeFavPlaylist) ) + { + attract_.reset( ); + page->favPlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeNextPlaylist) || + (input_.keystate(UserInput::KeyCodePlaylistDown) && page->isHorizontalScroll( )) || + (input_.keystate(UserInput::KeyCodePlaylistRight) && !page->isHorizontalScroll( ))) + { + attract_.reset( ); + page->nextPlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodePrevPlaylist) || + (input_.keystate(UserInput::KeyCodePlaylistUp) && page->isHorizontalScroll( )) || + (input_.keystate(UserInput::KeyCodePlaylistLeft) && !page->isHorizontalScroll( ))) + { + attract_.reset( ); + page->prevPlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) || + input_.keystate(UserInput::KeyCodeNextCyclePlaylist) ) + { + attract_.reset( ); + std::string cycleString; + config_.getProperty( "cyclePlaylist", cycleString ); + std::vector cycleVector; + Utils::listToVector( cycleString, cycleVector, ',' ); + page->nextCyclePlaylist( cycleVector ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodePrevCyclePlaylist) ) + { + attract_.reset( ); + std::string cycleString; + config_.getProperty( "cyclePlaylist", cycleString ); + std::vector cycleVector; + Utils::listToVector( cycleString, cycleVector, ',' ); + page->prevCyclePlaylist( cycleVector ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeRemovePlaylist) ) + { + attract_.reset( ); + page->removePlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeAddPlaylist) ) + { + attract_.reset( ); + page->addPlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } + + if ( input_.keystate(UserInput::KeyCodeRandom) ) + { + attract_.reset( ); + page->selectRandom( ); + state = RETROFE_MENUJUMP_REQUEST; } if (input_.keystate(UserInput::KeyCodeAdminMode)) diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index 00faaae..292a3c1 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 = "28"; +std::string retrofe_version_build = "29"; std::string Version::getString( )