-
-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre-launch/post-exit environment variables for wrapper script to detect game #5407
Comments
I do not think either of those will do. I think you would want something like But I'm not sure this is right. I don't know what data you need to infer, and if it is in the json it might be nice to get it from just one game, not a dump of all of them. Or maybe just get what you need in an env-var- that'd be less likely to go wrong I think. Anyway, 'id' is the unique ID for that table, and the slug is not unique. You can absolutely have two rows with the same slug; that might be two configurations of the same underlying game. |
Thanks for the quick reply :)
Ludusavi needs:
If wrapper scripts could have direct access to those pieces of information via environment variables, that would be the simplest solution for my use case.
Right now, Ludusavi collects the info it needs from the YAML files, which lets it support some unusual cases like scanning a disk backup from another system, where the system running Ludusavi may not actually have Lutris. It could certainly use the Lutris CLI in wrap mode, but there might be some complications with that:
|
We've reached a point where cloud saves is the single most important feature left to implement in Lutris. While there is some preliminary code for handling saves in Lutris, it is very minimal and not usable yet. Anyway, the plan is to support multiple backends to handle saves:
The Lutris API will make available some data on where to find saves. Like everywhere else in the project, we use the game slug as the identifier. We don't use the name ever because of games like Doom and Tomb Raider. I would suggest against using pre-launch and post-exit scripts. I've never used those and don't plan to, pre-launch / post-exit is one of the most untested / here be dragons parts of Lutris. It is mostly used by people who don't want to make a pull request to add missing functionality to the client. There will be (there already is, actually) parts of the code that handles game save sync. We hand over any data needed by Ludusavi at this stage. We could even send the location of the save files when we have that in our API. Anyway, this is the perfect time to start working on this since it will be the focus of Lutris 0.5.18. In any case the "id" field of the sqlite database should never be used and the LUTRIS_GAME_UUID even less, since it only exists for the duration of a single game launch. |
I've used pre/post launch scripts, though for compatibility not integration. Some games have weird requirements to get them to work. Sometimes you just have to joust with the dragons. I'm prepping a PR to help these scripts, but I'll leave out the ID if you don't want it used. WINEPREFIX seems to be there already, right enough. The name is also provided in the env-var "game_name", which is an odd name for an env-var, and it has a comment That leaves the game directory. I'll add GAME_DIRECTORY. I suspect it is too late for this to make 0.5.17, though. |
OK, I've got the PR up. It is very simple. @mtkennerly, please give it a try. Download this branch- no need to install it- and set up your scripts. You will have the Does that work for you? |
The changes look good to me, thanks! I'll try integrating them in Ludusavi, but there shouldn't be any issues. (I do think it might be nice to add an env var for the slug, even just for logging purposes, but it's not necessary.)
Let me know if I can help make any changes for Ludusavi to play nice with the eventual save sync API. Ludusavi gets data from PCGamingWiki, which does have a field to map games to Lutris slugs, so it might end up being useful to start tracking that in the Ludusavi manifest. |
Looks like @strycore took the PR, but he does not seem to want env-vars added without a clear purpose, so I won't add the slug without a clear use for it. I can't imagine you have our slugs in your database that you could look up. |
the previous "game_name" env var didn't have a clear purpose. I have kept it but renamed it to GAME_NAME so the current users of "game_name" would show up (hopefully). Still, using the game name instead of the slug isn't ideal because of Doom, Prince of Persia and Tomb Raider. I know I'm comparing DOS games with Windows games but Lutris isn't limited to Windows games. We also aim to sync save states and emulator memory cards. Our save backup system will depend a lot on the runner used. Most of the runners will be pretty straightforward to implement, what we need is metadata for DOS/Linux/Windows games |
If you'd like to try using the Ludusavi manifest for that data, I can start integrating Lutris slugs from PCGamingWiki's |
I'm torn. If @strycore wasn't clearly against superfluous environment variables, I'd add GAME_SLUG- it seems easy and safe. And I see now that PCGamingWiki has our slugs on file, so there is some database out there that has them. But there's no database anybody actually wants to use in a pre-launch script (or anything like that), and you don't have them or use them yourself. So this is all purely speculative. That does not seem enough to justify what could well be an env-var that nobody ever uses. |
I'm against lower cased environment variables that appear out of nowhere, that have been asked by no one and confuse everyone. You're somehow fixating on that and slowing your development down by creating non existent obstacles. If the slug is needed by Ludusavi to function properly then we add the slug, there's no need to go on wild roundabout fanfics about it. Ideally, we add a note in the code that tells our future selves who is consuming this env var and why. |
That would be a good start. It seems to me that PC gaming wiki only provides a single path for saves. We plan to have a more subtle system that can differentiate between configs, saves, log, screenshots, etc. Maybe we can do an initial sync from PGW and use the Lutris API to give save info since we'll build more complete data over time. |
It can show up to 5 paths per platform per game (5 is just an arbitrary limit in the wiki template). It does distinguish saves and config, but not the other kinds you mentioned. Here's an example with multiple paths for a platform: |
Welp, not torn anymore. |
@strycore Lutris slugs are now being tracked in the Ludusavi manifest. I still need to do a full refresh to scrape all of them, but I did an initial scrape of 450 articles, which found 123 with slugs. (Let me know if there's a better place to discuss this.) Edit: Full refresh is done. I forgot about #57 - I'll post some info there. |
For context, I'm the author of Ludusavi. It has a feature to be used as a wrapper to back up your save data, like
ludusavi wrap --name "Game Title" -- ./game --foo
. To avoid writing out the title, it also supports--infer [steam|heroic]
, which will check for some environment variables in order to figure out which game is running.I'd like to add support for
--infer lutris
, and I was wondering if you'd be open to adding some environment variables to support that. It would just need enough information so it can uniquely identify the game in the database and/or YAML files. WouldLUTRIS_GAME_SLUG
(table:games
, column:slug
) be sufficient, or wouldLUTRIS_GAME_ID
(table:games
, column:id
) be better?These were the closest I could find, but I don't think they cover this use case:
lutris/lutris/game.py
Lines 689 to 691 in 3866cf2
lutris/lutris/monitored_command.py
Line 133 in 3866cf2
The text was updated successfully, but these errors were encountered: