| Summary: | [Patch] Add mod support to WinRT SDL_GetBasePath | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ethan Lee <flibitijibibo> |
| Component: | file | Assignee: | Ethan Lee <flibitijibibo> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | Keywords: | target-2.0.14 |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Windows 10 | ||
| Attachments: |
Mod support for SDL-UWP
SDK minimum enforcement for EffectiveLocation Check the NTDDI define before comparing it |
||
Maybe you mean for this to apply to SDL_GetPrefPath()? SDL_GetBasePath() is the directory where the executable resides. SDL_GetPrefPath() is the directory where you can save data. In this case no - per MSDN: https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.package.effectivelocation?view=winrt-19041 InstalledLocation is the sandboxed path that's read-only, and MutableLocation is the virtual path that allows users to modify base install data for mod support. SDL_GetBasePath() returns a read-only location. SDL_GetPrefPath() returns a writeable location. It seems like the current code is correct, right? Let me try a different angle for a second: This patch is currently already shipping in Celeste for Windows 10 and will be used to advertise modding support in the future. Returning to the code: As far as the game is concerned, _both_ Installed and Mutable are read-only. The EffectiveLocation is just a virtualized install directory to allow end users to modify the install content outside of the program itself, without having to decrypt the UWP app bundle. The save directory is _completely_ different and is 100% unrelated to this change. Ahhh, thank you for clarifying. Your patch is in, thanks! https://hg.libsdl.org/SDL/rev/16bae903b2de This fails on older SDKs UWP: 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2039: 'EffectiveLocation': is not a member of 'Windows::ApplicationModel::Package' 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2227: left of '->Path' must point to class/struct/union/generic type 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2227: left of '->Data' must point to class/struct/union/generic type Windows Phone: 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(52): error C3083: 'ApiInformation': the symbol to the left of a '::' must be a type 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(52): error C2039: 'IsApiContractPresent' : is not a member of 'Windows::Foundation::Metadata' 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(52): error C3861: 'IsApiContractPresent': identifier not found 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2039: 'EffectiveLocation' : is not a member of 'Windows::ApplicationModel::Package' 1> c:\program files (x86)\windows phone kits\8.1\references\commonconfiguration\neutral\windows.winmd : see declaration of 'Windows::ApplicationModel::Package' 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2227: left of '->Path' must point to class/struct/union/generic type 1>..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp(53): error C2227: left of '->Data' must point to class/struct/union/generic type Ethan, can you take a look and see how to fix this for older SDK builds? I think it just needs to be guarded with an SDK version ifdef, but there's like 30 Windows version defs now because of 10 so this will take a minute. Ping this again if a patch isn't posted by Tuesday. Okay, this is one of the last things needed for the release. I'll leave it waiting here until you have a chance to post a fix. Thanks! Created attachment 4580 [details]
SDK minimum enforcement for EffectiveLocation
Attached is the patch that I believe will cover this. At minimum it should fix the buildbot while also making our own builds work. It's unfortunately very VERY hard to tell how UWP SDK versions are done, so the best I could find is NTDDI, which still seems off but it should at least cover the two existing cases I'm aware of (one being the lowest SDK in existence and the other being the one that Microsoft forces you to use for submission).
Patch added, thanks! https://hg.libsdl.org/SDL/rev/862fcd397b18 Created attachment 4581 [details]
Check the NTDDI define before comparing it
Sometimes I forget how old the SDKs can get... another patch, for SDKs that pre-date the NTDDI define we need.
|
Created attachment 4509 [details] Mod support for SDL-UWP Certain applications on the Windows Store are given permission to make their app "modifiable", which in the Xbox world means adding mod support. The change is very simple: Instead of using InstalledPath, use either MutablePath or EffectivePath, the latter of which automatically chooses between Installed and Mutable depending on whether the user has turned on mod support in the Xbox app. However, this feature is only available on Windows 1903 or newer, so we need to check for the API before attempting to use it. For older systems that don't have mod support we fall back to InstalledPath.