bottlesdevs / Bottles

Run Windows software and games on Linux
https://usebottles.com
GNU General Public License v3.0
6.35k stars 266 forks source link

Regarding MangoHud #2297

Open HackAnshul opened 1 year ago

HackAnshul commented 1 year ago

So, I really love that mangohud can be enabled via GUI, but it doesn't use the default config. Now, I know that bottles doesn't have access to filesystem=home. So, I created a symbolic link to default config in~/ .var/app/com.usebottles.bottles/config/MangoHud/Mangohud.conf And now it works as set in goverlay.

Can you implement this to happen automatically?

orowith2os commented 1 year ago

I can submit a PR to the flatpak package so that it has read-only access to the MangoHUD config, and that might fix your issue.

TheEvilSkeleton commented 1 year ago

It seems like Lutris and Steam don't allow this directory by default. For the time being I am against this proposal as we'll be doing something out of the ordinary. I suggest we communicate with Steam and Lutris flatpak maintainers before we change the permissions.

Sunspark-007 commented 1 year ago

I don't know that you should be against it, I will explain why. Using flatpak installed emulators that support/use shaders as an example, they will not see/use shaders unless you put the shader files in that /.var/app pathname for the respective flatpak app.

The flatpaks themselves need to be modified to be able to see that they're a flatpak and function differently accordingly. So, if there is no symlink then there will never again be support for the mangohud feature in the bottles flatpak without a faq entry in the setting that directs the user to manually create the link to the file as demonstrated by HackAnshul.

MangoHud is an external flatpak, it's not bundled with bottles. You need to look in that other path.

orowith2os commented 1 year ago

@Sunspark-007 what? That seems like a completely unrelated issue to this one.

Sunspark-007 commented 1 year ago

@orowith2os Why do you think it's an unrelated issue? I'm making the statement that flatpaks can have an issue where they are not looking in the right directory for files they need to read from, even though they created the directory to start with when the flatpak was installed. That pointing to the directory in .var resolves the issue of the missing items.

With this issue, we clearly see that bottles will not see that the MangoHud flatpak is installed. TheEvilSkeleton said that no changes should be made till communication with Steam and Lutris is done. This issue will remain open for some time. Steam is not going to change the path anytime soon, especially in light of getting burnt with their recent attempt to rename the SD card path in 3.4. If they put in a symlink for the SD card in 3.5, maybe they will be open to discussing creating a symlink to the .var folder down the road. So, perhaps it should become a FAQ entry, that people should manually create the symlink themselves before the option ungreys if they wish to use this feature in bottles because they are not likely to see the issue tracker.

Bottles core functionality is not affected, it just can't use MangoHud, that's all.

orowith2os commented 1 year ago

@Sunspark-007 Bottles doesn't need any extra work to use MangoHUD, aside from what it's currently doing (setting the appropriate PATH variable). When MangoHUD is installed properly (via Flatpak) it will be available automatically, additionally symlinks inside of Flatpak aren't a good idea as they can get cut off by the sandbox and become dangling.

The only communication that needs to be done with Steam and Lutris is seeing what they think about giving read-only access to the MangoHUD config files (xdg-config/MangoHud), which can be done with a simple issue. You can do that if you feel like it.

You seem to have a very large misunderstanding of what this issue is about.

TLATER commented 1 year ago

FWIW, the MangoHud flatpak recommends using flatpak override to add the configuration file: https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.MangoHud#configuration

I've done that on the steam end, and it works beautifully, but the configuration appears to be ignored with the bottles flatpak. I'll probably resort to a symlink for now.

berserkwarwolf commented 1 year ago

FWIW, the MangoHud flatpak recommends using flatpak override to add the configuration file: https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.MangoHud#configuration

I've done that on the steam end, and it works beautifully, but the configuration appears to be ignored with the bottles flatpak. I'll probably resort to a symlink for now.

Instead of xdg-config/MangoHud, I tried the full path, and it works.

orowith2os commented 1 year ago

Instead of xdg-config/MangoHud, I tried the full path, and it works.

Xdg-config/MangoHud is the full path, just shortened to work on more environments where the path might not be the same.

Perkolator commented 1 year ago

How does one get this working actually? I created ~/.var/app/com.usebottles.bottles/config/MangoHud/MangoHud.conf file and when launching a game, the console says that it's not found.

I really need this to work. This one game doesn't have any vsync/fps limit options and it runs like 1000fps which is totally unnecessary (point&click adventure game). It makes my laptop fans squeal and temps go high.

[MANGOHUD] [info] [config.cpp:118] skipping config: '/home/username/.var/app/com.usebottles.bottles/config/MangoHud/MangoHud.conf' [ not found ]

(console shows other places it also searches for the config, and obviously says "not found" for all of them too)

TLATER commented 1 year ago
[MANGOHUD] [info] [config.cpp:118] skipping config: '/home/username/.var/app/com.usebottles.bottles/config/MangoHud/MangoHud.conf' [ not found ]

Does that mean you're explicitly setting the config file location? Leave the environment variables empty, that path is translated to ~/.config/MangoHud/MangoHud.conf inside the sandbox, so MangoHud should load the configuration by default, unless you try to change the location.

Perkolator commented 1 year ago

Does that mean you're explicitly setting the config file location?

No. I just installed MangoHud (flatpak), enabled it from a bottle settings and then created that file I mentioned. I did nothing else.

EDIT: For that log message I posted here, I changed the "username".

Perkolator commented 1 year ago

Looking at the terminal, it seems that by default, the flatpak mangohud searches the conf file from these locations:

~/.var/app/com.usebottles.bottles/

EDIT: So, it doesn't look in ~/.config/MangoHud/MangoHud.conf at all. (didn't even try that though)

Perkolator commented 1 year ago

Ok, found the reason why it doesn't find the conf, it was because "sandbox" was ON for that bottle. So, how do I make this work when "sandbox" is ON? (I want to cut network from the bottle)

Perkolator commented 1 year ago

Tried to create a flatpak user & system overrides (flatpak override com.usebottles.bottles --user --filesystem=<fullpath_to_conf_file> & sudo flatpak override com.usebottles.bottles --filesystem=<fullpath_to_conf_file>) for the mangohud conf file but it doesn't work, sandbox still preventing from reading that file.

Any ideas?

Perkolator commented 1 year ago

No one? Should I open a new issue for sandbox not allowing to use mangohud config file?

Sunspark-007 commented 1 year ago

My solution was to use Heroic where it can use the development version 0.6.9-1 of Mangohud flatpak as packaged.

No symlinks or any other work was necessary. I think stable 0.6.8 which is a year old has issues.

Try the dev version, maybe it will work with Bottles.

Perkolator commented 1 year ago

Try the dev version, maybe it will work with Bottles.

Were you answering to me? There seems to be a misunderstanding what my problem is. Mangohud (installed as Flatpak) works just fine with Bottles if the conf file is placed in one of the folders it looks for it (below), putting it to ~/.config/MangoHud/MangoHud.conf doesn't work by default/as it is now, Bottles can't read that.

My problem is that if the Bottles experiments "Sandbox per bottle" setting is turned ON, and the sandbox is activated from a bottle settings, MangoHud can't read the conf file from all of the default places it searches them from (below), except from one folder.

Places where Flatpak MangoHud searches for conf files (in this order):

~/.var/app/com.usebottles.bottles/

When "Sandbox per bottle" is ON, MangoHud is able to read only the ~/.var/app/com.usebottles.bottles/data/bottles/runners/[runner]/bin/MangoHud.conf conf file, all others are not found.

It seems that earlier I made some kind of mistake when testing this, even that "runner" conf file was not found... I must have made a typo with the filename or something else stupid.. very sorry about that! Good thing I tested again.

So, currently it IS possible to use the experimental sandbox with mangohud, but it would be great if the other default locations (in ~/.var/app/com.usebottles.bottles/config/MangoHud/ folder) for the conf file would be available when the sandbox is turned on. Now user has to create/copy the conf file to new runner folder every time when they are installed.. not that ideal UX. EDIT: If one wants to make automatic backups of the MangoHud.conf, it's impossible(?) because the runner folder changes.

Perkolator commented 1 year ago

So, currently it IS possible to use the experimental sandbox with mangohud, but it would be great if the other default locations (in ~/.var/app/com.usebottles.bottles/config/MangoHud/ folder) for the conf file would be available when the sandbox is turned on. Now user has to create/copy the conf file to new runner folder every time when they are installed.. not that ideal UX. EDIT: If one wants to make automatic backups of the MangoHud.conf, it's impossible(?) because the runner folder changes.

May I propose that a --sandbox-expose-path-ro=/home/USERNAME/.var/app/com.usebottles.bottles/config/MangoHud would be added when a program is launched? I guess that should allow the default mangohud conf file to be read even if sandbox is enabled.

orowith2os commented 1 year ago

It would appear that the sandboxing feature needs more work to be feature complete, this could be one of those things - each option for a bottle should be able to enable or disable certain sandbox features, and it works from that, as well as being user-editable, like with Flatseal.

Perkolator commented 1 year ago

It would appear that the sandboxing feature needs more work to be feature complete

Regarding this; I have several "bugs"/observations about the experimental sandbox. Should I post them all in one issue or all separately? EDIT: I was thinking of a "general" issue topic for all sandbox related feedback/bugs.

orowith2os commented 1 year ago

Post them on the Discord, and @ me - orowith2os. I can compile everything into one issue tracking it all, and people can nibble at it as they like.

Perkolator commented 1 year ago

Post them on the Discord, and @ me - orowith2os. I can compile everything into one issue tracking it all, and people can nibble at it as they like.

Dang, I don't use Discord. What if you create the issue here first (add the --sandbox-expose-path-ro for mangohud as the first item?), then I could post my additions to that issue and you could "cherry pick" what seems important?

EDIT: Wait, did I misunderstood, did you mean that you'd create an issue in Discord, not Github?

orowith2os commented 1 year ago

Made https://github.com/bottlesdevs/Bottles/issues/2980, I meant I'll take your feedback on Discord and make an issue akin to this on GitHub.