Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ signing.properties
References/
*.hprof
android_sysvshm/build64/

# local build artifacts (FEX/Proton wcp)
dist/
15 changes: 15 additions & 0 deletions app/src/main/feature/library/GameSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ class GameSettingsStateHolder {
val selectedFexcoreVersion = mutableIntStateOf(0)
val fexcorePresetEntries = mutableStateOf<List<String>>(emptyList())
val selectedFexcorePreset = mutableIntStateOf(0)
// Per-version flag: true when that FEX version ships native .so UnixLibs.
val fexcoreUnixLibsFlags = mutableStateOf<List<Boolean>>(emptyList())
val useUnixLibs = mutableStateOf(true)

// Advanced - System
val startupSelectionEntries = mutableStateOf<List<String>>(emptyList())
Expand Down Expand Up @@ -3554,6 +3557,18 @@ private fun AdvancedSection(

// FEXCore — hidden when FEXCore isn't explicitly in either slot.
if (state.showFexcoreFrame.value) {
val fexUnixCapable = state.fexcoreUnixLibsFlags.value
.getOrNull(state.selectedFexcoreVersion.intValue) ?: false
SettingGroup {
SettingSwitch(
label = stringResource(R.string.use_unix_libs),
checked = state.useUnixLibs.value && fexUnixCapable,
onCheckedChange = { state.useUnixLibs.value = it },
enabled = fexUnixCapable
)
}
Spacer(Modifier.height(SettingSectionGap))

val fexcoreUsage = emulatorUsageLabel(state, setOf("fexcore"))
EmulatorSectionHeader(stringResource(R.string.container_fexcore_config), fexcoreUsage)
Spacer(Modifier.height(8.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ class ContainerSettingsComposeDialog @JvmOverloads constructor(
}

state.fullscreenStretched.value = c?.isFullscreenStretched() ?: false
state.useUnixLibs.value = c?.isUseUnixLibs() ?: true

// Steam fields are shortcut-only in the UI; leave any existing steam
// state on the container untouched — saveSettings() skips them.
Expand Down Expand Up @@ -799,6 +800,7 @@ class ContainerSettingsComposeDialog @JvmOverloads constructor(
c.setWinComponents(wincomponents)
c.setDrives(drivesString)
c.setFullscreenStretched(state.fullscreenStretched.value)
c.setUseUnixLibs(state.useUnixLibs.value)
c.setInputType(finalInputType)
c.setExclusiveXInput(state.containerExclusiveInput.value)
c.setStartupSelection(startupSelection)
Expand Down Expand Up @@ -839,6 +841,7 @@ class ContainerSettingsComposeDialog @JvmOverloads constructor(
data.put("wincomponents", wincomponents)
data.put("drives", drivesString)
data.put("fullscreenStretched", state.fullscreenStretched.value)
data.put("useUnixLibs", state.useUnixLibs.value)
data.put("inputType", finalInputType)
data.put("exclusiveXInput", state.containerExclusiveInput.value)
data.put("startupSelection", startupSelection.toInt())
Expand Down Expand Up @@ -989,6 +992,7 @@ class ContainerSettingsComposeDialog @JvmOverloads constructor(
if (firstDash >= 0) items.add(entryName.substring(firstDash + 1))
}
state.fexcoreVersionEntries.value = items
state.fexcoreUnixLibsFlags.value = items.map { contentsManager.fexcoreVersionHasUnixLibs(it) }
val saved = container?.getFEXCoreVersion() ?: ""
selectByValue(items, saved, state.selectedFexcoreVersion)
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/feature/shortcuts/ShortcutSettingsComposeDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ class ShortcutSettingsComposeDialog private constructor(
if (container.isFullscreenStretched) "1" else "0"
)
state.fullscreenStretched.value = fullscreenStretched == "1"
state.useUnixLibs.value = getShortcutSetting(
"useUnixLibs",
if (container.isUseUnixLibs) "1" else "0"
) == "1"

// LC_ALL
state.lcAll.value = getShortcutSetting("lc_all", container.getLC_ALL())
Expand Down Expand Up @@ -824,6 +828,7 @@ class ShortcutSettingsComposeDialog private constructor(
}

state.fexcoreVersionEntries.value = items
state.fexcoreUnixLibsFlags.value = items.map { contentsManager.fexcoreVersionHasUnixLibs(it) }
val savedVersion = if (shouldUseShortcutOverrides(container))
getShortcutSetting("fexcoreVersion", container.getFEXCoreVersion())
else
Expand Down Expand Up @@ -1071,6 +1076,13 @@ class ShortcutSettingsComposeDialog private constructor(
if (container.isFullscreenStretched) "1" else "0"
)

// Use UnixLibs
hasContainerOverride = hasContainerOverride or saveOverride(
"useUnixLibs",
if (state.useUnixLibs.value) "1" else "0",
if (container.isUseUnixLibs) "1" else "0"
)

// Win components
val wincomponents = buildWinComponentsString()
hasContainerOverride =
Expand Down Expand Up @@ -2160,6 +2172,7 @@ class ShortcutSettingsComposeDialog private constructor(

state.lcAll.value = container.getLC_ALL()
state.fullscreenStretched.value = container.isFullscreenStretched
state.useUnixLibs.value = container.isUseUnixLibs

val startupEntries = state.startupSelectionEntries.value
state.selectedStartupSelection.intValue = container.getStartupSelection().toInt()
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore-forudindstilling</string>
<string name="container_fexcore_version">FEXCore-version</string>
<string name="use_unix_libs">Brug UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Grafikdriver</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore-Voreinstellung</string>
<string name="container_fexcore_version">FEXCore-Version</string>
<string name="use_unix_libs">UnixLibs verwenden</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Grafiktreiber</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Preset de FEXCore</string>
<string name="container_fexcore_version">Versión de FEXCore</string>
<string name="use_unix_libs">Usar UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Controlador gráfico</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Préréglage FEXCore</string>
<string name="container_fexcore_version">Version de FEXCore</string>
<string name="use_unix_libs">Utiliser les UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Pilote graphique</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore प्रीसेट</string>
<string name="container_fexcore_version">FEXCore संस्करण</string>
<string name="use_unix_libs">UnixLibs का उपयोग करें</string>
<string name="container_graphics_driver">ग्राफ़िक्स ड्राइवर</string>
<string name="container_graphics_configuration">ग्राफ़िक्स ड्राइवर कॉन्फ़िगरेशन</string>
<string name="container_graphics_version">ग्राफ़िक्स ड्राइवर संस्करण</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Preset FEXCore</string>
<string name="container_fexcore_version">Versione FEXCore</string>
<string name="use_unix_libs">Usa UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Driver grafico</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore 프리셋</string>
<string name="container_fexcore_version">FEXCore 버전</string>
<string name="use_unix_libs">UnixLibs 사용</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">그래픽 드라이버</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Preset FEXCore</string>
<string name="container_fexcore_version">Wersja FEXCore</string>
<string name="use_unix_libs">Użyj UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Sterownik grafiki</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Predefinicao FEXCore</string>
<string name="container_fexcore_version">Versao do FEXCore</string>
<string name="use_unix_libs">Usar UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Driver Grafico</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Preset FEXCore</string>
<string name="container_fexcore_version">Versiune FEXCore</string>
<string name="use_unix_libs">Folosește UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Driver grafic</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Пресет FEXCore</string>
<string name="container_fexcore_version">Версия FEXCore</string>
<string name="use_unix_libs">Использовать UnixLibs</string>
<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Графический драйвер</string>
<string name="container_graphics_configuration">Конфигурация графического драйвера</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">Пресет FEXCore</string>
<string name="container_fexcore_version">Версія FEXCore</string>
<string name="use_unix_libs">Використовувати UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Графічний драйвер</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore 预设</string>
<string name="container_fexcore_version">FEXCore 版本</string>
<string name="use_unix_libs">使用 UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">图形驱动</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore 預設</string>
<string name="container_fexcore_version">FEXCore 版本</string>
<string name="use_unix_libs">使用 UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">圖形驅動程式</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
<string name="container_fexcore_config">FEXCore</string>
<string name="container_fexcore_preset">FEXCore Preset</string>
<string name="container_fexcore_version">FEXCore Version</string>
<string name="use_unix_libs">Use UnixLibs</string>

<!-- Container > Graphics Driver -->
<string name="container_graphics_driver">Graphics Driver</string>
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/runtime/container/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class Container {
private String drives = DEFAULT_DRIVES;
private String wineVersion = WineInfo.MAIN_WINE_VERSION.identifier();
private boolean fullscreenStretched;
private boolean useUnixLibs = true;
private byte startupSelection = STARTUP_SELECTION_ESSENTIAL;
private String cpuList;
private String cpuListWoW64;
Expand Down Expand Up @@ -207,6 +208,10 @@ public void setLC_ALL(String lc_all) {

public void setFullscreenStretched(boolean fullscreenStretched) { this.fullscreenStretched = fullscreenStretched; }

public boolean isUseUnixLibs() { return useUnixLibs; }

public void setUseUnixLibs(boolean useUnixLibs) { this.useUnixLibs = useUnixLibs; }

public byte getStartupSelection() {
return startupSelection;
}
Expand Down Expand Up @@ -424,6 +429,7 @@ public void saveData() {
data.put("wincomponents", wincomponents);
data.put("drives", drives);
data.put("fullscreenStretched", fullscreenStretched);
data.put("useUnixLibs", useUnixLibs);
data.put("inputType", inputType);
data.put("exclusiveXInput", exclusiveXInput);
data.put("startupSelection", startupSelection);
Expand Down Expand Up @@ -508,6 +514,9 @@ public void loadData(JSONObject data) throws JSONException {
case "fullscreenStretched" :
setFullscreenStretched(data.getBoolean(key));
break;
case "useUnixLibs" :
setUseUnixLibs(data.getBoolean(key));
break;
case "inputType" :
setInputType(data.getInt(key));
break;
Expand Down
70 changes: 69 additions & 1 deletion app/src/main/runtime/content/ContentsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
Expand Down Expand Up @@ -750,6 +751,72 @@ public ContentProfile getProfileByEntryName(String entryName) {
return null;
}

// A FEX version exposes native UnixLibs when its install dir ships any .so payload.
public boolean profileHasUnixLibs(ContentProfile profile) {
if (profile == null) return false;
return dirContainsSharedObject(getInstallDir(context, profile));
}

public boolean fexcoreVersionHasUnixLibs(String fexcoreVersion) {
if (fexcoreVersion == null || fexcoreVersion.isEmpty()) return false;
return profileHasUnixLibs(getProfileByEntryName("fexcore-" + fexcoreVersion));
}

private static boolean dirContainsSharedObject(File dir) {
if (dir == null) return false;
File[] files = dir.listFiles();
if (files == null) return false;
for (File file : files) {
if (file.isDirectory()) {
if (dirContainsSharedObject(file)) return true;
} else if (isSharedObject(file.getName())) {
return true;
}
}
return false;
}

private static boolean isSharedObject(String name) {
String lower = name.toLowerCase(Locale.ROOT);
return lower.endsWith(".so") || lower.contains(".so.");
}

// Delete the .so payload a profile installs (its PE dlls are left in place).
public void removeAppliedUnixLibs(ContentProfile profile) {
if (profile == null || profile.fileList == null) return;
for (ContentProfile.ContentFile contentFile : profile.fileList) {
if (!isSharedObject(new File(contentFile.target).getName())) continue;
File targetFile = new File(getPathFromTemplate(contentFile.target));
if (targetFile.exists() && targetFile.delete()) {
Log.i("ContentsManager", "UnixLibs: removed " + targetFile.getName());
}
}
}

// Copy a profile's .so payload into destDir (the active wine runtime's so_dir).
public void copyUnixLibsToDir(ContentProfile profile, File destDir) {
if (profile == null || profile.fileList == null) return;
for (ContentProfile.ContentFile contentFile : profile.fileList) {
String name = new File(contentFile.target).getName();
if (!isSharedObject(name)) continue;
File sourceFile = new File(getInstallDir(context, profile), contentFile.source);
if (!sourceFile.exists()) continue;
File destFile = new File(destDir, name);
FileUtils.copy(sourceFile, destFile);
FileUtils.chmod(destFile, 0771);
}
}

public void deleteUnixLibsFromDir(ContentProfile profile, File destDir) {
if (profile == null || profile.fileList == null) return;
for (ContentProfile.ContentFile contentFile : profile.fileList) {
String name = new File(contentFile.target).getName();
if (!isSharedObject(name)) continue;
File destFile = new File(destDir, name);
if (destFile.exists()) destFile.delete();
}
}

public boolean applyContent(ContentProfile profile) {
if (profile.type != ContentProfile.ContentType.CONTENT_TYPE_WINE
&& profile.type != ContentProfile.ContentType.CONTENT_TYPE_PROTON) {
Expand All @@ -760,7 +827,8 @@ public boolean applyContent(ContentProfile profile) {
targetFile.delete();
FileUtils.copy(sourceFile, targetFile);

if (profile.type == ContentProfile.ContentType.CONTENT_TYPE_BOX64) {
if (profile.type == ContentProfile.ContentType.CONTENT_TYPE_BOX64
|| isSharedObject(targetFile.getName())) {
FileUtils.chmod(targetFile, 0771);
}
}
Expand Down
Loading