diff --git a/Package/Environment/Common/controls.conf b/Package/Environment/Common/controls.conf index 8f530df..1d0dbc4 100644 --- a/Package/Environment/Common/controls.conf +++ b/Package/Environment/Common/controls.conf @@ -7,7 +7,8 @@ pageDown = B letterUp = N letterDown = M nextPlaylist = P -addPlaylist = O +addPlaylist = I +removePlaylist = O random = R select = Space back = Escape diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index 30ac3b7..e3f89c2 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -76,6 +76,7 @@ bool UserInput::initialize() MapKey("letterUp", KeyCodeLetterUp, false); MapKey("nextPlaylist", KeyCodeNextPlaylist, false); MapKey("addPlaylist", KeyCodeAddPlaylist, false); + MapKey("removePlaylist", KeyCodeRemovePlaylist, false); MapKey("random", KeyCodeRandom, false); // these features will need to be implemented at a later time // retVal = MapKey("admin", KeyCodeAdminMode) && retVal; diff --git a/RetroFE/Source/Control/UserInput.h b/RetroFE/Source/Control/UserInput.h index 11e8545..feaffc5 100644 --- a/RetroFE/Source/Control/UserInput.h +++ b/RetroFE/Source/Control/UserInput.h @@ -42,6 +42,7 @@ public: KeyCodeNextPlaylist, KeyCodeRandom, KeyCodeAddPlaylist, + KeyCodeRemovePlaylist, KeyCodeAdminMode, KeyCodeHideItem, KeyCodeQuit, diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 7df2c17..f47bd99 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -645,6 +645,30 @@ void Page::draw() } +void Page::removePlaylist() +{ + if(!selectedItem_) return; + + MenuInfo_S &info = collections_.back(); + CollectionInfo *collection = info.collection; + + std::vector *items = collection->playlists["favorites"]; + std::vector it = std::find(items->begin(), items->end(), selectedItem_); + + if(it != items->end()) + { + items->erase(it); + + items->shrink_to_fit(); + + if(activeMenu_) + { + activeMenu_->deallocateSpritePoints(); + activeMenu_->allocateSpritePoints(); + } + } +} + void Page::addPlaylist() { if(!selectedItem_) return; diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index eed65e1..8fdcea1 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -450,6 +450,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) !input_.keystate(UserInput::KeyCodeLetterDown) && !input_.keystate(UserInput::KeyCodeNextPlaylist) && !input_.keystate(UserInput::KeyCodeAddPlaylist) && + !input_.keystate(UserInput::KeyCodeRemovePlaylist) && !input_.keystate(UserInput::KeyCodeRandom)) { keyLastTime_ = 0; @@ -482,6 +483,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) { page->nextPlaylist(); } + if(input_.keystate(UserInput::KeyCodeRemovePlaylist)) + { + page->removePlaylist(); + } if(input_.keystate(UserInput::KeyCodeAddPlaylist)) { page->addPlaylist();