timkurvers / valheim-macos

Build-your-own Valheim build for macOS
MIT License
270 stars 14 forks source link

Cannot sync cloud data: "Unable to resolve path with root WinAppDataLocalLow (12)" #10

Closed flindeberg closed 1 year ago

flindeberg commented 1 year ago

It seems that there are some issues with resolving paths for the Cloud Sync, at least for me.

I get the following in ~/Library/Application Support/Steam/logs/cloud_log.txt:

[2023-04-03 17:54:49] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12)
[2023-04-03 17:54:49] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12)
[2023-04-03 17:54:49] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12)
[2023-04-03 17:54:49] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12)
[2023-04-03 17:54:49] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12)

And a bit further down:

[2023-04-03 17:55:01] [AppID 892970] Starting sync (up,AC Exit,)
[2023-04-03 17:55:01] [AppID 892970] Running AutoCloud on exit. Looking for new and updated files
[2023-04-03 17:55:01] [AppID 892970]     Skipping rule 0 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/characters) failed
[2023-04-03 17:55:01] [AppID 892970]     Skipping rule 1 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/worlds) failed

I assume I'm missing some environmental variable which points to where the WinAppDataLocalLow is on macOS?

~/Library/Application Support/unity.IronGate.Valheim-macOS-Custom/ is empty, and ~/Library/Application Support/Steam/userdata/<steam id>/892970/ contains one file remotecache.vdf, and the subdirectory remote does not exist.

I've tried launching with different environment variables set, from different locations, and from Steam "as a non-Steam game", but all give me the same log message in cloud_log.txt.

The game runs well though :-)

I see all my saved stuff correctly at https://store.steampowered.com/account/remotestorageapp/?appid=892970 (I used to play on Linux if that matters)

timkurvers commented 1 year ago

Hmm, curious. I have not seen the Unable to resolve path messages in stand-alone form in the cloud_log.txt file. That said, I did encounter some Failure to upload/download ...; likely manually removed-messages in one of the earlier log files, possibly related to me testing on two Macs simultaneously 🤔

Found a recent example of an exit-sync log (slightly altered) on my end:

[2023-04-01 14:06:33] [AppID 892970] Starting sync (up,AC Exit,)
[2023-04-01 14:06:33] [AppID 892970] Running AutoCloud on exit. Looking for new and updated files
[2023-04-01 14:06:33] [AppID 892970]     Skipping rule 0 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/characters) failed
[2023-04-01 14:06:33] [AppID 892970]     Skipping rule 1 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/worlds) failed
[2023-04-01 14:06:33] [AppID 892970]     No launch record found. Skipping looking for files while the game was running
[2023-04-01 14:06:33] [AppID 892970] AutoCloud complete
[2023-04-01 14:06:33] [AppID 892970] Currently already synced to global change number '<id>', should be nothing to download
[2023-04-01 14:06:33] [AppID 892970] Need to upload file characters/tim.fch
[2023-04-01 14:06:33] [AppID 892970] Need to delete file characters/tim_backup_auto-<id>.fch
[2023-04-01 14:06:33] [AppID 892970] Need to upload file serverlist/recent
[2023-04-01 14:06:33] [AppID 892970] Upload batch initiated, ID: <id>, ChangeNumber: <change-number>, App Build ID: 0
[2023-04-01 14:06:34] [AppID 892970] Delete OK for file characters/tim_backup_auto-<id>.fch
[2023-04-01 14:06:37] [AppID 892970] Upload OK for file characters/tim.fch
[2023-04-01 14:06:37] [AppID 892970] Upload OK for file serverlist/recent
[2023-04-01 14:06:37] [AppID 892970] Upload complete, result OK
[2023-04-01 14:06:38] [AppID 892970] YldWriteCacheDirectoryToFile - saved to '~/Library/Application Support/Steam/userdata/<steam id>/892970/remotecache.vdf'

Does your log have any additional entries after the Skipping rule 1-bit?

flindeberg commented 1 year ago

This is a tail -f the_log | grep 892970 on the log for one run:

[2023-04-05 12:49:12] [AppID 892970] Starting sync (init,)
[2023-04-05 12:49:12] [AppID 892970] AutoCloud checking local state for user <userid>
[2023-04-05 12:49:12] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12) <-- 1 per world / char I think
[2023-04-05 12:49:12] [U:1:<userid>] [AppID 892970] Init cache request complete
[2023-04-05 12:49:12] [AppID 892970] YldWriteCacheDirectoryToFile - saved to '/Users/flindeberg/Library/Application Support/Steam/userdata/<userid>/892970/remotecache.vdf'
[2023-04-05 12:49:32] [AppID 892970] Starting sync (up,AC Exit,)
[2023-04-05 12:49:32] [AppID 892970] Running AutoCloud on exit. Looking for new and updated files
[2023-04-05 12:49:32] [AppID 892970]     Skipping rule 0 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/characters) failed
[2023-04-05 12:49:32] [AppID 892970]     Skipping rule 1 because ResolvePath (WinAppDataLocalLow, IronGate/Valheim/worlds) failed
[2023-04-05 12:49:32] [AppID 892970]     No launch record found. Skipping looking for files while the game was running
[2023-04-05 12:49:32] [AppID 892970] FileForget(IronGate/Valheim/characters/<all remote chars>) - file has pending changes in cloud; ignoring forget so as not to create a conflict.
[2023-04-05 12:49:32] [AppID 892970] FileForget(IronGate/Valheim/worlds/<all remote worlds>) - file has pending changes in cloud; ignoring forget so as not to create a conflict.
[2023-04-05 12:49:32] [AppID 892970] AutoCloud complete
[2023-04-05 12:49:32] [AppID 892970] Unable to resolve path with root WinAppDataLocalLow (12) <-- one per char / world I think
[2023-04-05 12:49:32] [AppID 892970] Attempting to sync from local change number '0' to global change number '16695749370782862615'
[2023-04-05 12:49:32] [AppID 892970] Need to download file IronGate/Valheim/characters/<all my remote chars>.{fch|fch.old}
[2023-04-05 12:49:32] [AppID 892970] Need to download file IronGate/Valheim/worlds/<all my remote worlds>.{db|fwl|fwl.old}
[2023-04-05 12:49:32] [AppID 892970] Need to delete file characters/<a local char>.fch.new
[2023-04-05 12:49:32] [AppID 892970] Need to upload file characters/<a local char>.fch
[2023-04-05 12:49:32] [AppID 892970] Need to delete file worlds/<a local world>.fwl.new
[2023-04-05 12:49:32] [AppID 892970] Need to upload file worlds/<a local world>.fwl
[2023-04-05 12:49:32] [AppID 892970] Need to upload file characters/<a local char>.fch.old
[2023-04-05 12:49:32] [AppID 892970] Need to upload file worlds/<a local world>.db
[2023-04-05 12:49:32] [AppID 892970] Need to upload file worlds/<a local world>.fwl.old
[2023-04-05 12:49:32] [AppID 892970] Download I/O Operation Failed for file IronGate/Valheim/worlds/<1 per world>.fwl
[2023-04-05 12:49:32] [AppID 892970] Download I/O Operation Failed for file IronGate/Valheim/worlds/<1 per world>.fwl.old
[2023-04-05 12:49:32] [AppID 892970] Download I/O Operation Failed for file IronGate/Valheim/characters/<1 per character>.fch
[2023-04-05 12:49:32] [AppID 892970] Download I/O Operation Failed for file IronGate/Valheim/characters/<1 per character>.fch.old
[2023-04-05 12:49:32] [AppID 892970] Download complete, result I/O Operation Failed
[2023-04-05 12:49:32] [AppID 892970] YldWriteCacheDirectoryToFile - saved to '/Users/flindeberg/Library/Application Support/Steam/userdata/<userid>/892970/remotecache.vdf'

I created a world and character locally as well, just to try if that would jumpstart something, but it doesn't.

Do you have any ideas?

timkurvers commented 1 year ago

Hm, I wonder if the previous platform one plays on matters. I suppose there's three variants:

Seeing as I used to play Valheim Windows via CrossOver as well as Bootcamp, perhaps that makes it so the cloud syncing works even on this macOS custom build 🤔

Is there anything of interest in ~/Library/Application Support/Steam/userdata/<userid>/892970/remotecache.vdf?

flindeberg commented 1 year ago

Interesting. What ostype do you get @timkurvers ?

"892970"
{
        "ChangeNumber"          "0"
        "ostype"                "-75" // What does this mean?
        "IronGate/Valheim/characters/<remote-character>.fch" // Note the path!
        {
                "root"          "12"
                "size"          "0"
                "localtime"             "0"
                "time"          "0"
                "remotetime"            "0"
                "sha"           "0000000000000000000000000000000000000000"
                "syncstate"             "2"
                "persiststate"          "0"
                "platformstosync2"              "-1"
        }
       // additional records for remote characters and worlds
       // Some local chars and worlds
       // NOTE THE PATH! No 'IronGate/Valheim/characters', but just 'characters'
        "characters/<local-char>.fch" // Note the path!
        {
                "root"          "0"
                "size"          "11020"
                "localtime"             "1680544230"
                "time"          "1680544229"
                "remotetime"            "0"
                "sha"           "891dc4607d01cba9843dc5cfa85cbf585ba66920"
                "syncstate"             "3"
                "persiststate"          "0"
                "platformstosync2"              "-1"
        }
        # Some more local stuff (inc worlds)
}
flindeberg commented 1 year ago

Ah, I just notices something again, the "root" "12" might be connected to Unable to resolve path with root WinAppDataLocalLow (12).

Perhaps root number 12 does not exist on MacOS, for example. But does on Linux and Windows.

flindeberg commented 1 year ago

I think I know what is going on now. For some background see https://partner.steamgames.com/doc/features/cloud

I will verify and hopefully close this issue tonight, and write an MR which explains the shenanigans properly.

timkurvers commented 1 year ago

Interesting. What ostype do you get @timkurvers ?

I think I know what is going on now. For some background see https://partner.steamgames.com/doc/features/cloud

I will verify and hopefully close this issue tonight, and write an MR which explains the shenanigans properly.

Oh, that sounds great! Thanks for looking into it 👍

flindeberg commented 1 year ago

So, TLDR. The paths to where Valheim saves stuff seems to have been changed since I played last on Linux.

This mean I had to log in on that computer and mark all saves as "Cloud Save". This moves them into the correct root.

You can double check at https://store.steampowered.com/account/remotestorageapp/?appid=892970, the "Folder" column should be blank if the correct root is used. If think it said WinAppDataLocalLow when it didn't work.

I cannot recreate the issue with new chars, and the issue appears for chars created before version 0.209.8.

The specific changelog:

Steam Cloud:

- Cloud save files will now be stored in Steam/[YourIDNumber]/892970 instead of AppData
- Local files will now be stored in “worlds_local” and “characters_local” under AppData and no longer be synced to cloud to -avoid sync conflicts and dataloss when using multiple accounts on the same machine, and when using dedicated servers.
- Files still in the old file structure will be moved to the Steam Cloud or new local folder when used and a backup will be kept
- Worlds’ save files can now be renamed and will load correctly
- Large worlds (300mb or bigger) should now sync correctly
- Maximum Cloud storage for Valheim has increased greatly, thanks Valve!

I'll create a PR for a small change.

flindeberg commented 1 year ago

Added #19 and I consider this fixed now so I'll close it.