Skip to content

fix(cream.sh): work from any CWD, MangoHud support, bitness-aware preload, CREAM_CONFIG_PATH as file or dir - #75

Open
gongarn wants to merge 1 commit into
anticitizn:masterfrom
gongarn:upstream-pr/cream-sh-fixes
Open

fix(cream.sh): work from any CWD, MangoHud support, bitness-aware preload, CREAM_CONFIG_PATH as file or dir#75
gongarn wants to merge 1 commit into
anticitizn:masterfrom
gongarn:upstream-pr/cream-sh-fixes

Conversation

@gongarn

@gongarn gongarn commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Four small, self-contained fixes for package/cream.sh that address open issues:

  1. Work from any working directory (Crusader Kings III launch options not working for Steam #62) — Steam may launch the game from a different CWD, breaking sh ./cream.sh %command% launch options while terminal runs worked. The script now cds to its own directory first.
  2. MangoHud support (does not work with mangohud #51) — sh ./cream.sh mangohud %command% sets MANGOHUD=1 and MANGOHUD_DLSYM=1 so both preloads coexist (previously only one took effect).
  3. Bitness-aware preload (Issue with LD_PRELOAD on CK3 #71) — reads the ELF class of libsteam_api.so (byte at offset 4: 01 = 32-bit, 02 = 64-bit) and preloads only the matching creamlinux library, removing the wrong ELF class noise from ld.so visible in CK3 logs. Unknown files fall back to preloading both.
  4. CREAM_CONFIG_PATH — now accepts both a file path and a directory containing cream_api.ini (the script checked it as a directory while the C++ loader reads it as a file path).

Testing

  • All four scenarios verified on a real Steam setup (launch from foreign CWD, mangohud prefix, 32/64-bit fake libsteam_api.so, config as file/dir).
  • bash -n clean; behavior of the non-modified parts unchanged.

…load, CREAM_CONFIG_PATH as file or dir

- cd to the script's own directory: Steam may launch games from a
  different working directory, which broke 'sh ./cream.sh %command%'
  launch options while terminal runs worked (issue anticitizn#62)
- detect 'mangohud' as the first argument and set MANGOHUD=1 and
  MANGOHUD_DLSYM=1 so MangoHud and creamlinux preloads coexist (anticitizn#51)
- read the ELF class of libsteam_api.so (byte at offset 4: 01 = 32-bit,
  02 = 64-bit) and preload only the matching creamlinux library;
  unknown files fall back to both. Removes the 'wrong ELF class' noise
  from ld.so seen in CK3 logs (anticitizn#71)
- CREAM_CONFIG_PATH now accepts both a file path and a directory
  containing cream_api.ini (previously the script checked it as a
  directory while the C++ loader read it as a file path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant