Pegasus theme development general
-
Thanks guys, great info. What is the proper way to handle the swap between Megadrive and Genesis? Looks like the themes support both, but how is Pegasus choosing which one it shows? I tried changing it in the usual way and it didn't seem to have any effect.
-
@SinisterSpatula the default theme just shows the logo based on the collection's
shortname
(if there is one for it). There isn't any hardcoded game console information inside Pegasus. -
Okay, I guess the issue I'm running into, and if I understand correctly, is that Pegasus is pulling in the "shortname" for megadrive from
/etc/emulationstation/es_systems.cfg
and whatever is set as<name>megadrive</name>
. ES/retropie is wanting to keep the name always as megadrive so it knows where to grab configs, launching image, and other info from, and as far as themes are concerned, they should follow what is set in<theme>megadrive</theme>
(same applies for pcengine). So, unless I also rename the folder in/opt/retropie/configs/megadrive
to genesis, (which is going against the current standard) I don't see how to get it to use "genesis" instead. I can work around this in the code of the theme, but wanted to know if there was already a more proper way that I was not aware of yet. So I guess I was hoping, that pegasus was already taking into consideration what is written in<theme>
as well, and not just<name>
.Edit: Maybe I'm wrong about all of this? I just noticed Pegasus is saying "Sega Mega Drive" for the name in platforms menu, but that's not in es_systems.cfg.
For now I'm adding a setting to switch megadrive/genesis, and changing what it does based on that. (changing the source.svg image it uses, and text that it displays.) One bad side effect of this, is that the platform list will show the TurboGrafx-16 in the same spot as pcengine so the alphabetical sorting is not accurate.
-
@SinisterSpatula Yes, it uses
name
for shortname andfullname
for name.theme
is not used, however I thinkplatform
could be used for this task and I can add support for that. The theme is set to just load "shortname +.svg
" by default, but you can add any other logic as well. -
@fluffypillow
platform
can be multi-valued ines_systems.cfg
, though I don't think this is currently used by any system. -
Another thing that came up was the issue of localization. If someone wants "Favourite" instead of "Favorite" for example. I don't know if that could be something that is supported in the front end also, or how best that could be supported. For now I just included a "favourites" logo and people can manually rename it.
-
@SinisterSpatula that's a good question and I'm not sure yet what would be the best approach. It can't be provided by Pegasus' core, since you can use any text in a theme, so probably language setting will also need to be a theme option. The language Pegasus itself is using can be accessible to help with that.
-
@fluffypillow While that does at first glance feel like a theme option, I feel like simply having a EN-US and EN-GB option for language would make automating that on the theme a ton easier. As it stands right now there's no way to know which version of english people will want.
It's probably not a huge deal since Favorite/Favourite is about the only instance I can think of that we would implement but also I would hope that it was a very small change on your end too (basically just duplicate the en-us localisation and add that extra option) that maybe it's worth it?
-edit- Also on that note, how does one actually get the language selection? Someone asked about localisation for gameOS so I thought I may as well look into it (although actually properly localising it to each of the respective languages is another story...)
-
When jumping to a new index of the GridView, the following code works to move to it instantly, but the strange thing is, it's only instant if the new index is further down. If the index is a previous one (up above the current) then the performance bogs down and it's a much more processor intensive task. Any ideas on that? I've tried GridView.Center, Contain, SnapPosition. Visible seems like it gives the best performance (going down but not up), none of them give good performance going up, (same for .Beginning) Wondered if there was a trick, like making it invisible and disabled before jumping, and un-do it after the jump. (Just need a way to prevent it from trying to process a scroll/flick animation, I just want it to instantly re-position the grid.) I can jump it from 0 to Z in a flash, but going from Z to 0 will move like a glacier. This also has me wondering if the grid can start over again once it get's to Z, like maybe it can just show the start of the items again. But I haven't gotten very far when searching about that.
positionViewAtIndex(idx, GridView.Visible); currentIndex = idx;
-
@fluffypillow A long time ago I asked you about the ability to get which button is assigned to which actions (ie getting the button that is assigned to cancel). I feel like I recall you adding that but I can't seem to find that information anywhere. I suspect that info is held within api.keys but I'm not entirely sure what to query to get it. Is this possible at all?
-
@PlayingKarrde Yes, see the Array column here; the elements have
key
andmodifier
fields like QML KeyEvents. At the moment they also have aname()
function, but this might change in the future (ie. don't depend on it), and its output also varies depending on platform and language. -
@fluffypillow Thanks. You say not to rely on name() but isn't this exactly what I need? I'm honestly not sure how I can use the model that it provides otherwise as I'm not sure what those values represent. For context this is for making button help.
-
@PlayingKarrde It seems there's no built-in way to get the the current locale, so I'll add something for that. In a theme that'd look something like
- you add a theme option (think a simple dropdown list) for selecting a language out from those that your theme supports
- on loading/change you set it to the one Pegasus uses or to some fallback
You can add support for languages not supported by Pegasus, as it'll be just a theme option. Languages have a code like "en-US" and "en-GB", so you'd be able to make a difference or use a general "English" based on that.
I can also add translations if someone makes them :) I was also thinking about making a translation site, just haven't had the time yet.
@SinisterSpatula Such slowdown is very interesting, the memory of the Pi shouldn't be that slow. This will need some more debugging. Could you record a video of it?
As for jumping from the last to the first element, you can use
keyNavigationWraps
.@PlayingKarrde by don't depend, I mean it's not officially part of the Keys yet (ie. undocumented), I think I might change it from being a function to a regular property before first. But yes, that's something you'd use for for actually showing the name of the keys. One shouldn't depend on the the text either, as it may return different names on different languages/platforms (eg. Mac).
-
@fluffypillow said in Pegasus theme development general:
by don't depend, I mean it's not officially part of the Keys yet (ie. undocumented), I think I might change it from being a function to a regular property before first. But yes, that's something you'd use for for actually showing the name of the keys. One shouldn't depend on the the text either, as it may return different names on different languages/platforms (eg. Mac).
Gah ok how can I get something that is consistent and platform agnostic from that then?
-
The
key
andmodifier
fields should be same across platforms (they are actually just numbers), it's the displayed name that's different, Like Ctrl turns into Option (I think?) on Mac. The list of possiblekey
values is listed here (you can eg, doif (key == Qt.Key_X) //do something
), andmodifiers
are listed here. Gamepad keys have their own key code, I think I've listed them here somewhere but I'll also document them eventually. -
Hmm ok. I will brute force it then. It's not ideal but also not the end of the world since there aren't THAT many controller buttons.
-
@PlayingKarrde one sec and I'll provide a list :)
-
@fluffypillow here's the order, the number grows by one on every button after A
A = 0x100000, B, X, Y, L1, L2, L3, R1, R2, R3, SELECT, START, GUIDE,
-
@fluffypillow Oh ok that's easier than I thought. Although those aren't the results I was getting in my tests, I'll try them and see. Thanks!
-
For anyone else that wants to do this, this is the function I made:
function processButtonArt(buttonModel) { var i; for (i = 0; buttonModel.length; i++) { if (buttonModel[i].name().includes("Gamepad")) { var buttonValue = buttonModel[i].key.toString(16) return buttonValue.substring(buttonValue.length-1, buttonValue.length); } } }
Then passing in the key (ie
processButtonArt(api.keys.cancel)
) . This obviously isn't super ideal since it's currently relying on name() but it's the only way I could find to discern between a gamepad and key for now (if there's a better way I'm happy to change) but this is working for me for now.
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.