batocera-linux / batocera-emulationstation

MIT License
310 stars 237 forks source link

Set a background color behind a video element. #321

Closed KingKebab closed 4 years ago

KingKebab commented 4 years ago

Hello,

I would like to set a background color to a video tag element like this :

<video name="md_video">
         <pos>0.308 0.369</pos>
         <maxSize>0.2005 0.2680</maxSize>
         <delay>1.0</delay>
         <zIndex>44</zIndex>
         <color>000000</color>
</video>

But it seems the <color> feature isn't available for this element. So I think its an improvment, not a bug.

Why I'm looking for this feature ? On some vertical arcade games the video screen resolution doesn't overide properly the screenshot area of a mixed picture with screenshot+boxart+cartridge+marquee.

I did a video here to illustrate : https://www.youtube.com/watch?v=hh8kmRI7akk

You can see on the CRT screen, the screenshot picture overflows behind the video preview. And it's not really pretty.

I know the <showSnapshotNoVideo> tag to automatically swith between picture and video. But we can't recreate a full mixed picture with separated elements like using the <image name="md_marquee">. Because, it requires new media supports like : md_boxard, md_screenshot.

Kind regards.

fabricecaruso commented 4 years ago

In gamelists you have 3 images resources : Image -> Should be the screenshot Thumbnail -> Should be the box Marquee -> Should be the logo

So for image elements, your "md_boxart" is md_thumbnail, your "md_screenshot" is md_image...

In the video element, you can use combined to ( image, thumbnail, marquee -> image in you case ), it will solve your problem. You can also disable the bump effect using set to "none".

You can also crop video using minSize instead of maxSize to "fill" the "TV"

KingKebab commented 4 years ago

Hello Fabrice,

Thank you so much for your reply.

I used this code to display my boxart picture.

<image name="md_thumbnail">
         <pos>0.1 0.1</pos>
         <maxSize>1 1</maxSize>
         <zIndex>42</zIndex>         
</image>

Unfortunatly it shows me the "mix" picture. And I already use "md_image" image to display the "mix" picture.

I use ARRM to scrape media from ScreenScraper. It's the most powerfull and accurate tool I can found for now.

Here is the gamelist.xml format for games :

<game>
    <path>./1942.zip</path>
    <name>1942 (Revision B)</name>
    <desc>"1942" est le premier jeu d'une longue lignée d'avions américains bouffant du japonais, même si par la suite, les zéro devinrent des alliés dans les jeux suivant, combattant des ennemis non identifiés.
Assez difficile, je ne suis jamais allé très loin. J'ai tenté ma chance sur commodore 64, ce qui économisait quelques balles que je pus renvoyer à l'ennemi (hihihouhihouha le jeu de mots hé). bref, il est aujourd'hui assez vieillot. Je vous conseille donc de le télécharger pour l'histoire et de vous plonger plutôt sur "strikers 1945" qui bénéficie d'une dizaine d'années de savoir faire dans le domaine du shoot them up, largement tributaire de 1942.

</desc>
    <rating>4</rating>
    <releasedate>19840101T000000</releasedate>
    <developer>Capcom</developer>
    <publisher>Capcom</publisher>
    <genre>Shoot'em up / Vertical, Shoot'em Up</genre>
    <players>1-2</players>
    <image>./#snaps/1942_screenscraper_mix_arrm.png</image>
    <boxart>./#snaps/1942_screenscraper_boxart_arrm.png</boxart>
    <screenshot>./#snaps/1942_screenscraper_screenshot_arrm.png</screenshot>
    <marquee>./#snaps/1942_screenscraper_wheel_arrm.png</marquee>
    <video>./#records/1942_screenscraper_video_arrm.mp4</video>
    <mix>./#snaps/1942_screenscraper_mix_arrm.png</mix>
    <playcount>0</playcount>
    <lastplayed />
    <md5 />
    <region>wor</region>
  </game>

My current Batocera version is 5.24.

Do I need to upgrade softwares to link the "md_thumbnail" argument with the xml <boxart> tag as you explain ?

Is there an online doc about all new available options in EmulationStation's themes ? The most uptodate ressource I was able to find is : https://github.com/RetroPie/EmulationStation/blob/master/THEMES.md

fabricecaruso commented 4 years ago

"md_thumbnail" works with "thumbnail" element. When "thumbnail" does not exists, it fallsback on "image" -> This is what you have.

The gamelist sample you provided contains totally unknown media elements types and does not have a "thumbnail" element.

The only possible media elements are "image" "thumbnail" "marquee" and "video". "boxart" "screenshot" and "mix" elements are totally unknown to EmulationStation.

This is true for batocera, for retropie and also recalbox ( RB does not have "marquee" ). I don't even know an EmulationStation fork somewhere else supporting these tags.

Adding support for these tags is not in the loop because it would make compatibility with ES themes very very very complex to handle. Most users don't have these tags in their gamelist ( I don't ) and don't know how to scrap them.

So, Yes, take your courage in both hands, and replace "boxart" with "thumbnail" everywhere in your gamelists If you want it to work... Sorry...

The THEME.md file you can find on this git repo (browse code tab) is up to date ( for 5.24 version, not 5.25.... )

KingKebab commented 4 years ago

Thank you for your clarification, it helps me to find a workaround. The result isn't exactly what I would like, but it looks visualy proper.

You can see the result here to compare : https://www.youtube.com/watch?v=0EVv5yElwj8

I updated my video tag like this :

<video name="md_video">
         <pos>0.308 0.3685</pos>
         <maxSize>0.2005 0.2680</maxSize>
         <delay>0.0</delay>
         <showSnapshotNoVideo>true</showSnapshotNoVideo>
         <snapshotSource>thumbnail</snapshotSource>
         <zIndex>44</zIndex>  
</video>

And I added a fixed black image background behind the video :

<image name="blackscreen" extra="true">
         <path>./../_inc/images/black_background.png</path>
         <pos>0.208 0.235</pos>
         <size>0.200 0.268</size>
         <zIndex>42</zIndex>         
</image>

I also writed a short script to add a <thumbnail> tag for each game in my gamelist.xml file. The <thumbnail> tag is just a copy of the <screenshot> tag.

<game>
    <path>./1942.zip</path>
    <name>1942 (Revision B)</name>
    <desc>"1942" est le premier jeu d'une longue lignée d'avions américains bouffant du japonais, même si par la suite, les zéro devinrent des alliés dans les jeux suivant, combattant des ennemis non identifiés.
Assez difficile, je ne suis jamais allé très loin. J'ai tenté ma chance sur commodore 64, ce qui économisait quelques balles que je pus renvoyer à l'ennemi (hihihouhihouha le jeu de mots hé). bref, il est aujourd'hui assez vieillot. Je vous conseille donc de le télécharger pour l'histoire et de vous plonger plutôt sur "strikers 1945" qui bénéficie d'une dizaine d'années de savoir faire dans le domaine du shoot them up, largement tributaire de 1942.

</desc>
    <rating>4</rating>
    <releasedate>19840101T000000</releasedate>
    <developer>Capcom</developer>
    <publisher>Capcom</publisher>
    <genre>Shoot'em up / Vertical, Shoot'em Up</genre>
    <players>1-2</players>
    <image>./#snaps/1942_screenscraper_mix_arrm.png</image>
    <boxart>./#snaps/1942_screenscraper_boxart_arrm.png</boxart>
    <screenshot>./#snaps/1942_screenscraper_screenshot_arrm.png</screenshot>
    <thumbnail>./#snaps/1942_screenscraper_screenshot_arrm.png</thumbnail>
    <marquee>./#snaps/1942_screenscraper_wheel_arrm.png</marquee>
    <video>./#records/1942_screenscraper_video_arrm.mp4</video>
    <mix>./#snaps/1942_screenscraper_mix_arrm.png</mix>
    <playcount>0</playcount>
    <lastplayed />
    <md5 />
    <region>wor</region>
  </game>

To reproduce this fix, you have to scrap your roms files with the software ARRM (Another Recalbox Roms Manager) and enable the "Activation of the recovery of 4 images" option in its "Main options" tab. Then, it will feed your gamelist.xml with new tags like <screenshot>, <boxart> and <cartridge> and save each model of media separatly in your picture folder (this option let you rebuild a mix picture on the fly, without re-scrap your roms files on the ScreenScraper's server). The gamelist.xml is compliant with Batocera/Recalbox/Retropie and with any EmulationStation's themes. Because new unknown XML tags are ignored.

So now, I know most casual people doesn't use ARRM to scrap their roms files. However I think supporting new XML tags could help themes designers instead of using templates to create mixed pictures.

And finally, if you would like to do the same but without using ARRM. I think a <color> tag to set a background color behind the video is a required improvment. Because <minSize> and/or <maxSize> arguments can't detect and stretch to the real size to hide. Sometime arcade games have an horizontal screen and sometime a vertical screen. Heigh and width aren't always the same.

Hope my visit will give you some ideas and/or give help to any other people looking for a similar fix.

Kind regards.