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

Exception when indexing Stardew Valley installed with Xbox Game Pass #1476

Open
erri120 opened this issue May 28, 2024 · 6 comments
Open

Exception when indexing Stardew Valley installed with Xbox Game Pass #1476

erri120 opened this issue May 28, 2024 · 6 comments

Comments

@erri120
Copy link
Member

erri120 commented May 28, 2024

00:00:25.295 [ERROR] (NexusMods.App.Program) Encountered an exception published to an object with an unobserved ThrownExceptions property|System.UnauthorizedAccessException: Access to the path 'C:\Games\Xbox\Stardew Valley\Content\createdump.exe' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.FileStream..ctor(String path, FileStreamOptions options)
   at NexusMods.Paths.FileSystem.InternalCreateMemoryMappedFile(AbsolutePath absPath, FileMode mode, MemoryMappedFileAccess access)
   at NexusMods.Paths.BaseFileSystem.CreateMemoryMappedFile(AbsolutePath absPath, FileMode mode, MemoryMappedFileAccess access)
   at NexusMods.Extensions.Hashing.AbsolutePathExtensions.XxHash64MemoryMapped(AbsolutePath input, IActivitySource`1 job) in C:\Projects\NexusMods.App\src\Extensions\NexusMods.Extensions.Hashing\AbsolutePathExtensions.cs:line 44
   at NexusMods.DataModel.FileHashCache.<>c__DisplayClass7_0.<IndexFoldersAsync>b__4(IFileEntry info, CancellationToken _) in C:\Projects\NexusMods.App\src\NexusMods.DataModel\FileHashCache.cs:line 103
   at System.Threading.Tasks.Parallel.<>c__53`1.<<ForEachAsync>b__53_0>d.MoveNext()
--- End of stack trace from previous location ---
   at NexusMods.DataModel.FileHashCache.IndexFoldersAsync(IEnumerable`1 paths, CancellationToken token)+MoveNext() in C:\Projects\NexusMods.App\src\NexusMods.DataModel\FileHashCache.cs:line 92
   at NexusMods.DataModel.FileHashCache.IndexFoldersAsync(IEnumerable`1 paths, CancellationToken token)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at System.Linq.AsyncEnumerable.<ToListAsync>g__Core|424_0[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs:line 36
   at System.Linq.AsyncEnumerable.<ToListAsync>g__Core|424_0[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToList.cs:line 36
   at NexusMods.DataModel.FileHashCache.IndexDiskState(GameInstallation installation) in C:\Projects\NexusMods.App\src\NexusMods.DataModel\FileHashCache.cs:line 142
   at NexusMods.Abstractions.Loadouts.Synchronizers.ALoadoutSynchronizer.GetOrCreateInitialDiskState(GameInstallation installation) in C:\Projects\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts.Synchronizers\ALoadoutSynchronizer.cs:line 1212
   at NexusMods.Abstractions.Loadouts.Synchronizers.ALoadoutSynchronizer.CreateLoadout(GameInstallation installation, String suggestedName) in C:\Projects\NexusMods.App\src\Abstractions\NexusMods.Abstractions.Loadouts.Synchronizers\ALoadoutSynchronizer.cs:line 922
   at NexusMods.App.UI.Pages.MyGames.MyGamesViewModel.ManageGame(GameInstallation installation) in C:\Projects\NexusMods.App\src\NexusMods.App.UI\Pages\MyGames\MyGamesViewModel.cs:line 129
   at NexusMods.App.UI.Pages.MyGames.MyGamesViewModel.<>c__DisplayClass7_3.<<-ctor>b__11>d.MoveNext() in C:\Projects\NexusMods.App\src\NexusMods.App.UI\Pages\MyGames\MyGamesViewModel.cs:line 99
--- End of stack trace from previous location ---
   at NexusMods.App.UI.Pages.MyGames.MyGamesViewModel.<>c__DisplayClass7_3.<<-ctor>b__9>d.MoveNext() in C:\Projects\NexusMods.App\src\NexusMods.App.UI\Pages\MyGames\MyGamesViewModel.cs:line 99

@Sewer56
Copy link
Member

Sewer56 commented May 28, 2024

Some documentation I wrote in (very WIP) planning doc I'm working on:
https://reloaded-project.github.io/Reloaded-III/Loader/Copy-Protection/Windows-MSStore/#what-r3-should-do
(Consider also reading the rest)

And existing code I wrote:
https://github.com/Reloaded-Project/Reloaded-II/blob/master/source/Reloaded.Mod.Launcher.Lib/Utility/TryUnprotectGamePassGame.cs

Those are the steps to decrypt Xbox Store binaries, so they can be read and modified.

It's a bit convoluted as it's a multi step process, and annoying to have to do, but it's been working flawlessly for the last 3-4 months on my end.

@Al12rs
Copy link
Contributor

Al12rs commented May 28, 2024

Is manually installed smapi supposed to work on GamePass version?

@erri120 erri120 changed the title Exception when trying to manage Stardew Valley from Xbox May 28, 2024
@erri120
Copy link
Member Author

erri120 commented May 28, 2024

I think the easiest solution is to just skip the file if we encounter an UnauthorizedAccessException and the game store is set to Xbox Game Pass.

@Sewer56
Copy link
Member

Sewer56 commented May 28, 2024

Also this affects all Xbox games, or more specifically Win32 Centennial Apps, it is not Stardew Specific.

@Sewer56
Copy link
Member

Sewer56 commented May 28, 2024

I think the easiest solution is to just skip the file if we encounter an UnauthorizedAccessException and the game store is set to Xbox Game Pass.

If you want to go that route then at that point we should not take backups of these games by default.

A partial backup with all binaries missing is not useful if the game updates.

Edit: Also don't forget we move StardewValley.exe, if we don't have a backup of that, I'm not sure if our DataModel won't collapse on apply either way, even if you skip.

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