Screenshots naming scheme improvement

First comment in this forum so hi to everybody.

I’m just starting to use Libretro and I’m already impressed by it.

I noticed that the screenshots are saved with a generic name (i.e. ‘RetroArch-0215-203150.png’). I was wondering if you are planning to improve that to include the ROM name and maybe put the screenshots in different folders depending on the core that took them. A couple of months ago I developed a small python script that allows to collect and organize screenshots from different sources (emulators and xbox360+RGH by now) https://github.com/PixelGordo/Screenshot-Collector/releases and I would like to use it with LibRetro.

Regards and thanks in advance.

We discussed this just the other day in IRC, actually, and we decided on gamename-datestamp.png, IIRC, but it hasn’t been implemented yet. It should be a pretty quick change, just no one has had the gumption to do it yet. If you’d like to give it a shot, pull requests are always welcome :slight_smile:

I just code in Python and I think libretro is mainly coded in C, but I’ll take a look. It shouldn’t be too difficult… (and this is the moment you typically remember when you are struggling :D).

@hunterk could you please tell the source code file name responsible for taking screenshot?

[EDIT] is it this file?: https://github.com/libretro/RetroArch/blob/master/tasks/task_screenshot.c

[EDIT2] I think I found it. It seems to be the task_screenshot.c I mentioned above. And it calls the fill_dated_filename() in file_path.cMaybe a good approach is to create another function (let’s say, fill_rom_dated_filename()) in file_path.c and make task_screenshot.c calls it… I’m looking now how can I get the rom name to make some tests.

The PR was merged. Update RetroArch from source and see it working. :wink:

Nice! Thanks for the contribution, meleu :slight_smile: That’s a good improvement.

[EDIT: actually the auto_screenshot_filename works really fine! The trailing timestamp is what the “auto” means! If you want a screenshot with the “ROM Name.png” only, you just have to set auto_screenshot_filename to false (the default is true).]

Now I’m trying to figure out why the auto_screenshot_filename flag isn’t working. Do you have an idea?

As you can see here in the code, the screenshot name is “rom name-timestamp.ext” or just “rom name.ext” based on the auto_screenshot_filename flag. Theoretically the screenshot taken when auto_screen_filename is true, is always overwritten with the most recent one. But I tested it (before and after my changes) and it doesn’t work. The auto_screen_filename seems to be always “false”, no matter if it’s “true” in retroarch.cfg.

Example of use case: I use a trick to make the emulationstation frontend use my last screenshot from a game to be the “boxart”. If the auto_screenshot_filename worked, it would simplifies this process and I could turn on/off the screenshot taking for boxart or for any other purpose…

Great!

I already had retroarch configured to save screenshots in /tmp and them move-rename them to their final location but the new naming scheme will make everything cleaner.

Regards