Fix: typing space in Env Variables would lead to crash. + added variable presets for Mango#1208
Fix: typing space in Env Variables would lead to crash. + added variable presets for Mango#1208Catpotatos wants to merge 3 commits intoutkarshdalal:masterfrom
Conversation
feat: Added Mango Hud variables to saved presets for fps and frame limiting. removed variable that was not working for device spoofing. Re-ordered WINEDLLOVERRIDES to top.
📝 WalkthroughWalkthroughNormalize and validate environment variable inputs (trim and skip malformed entries), update known env-var registry (add Mangohud entries, change WINEDLLOVERRIDES presets, remove DXVK_FILTER_DEVICE_NAME), add auto-detection/persistence of input DLL overrides in containers, and adjust suggestion dropdown rendering. Changes
Sequence Diagram(s)sequenceDiagram
participant XServer as XServerScreen
participant CU as ContainerUtils.autoApplyInputDllOverrides
participant Container as Container
participant EnvVars as EnvVars
participant FS as A_Drive_FileSystem
XServer->>CU: call autoApplyInputDllOverrides(container)
CU->>Container: read mapped A: path
Container->>FS: scan up to 3 levels for dinput*.dll
FS-->>CU: list of found DLL filenames
CU->>EnvVars: read WINEDLLOVERRIDES value
CU->>EnvVars: compute/prepend new overrides (avoid duplicates)
CU->>Container: container.saveData() if changed
CU-->>XServer: return boolean (changed or not)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Pull request overview
Fixes crashes when users enter spaces while editing environment variables, and expands preset/suggestion support for common env vars (including MangoHud), improving the env-var editing UX in the app.
Changes:
- Harden
EnvVars.putAll()against empty/invalid tokens when splitting persisted env-var strings. - Add/update known env-var presets: introduce
MANGOHUD/MANGOHUD_CONFIG, moveWINEDLLOVERRIDEShigher, removeDXVK_FILTER_DEVICE_NAME. - Trim env-var name/value inputs in the settings list and creation dialog to avoid leading/trailing whitespace issues.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/src/main/java/com/winlator/core/envvars/EnvVars.java | Skips empty/invalid tokens when parsing env var strings to prevent crashes. |
| app/src/main/java/com/winlator/core/envvars/EnvVarInfo.kt | Updates known env var definitions: adds MangoHud vars, adjusts WINEDLLOVERRIDES, removes GPU spoofing var preset. |
| app/src/main/java/app/gamenative/ui/component/settings/SettingsEnvVars.kt | Trims edited env-var values in the settings list UI. |
| app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt | Trims env-var name/value in the “create env var” dialog. |
Comments suppressed due to low confidence (1)
app/src/main/java/com/winlator/core/envvars/EnvVars.java:30
- This change fixes a crash case in
putAll, but there’s no unit test coverage for parsing env var strings (e.g., multiple consecutive spaces, leading/trailing spaces, or invalid tokens without=). Adding tests would help prevent regressions sinceEnvVars(String)is used to deserialize persisted config values.
public void putAll(String values) {
if (values == null || values.isEmpty()) return;
String[] parts = values.split(" ");
for (String part : parts) {
int index = part.indexOf("=");
if (part.isEmpty() || index < 1) continue;
String name = part.substring(0, index);
String value = part.substring(index+1);
data.put(name, value);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| String[] parts = values.split(" "); | ||
| for (String part : parts) { | ||
| int index = part.indexOf("="); | ||
| if (part.isEmpty() || index < 1) continue; | ||
| String name = part.substring(0, index); | ||
| String value = part.substring(index+1); | ||
| data.put(name, value); |
There was a problem hiding this comment.
putAll still uses values.split(" "), so any env var value containing an unescaped space (e.g. DXVK_HUD=fps, frametimes) will be split into multiple tokens and silently truncated/ignored. Consider either (a) storing env vars using toEscapedString() and teaching putAll to split on unescaped spaces + unescape \ , or (b) validating/rejecting spaces in values at input time with a user-facing error, so values aren’t corrupted.
There was a problem hiding this comment.
tested, keyboard doesn't allow spaces to be typed. video shared.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/com/winlator/core/envvars/EnvVars.java (1)
21-29:⚠️ Potential issue | 🔴 CriticalThis still breaks env var values that contain spaces.
Skipping malformed tokens avoids the crash, but callers still persist a space-delimited flat string (
EnvironmentTab.ktLine 206 usesenvVars.toString()). A value likeFOO=hello worldnow round-trips here asFOO=helloplus a skippedworldtoken, so the crash becomes silent config corruption instead of a real fix. Please switch to a serializer/parser pair that preserves spaces consistently, e.g. escaped serialization plus matching unescape logic here, or a structured format.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/winlator/core/envvars/EnvVars.java` around lines 21 - 29, The current putAll method in EnvVars.java corrupts values containing spaces because it splits on plain spaces; update the parser to match a safe serializer used by EnvironmentTab.kt (do not split on spaces inside quoted values or escaped spaces) or switch to a structured format (e.g., JSON, Properties, or newline-separated key=value) and parse that instead; specifically, change putAll(String values) so it decodes the same escaped/quoted format that the corresponding envVars.toString() produces and then call data.put(name, value) with the correctly unescaped full value for each parsed token.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@app/src/main/java/com/winlator/core/envvars/EnvVars.java`:
- Around line 21-29: The current putAll method in EnvVars.java corrupts values
containing spaces because it splits on plain spaces; update the parser to match
a safe serializer used by EnvironmentTab.kt (do not split on spaces inside
quoted values or escaped spaces) or switch to a structured format (e.g., JSON,
Properties, or newline-separated key=value) and parse that instead;
specifically, change putAll(String values) so it decodes the same escaped/quoted
format that the corresponding envVars.toString() produces and then call
data.put(name, value) with the correctly unescaped full value for each parsed
token.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ec396b53-fda9-4786-9876-e91197e54ad5
📒 Files selected for processing (4)
app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.ktapp/src/main/java/app/gamenative/ui/component/settings/SettingsEnvVars.ktapp/src/main/java/com/winlator/core/envvars/EnvVarInfo.ktapp/src/main/java/com/winlator/core/envvars/EnvVars.java
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt">
<violation number="1" location="app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt:163">
P2: Value field trims on every keystroke, causing incorrect/unnatural entry of spaced env var values.</violation>
</file>
<file name="app/src/main/java/com/winlator/core/envvars/EnvVars.java">
<violation number="1" location="app/src/main/java/com/winlator/core/envvars/EnvVars.java:26">
P2: The new guard prevents crashes on space-containing values but introduces silent data corruption: `putAll` splits on `" "`, so a value like `DXVK_HUD=fps, frametimes` becomes tokens `DXVK_HUD=fps,` and `frametimes`. The second token has no `=` and is now silently skipped, truncating the stored value. The `.trim()` calls in the UI prevent users from *typing* spaces, but `putAll` can still receive space-containing strings from previously-persisted data or programmatic callers. Consider using an escape-aware delimiter (e.g., storing/splitting on a character that doesn't appear in values, or escaping spaces) so round-tripping is lossless.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| NoExtractOutlinedTextField( | ||
| value = envVarValue, | ||
| onValueChange = { envVarValue = it }, | ||
| onValueChange = { envVarValue = it.trim() }, |
There was a problem hiding this comment.
P2: Value field trims on every keystroke, causing incorrect/unnatural entry of spaced env var values.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/ui/component/dialog/EnvironmentTab.kt, line 163:
<comment>Value field trims on every keystroke, causing incorrect/unnatural entry of spaced env var values.</comment>
<file context>
@@ -160,7 +160,7 @@ fun EnvironmentTabContent(state: ContainerConfigState) {
NoExtractOutlinedTextField(
value = envVarValue,
- onValueChange = { envVarValue = it },
+ onValueChange = { envVarValue = it.trim() },
label = { Text(text = stringResource(R.string.value)) },
singleLine = true,
</file context>
| onValueChange = { envVarValue = it.trim() }, | |
| onValueChange = { envVarValue = it }, |
| String[] parts = values.split(" "); | ||
| for (String part : parts) { | ||
| int index = part.indexOf("="); | ||
| if (part.isEmpty() || index < 1) continue; |
There was a problem hiding this comment.
P2: The new guard prevents crashes on space-containing values but introduces silent data corruption: putAll splits on " ", so a value like DXVK_HUD=fps, frametimes becomes tokens DXVK_HUD=fps, and frametimes. The second token has no = and is now silently skipped, truncating the stored value. The .trim() calls in the UI prevent users from typing spaces, but putAll can still receive space-containing strings from previously-persisted data or programmatic callers. Consider using an escape-aware delimiter (e.g., storing/splitting on a character that doesn't appear in values, or escaping spaces) so round-tripping is lossless.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/com/winlator/core/envvars/EnvVars.java, line 26:
<comment>The new guard prevents crashes on space-containing values but introduces silent data corruption: `putAll` splits on `" "`, so a value like `DXVK_HUD=fps, frametimes` becomes tokens `DXVK_HUD=fps,` and `frametimes`. The second token has no `=` and is now silently skipped, truncating the stored value. The `.trim()` calls in the UI prevent users from *typing* spaces, but `putAll` can still receive space-containing strings from previously-persisted data or programmatic callers. Consider using an escape-aware delimiter (e.g., storing/splitting on a character that doesn't appear in values, or escaping spaces) so round-tripping is lossless.</comment>
<file context>
@@ -23,6 +23,7 @@ public void putAll(String values) {
String[] parts = values.split(" ");
for (String part : parts) {
int index = part.indexOf("=");
+ if (part.isEmpty() || index < 1) continue;
String name = part.substring(0, index);
String value = part.substring(index+1);
</file context>
There was a problem hiding this comment.
keyboard will not allow to type spaces. several barriers in place to ensure a space, that could break the environment variable intention, won't go through.
Values should not contain spaces,
so typing "DXVK_HUD=fps, frametimes" should actually always become DXVK_HUD=fps,frametimes and parse correctly as intended.
Before this implementation, entering a space would mean a crash. now it blocks it from happening.
|
not sure the mango changes are needed, #1081 is doing fps cap in a different way |
The mango does not stay as default, it's just added to the dropbox of options to choose from when clicking add new variable and clicking on the suggestion box. I can remove if you prefer. |
Search A: drive on opening "Edit Container" and populate dinput and dinput8 as native on WINEDLLOVERRIDES if dlls are found in gamedir. Added presets for input dlls native before builtin: "dinput8=n,b;dinput=n,b", "xinput1_3=n,b;xinput1_4=n,b;xinput9_1_0=n,b", "xinput9_1_0=n,b;windows.gaming.input=n,b", "xinput1_1=n,b;xinput1_2=n,b" WINEDLLOVERRIDES presets are now inside categories to avoid overwhelming users
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/src/main/java/app/gamenative/utils/ContainerUtils.kt (1)
1351-1367: Skip symlinked directories to matchscanExecutablesInADrivebehavior.
scanExecutablesInADriveexplicitly usesFileUtils.isSymlink(file)to avoid cycles (e.g. GOG ISI rootdir → game root, per the comment on line 1193).scanForInputDllstraverses without that guard; themaxDepth = 3bound prevents runaway recursion but symlink loops still incur redundant I/O and may double-count DLLs reachable via multiple paths. Consider mirroring the existing guard for consistency.♻️ Proposed refactor
for (file in files) { if (file.isFile && file.name.lowercase() in targetNames) { found.add(file.name.lowercase()) } else if (file.isDirectory && currentDepth < maxDepth) { + if (FileUtils.isSymlink(file)) continue scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt` around lines 1351 - 1367, The function scanForInputDlls currently descends into directories without skipping symlinks which can cause redundant I/O and duplicate discovery; update the directory-branch to skip symlinked directories by checking FileUtils.isSymlink(file) (same approach as scanExecutablesInADrive) before recursing into scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1), ensuring symlinked directories are ignored and preserving the existing maxDepth and found behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt`:
- Around line 1326-1337: The code claims to "prepend" auto-detected overrides
but builds the env value as "$existing;$toPrepend" which appends; change the
construction to place the new entries before existing (i.e.
"$toPrepend;$existing") when calling containerEnvVars.put("WINEDLLOVERRIDES",
...), and optionally rename `toPrepend` or update the inline comment near the
`containerEnvVars.put` usage so the variable name, comment and behavior match;
keep the filtering via `existingEntries` and still set `updated = true` as
currently done.
- Around line 991-995: getOrCreateContainer currently calls
autoApplyInputDllOverrides every time, causing auto-added WINEDLLOVERRIDES to be
re-applied after a user deletes them; change the flow to make this a one-time
migration by persisting a container extra flag (e.g.,
"inputDllOverridesAutoApplied") on the Container object: before calling
autoApplyInputDllOverrides in getOrCreateContainer check
container.getExtra("inputDllOverridesAutoApplied") and skip if true; after
autoApplyInputDllOverrides completes successfully set
container.setExtra("inputDllOverridesAutoApplied", true) and persist the
container; keep the existing dedup logic (the DLL-name match) but ensure the
flag prevents re-running the migration.
---
Nitpick comments:
In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt`:
- Around line 1351-1367: The function scanForInputDlls currently descends into
directories without skipping symlinks which can cause redundant I/O and
duplicate discovery; update the directory-branch to skip symlinked directories
by checking FileUtils.isSymlink(file) (same approach as scanExecutablesInADrive)
before recursing into scanForInputDlls(file, targetNames, found, maxDepth,
currentDepth + 1), ensuring symlinked directories are ignored and preserving the
existing maxDepth and found behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a2b1297e-5ce8-449d-b2db-e3ac5eaac7a5
📒 Files selected for processing (4)
app/src/main/java/app/gamenative/ui/component/settings/SettingsTextFieldWithSuggestions.ktapp/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.ktapp/src/main/java/app/gamenative/utils/ContainerUtils.ktapp/src/main/java/com/winlator/core/envvars/EnvVarInfo.kt
✅ Files skipped from review due to trivial changes (1)
- app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt
🚧 Files skipped from review as they are similar to previous changes (1)
- app/src/main/java/com/winlator/core/envvars/EnvVarInfo.kt
|
|
||
| // Auto-detect loose input DLLs in game directory and persist WINEDLLOVERRIDES | ||
| autoApplyInputDllOverrides(container) | ||
|
|
||
| return container |
There was a problem hiding this comment.
Users cannot opt out — auto-detected overrides will be re-added after manual deletion.
autoApplyInputDllOverrides runs unconditionally every time getOrCreateContainer is called, and the dedup check at line 1327 only matches by DLL name. If a user intentionally deletes the auto-added dinput8=n,b entry from the Environment tab (e.g., because it breaks their game), the next launch will silently re-add it — the user has no way to opt out short of renaming/removing the DLL on disk.
Consider persisting a container extra (e.g., inputDllOverridesAutoApplied) that's set after the first successful apply and checked before re-running, so this behaves as a one-time migration rather than a sticky loop.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt` around lines 991 -
995, getOrCreateContainer currently calls autoApplyInputDllOverrides every time,
causing auto-added WINEDLLOVERRIDES to be re-applied after a user deletes them;
change the flow to make this a one-time migration by persisting a container
extra flag (e.g., "inputDllOverridesAutoApplied") on the Container object:
before calling autoApplyInputDllOverrides in getOrCreateContainer check
container.getExtra("inputDllOverridesAutoApplied") and skip if true; after
autoApplyInputDllOverrides completes successfully set
container.setExtra("inputDllOverridesAutoApplied", true) and persist the
container; keep the existing dedup logic (the DLL-name match) but ensure the
flag prevents re-running the migration.
| // Parse existing entry names — handles both "dinput8=n,b" and "dinput8=native,builtin" | ||
| val existingEntries = existing.split(";").map { it.trim().substringBefore("=") }.toSet() | ||
| val toPrepend = foundDlls | ||
| .map { it.removeSuffix(".dll") } | ||
| .filter { it !in existingEntries } | ||
| .joinToString(";") { "$it=n,b" } | ||
| if (toPrepend.isNotEmpty()) { | ||
| // Preserve existing user values; prepend auto-detected overrides in front | ||
| containerEnvVars.put("WINEDLLOVERRIDES", "$existing;$toPrepend") | ||
| updated = true | ||
| } | ||
| } |
There was a problem hiding this comment.
Variable/comment say "prepend" but the code appends.
The variable is named toPrepend, the inline comment on line 1333 says "prepend auto-detected overrides in front", and the PR description states the change "prepends" auto-detected entries — but the actual expression is "$existing;$toPrepend", which places the new entries at the end. For non-duplicate names (filtered above) Wine semantics are unaffected, so this is primarily an intent/naming inconsistency rather than a functional defect, but it will confuse future readers.
🔧 Match the stated intent
if (toPrepend.isNotEmpty()) {
// Preserve existing user values; prepend auto-detected overrides in front
- containerEnvVars.put("WINEDLLOVERRIDES", "$existing;$toPrepend")
+ containerEnvVars.put("WINEDLLOVERRIDES", "$toPrepend;$existing")
updated = true
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt` around lines 1326 -
1337, The code claims to "prepend" auto-detected overrides but builds the env
value as "$existing;$toPrepend" which appends; change the construction to place
the new entries before existing (i.e. "$toPrepend;$existing") when calling
containerEnvVars.put("WINEDLLOVERRIDES", ...), and optionally rename `toPrepend`
or update the inline comment near the `containerEnvVars.put` usage so the
variable name, comment and behavior match; keep the filtering via
`existingEntries` and still set `updated = true` as currently done.
There was a problem hiding this comment.
3 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/java/app/gamenative/utils/ContainerUtils.kt">
<violation number="1" location="app/src/main/java/app/gamenative/utils/ContainerUtils.kt:993">
P2: This function runs unconditionally on every container creation/launch. If a user manually removes an auto-detected DLL override (e.g., because `dinput8=n,b` breaks their game), it will be silently re-added on the next launch with no way to opt out. Consider persisting a flag (e.g., `inputDllOverridesAutoApplied`) after the first successful apply so this behaves as a one-time migration rather than a recurring forced override.</violation>
<violation number="2" location="app/src/main/java/app/gamenative/utils/ContainerUtils.kt:1334">
P3: The variable name `toPrepend` and the comment say "prepend auto-detected overrides in front", but `"$existing;$toPrepend"` actually appends the new entries after existing ones. Either rename to `toAppend` and fix the comment, or swap the order to match the stated intent.</violation>
<violation number="3" location="app/src/main/java/app/gamenative/utils/ContainerUtils.kt:1363">
P2: Recursive DLL scanning recurses into directories without skipping symlinks, unlike the existing executable scan, which can cause unintended traversal/performance regressions in linked game folders.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } else if (file.isDirectory && currentDepth < maxDepth) { | ||
| scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1) | ||
| } |
There was a problem hiding this comment.
P2: Recursive DLL scanning recurses into directories without skipping symlinks, unlike the existing executable scan, which can cause unintended traversal/performance regressions in linked game folders.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/utils/ContainerUtils.kt, line 1363:
<comment>Recursive DLL scanning recurses into directories without skipping symlinks, unlike the existing executable scan, which can cause unintended traversal/performance regressions in linked game folders.</comment>
<file context>
@@ -1272,4 +1277,92 @@ object ContainerUtils {
+ for (file in files) {
+ if (file.isFile && file.name.lowercase() in targetNames) {
+ found.add(file.name.lowercase())
+ } else if (file.isDirectory && currentDepth < maxDepth) {
+ scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1)
+ }
</file context>
| } else if (file.isDirectory && currentDepth < maxDepth) { | |
| scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1) | |
| } | |
| } else if (file.isDirectory && !FileUtils.isSymlink(file) && currentDepth < maxDepth) { | |
| scanForInputDlls(file, targetNames, found, maxDepth, currentDepth + 1) | |
| } |
| } | ||
|
|
||
| // Auto-detect loose input DLLs in game directory and persist WINEDLLOVERRIDES | ||
| autoApplyInputDllOverrides(container) |
There was a problem hiding this comment.
P2: This function runs unconditionally on every container creation/launch. If a user manually removes an auto-detected DLL override (e.g., because dinput8=n,b breaks their game), it will be silently re-added on the next launch with no way to opt out. Consider persisting a flag (e.g., inputDllOverridesAutoApplied) after the first successful apply so this behaves as a one-time migration rather than a recurring forced override.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/utils/ContainerUtils.kt, line 993:
<comment>This function runs unconditionally on every container creation/launch. If a user manually removes an auto-detected DLL override (e.g., because `dinput8=n,b` breaks their game), it will be silently re-added on the next launch with no way to opt out. Consider persisting a flag (e.g., `inputDllOverridesAutoApplied`) after the first successful apply so this behaves as a one-time migration rather than a recurring forced override.</comment>
<file context>
@@ -987,6 +988,10 @@ object ContainerUtils {
}
+
+ // Auto-detect loose input DLLs in game directory and persist WINEDLLOVERRIDES
+ autoApplyInputDllOverrides(container)
+
return container
</file context>
| .joinToString(";") { "$it=n,b" } | ||
| if (toPrepend.isNotEmpty()) { | ||
| // Preserve existing user values; prepend auto-detected overrides in front | ||
| containerEnvVars.put("WINEDLLOVERRIDES", "$existing;$toPrepend") |
There was a problem hiding this comment.
P3: The variable name toPrepend and the comment say "prepend auto-detected overrides in front", but "$existing;$toPrepend" actually appends the new entries after existing ones. Either rename to toAppend and fix the comment, or swap the order to match the stated intent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/utils/ContainerUtils.kt, line 1334:
<comment>The variable name `toPrepend` and the comment say "prepend auto-detected overrides in front", but `"$existing;$toPrepend"` actually appends the new entries after existing ones. Either rename to `toAppend` and fix the comment, or swap the order to match the stated intent.</comment>
<file context>
@@ -1272,4 +1277,92 @@ object ContainerUtils {
+ .joinToString(";") { "$it=n,b" }
+ if (toPrepend.isNotEmpty()) {
+ // Preserve existing user values; prepend auto-detected overrides in front
+ containerEnvVars.put("WINEDLLOVERRIDES", "$existing;$toPrepend")
+ updated = true
+ }
</file context>
Description
Fix: typing space in Env Variables would lead to crash.
Added:
Search A: drive on opening "Edit Container" and populate dinput and dinput8 as native on WINEDLLOVERRIDES if dlls are found in gamedir.
Added presets for input dlls native before builtin:
"dinput8=n,b;dinput=n,b",
"xinput1_3=n,b;xinput1_4=n,b;xinput9_1_0=n,b",
"xinput9_1_0=n,b;windows.gaming.input=n,b",
"xinput1_1=n,b;xinput1_2=n,b"
WINEDLLOVERRIDES presets are now inside categories to avoid overwhelming users
Recording
screen-20260413-214813.1.mp4
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
Fixes a crash when typing spaces in Environment Variables and adds MangoHud presets for FPS display and limiting. Also removes a broken spoofing preset and moves
WINEDLLOVERRIDESto the top with common suggestions.Bug Fixes
EnvVars.putAllto avoid crashes from stray spaces.New Features
MANGOHUD(toggle) andMANGOHUD_CONFIGpresets (fps, fps_limit=60, fps_only).WINEDLLOVERRIDESsuggestions and place it first in the list.DXVK_FILTER_DEVICE_NAMEpreset.Written for commit ae01c35. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
Bug Fixes
New Features