Variable Support in Themes in EmulationStation
-
@jdrassa Yeah i thought so.
But if i remember correctly, I've seen something likemd_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. -
@ectoone You are correct. Something like that was proposed with grid view. It would make sense to support it in all views.
-
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.pngThis 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.
-
@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.
-
-
@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.
-
@ruckage Also just to note. I see you are using
${system.name}
. I would recommend using${system.theme}
instead. -
@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. -
@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.
-
@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. -
@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 -
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. -
@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.
-
@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.
-
@jdrassa Oh, thanks for the answer.
My Invaders Theme would be an example where text would break the design and that uses<text>${system.fullName}</text>
to show which system is selected.
So there are cases where it would be useful, but it depends on the Theme creator to avoid confusion. So i understand why you didn't change that. -
@jdrassa
Regarding the default carousel image I agree with @EctoOne , it's something that could be useful in certain circumstances so I think it would be worth adding. For my theme I had considered it as having just text breaks the look of my theme as well - however in my case it wouldn't be ideal as you couldn't tell what system was selected so instead I'm going to generate basic icons/logos for every supported system and use the default image option for the backgrounds.I've tested the default images in the version you posted and all seems to be working perfectly. Thanks for all your hard work.
-
-
@jdrassa
Thanks, that's great news. -
@jdrassa
Hi. I just tried you latest continuous build for windows and the automatic variable system.theme isn't working so my snes mini theme no longer displays any icons/backgrounds. Has something changed or is this a bug?The version I was using previously was from 1st October (I think when you added default image support) and the variables all work perfectly in that version.
Thanks in advance for your help.
-
@ruckage Looks like a recent change introduced a bug where only the first variable is being resolved. Should have a fix out in a day or two.
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.