feat(): Epic Offline Mode for offline launches#1467
Conversation
…s to XServerScreen due to the offline settings.
📝 WalkthroughWalkthroughThis PR adds Epic Games offline mode support by introducing a new user-configurable preference that flows through the container configuration system to the launch path. The feature persists offline mode state across app sessions and passes it to the Epic game launcher. ChangesEpic Offline Mode Implementation
Sequence DiagramsequenceDiagram
participant User as User
participant Settings as GeneralTab
participant Prefs as PrefManager
participant Utils as ContainerUtils
participant Container as Container
participant XServer as XServerScreen
participant Epic as EpicGameLauncher
User->>Settings: Toggle epicOfflineMode
Settings->>Prefs: epicOfflineMode = true
Prefs->>Utils: setDefaultContainerData()
Utils->>Container: setEpicOfflineMode(true)
User->>XServer: Launch game with offline flag
XServer->>Container: isEpicOfflineMode() check
XServer->>Epic: buildLaunchParameters(offline=true)
Epic->>Epic: Return offline launch success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| @@ -2992,16 +2992,13 @@ private fun setupXEnvironment( | |||
| bootToContainer: Boolean, | |||
| testGraphics: Boolean, | |||
| xServerState: MutableState<XServerState>, | |||
| // xServerViewModel: XServerViewModel, | |||
| envVars: EnvVars, | |||
| // generateWinePrefix: Boolean, | |||
| container: Container?, | |||
| appLaunchInfo: LaunchInfo?, | |||
| // shortcut: Shortcut?, | |||
| xServer: XServer, | |||
| containerVariantChanged: Boolean, | |||
| onGameLaunchError: ((String) -> Unit)? = null, | |||
| navigateBack: () -> Unit, | |||
| offline: Boolean = false | |||
There was a problem hiding this comment.
removed some old params, and removed navigateBack as it wasn't used.
Added in "offline" from the XServerScreen constructor to do a similar check as Steam.
There was a problem hiding this comment.
ah cool, ok if navigteBack isn't used.
| val params = mutableListOf<String>() | ||
|
|
||
| // Do offline play if offline. | ||
| // Offline launch if offline (either via the container settings or the device) |
There was a problem hiding this comment.
I think the app "offline mode" specifically says it's for Steam - we should double check this. Otherwise, looks great!
| containerVariantChanged, | ||
| onGameLaunchError, | ||
| navigateBack, | ||
| isOffline |
There was a problem hiding this comment.
this looks suspect, don't we need navigateBack?
| SettingsSwitch( | ||
| colors = settingsTileColorsAlt(), | ||
| title = { Text(text = stringResource(R.string.epic_offline_mode)) }, | ||
| subtitle = { Text(text = stringResource(R.string.epic_offline_mode_description)) }, | ||
| state = config.epicOfflineMode, | ||
| onCheckedChange = { state.config.value = config.copy(epicOfflineMode = it) }, | ||
| ) |
There was a problem hiding this comment.
perhaps we show this only for epic and the steam one only for steam? no biggie if this is complex to do though.
alternatively, we just update the Steam offline mode to say "Offline Mode" and subtitle to say "applies to Steam & Epic only"? And then reuse the same steamOfflineMode boolean for both Steam and Epic?
|
Left some comments but I think it's in a good state to merge. Merging. |
Description
Added a new option in the Container settings for launching games offline when using Epic.
Now correctly launches games offline if the device or the setting has been enabled.
Also added translations.
Fixes games such as Tomb Raider 1-3 Remastered where the game can only launch in offline mode.
Recording
Recording of Offline mode for Epic games:
https://github.com/user-attachments/assets/639704e0-f41f-4d53-9b6f-0833edda3729
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Add Epic Offline Mode for Epic game launches. Games can now launch without authentication when the device is offline or the setting is enabled, with per‑container persistence and localized UI.
PrefManager.epicOfflineMode,ContainerData.epicOfflineMode, andContainergetters/setters.XServerScreento Epic launches;EpicGameLaunchernow skips token fetch when offline.Written for commit 1062f4b. Summary will update on new commits. Review in cubic
Summary by CodeRabbit