RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Last Played Collection - Possible to limit?

    Scheduled Pinned Locked Moved Help and Support
    emulationstatiocollectionslastplayed
    65 Posts 9 Posters 14.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ClydeC
      Clyde @Alturis
      last edited by

      @alturis So, someone™ could write a bash script that scans the gamelist.xml and deletes all <lastplayed> entries but the newest x ones. The script could be run at startup or shutdown time, or at a timed interval.

      hiulitH 1 Reply Last reply Reply Quote 1
      • hiulitH
        hiulit @Clyde
        last edited by

        @clyde @Alturis I've got something in the works :D

        My little contributions to the RetroPie project:

        • Shell-Script-Boilerplate
        • Fun-Facts-Splashscreens
        • Limit-Last-Played-Games
        1 Reply Last reply Reply Quote 0
        • pjftP
          pjft
          last edited by

          You're all correct on all accounts.

          @hiulit if you're going through that work yourself, and from recalling the code, you probably don't really need to delete the <lastplayed> entry, but set the playcount to 0.

          Test that and see how it goes. It might be that that's sufficient, or that you need to delete both.

          Best.

          hiulitH 1 Reply Last reply Reply Quote 0
          • hiulitH
            hiulit @pjft
            last edited by

            @pjft Right now I don't have my Pi with me. I'm testing it in a VM with Pixel and RetroPie installed on it.
            I think I have managed to create a little script that gets all <lastplayed> tags, sorts them in a descending order and removes all the tags starting at nth (so it only leaves tags from 1 to nth, the most recent).
            Do you think it would be better to just reset <playcount> to 0?

            My little contributions to the RetroPie project:

            • Shell-Script-Boilerplate
            • Fun-Facts-Splashscreens
            • Limit-Last-Played-Games
            pjftP 1 Reply Last reply Reply Quote 0
            • pjftP
              pjft @hiulit
              last edited by

              @hiulit I am not fully sure, as that was put together over 6 months ago.

              I am very much under the impression that the playcount plays a role in determining whether it shows or not. I'm not sure whether it is the only factor, though, but I think that that would really be the key factor.

              hiulitH 2 Replies Last reply Reply Quote 0
              • hiulitH
                hiulit @pjft
                last edited by

                @pjft I'll try and play with both <lastplayed> and <playcount> and see how it goes :)

                My little contributions to the RetroPie project:

                • Shell-Script-Boilerplate
                • Fun-Facts-Splashscreens
                • Limit-Last-Played-Games
                1 Reply Last reply Reply Quote 0
                • hiulitH
                  hiulit @pjft
                  last edited by

                  @pjft Do you know which file does EmulationStation uses to create the Last played collection? Because I can't find a gamelist.xml in /opt/retropie/configs/all/emulationstation/collections/.
                  I've seen that there's a gamelist.xml in /opt/retropie/configs/all/emulationstation/gamelists/ but there's also the one in /home/pi/RetroPie/roms/<SYSTEM>/ so I don't know which one to use :P

                  My little contributions to the RetroPie project:

                  • Shell-Script-Boilerplate
                  • Fun-Facts-Splashscreens
                  • Limit-Last-Played-Games
                  AlturisA 1 Reply Last reply Reply Quote 0
                  • mediamogulM
                    mediamogul Global Moderator
                    last edited by mediamogul

                    I'm no coder, but in all the digital arts, the best practice is to always to work as non-destructively as possible. Wouldn't it make more sense to implement something like this directly into ES, to where the user could set a numbered limit to the list and everything beyond that would be ignored, rather than having the MD itself deleted, or reset? Again, I don't know if that would even be possible, it's just a thought. I have to admit, the more I think about it, that never-ending and always growing 'Last Played' list does seem like a strange and unwieldy concept.

                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                    hiulitH pjftP 2 Replies Last reply Reply Quote 2
                    • AlturisA
                      Alturis @hiulit
                      last edited by

                      @hiulit said in Last Played Collection - Possible to limit?:

                      @pjft Do you know which file does EmulationStation uses to create the Last played collection? Because I can't find a gamelist.xml in /opt/retropie/configs/all/emulationstation/collections/.
                      I've seen that there's a gamelist.xml in /opt/retropie/configs/all/emulationstation/gamelists/ but there's also the one in /home/pi/RetroPie/roms/<SYSTEM>/ so I don't know which one to use :P

                      Think it depends. In a vanilla install of RetroPie they are stored in .../emulationstation/gamelists but if you installed Steven Selph's scraper it has an option to store them in the roms folders. Not sure where exactly that setting is that Steven Selph's scraper is modifying though.

                      RP 4.7.1 • Pi4 4Gig • CanaKit Aluminum • 64GB microSD • 1920x1080 BarTop [2 Sanwa sticks]

                      hiulitH 1 Reply Last reply Reply Quote 0
                      • hiulitH
                        hiulit @mediamogul
                        last edited by

                        @mediamogul I'm with you. It would be better that this feature would be implemented directly into EmulationStation. But in the meantime, I'm having fun coding this little script. Also, I'm not capable of code for EmulationStation, so we'll have to pressure the developers if we want this feature added :P

                        My little contributions to the RetroPie project:

                        • Shell-Script-Boilerplate
                        • Fun-Facts-Splashscreens
                        • Limit-Last-Played-Games
                        1 Reply Last reply Reply Quote 0
                        • hiulitH
                          hiulit @Alturis
                          last edited by

                          @alturis Hmmm.. I think you are right. As I always scrape the system with Steven Selph's scraper and always set the option to create the gamelist.xml per system that's what I'm using. I should have this into consideration.

                          My little contributions to the RetroPie project:

                          • Shell-Script-Boilerplate
                          • Fun-Facts-Splashscreens
                          • Limit-Last-Played-Games
                          1 Reply Last reply Reply Quote 0
                          • hiulitH
                            hiulit
                            last edited by

                            Here: https://retropie.org.uk/forum/topic/15892/where-are-favorites-last-played-collections-stored/2

                            @mitu said exactly what we were talking about.

                            The automatic collections don't have a dedicated folder or configuration file, they're created based on the existing game information/metadata, stored in the gamelist.xml file for each system.

                            My little contributions to the RetroPie project:

                            • Shell-Script-Boilerplate
                            • Fun-Facts-Splashscreens
                            • Limit-Last-Played-Games
                            1 Reply Last reply Reply Quote 0
                            • AlturisA
                              Alturis
                              last edited by

                              Yeah honestly the OCD part of me would rather just wait until its an option built into EmulationStation rather then wipe out the play counts or last played dates on the data itself.

                              RP 4.7.1 • Pi4 4Gig • CanaKit Aluminum • 64GB microSD • 1920x1080 BarTop [2 Sanwa sticks]

                              hiulitH 1 Reply Last reply Reply Quote 0
                              • hiulitH
                                hiulit @Alturis
                                last edited by

                                @alturis If it's any relief, my script will create a backup of the gamelist.xml :P

                                My little contributions to the RetroPie project:

                                • Shell-Script-Boilerplate
                                • Fun-Facts-Splashscreens
                                • Limit-Last-Played-Games
                                1 Reply Last reply Reply Quote 0
                                • pjftP
                                  pjft @mediamogul
                                  last edited by

                                  @mediamogul I agree. I personally don't want to add another option to the menu to determine what's the right cutoff point, so I could pick one on my own (100, perhaps) and leave it at that.

                                  That being said, I'm not sure I have the time to make that happen in the near future - my limited time in the coming weeks will be devoted to improving lr-fuse controls - and I genuinely doubt it's a quick change but I'll take a look if I have the time during March.

                                  1 Reply Last reply Reply Quote 2
                                  • AlturisA
                                    Alturis
                                    last edited by

                                    Is there a github for EmulationStation?

                                    RP 4.7.1 • Pi4 4Gig • CanaKit Aluminum • 64GB microSD • 1920x1080 BarTop [2 Sanwa sticks]

                                    pjftP 1 Reply Last reply Reply Quote 0
                                    • pjftP
                                      pjft @Alturis
                                      last edited by pjft

                                      @alturis https://github.com/RetroPie/EmulationStation

                                      The change would be here:

                                      https://github.com/RetroPie/EmulationStation/blob/master/es-app/src/CollectionSystemManager.cpp#L698

                                      You'd also need to devise a way to remove one from the end when you add a new one to the top.

                                      The main challenge is likely to include the top X most recently played across all systems, I imagine you'd rely on the "All Games" collection.

                                      1 Reply Last reply Reply Quote 0
                                      • hiulitH
                                        hiulit
                                        last edited by

                                        FYI, just setting <playcount> to 0 is enough to make a game dissapear from the Last played collection. No need to remove the <lastplayed> tag.

                                        My little contributions to the RetroPie project:

                                        • Shell-Script-Boilerplate
                                        • Fun-Facts-Splashscreens
                                        • Limit-Last-Played-Games
                                        1 Reply Last reply Reply Quote 0
                                        • AlturisA
                                          Alturis
                                          last edited by Alturis

                                          Well I found where the code change would need to go.

                                          CollectionSystemManager.cpp

                                          void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysData)
                                          

                                          Just needs something like this at the end - need to read some code to figure out the right FileData collection class syntax

                                          	if ( sysDecl.type == AUTO_LAST_PLAYED )
                                          	{
                                          		rootFolder->remove( max( rootFolder->count - 50, 0 ) );
                                          	}
                                          

                                          Edit: changed min to max

                                          RP 4.7.1 • Pi4 4Gig • CanaKit Aluminum • 64GB microSD • 1920x1080 BarTop [2 Sanwa sticks]

                                          pjftP 1 Reply Last reply Reply Quote 2
                                          • pjftP
                                            pjft @Alturis
                                            last edited by pjft

                                            @alturis The idea is good, in concept, but that can only be applied if - and after - it has been sorted by last played time.

                                            Edit: after I looked at the code I see that that particular location would already be sorted.

                                            I'd also need to make sure to update the "update" function to keep that number straight.

                                            I'll look through that, and I'll fix it at 100.

                                            Edit 2: for reference, it'd be here:

                                            https://github.com/RetroPie/EmulationStation/blob/master/es-app/src/CollectionSystemManager.cpp#L280

                                            hiulitH 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.