fix: set ExeRunDir to game root in ColdClientLoader.ini#775
fix: set ExeRunDir to game root in ColdClientLoader.ini#775utkarshdalal merged 1 commit intoutkarshdalal:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughIn Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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.
Actionable comments posted: 1
🤖 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/SteamUtils.kt`:
- Around line 327-330: The Exe/ExeRunDir are built from
getAppDirName(getAppInfoOf(steamAppId)) which can differ from the real on-disk
folder; change the construction to use the actual install directory name derived
from File(SteamService.getAppDirPath(steamAppId)).name (or a shared helper) so
the INI paths match createAppManifest() and the manifest/symlink. Update the
occurrences that build exePath/exeRunDir (lines using getAppDirName(...) and
container.executablePath) and the analogous code at the other site (around lines
353-354) to compute gameDirName =
File(SteamService.getAppDirPath(steamAppId)).name and then build
"steamapps\\common\\$gameDirName\\$executablePath" and
"steamapps\\common\\$gameDirName" accordingly. Ensure container.executablePath
is still normalized (replace "/" with "\\") before composing the final strings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 28250dee-726d-42b9-b8bf-c97385a285bc
📒 Files selected for processing (1)
app/src/main/java/app/gamenative/utils/SteamUtils.kt
5f528b3 to
4d9708d
Compare
|
Are you sure about this? It should work just fine for nested folders, for instance |
I forgot to actually mention that this is about the save file. While the game boots fine without this fix, setting the ExeRunDir means it can find the save file correctly. |
|
@kiequoo , which game did this fix? Surprised this affects game saves at all! |
|
|
||
| internal fun writeColdClientIni(steamAppId: Int, container: Container) { | ||
| val gameName = getAppDirName(getAppInfoOf(steamAppId)) | ||
| val gameName = File(SteamService.getAppDirPath(steamAppId)).name |
There was a problem hiding this comment.
This line doesn't need changing no?
There was a problem hiding this comment.
True, this was a suggestion of your coderabbitai :)
New Star GP (appid 2217580), whose save ( |
Since the initial ColdClientLoader implementation (77c8e15), ExeRunDir has been left empty. When empty, ColdClientLoader defaults the working directory to the executable's parent directory. This is fine for games whose exe sits at the game root, but breaks games like New Star GP where the exe lives in a subdirectory (e.g. release/NSGP.exe). Steam itself always launches games with the working directory set to the game install root, not the exe's subdirectory. New Star GP stores its save file (UserData.txt) in the game install root, and its UFS config declares it there too. The game opens UserData.txt as a relative path, so when CWD is release/ instead of the game root, the file is never found and progress cannot be loaded. Setting ExeRunDir=steamapps\common\<gameName> matches Steam's behaviour and fixes cloud save loading for any game whose executable is not at the root of the install directory.
|
Can you confirm that other games that have executables in subdirectories and at the root keep working? And can find cloud saves? Worried that games may stop working - we had to set this for wine (not Goldberg as you've done here) because games would only run through the container and not the play button. |
I just checked my library and I found JellyCar Worlds has it's executable in a |
This reverts commit 69cae38.
PR utkarshdalal#775 introduced ExeRunDir to fix save loading in New Star GP, whose exe lives in a subdirectory (release/NSGP.exe) and opens saves via a relative path from the game install root. Without ExeRunDir, ColdClient- Loader defaults the working directory to the exe's parent, so the save file was never found. However, hardcoding ExeRunDir to the game root broke games like Batman: Arkham Asylum GOTY (reverted in PR utkarshdalal#950), which declares workingdir: Binaries in its appinfo. For these games, the correct CWD is the subdirectory, not the root — and the previous empty ExeRunDir happened to work because ColdClientLoader defaulted to the exe's parent. The fix reads workingDir from the Steam launch config (LaunchInfo) and appends it to the game root for ExeRunDir when present, falling back to the game root when absent. This matches Steam's own behaviour across all cases observed in the wild. The INI content is extracted into generateColdClientIni() for testability, with unit tests covering the Batman and New Star GP cases and edge cases such as trailing slashes and forward-slash normalisation. Fixes: utkarshdalal#775 Fixes: utkarshdalal#950
|
Attempt 2: #1012 Confirmed working with both New star GP (as per this PR) and Batman Arkham Asylum |
PR utkarshdalal#775 introduced ExeRunDir to fix save loading in New Star GP, whose exe lives in a subdirectory (release/NSGP.exe) and opens saves via a relative path from the game install root. Without ExeRunDir, ColdClient- Loader defaults the working directory to the exe's parent, so the save file was never found. However, hardcoding ExeRunDir to the game root broke games like Batman: Arkham Asylum GOTY (reverted in PR utkarshdalal#950), which declares workingdir: Binaries in its appinfo. For these games, the correct CWD is the subdirectory, not the root — and the previous empty ExeRunDir happened to work because ColdClientLoader defaulted to the exe's parent. The fix reads workingDir from the Steam launch config (LaunchInfo) and appends it to the game root for ExeRunDir when present, falling back to the game root when absent. This matches Steam's own behaviour across all cases observed in the wild. The INI content is extracted into generateColdClientIni() for testability, with unit tests covering the Batman and New Star GP cases and edge cases such as trailing slashes and forward-slash normalisation. Fixes: utkarshdalal#775 Fixes: utkarshdalal#950
Since the initial ColdClientLoader implementation (77c8e15), ExeRunDir has been left empty. When empty, ColdClientLoader defaults the working directory to the executable's parent directory. This is fine for games whose exe sits at the game root, but breaks games like New Star GP where the exe lives in a subdirectory (e.g. release/NSGP.exe).
Steam itself always launches games with the working directory set to the game install root, not the exe's subdirectory. New Star GP stores its save file (UserData.txt) in the game install root, and its UFS config declares it there too. The game opens UserData.txt as a relative path, so when CWD is release/ instead of the game root, the file is never found and progress cannot be loaded.
Setting ExeRunDir=steamapps\common<gameName> matches Steam's behaviour and fixes cloud save loading for any game whose executable is not at the root of the install directory.
Summary by cubic
Set ExeRunDir in
ColdClientLoader.inito the game install root (steamapps\common\<gameName>) using the actual install folder name fromgetAppDirName(). This matches Steam’s working directory and fixes cloud save loading for New Star GP and other games with executables in subfolders.Written for commit 657ea54. Summary will update on new commits.
Summary by CodeRabbit