-
-
Notifications
You must be signed in to change notification settings - Fork 402
Made faster external loading optional and disabled by default as it w… #1865
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -396,7 +396,28 @@ fun GeneralTabContent( | |||||||||||||
| } | ||||||||||||||
| }, | ||||||||||||||
| ) | ||||||||||||||
| SettingsSwitch( | ||||||||||||||
| colors = settingsTileColorsAlt(), | ||||||||||||||
| title = { Text(text = stringResource(R.string.disable_libredirect_title)) }, | ||||||||||||||
| subtitle = { Text(text = stringResource(R.string.disable_libredirect_subtitle)) }, | ||||||||||||||
| state = config.disableLibredirect, | ||||||||||||||
| onCheckedChange = { | ||||||||||||||
| state.config.value = if (it) { | ||||||||||||||
| config.copy(disableLibredirect = true, fasterExternalLoading = false) | ||||||||||||||
| } else { | ||||||||||||||
| config.copy(disableLibredirect = false) | ||||||||||||||
| } | ||||||||||||||
| }, | ||||||||||||||
| ) | ||||||||||||||
| } | ||||||||||||||
| SettingsSwitch( | ||||||||||||||
| colors = settingsTileColorsAlt(), | ||||||||||||||
| enabled = !config.disableLibredirect, | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Keep the faster-loading switch enabled for non-Bionic containers.
Make the condition variant-aware, or clear Proposed fix- enabled = !config.disableLibredirect,
+ enabled =
+ !config.containerVariant.equals(Container.BIONIC, ignoreCase = true) ||
+ !config.disableLibredirect,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: After enabling Prompt for AI agents
Suggested change
|
||||||||||||||
| title = { Text(text = stringResource(R.string.faster_external_loading_title)) }, | ||||||||||||||
| subtitle = { Text(text = stringResource(R.string.faster_external_loading_subtitle)) }, | ||||||||||||||
| state = config.fasterExternalLoading, | ||||||||||||||
| onCheckedChange = { state.config.value = config.copy(fasterExternalLoading = it) }, | ||||||||||||||
| ) | ||||||||||||||
| val steamTypeItems = listOf("Normal", "Light", "Ultra Light") | ||||||||||||||
| val currentSteamTypeIndex = when (config.steamType.lowercase()) { | ||||||||||||||
| Container.STEAM_TYPE_LIGHT -> 1 | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,20 @@ public WineInfo getWineInfo() { | |
| public Container getContainer() { return this.container; } | ||
| public void setContainer(Container container) { this.container = container; } | ||
|
|
||
| // Resolve which libredirect shim to preload. Normally the flavor default | ||
| // (PRELOAD_BIONIC_SO). When the container disables libredirect, modern falls | ||
| // back to the W^X-only minimal shim (still required to run Wine on a strict | ||
| // W^X kernel) and legacy preloads nothing. Returns null to preload nothing. | ||
| private String resolveLibredirectPreload(ImageFs imageFs) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The minimal-shim filename libredirect-bionic-wx-minimal.so is duplicated as independent string literals in BionicProgramLauncherComponent.resolveLibredirectPreload() and ImageFsInstaller.ensureBionicLib(). If they drift (rename of asset/shim), the preload path would point at a nonexistent shim with no compile-time check. Define it once (e.g. a BuildConfig/PRELOAD-style constant or shared constant) and reference it from both files. Prompt for AI agents |
||
| if (container != null && container.isDisableLibredirect()) { | ||
| if (BuildConfig.MODERN_ANDROID) { | ||
| return imageFs.getLibDir() + "/libredirect-bionic-wx-minimal.so"; | ||
| } | ||
| return null; | ||
| } | ||
| return imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO; | ||
| } | ||
|
|
||
| /** Numeric Steam appid for the game in this container (e.g. "221380"). | ||
| * Set from XServerScreen before start(); only consumed in real-Steam mode | ||
| * to publish SteamGameId / SteamAppId for the steam_helper handshake. */ | ||
|
|
@@ -301,18 +315,37 @@ private int execGuestProgram() { | |
| String ld_preload = ""; | ||
| String sysvPath = imageFs.getLibDir() + "/libandroid-sysvshm.so"; | ||
| String evshimPath = context.getApplicationInfo().nativeLibraryDir + "/libevshim.so"; | ||
| String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO; | ||
| String replacePath = resolveLibredirectPreload(imageFs); | ||
|
|
||
| if (new File(sysvPath).exists()) ld_preload += sysvPath; | ||
|
|
||
|
|
||
| ld_preload += ":" + evshimPath; | ||
| ld_preload += ":" + replacePath; | ||
| if (replacePath != null) ld_preload += ":" + replacePath; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When libredirect is disabled on modern Android, the resolved minimal-shim path is appended to LD_PRELOAD without verifying the file exists, unlike the sysvPath entry which is guarded. If libredirect-bionic-wx-minimal.so is missing (asset not shipped in a build flavor, copy interrupted, or path drift), the wine process launches with LD_PRELOAD pointing at a nonexistent .so and fails to start. Prompt for AI agents |
||
|
|
||
| envVars.put("LD_PRELOAD", ld_preload); | ||
| envVars.put("EVSHIM_WINE", 1); | ||
| envVars.put("EVSHIM_SHM_NAME", "controller-shm0"); | ||
|
|
||
| if (container != null && container.isFasterExternalLoading()) { | ||
| String ffpGameDir = null; | ||
| for (String[] drive : Container.drivesIterator(container.getDrives())) { | ||
| if (drive[0].equals("A")) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When Prompt for AI agents |
||
| try { | ||
| ffpGameDir = new File(drive[1]).getCanonicalPath(); | ||
| } catch (IOException e) { | ||
| ffpGameDir = drive[1]; | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| if (ffpGameDir != null && ffpGameDir.startsWith("/storage/") | ||
| && !ffpGameDir.startsWith("/storage/emulated/")) { | ||
| envVars.put("FFP_ENABLE", "1"); | ||
| envVars.put("FFP_MARKERS", "/steamapps/common/;/dosdevices/a:"); | ||
| } | ||
| } | ||
|
|
||
| // Check for specific shared memory libraries | ||
| // if ((new File(imageFs.getLibDir(), "libandroid-sysvshm.so")).exists()){ | ||
| // ld_preload = imageFs.getLibDir() + "/libandroid-sysvshm.so"; | ||
|
|
@@ -672,11 +705,11 @@ public String execShellCommand(String command, boolean includeStderr) { | |
|
|
||
| String ld_preload = ""; | ||
| String sysvPath = imageFs.getLibDir() + "/libandroid-sysvshm.so"; | ||
| String replacePath = imageFs.getLibDir() + "/" + BuildConfig.PRELOAD_BIONIC_SO; | ||
| String replacePath = resolveLibredirectPreload(imageFs); | ||
|
|
||
| if (new File(sysvPath).exists()) ld_preload += sysvPath; | ||
|
|
||
| ld_preload += ":" + replacePath; | ||
| if (replacePath != null) ld_preload += ":" + replacePath; | ||
|
|
||
| envVars.put("LD_PRELOAD", ld_preload); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Toggling Disable libredirect off does not restore the faster external loading value that was forced to false when it was toggled on. A user who had faster external loading enabled and experiments with disabling libredirect permanently loses that preference.
Prompt for AI agents