tralph3 / Steam-Metadata-Editor

An easy to use GUI that edits the metadata of your Steam Apps
GNU General Public License v3.0
161 stars 18 forks source link

Add permissions to /run/media directory for flatpak version #44

Open RealHypnoticOcelot opened 7 months ago

RealHypnoticOcelot commented 7 months ago

I'm not sure if I could be doing something wrong, but I'm struggling to edit the launch menu. I'm currently using SteamOS and trying to modify Lethal Company. The modification I'm trying to achieve is to make the first launch option to be for playing the game normally, and the second option to come with some extra flags.

The metadata editor was installed using Flatpak, and I haven't launched it using the terminal, so no flags like --silent are present.

When I try to select the executable for the game, I'm unable to find the location of the SD card in the inbuilt file picker(It should be at /run/media/... but the media folder isn't showing up).

Am I not supposed to set executable or game directory if I'm only changing launch options, or is this an unintended issue? Thanks in advance!

tralph3 commented 7 months ago

It should show up. The file picker is the built-in for tkinter, so I don't really have much input into that. Are you sure it is located there? You can verify the mount points by running lsblk in a terminal.

RealHypnoticOcelot commented 7 months ago

Hello, attached is a video showing the issue, and why I don't think there's something wrong on my end? A lot of folders just don't show up in the file picker for whatever reason.

https://github.com/tralph3/Steam-Metadata-Editor/assets/57046530/ab8fb4f8-14e0-47b9-86e1-0c9861806aa4

tralph3 commented 7 months ago

Ah... seems to be an issue with flatpak. It doesn't have permission to see those folders. I would have to add it. Not much you can do in the meantime.

RealHypnoticOcelot commented 7 months ago

Oh, in that case, Flatseal can fix that!! Thank you!!

tralph3 commented 7 months ago

Well, that too. Please do tell me if that fixed the issue.

RealHypnoticOcelot commented 7 months ago

It seemed to fix the permissions issue, but when I selected the game's .exe, it looks like maybe it added the path twice or something?

https://github.com/tralph3/Steam-Metadata-Editor/assets/57046530/eda90a45-7004-48a2-ac72-e3d6a38e537a

tralph3 commented 7 months ago

The problem is that Steam will only accept paths relative to the game's install path, although the algorithm should detect that it is in the same folder, and it shouldn't be adding all those up dirs.

There seems to be one extra .., so maybe the algorithm is wrong? I'll have to take a look.

tralph3 commented 7 months ago

Or maybe flatpak is making it behave a bit wonky.

RealHypnoticOcelot commented 7 months ago

Hmm, is there anything that can be done in the meantime? Or is waiting for a fix all that I can do?

tralph3 commented 7 months ago

Well, if you feel adventurous, you can edit the source code to allow you to manually modify the directory and working directory entries. Just remember that you can't set an absolute path, it must be relative to the game's install path (so just the executable name would do in this case).

You need to go to the main_window.py file. In line 914 you can see the execEntry variable. Delete the parameter that says state="readonly". Same for the wkngDirEntry a couple of lines below.

That should let you edit the fields by hand and get you by in the meantime. If the executable is in the same folder as the install path, then you don't need to modify the working directory, it can be left blank.

RealHypnoticOcelot commented 7 months ago

That works perfectly, thank you!! I'm able to launch the game now, but I'm encountering another issue; the launch options I set with the metadata editor aren't actually doing anything. If I set them through Steam it works fine but it doesn't work with the tool for some reason. Attached is a video; the launches may look identical, but notice the terminal that pops up upon the second launch, indicating that the game is running modded.

https://github.com/tralph3/Steam-Metadata-Editor/assets/57046530/9590ab17-5572-45f5-a3cd-9c959dc68387

tralph3 commented 7 months ago

The launch arguments are for the executable. It's not the same as on Steam. If the game had launch arguments like "-novideo" or something like that, then Steam would run "%command% -novideo". You can't add DLL overrides or stuff like that there.

Maybe you can do something hacky like adding a ; and then writing other commands? In that case, Steam would expand %command% to mean the game's executable plus the "arguments" you provided. I'm not sure how that would work tho, and it should only execute after the game process exits so it probably won't do anything anyway.

tralph3 commented 7 months ago

Well something even more hackish would be to add as argument any string, and then in the launch options on Steam you could try to write a conditional that checks for that string and returns the actual launch command depending on that.

RealHypnoticOcelot commented 7 months ago

Hmm, I'm not sure where to begin with that. The launch arguments I'm using seem to be before the %command% so there's that, and I didn't even know you could write conditionals for Steam launch options?? So, assuming I set the actual launch argument to be "modded", what exactly could I do in Steam's launch options to check for that?

tralph3 commented 7 months ago

IIRC it's just a shell prompt, so shell commands should work. I've even written things like %command% > log.txt and it just redirects the output. Although that didn't seem to work last time I tried for some reason, but yeah, a standard bash if statement should probably work.

Another thing you could try is to make a script that launches the game. Then you can define any argument you want in your own script. That would likely work better.

RealHypnoticOcelot commented 7 months ago

Well, I have to admit I'm not super experienced with shell commands or bash at all, let alone writing a script to run the game via proton. So does %command% give you the arguments or ? I'm trying to figure out how it would work exactly. My current launch argument is WINEDLLOVERRIDES="winhttp.dll=n,b" %command% if that's any help.

tralph3 commented 7 months ago

Yeah that won't work. The launch arguments option in SME gets appended to the game's executable. There's no circumventing that.

If the executable is sample.exe then %command% gets expanded to sample.exe.

If you add the argument -test, then %command% gets expanded to sample.exe -test.

If you want to declare an env variable via this mechanism, then you'll have to get creative.

RealHypnoticOcelot commented 7 months ago

Hmm, alright. I suppose I'll just have to put in the launch options every time I play modded, that'll be fine for now! Thanks a ton for your help!