RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Variable Support in Themes in EmulationStation

    Scheduled Pinned Locked Moved Ideas and Development
    emulationstationthemes
    111 Posts 13 Posters 36.0k 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.
    • ruckageR
      ruckage @EctoOne
      last edited by

      @ectoone
      Not really, it still negates the need to have a separate folder for each system and it would allow you to colour any element in the theme using the loaded variable.
      What ever you do you're still going to have files for each system if you want system specific elements, your suggestions doesn't change that and limits it to backgrounds only.

      SNES mini/Nes mini/Famicom mini theme developer.

      If you'd like to support my work you can donate here: Donate

      E 1 Reply Last reply Reply Quote 0
      • E
        EctoOne @ruckage
        last edited by

        @ruckage The negation of separate folders was what i meant by "dumping all txt files into one location". :)
        And i never said my idea was a good one, just an alternative with flaws.
        I would prefer to use the method i mentioned up top and be able to mix variables into other variables.

        1 Reply Last reply Reply Quote 0
        • J
          jdrassa
          last edited by

          @ruckage said in Variable Support in Themes in EmulationStation:

          Hi, do you mind me asking why you decided against that

          I was worried it would overly complicate things. If a lot of variables were defined that way, then it would be more difficult to get an overall view of what is different about a specific system. Where as maintaining system specific theming in the system specific theme file centralizes it.

          @ruckage said in Variable Support in Themes in EmulationStation:

          Would an alternative option be to have a way to load external variables in from a text file?
          You could have a text file that contains the variable and nothing else - in this case a colour, and give the text file the same name as the system:

          I think the problem with this approach is that once you start introducing multiple variables, the number of files you are creating will grow quickly.

          Get latest build of EmulationStation for Windows here

          E 1 Reply Last reply Reply Quote 1
          • E
            EctoOne @jdrassa
            last edited by

            @jdrassa said in Variable Support in Themes in EmulationStation:

            @ruckage said in Variable Support in Themes in EmulationStation:

            Hi, do you mind me asking why you decided against that

            I was worried it would overly complicate things. If a lot of variables were defined that way, then it would be more difficult to get an overall view of what is different about a specific system. Where as maintaining system specific theming in the system specific theme file centralizes it.

            I always refrained to create an dynamic theme because of the one system per folder setup. I rather use threaded variables than maintaining multiple files. That allows me to save variants of code blocks for several elements.
            It also is just a problem that themers would have to deal with, not the users.
            If you would add that, it wouldn't break the option to still use the system/theme.xml method, am I right? So why not have both ways.

            And to be honest, I was more confused by the fact that some complex code works, and some simple stuff didn't. Plus, that I had times, where - for whatever reason - the same code worked in one moment and then suddenly stopped working.

            1 Reply Last reply Reply Quote 0
            • E
              EctoOne
              last edited by

              Heya, would it be possible to get a game.name variable? I mean one like system.name that could be used within an text element to display the currently selected game.
              I was thinking about that after I accidentally turned the carousel from a navigation element into a design element when I was working on my Metroid theme.
              Since the available elements for detailed view are limited, I always have a hard time to create something I like. And I thought what I could do if I could hide the gamelist and have just one game name on screen (now that I think of it, I probably just could make the gamelist very small to display one game... Welp, back to the drawing board.).
              But still, I can see more options where I could use that variable. I'm thinking of ways to display more images based on a game without having extra tags in the gamelist. Although I'm not sure how ES handles images and that might be to resource heavy.

              J 1 Reply Last reply Reply Quote 0
              • J
                jdrassa @EctoOne
                last edited by

                @ectoone Unfortunately that is not possible due to how the themes are loaded and when the variables are resolved.

                Get latest build of EmulationStation for Windows here

                E 1 Reply Last reply Reply Quote 0
                • E
                  EctoOne @jdrassa
                  last edited by

                  @jdrassa Yeah i thought so.
                  But if i remember correctly, I've seen something like md_gamename when i was looking at the github discussion for grid view. Maybe that will be available in other views. But i'm so tired that i could be totally wrong about that.

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    jdrassa @EctoOne
                    last edited by

                    @ectoone You are correct. Something like that was proposed with grid view. It would make sense to support it in all views.

                    Get latest build of EmulationStation for Windows here

                    1 Reply Last reply Reply Quote 1
                    • ruckageR
                      ruckage
                      last edited by ruckage

                      @jdrassa

                      I'm using the single theme.xml principle for my snes mini theme but I've hit a bit a snag.

                      I'm using the ${system.name} variable extensively to load system specific backgrounds and logos etc. which works really well and is far better than having a folder for each system.
                      However there is a downside - for unsupported systems and custom collections you lose the ability to have a default system as for example ${system.name}.png will always look for a png with the current system name and if it doesn't exist will load nothing.

                      Would it be possible if no file exists for ES to then assume that ${system.name}=default and then look for that file instead?

                      Eg. Assume that nes has no assets.

                      In the theme we have: <path>./${system.name}.png</path>
                      This will look for nes.png

                      This doesn't exist so as a backup ES will then look for: default.png
                      (basically it would replace the system name with the word default or another word of your choice)

                      I hope that makes sense, I love not needing a folder for every system - it makes changes so much easier and this seems to be the only real downside.

                      SNES mini/Nes mini/Famicom mini theme developer.

                      If you'd like to support my work you can donate here: Donate

                      E J 2 Replies Last reply Reply Quote 1
                      • E
                        EctoOne @ruckage
                        last edited by

                        @ruckage What I did for the default background was to use a default image as background and have the system backgrounds load on top of that using zindex. But I agree that some default value would be useful, it would allow us to have a default logo on the carousel instead of plain text as well.

                        ruckageR 1 Reply Last reply Reply Quote 0
                        • ruckageR
                          ruckage @EctoOne
                          last edited by ruckage

                          @ectoone
                          Hi @EctoOne, I did consider that as an option but unfortunately it's not viable on my current theme as it uses so many layers. I've had to optimise it carefully as it is so adding even 1 more full-screen layer would sadly result in too much slowdown.

                          SNES mini/Nes mini/Famicom mini theme developer.

                          If you'd like to support my work you can donate here: Donate

                          1 Reply Last reply Reply Quote 0
                          • J
                            jdrassa @ruckage
                            last edited by

                            @ruckage I will need to think some about the best way to approach this. The way variables are processed, they are are resolved well before the values are passed to the actual gui components (i.e. ImageComponent, TextComponent, ...). As such, the components are unaware of variables.

                            I am leaning towards adding something like the following:

                            <image>
                              <path>./${system.name}.png</path>
                              <defaultPath>./default.png</defaultPath>
                            </image>
                            

                            This would make the behavior very specific and deliberate.

                            Get latest build of EmulationStation for Windows here

                            1 Reply Last reply Reply Quote 1
                            • J
                              jdrassa
                              last edited by

                              @ruckage Also just to note. I see you are using ${system.name}. I would recommend using ${system.theme} instead.

                              Get latest build of EmulationStation for Windows here

                              ruckageR 1 Reply Last reply Reply Quote 1
                              • ruckageR
                                ruckage @jdrassa
                                last edited by

                                @jdrassa
                                Thanks for the reply. Having a default path sounds perfect to me.

                                Regarding the use of ${system.name} I'll change that to ${system.theme}.
                                What's the difference between them as ${system.name} seems to work perfectly and the only systems I noticed which didn't work as expected were all/favorites/recent.

                                SNES mini/Nes mini/Famicom mini theme developer.

                                If you'd like to support my work you can donate here: Donate

                                J 1 Reply Last reply Reply Quote 0
                                • J
                                  jdrassa @ruckage
                                  last edited by jdrassa

                                  @ruckage The values are derived from es_systems.cfg.

                                    <system>
                                      <name>nes</name>  <!-- ${system.name} -->
                                      <fullname>Nintendo Entertainment System</fullname> <!-- ${system.fullName} -->
                                      <path>/home/pi/RetroPie/roms/nes</path>
                                      <extension>.nes .zip .NES .ZIP</extension>
                                      <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes %ROM%</command>
                                      <platform>nes</platform>
                                      <theme>nes</theme> <!-- ${system.theme} -->
                                    </system>
                                  

                                  While generally, name and theme are the same, there are some cases where they are not. It also helps for systems like megadrive/genesis and pce/tg16 where the user may have changed the theme.

                                  Get latest build of EmulationStation for Windows here

                                  ruckageR 1 Reply Last reply Reply Quote 1
                                  • ruckageR
                                    ruckage @jdrassa
                                    last edited by

                                    @jdrassa
                                    Thanks, obvious really if I'd thought about it.
                                    I've changed all instances of ${system.name} to ${system.theme}. Thanks for the advise.

                                    SNES mini/Nes mini/Famicom mini theme developer.

                                    If you'd like to support my work you can donate here: Donate

                                    J 1 Reply Last reply Reply Quote 0
                                    • J
                                      jdrassa @ruckage
                                      last edited by jdrassa

                                      @ruckage I have implemented default image support. I ended up naming the new field default since that was what video was already using.

                                      <image>
                                        <path>./${system.name}.png</path>
                                        <default>./default.png</default>
                                      </image>
                                      

                                      It also occurred to me that this could work well for the missing.png you use. You could set it as the default for md_image and then it would only show if the selected game does not have an image.

                                      Windows build available here:
                                      https://ci.appveyor.com/project/jrassa/emulationstation/build/2.6.4-201746011746/artifacts

                                      Get latest build of EmulationStation for Windows here

                                      ruckageR E 2 Replies Last reply Reply Quote 3
                                      • ruckageR
                                        ruckage @jdrassa
                                        last edited by ruckage

                                        @jdrassa

                                        That's great, I'll give it a test. Is this part of the main branch yet?
                                        edit: Yes it definately would be perfect for the missing .png. It's currently removed as it was sometimes visible when not needed so this would fix that.

                                        SNES mini/Nes mini/Famicom mini theme developer.

                                        If you'd like to support my work you can donate here: Donate

                                        1 Reply Last reply Reply Quote 0
                                        • E
                                          EctoOne @jdrassa
                                          last edited by EctoOne

                                          @jdrassa Is the default thing also possible within the carousel?
                                          It seems stupid to cover the text for unthemed systems but since we can pull the system name with system.Fullname and format it like we want, i can see some use for it.

                                          Edit: Nvm, i totally forgot that it's based around the image tag, so it should be possible. For some reason i thought that the logos were defined by the carousel tag.

                                          J 1 Reply Last reply Reply Quote 0
                                          • J
                                            jdrassa @EctoOne
                                            last edited by

                                            @ectoone The carousel is a bit of a special case. There is logic there that determines if it should show the image vs. text. I did not make any changes to that logic, so the default image doesn't currently work for the carousel. I am not sure that I see the use case where a default image would be better then text, since the user wouldn't be able to tell what system it.

                                            Get latest build of EmulationStation for Windows here

                                            E ruckageR 2 Replies 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.