Scroll of Title of game - better understand how it works ?
-
Looks like a royale brain twister on a first sight.
It it defined in a header file / template class:TextListComponent.h
.The decision to scroll is made at this line.
It might be tempting to assume the wrong decision is caused either by a theme or is caused by a few fixed characters off but the rabbit hole goes deeper:
I discovered that game titles with L, F, T aso. are significantly shorter measured bysizeText()
than those with less of those characters?!
It turned out that thesizeText()
is feeded with the gametitle "as-is" from thegamelist.xml
(usually mixed upper/lowercase), but to measure the x-dimension right the theme's<forceUppercase>
must be honored before callingsizeText()
.Small change. But with that each title scrolls even if it is only a few pixels too long. :)
diff --git a/es-app/src/components/TextListComponent.h b/es-app/src/components/TextListComponent.h index bd1520d..f1a8efb 100644 --- a/es-app/src/components/TextListComponent.h +++ b/es-app/src/components/TextListComponent.h @@ -304,7 +304,8 @@ void TextListComponent<T>::update(int deltaTime) mMarqueeOffset2 = 0; // if we're not scrolling and this object's text goes outside our size, marquee it! - const float textLength = mFont->sizeText(mEntries.at((unsigned int)mCursor).name).x(); + auto name = mEntries.at((unsigned int)mCursor).name; + const float textLength = mFont->sizeText(mUppercase ? Utils::String::toUpper(name) : name).x(); const float limit = mSize.x() - mHorizontalMargin * 2; if(textLength > limit)
Please test the proposed patch on your installation and report back. Then a PR could be filed.
Thanks for challenging this guys, you helped to squish an annoying, old (might be 7yrs old) bug which must be around since
<forceUppercase>
was introduced for themes. -
@lolonois said in Scroll of Title of game - better understand how it works ?:
Looks like a royale brain twister on a first sight.
It it defined in a header file / template class:TextListComponent.h
.The decision to scroll is made at this line.
It might be tempting to assume the wrong decision is caused either by a theme or is caused by a few fixed characters off but the rabbit hole goes deeper:
I discovered that game titles with L, F, T aso. are significantly shorter measured bysizeText()
than those with less of those characters?!
It turned out that thesizeText()
is feeded with the gametitle "as-is" from thegamelist.xml
(usually mixed upper/lowercase), but to measure the x-dimension right the theme's<forceUppercase>
must be honored before callingsizeText()
.Small change. But with that each title scrolls even if it is only a few pixels too long. :)
diff --git a/es-app/src/components/TextListComponent.h b/es-app/src/components/TextListComponent.h index bd1520d..f1a8efb 100644 --- a/es-app/src/components/TextListComponent.h +++ b/es-app/src/components/TextListComponent.h @@ -304,7 +304,8 @@ void TextListComponent<T>::update(int deltaTime) mMarqueeOffset2 = 0; // if we're not scrolling and this object's text goes outside our size, marquee it! - const float textLength = mFont->sizeText(mEntries.at((unsigned int)mCursor).name).x(); + auto name = mEntries.at((unsigned int)mCursor).name; + const float textLength = mFont->sizeText(mUppercase ? Utils::String::toUpper(name) : name).x(); const float limit = mSize.x() - mHorizontalMargin * 2; if(textLength > limit)
Please test the proposed patch on your installation and report back. Then a PR could be filed.
Thanks for challenging this guys, you helped to squish an annoying, old (might be 7yrs old) bug which must be around since
<forceUppercase>
was introduced for themes.Lol... I am absolutely not an expert :)
plus English is not my mother tongue :)I don't have understand how i need to modify... my actual gamelist.xml ?
Or some file of "carbon" theme ? :) -
@djdiabolik you asked for
- Scroll of Title of game - better understand how it works ?
- how many characters are actually shown?
- is there some sort of gap to make the title scroll begin?
Ad 1: I guess I layed out how it works: The
name
contains the game's name. If you studysizeText()
of the Font class, note how thelinewidth
is summed up by each glyph ofname
This width is returned totextLength
and compared to thelimit
(see next).Ad 2: In the
<gamelist>
element in thecarbon.xml
file, see:<textlist name="gamelist">
in the childelement<size>0.489 0.794</size>
defines the available x - width and y - height in percentage of the total screen dimension (e.g. 1920x1080) . (The size may even be smaller due to other settings of the theme.) This x value is the space (thelimit
) you have for the game name. How many characters this is depends on the font and fontsize in use and if a character is lower or uppercase.Ad 3: No. If
textLength > limit
it scrolls, else not. Period.TL;DR: It can neither be fixed by editing the
gamelist.xml
nor by editing any theme file. -
@djdiabolik I think what they're saying is, this is not something you can fix in a config file. You'd have to modify the code yourself, and recompile it.
-
@sleve_mcdichael no need to talk to me with an royal we. (-; RetroPie and Emulationstation is open for all to learn/modify/extend.
But yes, you are right. A fix is only possible by changing the code.
However, you can do a workaround by displaying the game names without being modified to UPPERCASE:
Get a copy of the carbon theme (if not present already, else skip right to step 2):
- ssh to your pi as user pi.
cd .emulationstation mkdir themes cd themes git clone https://github.com/RetroPie/es-theme-carbon.git carbon cd carbon
- ssh to your pi
-
Submitted PR#742.
-
I told you that I am all less than an expert on the case... I thought it was easier.
If i need to recompile ( as it say @sleve_mcdichael )the source/code of default 'carbon' theme it's time for me to roll up my sleeves and start studying ;)
If I wanted to make an alternate copy of stock 'carbon' theme for testing some all modification i can use this:
git clone https://github.com/RetroPie/es-theme-carbon.git carbon-alt
it's correct ?
EDIT
i am trying to learn.... i have turned on my pi4 right now.
I have connected by ssh and reach it:pi@retropie:~ $ cd .emulationstation pi@retropie:~/.emulationstation $ ls collections es_input.cfg es_input.cfg.bak es_log.txt es_log.txt.bak es_settings.cfg es_temporaryinput.cfg gamelists scrapers tmp
there's no exist a folder called themes..... i have created and made the carbon.
I have made all modification as you have correctly listed.
Restart ES and apparently there's no difference.I should perhaps apply this ex-novo theme ?
EDIT 2nd part
Is working :)pi@retropie:~/.emulationstation $ mkdir themes pi@retropie:~/.emulationstation $ cd themes pi@retropie:~/.emulationstation/themes $ git clone https://github.com/RetroPie/es-theme-carbon.git carbon-alt Cloning into 'carbon-alt'...
To edit carbon.xml after i thinks it's a good alternative using a sftp client connected as Pi user.
Whit it i can use notepad++ to edit files......the problem is that it gives me this error:
fatal: unable to access 'https://github.com/RetroPie/es-theme-carbon.git/': Failed to connect to github.com port 443: Connection timed out
I've heard about this problem elsewhere before...... i can ping www.github.com whitout any problems.
My Pi4 it's connected by wifi..... problably need to see the port 443.....EDIT 3rd part
Problably it's ok:pi@retropie:~/.emulationstation/themes $ git clone http://github.com/RetroPie/es-theme-carbon.git carbon-alt Cloning into 'carbon-alt'... warning: redirecting to https://github.com/RetroPie/es-theme-carbon.git/ remote: Enumerating objects: 1301, done. remote: Total 1301 (delta 0), reused 0 (delta 0), pack-reused 1301 Receiving objects: 100% (1301/1301), 3.82 MiB | 3.74 MiB/s, done. Resolving deltas: 100% (247/247), done.
Using http instead https.....now time to modify all it's need.
EDIT 4rd part
Ok all modification it's done.
After i have created the folder "carbon-alt" i have need to select it directly from ES.
I have restart ES after select it and try to see the result... apparently there's no difference respect the stock carbon.there is something I did not understand :)
Edit part 5
and anyway... i have modify all<forceUppercase>0</forceUppercase>
I have restart ES and chose this "carbon-alt" theme but there's somethings strange because i continue to see al names in uppercase anyway.
I have check the gamelist.xml for my nes collection..... i have pick this as example:<game id="1791" source="ScreenScraper.fr"> <path>./A/Advanced Dungeons & Dragons - Dragons of Flame (Japan).zip</path> <name>Advanced Dungeons & Dragons - Dragons of Flame (Japan)</name> <desc>Set in between the SSI's AD&D Dragonlance action games Heroes of the Lance and Shadow Sorcerer. This game follows the tradition of Heroes of the Lance with a side-scrolling, action-oriented view, a breakaway from the standard GoldBox RPGs. Plot-wise, it also takes place between those two games, following closely the novel/game modules written by Weiss/Hickman. You take control of one character at a time, with each hero having different abilities.</desc> <releasedate>19920221T000000</releasedate> <developer>Pony Canyon</developer> <publisher>U.S. Gold</publisher> <genre>Role playing games</genre> <players>1</players> <image>./media/images/A/Advanced Dungeons & Dragons - Dragons of Flame (Japan).png</image> <genreid>768</genreid> </game>
The name it's not all in uppercase.. but on ES it's show as uppercase anyway and it's out at left and no scroll.
seems not to be these changes stuff for me.....Final EDIT for moment
nothing guys :) is not in my skills modify this.
I have made another some test and restart ES about five time but i continue to see al title in uppercase on my alternative copy of carbon theme.
There must be something that escapes me.....Look at this another example.... i have download another different name from ES. it's pixel-metadata.
This is nes title:
look this. out of screen at right. All uppercase instead it's setted at 0 and not scrollingThe gamelist.xml it's not contain name in uppercase....
If i scroll upper on europe virtual console of same games.... look here:
it's scroll whitout any issueand here:
it's scrollIt's screen it's setted in 1080p... it's retropie setting to force all name in uppercase instead it's not setted on theme ?
I don't really undestand where could the problem be.... but probably it's my limit knowledge. -
@djdiabolik thanks for the verbose reply. I guess you are almost there with the workaround. Some hints from the distance:
If I wanted to make an alternate copy of stock 'carbon' theme for testing some all modification i can use this:
git clone https://github.com/RetroPie/es-theme-carbon.git carbon-alt
it's correct ?
While it is not explicitly stated in the guide the <folder name> of the theme and the <theme>.xml must have the same name, so in your case it should look like
carbon-alt/carbon-alt.xml
and not
carbon-alt/carbon.xml
I assume this is it, which left you stranded with your quote "There must be something that escapes me....."
For the meta-pixel theme (never used it, but some ideas which may cause the "still in uppercase" effect):
- If you haven't done yet: Copy the whole meta-pixel folder to your PC (with sftp/winscp or alike) and use notepad++ to find any occurence of
<forceUppercase>1
. From my memory there is a search option Find in files within notepad++ (set file Filter to *.xml and Search from folder meta-pixel downwards).
Rationale: Each XML<text>
element can be overwritten by platform (=the foldersnes/
,amiga/
and so on) specific formatting so on some platforms the theme designer may have choosen to display games in uppercase, even if it is set to 0 in the "global" theme setting (i.e. incarbon-alt.xml
ormeta-pixel.xml
). - Edit all occurences and copy the tree back to the Raspberry Pi.
If this does not help: Some Fonts only provide uppercase Glyphs for every character even if the game name consists of mixed case characters. In this case the
<forceUppercase>
has no visible effect. :/- To verify: Search for
*.ttf
files within the theme folder. Copy them to Windows. On windows double click on the found font filename to see sample text of that font (no need to install it). If there are no lowercase characters shown the font only provides uppercase.
Hope this helps.
- If you haven't done yet: Copy the whole meta-pixel folder to your PC (with sftp/winscp or alike) and use notepad++ to find any occurence of
-
@lolonois
mmmmm... i tried to install other themes just for testing :)
But i'm back to use the stock and default "carbon" because basically I like it and it is essential :)For made all possibly test the "alternative" carbon it's now cloned here:
/opt/retropie/configs/all/emulationstation/themes/carbon-alt/In this folder there's present a file called carbon.xml and not a file called carbon-alt.xml.... do you think I should maybe rename the file itself?
I have tryed to look on theme.xml and there's this:
<theme> <formatVersion>4</formatVersion> <include>./carbon.xml</include>
this should mean that the name carbon.xml it's right :)
The carbon theme use this:
<fontPath>./art/Cabin-Bold.ttf</fontPath>
I have copyed this cabin-bold.ttf on windows.
I can also confirm this cabin-bold.ttf not contain only uppercase text but it's contain all this caracter:
I have load a preview hereAt this point i have also see... inside "nes" folder there's a theme.xml but there's no contain a strings like forceuppercase or similar.
maybe it's emulationstation that has some default option turned on?
I need to check......
-
@djdiabolik If the carbon-alt theme works (ie. your changes to files in that folder do have an effect in ES) with the
carbon.xml
as filename there is no need to change it. However, if you (have to) change it tocarbon-alt.xml
make sure to rename also all references in to thecarbon.xml
inside the xml (as you noted above). I must say I have not spent much time on themes in general, so my hint is an educated guess.Anyhow, I guess you can stop fiddling with themes. My pull request (https://github.com/RetroPie/EmulationStation/pull/742) has been accepted to the development version of Emulationstation. You may run this version by yourself:
- Quit Emulationstation.
- ssh to your RetroPie
- Start
sudo ~/RetroPie-Setup/retropie_setup.sh
, select Manage experimental packages, scroll down to almost the end (see screenshot), to entry198 emulationstation-dev
then selectInstall from source
.
- Let the compile finish
- Restart Emulationstation
PS: If you want to revert to stable Emulationstation navigate in the retropoe setup to Manage packages -> Manage core packages -> 199 emulationstation . But from my experience the development version is kept pretty stable from the project maintainers.
-
@lolonois said in Scroll of Title of game - better understand how it works ?:
Anyhow, I guess you can stop fiddling with themes
Lol... fiddling with themes... lol.. at the end it's fun for me :)
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.