diff --git a/Package/Environment/Common/controls.conf b/Package/Environment/Common/controls.conf index 638ccb3..8f530df 100644 --- a/Package/Environment/Common/controls.conf +++ b/Package/Environment/Common/controls.conf @@ -7,6 +7,7 @@ pageDown = B letterUp = N letterDown = M nextPlaylist = P +addPlaylist = O random = R select = Space back = Escape diff --git a/Package/Environment/Common/layouts/Default 16x9/layout.xml b/Package/Environment/Common/layouts/Default 16x9/layout.xml index 87eb262..90732e1 100644 --- a/Package/Environment/Common/layouts/Default 16x9/layout.xml +++ b/Package/Environment/Common/layouts/Default 16x9/layout.xml @@ -12,7 +12,7 @@ - + @@ -367,4 +367,4 @@ - \ No newline at end of file + diff --git a/RetroFE/Source/Control/UserInput.cpp b/RetroFE/Source/Control/UserInput.cpp index 5683b69..30ac3b7 100644 --- a/RetroFE/Source/Control/UserInput.cpp +++ b/RetroFE/Source/Control/UserInput.cpp @@ -66,15 +66,17 @@ bool UserInput::initialize() retVal = MapKey("down", KeyCodeRight) && retVal; } - retVal = MapKey("pageDown", KeyCodePageDown) && retVal; - retVal = MapKey("pageUp", KeyCodePageUp) && retVal; - MapKey("letterDown", KeyCodeLetterDown); - MapKey("letterUp", KeyCodeLetterUp); retVal = MapKey("select", KeyCodeSelect) && retVal; retVal = MapKey("back", KeyCodeBack) && retVal; retVal = MapKey("quit", KeyCodeQuit) && retVal; - MapKey("nextPlaylist", KeyCodeNextPlaylist); - MapKey("random", KeyCodeRandom); + retVal = MapKey("pageDown", KeyCodePageDown); + retVal = MapKey("pageUp", KeyCodePageUp); + + MapKey("letterDown", KeyCodeLetterDown, false); + MapKey("letterUp", KeyCodeLetterUp, false); + MapKey("nextPlaylist", KeyCodeNextPlaylist, false); + MapKey("addPlaylist", KeyCodeAddPlaylist, false); + MapKey("random", KeyCodeRandom, false); // these features will need to be implemented at a later time // retVal = MapKey("admin", KeyCodeAdminMode) && retVal; // retVal = MapKey("remove", KeyCodeHideItem) && retVal; @@ -89,6 +91,11 @@ bool UserInput::initialize() } bool UserInput::MapKey(std::string keyDescription, KeyCode_E key) +{ + return MapKey(keyDescription, key, true); +} + +bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required) { SDL_Scancode scanCode; std::string description; @@ -97,7 +104,8 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key) if(!config_.getProperty(configKey, description)) { - Logger::write(Logger::ZONE_ERROR, "Input", "Missing property " + configKey); + Logger::Zone zone = (required) ? Logger::ZONE_ERROR : Logger::ZONE_INFO; + Logger::write(zone, "Input", "Missing property " + configKey); return false; } diff --git a/RetroFE/Source/Control/UserInput.h b/RetroFE/Source/Control/UserInput.h index dc7aa03..11e8545 100644 --- a/RetroFE/Source/Control/UserInput.h +++ b/RetroFE/Source/Control/UserInput.h @@ -41,6 +41,7 @@ public: KeyCodeLetterUp, KeyCodeNextPlaylist, KeyCodeRandom, + KeyCodeAddPlaylist, KeyCodeAdminMode, KeyCodeHideItem, KeyCodeQuit, @@ -56,6 +57,7 @@ public: private: bool MapKey(std::string keyDescription, KeyCode_E key); + bool MapKey(std::string keyDescription, KeyCode_E key, bool required); Configuration &config_; std::vector joysticks_; InputHandler *keyHandlers_[KeyCodeMax]; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index cf688d9..685b37b 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -129,12 +129,14 @@ void ScrollingList::setItems(std::vector *items) deallocateSpritePoints(); items_ = items; - itemIndex_ = 0; + if(items_) + { + itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size()); + } allocateSpritePoints(); notifyAllRequested_ = true; - } unsigned int ScrollingList::loopIncrement(unsigned int offset, unsigned int i, unsigned int size) @@ -215,6 +217,11 @@ void ScrollingList::setPoints(std::vector *scrollPoints, std::vector if(scrollPoints) size = scrollPoints_->size(); components_.resize(size); + if(items_) + { + itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size()); + } + allocateSpritePoints(); } diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.h b/RetroFE/Source/Graphics/Component/ScrollingList.h index f4f0f11..798b3ce 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.h +++ b/RetroFE/Source/Graphics/Component/ScrollingList.h @@ -79,12 +79,12 @@ public: void setScrollAcceleration(float value); void setStartScrollTime(float value); bool horizontalScroll; + void deallocateSpritePoints(); + void allocateSpritePoints(); private: void click(double nextScrollTime); - void deallocateSpritePoints(); - void allocateSpritePoints(); void resetTweens(Component *c, AnimationEvents *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime); unsigned int loopIncrement(unsigned int offset, unsigned int i, unsigned int size); unsigned int loopDecrement(unsigned int offset, unsigned int i, unsigned int size); diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 0b54ef8..7df2c17 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -645,6 +645,25 @@ void Page::draw() } +void Page::addPlaylist() +{ + if(!selectedItem_) return; + + MenuInfo_S &info = collections_.back(); + CollectionInfo *collection = info.collection; + + std::vector *items = collection->playlists["favorites"]; + if(playlist_->first != "favorites" && std::find(items->begin(), items->end(), selectedItem_) == items->end()) + { + items->push_back(selectedItem_); + if(activeMenu_) + { + activeMenu_->deallocateSpritePoints(); + activeMenu_->allocateSpritePoints(); + } + } +} + std::string Page::getCollectionName() { if(collections_.size() == 0) return ""; diff --git a/RetroFE/Source/Graphics/Page.h b/RetroFE/Source/Graphics/Page.h index 29b62d9..3b4a003 100644 --- a/RetroFE/Source/Graphics/Page.h +++ b/RetroFE/Source/Graphics/Page.h @@ -80,6 +80,7 @@ public: std::string getCollectionName(); void setMinShowTime(float value); float getMinShowTime(); + void addPlaylist(); private: void highlight(); diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 20ba9d6..eed65e1 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -449,6 +449,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) !input_.keystate(UserInput::KeyCodeLetterUp) && !input_.keystate(UserInput::KeyCodeLetterDown) && !input_.keystate(UserInput::KeyCodeNextPlaylist) && + !input_.keystate(UserInput::KeyCodeAddPlaylist) && !input_.keystate(UserInput::KeyCodeRandom)) { keyLastTime_ = 0; @@ -481,6 +482,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page) { page->nextPlaylist(); } + if(input_.keystate(UserInput::KeyCodeAddPlaylist)) + { + page->addPlaylist(); + } if(input_.keystate(UserInput::KeyCodeRandom)) { page->selectRandom();