Skip to content

Commit 869940d

Browse files
Jarod Kurland (Glacier)Jarod Kurland (Glacier)
authored andcommitted
chore: applied patch, correcting default path and current endpoint issues caused by snapshot version mismatch
1 parent e0aa261 commit 869940d

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

app/src/main/java/com/OxGames/Pluvia/enums/PathType.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import timber.log.Timber
88

99
enum class PathType {
1010
GameInstall,
11+
SteamUserData,
1112
WinMyDocuments,
1213
WinAppDataLocal,
1314
WinAppDataLocalLow,
@@ -27,9 +28,14 @@ enum class PathType {
2728
* [com.winlator.container.ContainerManager.activateContainer] on the proper
2829
* [com.winlator.container.Container] beforehand.
2930
*/
30-
fun toAbsPath(context: Context, appId: Int): String {
31+
fun toAbsPath(context: Context, appId: Int, accountId: Long): String {
3132
val path = when (this) {
3233
GameInstall -> SteamService.getAppDirPath(appId)
34+
SteamUserData -> Paths.get(
35+
ImageFs.find(context).rootDir.absolutePath,
36+
ImageFs.WINEPREFIX,
37+
"/drive_c/Program Files (x86)/Steam/userdata/${accountId}/${appId}/remote",
38+
).toString()
3339
WinMyDocuments -> Paths.get(
3440
ImageFs.find(context).rootDir.absolutePath,
3541
ImageFs.WINEPREFIX,
@@ -76,6 +82,7 @@ enum class PathType {
7682
val isWindows: Boolean
7783
get() = when (this) {
7884
GameInstall,
85+
SteamUserData,
7986
WinMyDocuments,
8087
WinAppDataLocal,
8188
WinAppDataLocalLow,
@@ -86,13 +93,16 @@ enum class PathType {
8693
}
8794

8895
companion object {
89-
val DEFAULT = PathType.GameInstall
96+
val DEFAULT = SteamUserData
9097

9198
fun from(keyValue: String?): PathType {
9299
return when (keyValue?.lowercase()) {
93100
"%${GameInstall.name.lowercase()}%",
94101
GameInstall.name.lowercase(),
95102
-> GameInstall
103+
"%${SteamUserData.name.lowercase()}%",
104+
SteamUserData.name.lowercase(),
105+
-> SteamUserData
96106
"%${WinMyDocuments.name.lowercase()}%",
97107
WinMyDocuments.name.lowercase(),
98108
-> WinMyDocuments

app/src/main/java/com/OxGames/Pluvia/service/SteamAutoCloud.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ object SteamAutoCloud {
8888
fileList.pathPrefixes.map { prefix ->
8989
var modified = prefix
9090

91-
val prefixContainsNoPlaceholder = findPlaceholderWithin(prefix).none()
92-
93-
if (prefixContainsNoPlaceholder) {
94-
modified = Paths.get(PathType.DEFAULT.name, prefix).pathString
95-
}
96-
9791
pathTypePairs.forEach {
9892
modified = modified.replace(it.first, it.second)
9993
}
@@ -106,7 +100,7 @@ object SteamAutoCloud {
106100
if (file.pathPrefixIndex < fileList.pathPrefixes.size) {
107101
Paths.get(fileList.pathPrefixes[file.pathPrefixIndex]).pathString
108102
} else {
109-
Paths.get("%${PathType.DEFAULT.name}%").pathString
103+
""
110104
}
111105
}
112106

@@ -120,7 +114,7 @@ object SteamAutoCloud {
120114
if (file.pathPrefixIndex < fileList.pathPrefixes.size) {
121115
Paths.get(convertedPrefixes[file.pathPrefixIndex], file.filename)
122116
} else {
123-
Paths.get(getAppDirPath(appInfo.id), file.filename)
117+
Paths.get(prefixToPath(PathType.DEFAULT.name), file.filename)
124118
}
125119
}
126120

app/src/main/java/com/OxGames/Pluvia/service/SteamService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ class SteamService : Service(), IChallengeUrlChanged {
11551155
Timber.w("Failed to connect to Steam, marking endpoint bad and force disconnecting")
11561156

11571157
try {
1158-
steamClient!!.servers.tryMark(steamClient!!.currentEndPoint, PROTOCOL_TYPES, ServerQuality.BAD)
1158+
steamClient!!.servers.tryMark(steamClient!!.currentEndpoint, PROTOCOL_TYPES, ServerQuality.BAD)
11591159
} catch (e: Exception) {
11601160
Timber.e(e, "Failed to mark endpoint as bad:")
11611161
}

app/src/main/java/com/OxGames/Pluvia/ui/MainViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class MainViewModel @Inject constructor(
198198
viewModelScope.launch {
199199
SteamService.notifyRunningProcesses()
200200
SteamService.closeApp(appId) { prefix ->
201-
PathType.from(prefix).toAbsPath(context, appId)
201+
PathType.from(prefix).toAbsPath(context, appId, SteamService.userSteamId!!.accountID)
202202
}.await()
203203
}
204204
}

app/src/main/java/com/OxGames/Pluvia/ui/PluviaMain.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ fun preLaunchApp(
514514

515515
// sync save files and check no pending remote operations are running
516516
val prefixToPath: (String) -> String = { prefix ->
517-
PathType.from(prefix).toAbsPath(context, appId)
517+
PathType.from(prefix).toAbsPath(context, appId, SteamService.userSteamId!!.accountID)
518518
}
519519
val postSyncInfo = SteamService.beginLaunchApp(
520520
appId = appId,

0 commit comments

Comments
 (0)