this post was submitted on 30 Jun 2023
0 points (50.0% liked)

Linux Gaming

19234 readers
1 users here now

Gaming on the GNU/Linux operating system.

Recommended news sources:

Related chat:

Related Communities:

Please be nice to other members. Anyone not being nice will be banned. Keep it fun, respectful and just be awesome to each other.

founded 5 years ago
MODERATORS
 

So i started using ludusavi and i really like it! I can just dump all my saves onto my NAS and i'm good to go.

I now made two .sh files, one for ludusavi restore --force and one for ludusavi backup --force I made the global Lutris setting to exectute the restore BEFORE launching a game and backup AFTER exiting.

This should then give me a steamcloud like automatism where my savegames would be always on the newest version regardless on what PC i played on last time.

But this only works if i play them via Lutris. I have a steamdeck and a minipc with chimeraOS (steam gamepadui per default). I start the games via steam there, not lutris... does anyone know of some possibility to globally start a script or command before starting and another one after exiting the game in steam?

Because i have quite the few non-steam games in my library and also have all my emulated games in there.

That would be fantastic!

top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 years ago* (last edited 2 years ago) (1 children)

I don't remember the file specifically, but steam uses a script to launch games if I remember correctly. That script sets up some library paths and other stuff that's needed, I remember editing that script a long while back to include either prime-run or gamemode, but I couldn't find any references to that script on Google, whenever I'm on the computer I'll try to find it.

Edit: I think the file is ~/.steam/debian-installation/ubuntu12_32/steam-runtime/run.sh or similar, look for a run.sh in some of the steam runtimes.

[–] RandomLegend 1 points 2 years ago (1 children)

Heyho,

thanks! I found the script but tbh it's a bit over my head^^ But the solution presented by @[email protected] is good enough for me...yes i do have to set it up manually for each game but it works reliably and is a simple copy&paste process where i just go through my games while watching something on youtube πŸ˜€

[–] [email protected] 1 points 2 years ago (1 children)

Just modify the script, right near the end where it says exec "$@", and add one line before to do anything before launching the game and one after to do anything after, e.g.

ludosavi restore --force
exec "$@"
ludosavi backup --force

If you do it per game you can write ludosavi restore --force && %command% && ludosavi backup --force which should execute the commands before and after the game.

[–] RandomLegend 1 points 2 years ago

Thanks i'll give it a try then!

yeah the command to do that per game i figured out already, thanks again

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago) (1 children)

Are you just talking about the ability to set a run/launch command on steam? This is set per game by going to the game settings (cog icon) and it's right there at the bottom.

Edit: not sure for post-exit though...

[–] RandomLegend 1 points 2 years ago

yeah i could put the restore command at the launch command...but as you already said: manually for each game and it doesn't do anything on exit.

And tbh it would be really cumbersome to add them all by hand...

[–] [email protected] 1 points 2 years ago (1 children)

If you already use gamemode it has custom section in gamemode.ini file to execute custom scripts before and after game sessions. You simply use gamemoderun %command% as launch option for all of your games.

Another option is directly chaining your scripts with %command% but your mileage may vary.

I was able to log game start and end with this naive launch option.

echo "start" >> ~/Desktop/test.txt && %command% && echo "end" >> ~/Desktop/test.txt
[–] RandomLegend 1 points 2 years ago

to do that via gamemode is interesting, yes!

I could absolutely do that....still had the manual part of adding it to all games...but then atleast it works Thanks!

[–] [email protected] 1 points 2 years ago (1 children)

Well for steam games, you can set launch options. Maybe you could do something like commandbefore; %command%; commandafter? Keep %command% literally as it is, Steam interprets that and executes the game in its place.

[–] RandomLegend 1 points 2 years ago (1 children)

i know that i can run commands, as i said in the post...but commandafter doesn't exist afaik

[–] [email protected] 1 points 2 years ago (1 children)

I haven’t tried it but if you put that command after a ; it only should execute after the game exits.

[–] RandomLegend 1 points 2 years ago (2 children)

touch ~/start.txt; %command%; touch ~/end.txt

this should in theory create an empty start.txt at launch, and an empty end.txt file after exiting, yes?

[–] [email protected] 1 points 2 years ago

Yes, that's what I would assume

[–] [email protected] 1 points 2 years ago (1 children)

touch ~/start.txt; %command%; touch ~/end.txt

After a quick test, it does work! Just tested it with Worms W.M.D running in Proton.

[–] RandomLegend 1 points 2 years ago

fantastic! i'll test aswell as soon as i am home.

Thanks mate!

load more comments
view more: next β€Ί