Skip to content
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

CommonPaths: Add Steam-specific user directory and clean up #11459

Merged
merged 7 commits into from
Feb 5, 2023

Conversation

OatmealDome
Copy link
Member

@OatmealDome OatmealDome commented Jan 17, 2023

Having a Steam-specific user directory will allow us to enable Steam Cloud, so that users can have their save files synchronized across machines. The paths are as follows:

  • Windows: %appdata%\Dolphin Emulator (Steam)
  • macOS: ~/Library/Application Support/Dolphin (Steam)
  • Linux: ~/.config/dolphin-emu-steam, ~/.local/share/dolphin-emu-steam, and ~/.cache/dolphin-emu-steam

In addition, the user directory logic has been simplified for Windows builds on Steam. Basically, the registry keys and the old user directory are ignored. (We cannot check the user directory registry key because it is set to the non-Steam path on newer installs.)

While I was here, I also took the opportunity to clean up CommonPaths.h, since the names used for the defines were a bit outdated.

@OatmealDome OatmealDome force-pushed the steam-user-dir branch 3 times, most recently from c396908 to c4e3d90 Compare January 17, 2023 20:11
@mbc07
Copy link
Member

mbc07 commented Jan 18, 2023

This seems a bit odd. Is there any particular reason to separate the user folder of regular builds vs Steam builds? Couldn't we just point the Steam Cloud API to the regular user folder?

@OatmealDome
Copy link
Member Author

OatmealDome commented Jan 18, 2023

Couldn't we just point the Steam Cloud API to the regular user folder?

This is what I've set up already in the backend, but it has been broken with the merging of #10708.

There are two ways to set up Steam Cloud: automatic ("auto-cloud") and manual (via the API).

With automatic, I can just can point Steam Cloud to a specific path and tell it to sync that directory. Unfortunately, this system is very limited. I can't have logic that says "use this path if it exists, otherwise use this path", which is necessary to sync the correct user directory on Windows now that there are two possible paths.

We would have a lot more control with a manual implementation, but it isn't possible to add one at the moment because it would necessitate linking with the Steamworks SDK. This would cause a violation of the GPL. Even if we could, a rewrite of our file handling code to add Steam Cloud support is needed.

@AdmiralCurtiss
Copy link
Contributor

What folders are you syncing to the Steam Cloud, by the way? I have a feeling just syncing the whole user folder is going to result in a lot of cruft being synced (savestates are huge, the Load folder could be huge if the user puts texture packs in there, shader caches are pointless to sync -- though shader UID files might not be), which is probably not ideal. Syncing the config files themselves is probably not a great idea either, since there's a lot of system-specific stuff that you probably don't want to share eg. between your gaming PC and your Steam Deck.

@shuffle2
Copy link
Contributor

What folders are you syncing to the Steam Cloud, by the way? I have a feeling just syncing the whole user folder is going to result in a lot of cruft being synced (savestates are huge, the Load folder could be huge if the user puts texture packs in there, shader caches are pointless to sync -- though shader UID files might not be), which is probably not ideal. Syncing the config files themselves is probably not a great idea either, since there's a lot of system-specific stuff that you probably don't want to share eg. between your gaming PC and your Steam Deck.

Aren't these all the same reasons the folder shouldn't be roamed? :-P

@OatmealDome
Copy link
Member Author

@AdmiralCurtiss Just GC and Wii, since those contain the user's save files.

@MayImilae
Copy link
Contributor

MayImilae commented Jan 18, 2023

How does Steam Cloud handle a Wii NAND? Does Steam Cloud allow 512MB?

@OatmealDome
Copy link
Member Author

@MayImilae It should handle NANDs fine. The total storage space allocated for an application is set by the developer. Right now I have it set to 1GB, which is probably a little excessive.

@AdmiralCurtiss
Copy link
Contributor

Aren't these all the same reasons the folder shouldn't be roamed? :-P

Well... yes, not wrong. I'm not sure if we can change this now, and I'm not sure how easy it would be to add this to the code, but it would have probably been a good idea to split the user folder into a 'local' and a 'roaming' one, and then Steam could just sync the roaming one. But,

Just GC and Wii, since those contain the user's save files.

yeah this seems like a decent solution anyway.

Copy link

@Rumi-Larry Rumi-Larry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so that the Mac and Windows names match.

Source/Core/Common/CommonPaths.h Show resolved Hide resolved
Source/Core/Common/CommonPaths.h Show resolved Hide resolved
Source/Core/Common/CommonPaths.h Show resolved Hide resolved
@AdmiralCurtiss AdmiralCurtiss merged commit ca0b61b into dolphin-emu:master Feb 5, 2023
Copy link

@cobalt2727 cobalt2727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a case to be made for only using folders that correspond to each Steam user

// 1. GetExeDirectory()\portable.txt exists
// -> Use GetExeDirectory()\User
// 2. AppData\Roaming exists
// -> Use AppData\Roaming\Dolphin Emulator (Steam) as the User directory path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually suggest the Steam builds not use AppData\Roaming at all, and instead rely on Steam user-specific folders. Using folders outside the Steam directory could cause conflicts if multiple Steam users sign into the same OS user. (Sorry I didn't think to say this sooner...)

@OatmealDome
Copy link
Member Author

How often do people run into this?

I looked up some random big name games off the top of my head out of curiosity, and most of them store their save files under %userprofile%:

The one exception I found was Resident Evil 4 (2023), which synchronizes saves with Steam Cloud via the Steamworks API.

@MayImilae
Copy link
Contributor

MayImilae commented Apr 2, 2023

If we want to change the user directory for steam builds, we should probably do that before steam builds end up in users hands and we have an article telling them how to transfer saves and what not. So, decide fast I guess.

IMO, per Steam user would be better than not, as that matches what we already do with desktop Dolphin (per OS user).

@OatmealDome
Copy link
Member Author

OatmealDome commented Apr 3, 2023

Yeah, I agree it would be best. Unfortunately, this is going to take some effort to resolve.

I can set up separate per-Steam account user folders by using the Steam account ID. (This is the sole variable I have access to when setting up Steam Cloud.) The only way I can find to fetch this is via the Steamworks SDK, which we can't link to directly because of the GPL. I've been working on a steamshim-alike program which should sidestep direct linking while letting us use the Steamworks SDK, but it won't be ready for a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants