GerbilSoft / rom-properties

ROM Properties Page shell extension
GNU General Public License v2.0
495 stars 36 forks source link

Screenshots are not displayed (GNOME/bubblewrap) #239

Open Amnesia1000 opened 4 years ago

Amnesia1000 commented 4 years ago

The new feature to show screenshots of GBA, GBC and SNES is not working. It may be a new dependency problem (own compilation), or it just isn't working on Linux.

Tested in Manjaro Linux Gnome 3.36

GerbilSoft commented 4 years ago

This may be an issue with rp-download. Can you post the output of this command:

/usr/libexec/rp-download -v gba/title/E/ASOE78.png

Note that rp-download might be installed somewhere else on your system, possibly /usr/local/libexec.

Amnesia1000 commented 4 years ago

/usr/libexec/rp-download -v gba/title/E/ASOE78.png URL: https://rpdb.gerbilsoft.com/gba/title/E/ASOE78.png Cache Filename: /home/amnesia/.cache/rom-properties/gba/title/E/ASOE78.png /usr/libexec/rp-download: Error downloading file: File exists

GerbilSoft commented 4 years ago

Can you check the size of the file? If it's 0 bytes, delete it and try rp-download again.

If it's not 0 bytes, then something's broken somewhere else...

Amnesia1000 commented 4 years ago

Its 0 bytes.

I removed rp-download and re-installed. Then I went back to using "/usr/libexec/rp-download -v gba/title/E/ASOE78.png" and it is still the size of 0 bytes. I will compile from scratch to test if there is no compilation problem.

Amnesia1000 commented 4 years ago

I compiled again from scratch, I used the command to download the cover again and the file is 0 bytes.

GerbilSoft commented 4 years ago

Can you rebuild with -DENABLE_SECCOMP_DEBUG=1 and retry running rp-download? I'm thinking seccomp is interfering.

Amnesia1000 commented 4 years ago

Sorry for the delay, I recompiled with "-DENABLE_SECCOMP_DEBUG = 1", uninstall the old version and install the new one. Now this is the result of wanting to download the image: /usr/libexec/rp-download -v gba/title/E/ASOE78.png URL: https://rpdb.gerbilsoft.com/gba/title/E/ASOE78.png Cache Filename: /home/amnesia/.cache/rom-properties/gba/title/E/ASOE78.png SYSCALL TRAP: [amd64] rt_sigprocmask() SYSCALL TRAP: [amd64] geteuid() SYSCALL TRAP: [amd64] getpid() SYSCALL TRAP: [amd64] sendmsg() SYSCALL TRAP: [amd64] gettid() SYSCALL TRAP: [amd64] writev() SYSCALL TRAP: [amd64] tgkill() SYSCALL TRAP: [amd64] rt_sigaction() zsh: segmentation fault (core dumped) /usr/libexec/rp-download -v gba/title/E/ASOE78.png

GerbilSoft commented 4 years ago

rt_sigprocmask() isn't called by rom-properties directly, which means something went wrong somewhere. I'll install Manjaro tonight and see if I can reproduce this.

GerbilSoft commented 4 years ago

Can you test the latest code from git master? I added two syscalls, geteuid() and sendmsg(), which were both caught by the seccomp() filter. (They seem to be used by libnss_resolve.so, which is part of systemd-resolved.)

Amnesia1000 commented 4 years ago

Sorry for the delay, but these are the times when I can try rp.

/usr/libexec/rp-download -v gba/title/E/ASOE78.png URL: https://rpdb.gerbilsoft.com/gba/title/E/ASOE78.png Cache Filename: /home/amnesia/.cache/rom-properties/gba/title/E/ASOE78.png SYSCALL TRAP: [amd64] rt_sigprocmask() SYSCALL TRAP: [amd64] getpid() SYSCALL TRAP: [amd64] gettid() SYSCALL TRAP: [amd64] ppoll() /usr/libexec/rp-download: Error downloading file: File exists

The file still weighs 0 bytes.

I think the problem is that it creates an empty file (shows it to me as a non-image text file) before downloading the image, so it says "/usr/libexec/rp-download: Error downloading file: File exists". If this is not the case, forgive my ignorance I just try to give some kind of help.

Amnesia1000 commented 4 years ago

I just uninstalled everything, downloaded the full git again, compiled and using the command to download the cover, it worked. But the covers are not shown.

I restart the PC just in case the changes were not taken and it still doesn't show the screenshots. I look at the cache folder of rom-properties and there is not the gbc folder with the screenshots that I should download.

The Sonic Adventure game (with ID ASOE78) also does not show the screenshot, which is already downloaded in the cache folder, like the 3DS and Wii/Gamecube covers.

GerbilSoft commented 4 years ago

Looks like it might be an issue with Nautilus's bubblewrap sandbox.

(org.gnome.Nautilus:85291): GnomeDesktop-DEBUG: 14:02:32.808: Failed to launch script: rp-thumbnail: /media/sf_david/programming/rom-properties/src/libcachecommon/CacheDir.cpp:70: const string& LibCacheCommon::getCacheDirectory(): Assertion `!cache_dir.empty()' failed.

Amnesia1000 commented 4 years ago

Ohhhh, ok ...

GerbilSoft commented 4 years ago

Fixed the cache directory issue locally but it still isn't working.

There's two ways to fix this:

  1. Disable bubblewrap. This obviously reduces security, so it's probably not a good idea. (It also requires recompiling libgnome-desktop.)
  2. Update libgnome-desktop to allow reading from/writing to the rom-properties cache directory. This isn't currently doable outside of modifying libgnome-desktop and adding the specific paths as a hack. I will file a bug report upstream.
Amnesia1000 commented 4 years ago

Ok, I hope they can fix it: S

GerbilSoft commented 4 years ago

Filed a bug upstream: https://gitlab.gnome.org/GNOME/gnome-desktop/-/issues/162

GerbilSoft commented 4 years ago

I posted some patches for libgnome-desktop on the upstream bug report that fix the already-downloaded case.

You'll need to recompile libgnome-desktop with these patches, and then add the following line to /usr/share/thumbnailers/rom-properties.thumbnailer:

AllowPathsRW=${XDG_CACHE_HOME}/rom-properties

This will work for images that are already downloaded. Downloading new images will not work yet, since libgnome-desktop is still unsharing the network namespace when calling bubblewrap. This would probably need another option.

Amnesia1000 commented 4 years ago

Could you guide me a little in the process? If it's not a problem

I don't know how to apply the patches

GerbilSoft commented 4 years ago

It doesn't look like they're going to accept the patches upstream, since it basically defeats the purpose of using a sandbox.

I have an idea for another method: A system-wide cache in /usr/share/rom-properties/cache. libgnome-desktop adds the entire /usr/ directory as read-only when calling bubblewrap, so this will be usable. You'll need to update the cache manually, of course.

I'll look into setting up some scripts to automatically package the image directories as downloadable archives on a periodic basis.

Note that this will also be usable for GameTDB, which provides downloadable archives. amiibo.life does not provide downloadable archives, so you'll need to use an unsandboxed file browser (or rp-download directly) for amiibo images.

Amnesia1000 commented 4 years ago

Excellent, I look forward to the improvements

Is there a way that the rom-properties itself is able to update the cache automatically? I don't say every time a change is made in the folder (add or remove any rom), if not for example at system startup, or every X number of minutes / hours (it could be set in rom-properties.conf)

GerbilSoft commented 4 years ago

Latest code from git master now supports /usr/share/rom-properties/cache/ as a system-wide cache directory.

There's currently no way that rom-properties would be able to update the system-wide cache, since I don't have any sort of "download all images" functionality set up. Some options for this would be rsync (more efficient), downloading entire ZIP/RAR/etc archives (takes more bandwidth), or a git repository (not ideal because older files use up space).

Amnesia1000 commented 4 years ago

I already have the latest version installed, what should I do to show the screenshoots then?

Do I have to copy the contents of .cache/rom-properties to the /usr/share/rom-properties/cache/ folder? Do you use the same paths that you used in the local folder (gba/title/E/XXXXXX.png, wii/cover/US/XXXXXX.png, 3ds/coverM/US/XXXXXX.png)?

GerbilSoft commented 4 years ago

Directory layout is the same in /usr/share/rom-properties/cache as in ~/.cache/rom-properties, so copying them over should work.

Amnesia1000 commented 4 years ago

Well, this is what happens. I copied the content of ~/.cache/rom-properties to /usr/share/rom-properties/cache (leaving /usr/share/rom-properties/cache/wii/cover/US/XXXXXX.png, /usr/share/rom-properties/cache/3ds/coverM/US/XXXX.jpg).

The ~/.config/rom-properties/rom-properties.conf file contains the following configuration Amiibo= DreamcastSave= GameCube=ExtCover GameCubeSave= NintendoDS=ExtCover Nintendo3DS=ExtCover PlayStationSave= WiiU=ExtCover

I removed the thumbnails cache, restarted the machine so that all changes were taken, and when starting again and going to the Wii, Gamecube, DS, WiiU and 3DS rom folder, they still show the game's internal images/banners (the same thing happens with DS and WiiU).

Amnesia1000 commented 4 years ago

Did you solve this problem in the virtual machine? I have tried different order of folders but nothing seems to solve the problem. It is possible to download all Screenshoots of GB, GBA and SNES to be able to test with those as well.

And a question, I am not clear if rom-properties will automatically download screenshoots, covers, disc, etc, in the folder "/usr/share/rom-properties/cache" or will it be necessary to manually copy the files?

GerbilSoft commented 4 years ago

I fixed some issues that prevented Manjaro GNOME 20.0.3 from loading images from the system-wide cache directory correctly. (On debug builds, it also broke internal images due to an assertion.) Please try out the above commit and let me know if you have any issues.

Amnesia1000 commented 4 years ago

Hi, I tried the build 1.7.1 and the problem persists.

Also the last build does not load all the (internal) images of the GameCube games. Previously it displayed the thumbnails correctly, and the games have remained unchanged. Captura de pantalla de 2020-09-23 22-23-12

GerbilSoft commented 4 years ago

I'll have to test this again then. You're still using Manjaro GNOME 20.0.3, right?

Amnesia1000 commented 4 years ago

Yes, I still use manjaro Gnome. The procedure I followed was the following, I updated rom-properties, deleted all the thumbnail cache, restarted and tested the games folder (gb, gbc, gc and snes) and none showed the title/custom cover

Amnesia1000 commented 2 years ago

This problem still has no solution? I recently reinstalled manjaro gnome, I want to know if copying covers to /usar/share/rom-properties/cache still works

Amnesia1000 commented 2 years ago

@GerbilSoft I just tried copying the covers from the home cache folder to the cache folder in /usr/share/ and it does indeed show the covers, now, is it possible that when installing in gnome, it creates a symlink? I know it is not something neat, but it would be a small patch so that people using gnome can see the covers. I don't know if this can really be done, but if it can be done, it would be good to implement it until there is a definitive solution.